aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorGav Wood <i@gavwood.com>2015-02-04 04:25:08 +0800
committerGav Wood <i@gavwood.com>2015-02-04 04:25:08 +0800
commit2ff4a80b6266a6bcd22ef6cbb654f90fc84f9276 (patch)
tree5a69a85a19d619453fa4283a78a47e64051ed0c9 /ExpressionCompiler.cpp
parent04164b612c61ea2ea5c18f56600f95f03ded7235 (diff)
downloaddexon-solidity-2ff4a80b6266a6bcd22ef6cbb654f90fc84f9276.tar.gz
dexon-solidity-2ff4a80b6266a6bcd22ef6cbb654f90fc84f9276.tar.zst
dexon-solidity-2ff4a80b6266a6bcd22ef6cbb654f90fc84f9276.zip
Fixes for named-args.
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r--ExpressionCompiler.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index 13d8ccf1..875e00bc 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -204,34 +204,25 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
{
FunctionType const& function = dynamic_cast<FunctionType const&>(*_functionCall.getExpression().getType());
TypePointers const& parameterTypes = function.getParameterTypes();
- vector<string> const& parameterNames = function.getParameterNames();
vector<ASTPointer<Expression const>> const& callArguments = _functionCall.getArguments();
- vector<string> const& callArgumentNames = _functionCall.getNames();
+ vector<ASTPointer<ASTString>> const& callArgumentNames = _functionCall.getNames();
solAssert(callArguments.size() == parameterTypes.size(), "");
vector<ASTPointer<Expression const>> arguments;
if (callArgumentNames.empty())
- {
// normal arguments
- arguments = {callArguments.begin(), callArguments.end()};
- }
+ arguments = callArguments;
else
- {
// named arguments
- for (size_t i = 0; i < parameterNames.size(); i++) {
+ for (auto const& parameterName: function.getParameterNames())
+ {
bool found = false;
- for (size_t j = 0; j < callArgumentNames.size(); j++) {
- if (parameterNames[i] == callArgumentNames[j]) {
+ for (size_t j = 0; j < callArgumentNames.size() && !found; j++)
+ if ((found = (parameterName == *callArgumentNames[j])))
// we found the actual parameter position
arguments.push_back(callArguments[j]);
-
- found = true;
- break;
- }
- }
solAssert(found, "");
}
- }
switch (function.getLocation())
{