Skip to content

Commit

Permalink
Add ast json import/export.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Mar 14, 2022
1 parent 23a2eee commit d8be24d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libsolidity/ast/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ class UsingForDirective: public ASTNode
std::vector<ASTPointer<IdentifierPath>> _functions,
bool _usesBraces,
ASTPointer<TypeName> _typeName,
bool _global = false
bool _global
):
ASTNode(_id, _location),
m_functions(_functions),
Expand Down
1 change: 1 addition & 0 deletions libsolidity/ast/ASTJsonConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ bool ASTJsonConverter::visit(UsingForDirective const& _node)
}
else
attributes.emplace_back("libraryName", toJson(*_node.functionsOrLibrary().front()));
attributes.emplace_back("global", _node.global());

setJsonNode(_node, "UsingForDirective", move(attributes));

Expand Down
3 changes: 2 additions & 1 deletion libsolidity/ast/ASTJsonImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ ASTPointer<UsingForDirective> ASTJsonImporter::createUsingForDirective(Json::Val
_node,
move(functions),
!_node.isMember("libraryName"),
_node["typeName"].isNull() ? nullptr : convertJsonToASTNode<TypeName>(_node["typeName"])
_node["typeName"].isNull() ? nullptr : convertJsonToASTNode<TypeName>(_node["typeName"]),
_node.isMember("global") && _node["global"].asBool()
);
}

Expand Down

0 comments on commit d8be24d

Please sign in to comment.