diff options
author | djudjuu <julfaber@gmail.com> | 2017-06-05 21:36:06 +0800 |
---|---|---|
committer | djudjuu <julfaber@gmail.com> | 2017-06-06 19:26:23 +0800 |
commit | 62eafdd0103a05d46295fc9b83039adb038683e8 (patch) | |
tree | 305bf30c07461dbd7be892fc912e36d2bb41a848 | |
parent | 597bf8a43d9462eaba8dca63bb8b765bf6b122a7 (diff) | |
download | dexon-solidity-62eafdd0103a05d46295fc9b83039adb038683e8.tar.gz dexon-solidity-62eafdd0103a05d46295fc9b83039adb038683e8.tar.zst dexon-solidity-62eafdd0103a05d46295fc9b83039adb038683e8.zip |
adjusted testcase and renaming
-rw-r--r-- | libsolidity/ast/ASTJsonConverter.cpp | 6 | ||||
-rw-r--r-- | libsolidity/ast/ASTJsonConverter.h | 2 | ||||
-rw-r--r-- | test/libsolidity/ASTJSON.cpp | 2 |
3 files changed, 4 insertions, 6 deletions
diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index e1bcf6a1..1de2e801 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -704,13 +704,12 @@ bool ASTJsonConverter::visit(ElementaryTypeNameExpression const& _node) bool ASTJsonConverter::visit(Literal const& _node) { - string tokenString = tokenKind(_node.token()); Json::Value value{_node.value()}; if (!dev::validateUTF8(_node.value())) value = Json::nullValue; Token::Value subdenomination = Token::Value(_node.subDenomination()); std::vector<pair<string, Json::Value>> attributes = { - make_pair(m_legacy ? "token" : "kind", tokenString), + make_pair(m_legacy ? "token" : "kind", literalTokenKind(_node.token())), make_pair("value", value), make_pair(m_legacy ? "hexvalue" : "hexValue", toHex(_node.value())), make_pair( @@ -793,7 +792,7 @@ string ASTJsonConverter::functionCallKind(FunctionCallKind _kind) } } -string ASTJsonConverter::tokenKind(Token::Value _token) +string ASTJsonConverter::literalTokenKind(Token::Value _token) { switch (_token) { @@ -802,7 +801,6 @@ string ASTJsonConverter::tokenKind(Token::Value _token) case dev::solidity::Token::StringLiteral: return "string"; case dev::solidity::Token::TrueLiteral: - return "bool"; case dev::solidity::Token::FalseLiteral: return "bool"; default: diff --git a/libsolidity/ast/ASTJsonConverter.h b/libsolidity/ast/ASTJsonConverter.h index 746b3f78..c2de5c48 100644 --- a/libsolidity/ast/ASTJsonConverter.h +++ b/libsolidity/ast/ASTJsonConverter.h @@ -133,7 +133,7 @@ private: std::string location(VariableDeclaration::Location _location); std::string contractKind(ContractDefinition::ContractKind _kind); std::string functionCallKind(FunctionCallKind _kind); - std::string tokenKind(Token::Value _token); + std::string literalTokenKind(Token::Value _token); std::string type(Expression const& _expression); std::string type(VariableDeclaration const& _varDecl); int nodeId(ASTNode const& _node) diff --git a/test/libsolidity/ASTJSON.cpp b/test/libsolidity/ASTJSON.cpp index 8a790347..df7fac51 100644 --- a/test/libsolidity/ASTJSON.cpp +++ b/test/libsolidity/ASTJSON.cpp @@ -192,7 +192,7 @@ BOOST_AUTO_TEST_CASE(non_utf8) Json::Value literal = astJson["children"][0]["children"][0]["children"][2]["children"][0]["children"][1]; BOOST_CHECK_EQUAL(literal["name"], "Literal"); BOOST_CHECK_EQUAL(literal["attributes"]["hexvalue"], "ff"); - BOOST_CHECK_EQUAL(literal["attributes"]["token"], Json::nullValue); + BOOST_CHECK_EQUAL(literal["attributes"]["token"], "string"); BOOST_CHECK_EQUAL(literal["attributes"]["value"], Json::nullValue); BOOST_CHECK(literal["attributes"]["type"].asString().find("invalid") != string::npos); } |