mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Add ast json converter for PlaceholderStatement
This commit is contained in:
		
							parent
							
								
									e9c894c9f8
								
							
						
					
					
						commit
						406f3a4b5d
					
				| @ -236,6 +236,12 @@ bool ASTJsonConverter::visit(Block const& _node) | ||||
| 	return true; | ||||
| } | ||||
| 
 | ||||
| bool ASTJsonConverter::visit(PlaceholderStatement const& _node) | ||||
| { | ||||
| 	addJsonNode(_node, "Placeholder", {}, true); | ||||
| 	return true; | ||||
| } | ||||
| 
 | ||||
| bool ASTJsonConverter::visit(IfStatement const& _node) | ||||
| { | ||||
| 	addJsonNode(_node, "IfStatement", {}, true); | ||||
| @ -480,6 +486,11 @@ void ASTJsonConverter::endVisit(Block const&) | ||||
| 	goUp(); | ||||
| } | ||||
| 
 | ||||
| void ASTJsonConverter::endVisit(PlaceholderStatement const&) | ||||
| { | ||||
| 	goUp(); | ||||
| } | ||||
| 
 | ||||
| void ASTJsonConverter::endVisit(IfStatement const&) | ||||
| { | ||||
| 	goUp(); | ||||
|  | ||||
| @ -71,6 +71,7 @@ public: | ||||
| 	bool visit(ArrayTypeName const& _node) override; | ||||
| 	bool visit(InlineAssembly const& _node) override; | ||||
| 	bool visit(Block const& _node) override; | ||||
| 	bool visit(PlaceholderStatement const& _node) override; | ||||
| 	bool visit(IfStatement const& _node) override; | ||||
| 	bool visit(WhileStatement const& _node) override; | ||||
| 	bool visit(ForStatement const& _node) override; | ||||
| @ -113,6 +114,7 @@ public: | ||||
| 	void endVisit(ArrayTypeName const&) override; | ||||
| 	void endVisit(InlineAssembly const&) override; | ||||
| 	void endVisit(Block const&) override; | ||||
| 	void endVisit(PlaceholderStatement const&) override; | ||||
| 	void endVisit(IfStatement const&) override; | ||||
| 	void endVisit(WhileStatement const&) override; | ||||
| 	void endVisit(ForStatement const&) override; | ||||
|  | ||||
| @ -182,6 +182,19 @@ BOOST_AUTO_TEST_CASE(array_type_name) | ||||
| 	BOOST_CHECK_EQUAL(array["src"], "13:6:1"); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(placeholder_statement) | ||||
| { | ||||
| 	CompilerStack c; | ||||
| 	c.addSource("a", "contract C { modifier M { _ } }"); | ||||
| 	c.parse(); | ||||
| 	map<string, unsigned> sourceIndices; | ||||
| 	sourceIndices["a"] = 1; | ||||
| 	Json::Value astJson = ASTJsonConverter(c.ast("a"), sourceIndices).json(); | ||||
| 	Json::Value placeholder = astJson["children"][0]["children"][0]["children"][1]["children"][0]; | ||||
| 	BOOST_CHECK_EQUAL(placeholder["name"], "Placeholder"); | ||||
| 	BOOST_CHECK_EQUAL(placeholder["src"], "26:1:1"); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_SUITE_END() | ||||
| 
 | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user