When a function is defined, set its symbol's position to the code position.

Before, if the function was declared before being defined, then the symbol's
SourcePos would be left set to the position of the declaration.  This ended
up getting the debugging symbols mixed up in this case, which was undesirable.
This commit is contained in:
Matt Pharr
2012-04-28 20:28:39 -07:00
parent a1a43cdfe0
commit c4b1d79c5c
2 changed files with 8 additions and 3 deletions

View File

@@ -1862,8 +1862,11 @@ function_definition
dynamic_cast<const FunctionType *>($2->type);
if (funcType == NULL)
Assert(m->errorCount > 0);
else
m->AddFunctionDefinition($2->name, funcType, $4);
else {
Stmt *code = $4;
if (code == NULL) code = new StmtList(@4);
m->AddFunctionDefinition($2->name, funcType, code);
}
}
m->symbolTable->PopScope(); // push in lAddFunctionParams();
}