mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Implements AST JSON import for function call options.
This commit is contained in:
parent
8e7aef63f0
commit
893fb4d05b
@ -192,6 +192,8 @@ ASTPointer<ASTNode> ASTJsonImporter::convertJsonToASTNode(Json::Value const& _js
|
|||||||
return createBinaryOperation(_json);
|
return createBinaryOperation(_json);
|
||||||
if (nodeType == "FunctionCall")
|
if (nodeType == "FunctionCall")
|
||||||
return createFunctionCall(_json);
|
return createFunctionCall(_json);
|
||||||
|
if (nodeType == "FunctionCallOptions")
|
||||||
|
return createFunctionCallOptions(_json);
|
||||||
if (nodeType == "NewExpression")
|
if (nodeType == "NewExpression")
|
||||||
return createNewExpression(_json);
|
return createNewExpression(_json);
|
||||||
if (nodeType == "MemberAccess")
|
if (nodeType == "MemberAccess")
|
||||||
@ -752,6 +754,26 @@ ASTPointer<FunctionCall> ASTJsonImporter::createFunctionCall(Json::Value const&
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ASTPointer<FunctionCallOptions> ASTJsonImporter::createFunctionCallOptions(Json::Value const& _node)
|
||||||
|
{
|
||||||
|
std::vector<ASTPointer<Expression>> options;
|
||||||
|
for (auto& option: member(_node, "options"))
|
||||||
|
options.push_back(convertJsonToASTNode<Expression>(option));
|
||||||
|
std::vector<ASTPointer<ASTString>> names;
|
||||||
|
for (auto& name: member(_node, "names"))
|
||||||
|
{
|
||||||
|
astAssert(name.isString(), "Expected 'names' members to be strings!");
|
||||||
|
names.push_back(make_shared<ASTString>(name.asString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return createASTNode<FunctionCallOptions>(
|
||||||
|
_node,
|
||||||
|
convertJsonToASTNode<Expression>(member(_node, "expression")),
|
||||||
|
options,
|
||||||
|
names
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
ASTPointer<NewExpression> ASTJsonImporter::createNewExpression(Json::Value const& _node)
|
ASTPointer<NewExpression> ASTJsonImporter::createNewExpression(Json::Value const& _node)
|
||||||
{
|
{
|
||||||
return createASTNode<NewExpression>(
|
return createASTNode<NewExpression>(
|
||||||
|
@ -111,6 +111,7 @@ private:
|
|||||||
ASTPointer<UnaryOperation> createUnaryOperation(Json::Value const& _node);
|
ASTPointer<UnaryOperation> createUnaryOperation(Json::Value const& _node);
|
||||||
ASTPointer<BinaryOperation> createBinaryOperation(Json::Value const& _node);
|
ASTPointer<BinaryOperation> createBinaryOperation(Json::Value const& _node);
|
||||||
ASTPointer<FunctionCall> createFunctionCall(Json::Value const& _node);
|
ASTPointer<FunctionCall> createFunctionCall(Json::Value const& _node);
|
||||||
|
ASTPointer<FunctionCallOptions> createFunctionCallOptions(Json::Value const& _node);
|
||||||
ASTPointer<NewExpression> createNewExpression(Json::Value const& _node);
|
ASTPointer<NewExpression> createNewExpression(Json::Value const& _node);
|
||||||
ASTPointer<MemberAccess> createMemberAccess(Json::Value const& _node);
|
ASTPointer<MemberAccess> createMemberAccess(Json::Value const& _node);
|
||||||
ASTPointer<IndexAccess> createIndexAccess(Json::Value const& _node);
|
ASTPointer<IndexAccess> createIndexAccess(Json::Value const& _node);
|
||||||
|
Loading…
Reference in New Issue
Block a user