mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add ast json converter for ArrayTypeName
This commit is contained in:
parent
bdc2436ae3
commit
e9c894c9f8
@ -218,6 +218,12 @@ bool ASTJsonConverter::visit(Mapping const& _node)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ASTJsonConverter::visit(ArrayTypeName const& _node)
|
||||||
|
{
|
||||||
|
addJsonNode(_node, "ArrayTypeName", {}, true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool ASTJsonConverter::visit(InlineAssembly const& _node)
|
bool ASTJsonConverter::visit(InlineAssembly const& _node)
|
||||||
{
|
{
|
||||||
addJsonNode(_node, "InlineAssembly", {}, true);
|
addJsonNode(_node, "InlineAssembly", {}, true);
|
||||||
@ -459,6 +465,11 @@ void ASTJsonConverter::endVisit(Mapping const&)
|
|||||||
goUp();
|
goUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ASTJsonConverter::endVisit(ArrayTypeName const&)
|
||||||
|
{
|
||||||
|
goUp();
|
||||||
|
}
|
||||||
|
|
||||||
void ASTJsonConverter::endVisit(InlineAssembly const&)
|
void ASTJsonConverter::endVisit(InlineAssembly const&)
|
||||||
{
|
{
|
||||||
goUp();
|
goUp();
|
||||||
|
@ -68,6 +68,7 @@ public:
|
|||||||
bool visit(ElementaryTypeName const& _node) override;
|
bool visit(ElementaryTypeName const& _node) override;
|
||||||
bool visit(UserDefinedTypeName const& _node) override;
|
bool visit(UserDefinedTypeName const& _node) override;
|
||||||
bool visit(Mapping const& _node) override;
|
bool visit(Mapping const& _node) override;
|
||||||
|
bool visit(ArrayTypeName const& _node) override;
|
||||||
bool visit(InlineAssembly const& _node) override;
|
bool visit(InlineAssembly const& _node) override;
|
||||||
bool visit(Block const& _node) override;
|
bool visit(Block const& _node) override;
|
||||||
bool visit(IfStatement const& _node) override;
|
bool visit(IfStatement const& _node) override;
|
||||||
@ -109,6 +110,7 @@ public:
|
|||||||
void endVisit(ElementaryTypeName const&) override;
|
void endVisit(ElementaryTypeName const&) override;
|
||||||
void endVisit(UserDefinedTypeName const&) override;
|
void endVisit(UserDefinedTypeName const&) override;
|
||||||
void endVisit(Mapping const&) override;
|
void endVisit(Mapping const&) override;
|
||||||
|
void endVisit(ArrayTypeName const&) override;
|
||||||
void endVisit(InlineAssembly const&) override;
|
void endVisit(InlineAssembly const&) override;
|
||||||
void endVisit(Block const&) override;
|
void endVisit(Block const&) override;
|
||||||
void endVisit(IfStatement const&) override;
|
void endVisit(IfStatement const&) override;
|
||||||
|
@ -169,6 +169,19 @@ BOOST_AUTO_TEST_CASE(event_definition)
|
|||||||
BOOST_CHECK_EQUAL(event["src"], "13:10:1");
|
BOOST_CHECK_EQUAL(event["src"], "13:10:1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(array_type_name)
|
||||||
|
{
|
||||||
|
CompilerStack c;
|
||||||
|
c.addSource("a", "contract C { uint[] i; }");
|
||||||
|
c.parse();
|
||||||
|
map<string, unsigned> sourceIndices;
|
||||||
|
sourceIndices["a"] = 1;
|
||||||
|
Json::Value astJson = ASTJsonConverter(c.ast("a"), sourceIndices).json();
|
||||||
|
Json::Value array = astJson["children"][0]["children"][0]["children"][0];
|
||||||
|
BOOST_CHECK_EQUAL(array["name"], "ArrayTypeName");
|
||||||
|
BOOST_CHECK_EQUAL(array["src"], "13:6:1");
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user