Skip to content
Snippets Groups Projects
Commit 1263ec85 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Fix function evaluation when parameter list is only one parameter

``
let f: R->R, (x)->x+1;
f(2);
``
was complaining that the function parameter was not of the correct type (git
language::parameter_list instead of language::name)
parent 1ebef8ca
No related branches found
No related tags found
1 merge request!37Feature/language
......@@ -81,7 +81,8 @@ ASTNodeFunctionExpressionBuilder::_buildArgumentProcessors(FunctionDescriptor& f
ASTNode& argument_nodes = *node.children[1];
const size_t arguments_number = argument_nodes.is_type<language::expression_list>() ? argument_nodes.children.size() : 1;
const size_t arguments_number =
argument_nodes.is_type<language::expression_list>() ? argument_nodes.children.size() : 1;
const size_t parameters_number =
parameter_variables.is_type<language::name_list>() ? parameter_variables.children.size() : 1;
......@@ -98,10 +99,14 @@ ASTNodeFunctionExpressionBuilder::_buildArgumentProcessors(FunctionDescriptor& f
ASTNode& argument_node = *argument_nodes.children[i];
this->_storeArgumentProcessor(parameter_variable, argument_node, function_processor);
}
} else {
if (parameter_variables.is_type<language::name_list>()) {
this->_storeArgumentProcessor(*parameter_variables.children[0], argument_nodes, function_processor);
} else {
this->_storeArgumentProcessor(parameter_variables, argument_nodes, function_processor);
}
}
}
PUGS_INLINE
std::unique_ptr<INodeProcessor>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment