Fixed #3725: Associate functions with correct parent scope when definition doesn't directly follow declaration.

This commit is contained in:
PKEuS 2012-04-25 20:52:59 +02:00
parent 31a252b057
commit ebf89aa229
1 changed files with 1 additions and 2 deletions

View File

@ -915,11 +915,10 @@ Function* SymbolDatabase::addGlobalFunction(Scope*& scope, const Token*& tok, co
function->token = funcStart;
function->hasBody = true;
Scope* old_scope = scope;
addNewFunction(&scope, &tok);
if (scope) {
scope->function = &old_scope->functionList.back();
scope->function = function;
return function;
}
return 0;