From 4b9eb299d023989873528e6e52fdc8925d3fcda9 Mon Sep 17 00:00:00 2001 From: Alex Sinyagin Date: Thu, 18 Aug 2016 15:38:20 +0000 Subject: Rename root AST JSON node to SourceUnit --- libsolidity/ast/ASTJsonConverter.cpp | 2 +- test/libsolidity/ASTJSON.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 3ce572bf..d23c4890 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -107,7 +107,7 @@ bool ASTJsonConverter::visit(SourceUnit const&) { Json::Value children(Json::arrayValue); - m_astJson["name"] = "root"; + m_astJson["name"] = "SourceUnit"; m_astJson["children"] = children; m_jsonNodePtrs.push(&m_astJson["children"]); diff --git a/test/libsolidity/ASTJSON.cpp b/test/libsolidity/ASTJSON.cpp index 64624a2d..ec60b668 100644 --- a/test/libsolidity/ASTJSON.cpp +++ b/test/libsolidity/ASTJSON.cpp @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(smoke_test) map sourceIndices; sourceIndices["a"] = 1; Json::Value astJson = ASTJsonConverter(c.ast("a"), sourceIndices).json(); - BOOST_CHECK_EQUAL(astJson["name"], "root"); + BOOST_CHECK_EQUAL(astJson["name"], "SourceUnit"); } BOOST_AUTO_TEST_CASE(source_location) @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(source_location) map sourceIndices; sourceIndices["a"] = 1; Json::Value astJson = ASTJsonConverter(c.ast("a"), sourceIndices).json(); - BOOST_CHECK_EQUAL(astJson["name"], "root"); + BOOST_CHECK_EQUAL(astJson["name"], "SourceUnit"); BOOST_CHECK_EQUAL(astJson["children"][0]["name"], "ContractDefinition"); BOOST_CHECK_EQUAL(astJson["children"][0]["children"][0]["name"], "FunctionDefinition"); BOOST_CHECK_EQUAL(astJson["children"][0]["children"][0]["src"], "13:32:1"); -- cgit v1.2.3