mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #13185 from ethereum/functionCall_locations
Add location for parameter names in FunctionCall ASTNode
This commit is contained in:
@@ -95,6 +95,20 @@ SourceLocation const ASTJsonImporter::createSourceLocation(Json::Value const& _n
|
||||
return solidity::langutil::parseSourceLocation(_node["src"].asString(), m_sourceNames);
|
||||
}
|
||||
|
||||
optional<vector<SourceLocation>> ASTJsonImporter::createSourceLocations(Json::Value const& _node) const
|
||||
{
|
||||
vector<SourceLocation> locations;
|
||||
|
||||
if (_node.isMember("nameLocations") && _node["nameLocations"].isArray())
|
||||
{
|
||||
for (auto const& val: _node["nameLocations"])
|
||||
locations.emplace_back(langutil::parseSourceLocation(val.asString(), m_sourceNames));
|
||||
return locations;
|
||||
}
|
||||
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
SourceLocation ASTJsonImporter::createNameSourceLocation(Json::Value const& _node)
|
||||
{
|
||||
astAssert(member(_node, "nameLocation").isString(), "'nameLocation' must be a string");
|
||||
@@ -893,11 +907,17 @@ ASTPointer<FunctionCall> ASTJsonImporter::createFunctionCall(Json::Value const&
|
||||
astAssert(name.isString(), "Expected 'names' members to be strings!");
|
||||
names.push_back(make_shared<ASTString>(name.asString()));
|
||||
}
|
||||
|
||||
optional<vector<SourceLocation>> sourceLocations = createSourceLocations(_node);
|
||||
|
||||
return createASTNode<FunctionCall>(
|
||||
_node,
|
||||
convertJsonToASTNode<Expression>(member(_node, "expression")),
|
||||
arguments,
|
||||
names
|
||||
names,
|
||||
sourceLocations ?
|
||||
*sourceLocations :
|
||||
vector<SourceLocation>(names.size())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user