From 6d566601362b542fb8edc4e14ae737e1893da1bb Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Thu, 19 Sep 2024 14:22:21 +0300 Subject: [PATCH] fix: stupid mistake with variable capturing --- .../topchetoeu/jscript/compilation/values/VariableNode.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/topchetoeu/jscript/compilation/values/VariableNode.java b/src/main/java/me/topchetoeu/jscript/compilation/values/VariableNode.java index bd0a9f8..ae32c9c 100644 --- a/src/main/java/me/topchetoeu/jscript/compilation/values/VariableNode.java +++ b/src/main/java/me/topchetoeu/jscript/compilation/values/VariableNode.java @@ -64,7 +64,7 @@ public class VariableNode extends Node implements Pattern, ChangeTarget { } public static IntFunction toGet(CompileResult target, Location loc, String name, boolean keep, boolean forceGet) { - var oldI = target.scope.get(name, true); + var oldI = target.scope.get(name, false); if (oldI != null) { if (keep) return _i -> oldI.index().toGet(); @@ -83,7 +83,7 @@ public class VariableNode extends Node implements Pattern, ChangeTarget { } public static IntFunction toInit(CompileResult target, Location loc, String name) { - var oldI = target.scope.get(name, true); + var oldI = target.scope.get(name, false); if (oldI != null) return _i -> oldI.index().toInit(); else return _i -> { @@ -94,7 +94,7 @@ public class VariableNode extends Node implements Pattern, ChangeTarget { }; } public static IntFunction toSet(CompileResult target, Location loc, String name, boolean keep) { - var oldI = target.scope.get(name, true); + var oldI = target.scope.get(name, false); if (oldI != null) return _i -> oldI.index().toSet(keep); else return _i -> {