From e3583d04f79c5e9ada9914f43711d3b90242dfdc Mon Sep 17 00:00:00 2001 From: djudjuu Date: Wed, 17 May 2017 15:52:45 +0200 Subject: include new InlineAssemblyInformation into JSON --- libsolidity/ast/ASTJsonConverter.cpp | 14 ++++++++++++-- libsolidity/ast/ASTJsonConverter.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'libsolidity') diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 492429d7..3c3ceae8 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -171,6 +171,16 @@ void ASTJsonConverter::appendExpressionAttributes( _attributes.insert(_attributes.end(), exprAttributes.begin(), exprAttributes.end()); } +Json::Value ASTJsonConverter::inlineAssemblyIdentifierToJson(pair _info) +{ + Json::Value tuple(Json::objectValue); + tuple["src"] = sourceLocationToString(_info.first->location); + tuple["declaration"] = idOrNull(_info.second.declaration); + tuple["isSlot"] = Json::Value(_info.second.isSlot); + tuple["isOffset"] = Json::Value(_info.second.isOffset); + tuple["valueSize"] = _info.second.valueSize; + return tuple; +} void ASTJsonConverter::print(ostream& _stream, ASTNode const& _node) { @@ -441,10 +451,10 @@ bool ASTJsonConverter::visit(InlineAssembly const& _node) Json::Value externalReferences(Json::arrayValue); for (auto const& it : _node.annotation().externalReferences) { - if (it.first && it.second) + if (it.first) { Json::Value tuple(Json::objectValue); - tuple[it.first->name] = nodeId(*it.second); + tuple[it.first->name] = inlineAssemblyIdentifierToJson(it); externalReferences.append(tuple); } } diff --git a/libsolidity/ast/ASTJsonConverter.h b/libsolidity/ast/ASTJsonConverter.h index 1499c3b8..cf62e5f5 100644 --- a/libsolidity/ast/ASTJsonConverter.h +++ b/libsolidity/ast/ASTJsonConverter.h @@ -128,6 +128,7 @@ private: { return _node ? toJson(*_node) : Json::nullValue; } + Json::Value inlineAssemblyIdentifierToJson(std::pair _info); std::string visibility(Declaration::Visibility const& _visibility); std::string location(VariableDeclaration::Location _location); std::string contractKind(ContractDefinition::ContractKind _kind); -- cgit