diff --git a/polymod/hscript/_internal/PolymodInterpEx.hx b/polymod/hscript/_internal/PolymodInterpEx.hx index 94e0f781..66a1f04b 100644 --- a/polymod/hscript/_internal/PolymodInterpEx.hx +++ b/polymod/hscript/_internal/PolymodInterpEx.hx @@ -1489,11 +1489,6 @@ class PolymodInterpEx extends Interp return null; } - if (locals.exists(id)) - { - // NOTE: id may exist but be null - return locals.get(id).r; - } if (variables.exists(id)) { // NOTE: id may exist but be null @@ -1681,10 +1676,11 @@ class PolymodInterpEx extends Interp this._classDeclOverride = cls; + var localsCopy:Map}> = this.locals.copy(); var result:Dynamic = null; try { - result = this.exprReturn(fn.expr); + result = this.executeEx(fn.expr); } catch (err:PolymodExprEx.ErrorEx) { @@ -1716,6 +1712,7 @@ class PolymodInterpEx extends Interp } } this._classDeclOverride = previousClassDecl; + this.locals = localsCopy; return result; }