LOC_ITEM_AS_INT_1,
LOC_ITEM_AS_INT_2,
LOC_METHOD_CALL_CHECK_1,
+ LOC_MEHTOD_CALL_CHECK_2,
+ LOC_MEHTOD_CALL_CHECK_3, // 11035
+ LOC_MEHTOD_CALL_CHECK_4,
LOC_COUNT
};
RplASExprStatement* args = dynamic_cast<RplASExprStatement*>(m_child2);
int argCount = 0;
RplASMethod* method = m_method;
- RplASExprStatement* params = dynamic_cast<RplASExprStatement*>(method->child2());
+ RplASVarDefinition* params = dynamic_cast<RplASVarDefinition*>(method->child2());
while (args != NULL && params != NULL){
argCount++;
- RplASCalculable* argExpr = dynamic_cast<RplASCalculable*>(args->child2());
+ RplASCalculable* argExpr = dynamic_cast<RplASCalculable*>
+ (args->child2());
if (argExpr == NULL)
rc = error(LOC_METHOD_CALL_CHECK_1, parser,
"argument %d misses expr", argCount);
else {
+ RplASNamedValue* var;
+ RplASItem* param = params->child2();
+ if (param == NULL
+ || (var = dynamic_cast<RplASNamedValue*>(param)) == NULL)
+ rc = error(LOC_MEHTOD_CALL_CHECK_2, parser,
+ "parameter %d misses named value: %s", argCount,
+ param == NULL ? "<null>" : param->nameOfItemType());
+ else {
+ // tryConversion() calls args->args->child2()->check()!
+ RplASConversion* converter = RplASConversion::tryConversion(
+ var->clazz(), args->child2(), parser, rc);
+ if (rc && converter != NULL)
+ args->setChild2(converter);
+ }
}
+ args = dynamic_cast<RplASExprStatement*>(args->child());
+ params = dynamic_cast<RplASVarDefinition*>(params->child());
}
-
+ if (args != NULL && params == NULL)
+ rc = error(LOC_MEHTOD_CALL_CHECK_3, parser,
+ "too many arguments: %d are enough", argCount);
+ else if (args == NULL && params != NULL && params->child3() != NULL)
+ rc = error(LOC_MEHTOD_CALL_CHECK_4, parser,
+ "too few arguments: %d are not enough", argCount);
return rc;
}