void DeclarationValidator::visit(FunctionDeclaration &func)
{
+ string key = func.name+func.signature;
+ map<string, FunctionDeclaration *>::const_iterator i = overloaded_functions.find(key);
+ if(i==overloaded_functions.end())
+ overloaded_functions.insert(make_pair(key, &func));
+ else if(func.return_type_declaration && i->second->return_type_declaration!=func.return_type_declaration)
+ {
+ error(func, format("Conflicting return type '%s' for function '%s'", func.return_type_declaration->name, func.name));
+ if(i->second->return_type_declaration)
+ add_info(*i->second, format("Previously declared as returning '%s'", i->second->return_type_declaration->name));
+ }
+
if(Statement *previous = find_definition(func.name))
{
if(!dynamic_cast<FunctionDeclaration *>(previous))
error(iface, format("Use of unlinked input block '%s'", iface.name));
}
+void ReferenceValidator::visit(FunctionCall &call)
+{
+ if(!call.declaration && !call.constructor)
+ error(call, format("Call to undeclared function '%s'", call.name));
+ TraversingVisitor::visit(call);
+}
+
void ReferenceValidator::visit(VariableDeclaration &var)
{
if(!var.type_declaration)