void FunctionResolver::visit(FunctionCall &call)
{
map<string, FunctionDeclaration *>::iterator i = stage->functions.find(call.name);
- if(i!=stage->functions.end())
- call.declaration = i->second;
+ FunctionDeclaration *declaration = (i!=stage->functions.end() ? i->second : 0);
+ r_any_resolved |= (declaration!=call.declaration);
+ call.declaration = declaration;
TraversingVisitor::visit(call);
}
// Set all previous declarations to use this definition.
for(vector<FunctionDeclaration *>::iterator i=decls.begin(); i!=decls.end(); ++i)
{
+ r_any_resolved |= (func.definition!=(*i)->definition);
(*i)->definition = func.definition;
(*i)->body.body.clear();
}
}
else
{
- func.definition = 0;
+ FunctionDeclaration *definition = (stage_decl ? stage_decl->definition : 0);
+ r_any_resolved |= (definition!=func.definition);
+ func.definition = definition;
+
if(!stage_decl)
stage_decl = &func;
- else
- func.definition = stage_decl->definition;
}
decls.push_back(&func);