mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Simplifying lambda function in CompilerStack::getInterface()
This commit is contained in:
parent
af9fb9917c
commit
06998aa2d2
@ -100,24 +100,22 @@ string const& CompilerStack::getInterface()
|
|||||||
Json::Value inputs(Json::arrayValue);
|
Json::Value inputs(Json::arrayValue);
|
||||||
Json::Value outputs(Json::arrayValue);
|
Json::Value outputs(Json::arrayValue);
|
||||||
|
|
||||||
auto streamVariables = [&](vector<ASTPointer<VariableDeclaration>> const& _vars,
|
auto streamVariables = [](vector<ASTPointer<VariableDeclaration>> const& _vars)
|
||||||
Json::Value &json)
|
|
||||||
{
|
{
|
||||||
|
Json::Value params(Json::arrayValue);
|
||||||
for (ASTPointer<VariableDeclaration> const& var: _vars)
|
for (ASTPointer<VariableDeclaration> const& var: _vars)
|
||||||
{
|
{
|
||||||
Json::Value input;
|
Json::Value input;
|
||||||
input["name"] = var->getName();
|
input["name"] = var->getName();
|
||||||
input["type"] = var->getType()->toString();
|
input["type"] = var->getType()->toString();
|
||||||
json.append(input);
|
params.append(input);
|
||||||
}
|
}
|
||||||
|
return params;
|
||||||
};
|
};
|
||||||
|
|
||||||
method["name"] = f->getName();
|
method["name"] = f->getName();
|
||||||
streamVariables(f->getParameters(), inputs);
|
method["inputs"] = streamVariables(f->getParameters());
|
||||||
method["inputs"] = inputs;
|
method["outputs"] = streamVariables(f->getReturnParameters());
|
||||||
streamVariables(f->getReturnParameters(), outputs);
|
|
||||||
method["outputs"] = outputs;
|
|
||||||
|
|
||||||
methods.append(method);
|
methods.append(method);
|
||||||
}
|
}
|
||||||
m_interface = writer.write(methods);
|
m_interface = writer.write(methods);
|
||||||
|
Loading…
Reference in New Issue
Block a user