diff options
author | Erik Kundt <bitshift@posteo.org> | 2018-03-21 23:40:19 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2018-04-13 03:14:50 +0800 |
commit | 8935c0dd2f47a20ed7cc2d1b6e11fa7cdd978b79 (patch) | |
tree | 671c1476992ceae819bab76f1a8f99f4050185a0 /libsolidity | |
parent | 7054defdd6c202d0943c11cb87ac2748b9bdc62b (diff) | |
download | dexon-solidity-8935c0dd2f47a20ed7cc2d1b6e11fa7cdd978b79.tar.gz dexon-solidity-8935c0dd2f47a20ed7cc2d1b6e11fa7cdd978b79.tar.zst dexon-solidity-8935c0dd2f47a20ed7cc2d1b6e11fa7cdd978b79.zip |
Uses short string representation of TypePointer
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/ast/ASTJsonConverter.cpp | 16 | ||||
-rw-r--r-- | libsolidity/ast/ASTJsonConverter.h | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 95ba3089..b8e00b60 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -134,10 +134,10 @@ string ASTJsonConverter::namePathToString(std::vector<ASTString> const& _namePat return boost::algorithm::join(_namePath, "."); } -Json::Value ASTJsonConverter::typePointerToJson(TypePointer _tp) +Json::Value ASTJsonConverter::typePointerToJson(TypePointer _tp, bool _short) { Json::Value typeDescriptions(Json::objectValue); - typeDescriptions["typeString"] = _tp ? Json::Value(_tp->toString()) : Json::nullValue; + typeDescriptions["typeString"] = _tp ? Json::Value(_tp->toString(_short)) : Json::nullValue; typeDescriptions["typeIdentifier"] = _tp ? Json::Value(_tp->identifier()) : Json::nullValue; return typeDescriptions; @@ -354,7 +354,7 @@ bool ASTJsonConverter::visit(VariableDeclaration const& _node) make_pair("visibility", Declaration::visibilityToString(_node.visibility())), make_pair("value", _node.value() ? toJson(*_node.value()) : Json::nullValue), make_pair("scope", idOrNull(_node.scope())), - make_pair("typeDescriptions", typePointerToJson(_node.annotation().type)) + make_pair("typeDescriptions", typePointerToJson(_node.annotation().type, true)) }; if (m_inEvent) attributes.push_back(make_pair("indexed", _node.isIndexed())); @@ -399,7 +399,7 @@ bool ASTJsonConverter::visit(ElementaryTypeName const& _node) { setJsonNode(_node, "ElementaryTypeName", { make_pair("name", _node.typeName().toString()), - make_pair("typeDescriptions", typePointerToJson(_node.annotation().type)) + make_pair("typeDescriptions", typePointerToJson(_node.annotation().type, true)) }); return false; } @@ -410,7 +410,7 @@ bool ASTJsonConverter::visit(UserDefinedTypeName const& _node) make_pair("name", namePathToString(_node.namePath())), make_pair("referencedDeclaration", idOrNull(_node.annotation().referencedDeclaration)), make_pair("contractScope", idOrNull(_node.annotation().contractScope)), - make_pair("typeDescriptions", typePointerToJson(_node.annotation().type)) + make_pair("typeDescriptions", typePointerToJson(_node.annotation().type, true)) }); return false; } @@ -425,7 +425,7 @@ bool ASTJsonConverter::visit(FunctionTypeName const& _node) make_pair(m_legacy ? "constant" : "isDeclaredConst", _node.stateMutability() <= StateMutability::View), make_pair("parameterTypes", toJson(*_node.parameterTypeList())), make_pair("returnParameterTypes", toJson(*_node.returnParameterTypeList())), - make_pair("typeDescriptions", typePointerToJson(_node.annotation().type)) + make_pair("typeDescriptions", typePointerToJson(_node.annotation().type, true)) }); return false; } @@ -435,7 +435,7 @@ bool ASTJsonConverter::visit(Mapping const& _node) setJsonNode(_node, "Mapping", { make_pair("keyType", toJson(_node.keyType())), make_pair("valueType", toJson(_node.valueType())), - make_pair("typeDescriptions", typePointerToJson(_node.annotation().type)) + make_pair("typeDescriptions", typePointerToJson(_node.annotation().type, true)) }); return false; } @@ -445,7 +445,7 @@ bool ASTJsonConverter::visit(ArrayTypeName const& _node) setJsonNode(_node, "ArrayTypeName", { make_pair("baseType", toJson(_node.baseType())), make_pair("length", toJsonOrNull(_node.length())), - make_pair("typeDescriptions", typePointerToJson(_node.annotation().type)) + make_pair("typeDescriptions", typePointerToJson(_node.annotation().type, true)) }); return false; } diff --git a/libsolidity/ast/ASTJsonConverter.h b/libsolidity/ast/ASTJsonConverter.h index 88b93699..29712f3b 100644 --- a/libsolidity/ast/ASTJsonConverter.h +++ b/libsolidity/ast/ASTJsonConverter.h @@ -152,7 +152,7 @@ private: } return tmp; } - static Json::Value typePointerToJson(TypePointer _tp); + static Json::Value typePointerToJson(TypePointer _tp, bool _short = false); static Json::Value typePointerToJson(std::shared_ptr<std::vector<TypePointer>> _tps); void appendExpressionAttributes( std::vector<std::pair<std::string, Json::Value>> &_attributes, |