Skip to content

Commit

Permalink
6049 [CTFE]: Array literals of structs with invariant() are wrong
Browse files Browse the repository at this point in the history
The __result variable is special; like 'this', it can be modified even when
the function call is from global scope. It needs to be cleared at the end of
every function call.
  • Loading branch information
Don Clugston committed May 24, 2011
1 parent 44880fa commit 91ffa26
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/interpret.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ Expression *FuncDeclaration::interpret(InterState *istate, Expressions *argument
VarDeclaration *v = (VarDeclaration *)parameters->data[i];
v->setValueWithoutChecking((Expression *)vsave.data[i]);
}
/* Clear __result. (Bug 6049).
*/
if (vresult)
vresult->setValueNull();

if (istate && !isNested())
{
Expand Down

0 comments on commit 91ffa26

Please sign in to comment.