class Module extends SomeOtherThing {
function functionB(value:Int) {
var test4 = value * 3 - 2
return test4;
}
function functionA(test:Int) {
var test2 = test * 2;
var test3 = functionB(test2);
trace(test2); // This fails when it shouldn't.
trace(test4); // This works when it shouldn't.
}
}
Root cause: When the interpreter calls this.functionB(), it reuses the Interp object as used by functionA and overrides its state as it does so. The local state needs to be preserved before the function call and restored afterwards.
Example:
Root cause: When the interpreter calls
this.functionB()
, it reuses theInterp
object as used byfunctionA
and overrides its state as it does so. The local state needs to be preserved before the function call and restored afterwards.