From db241919f2d7430cbbb4efa1fde9afa632774f8e Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:43:15 +0200 Subject: [PATCH] fix: when capturing, must check if already in captures --- .../me/topchetoeu/jscript/compilation/scope/FunctionScope.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/topchetoeu/jscript/compilation/scope/FunctionScope.java b/src/main/java/me/topchetoeu/jscript/compilation/scope/FunctionScope.java index 8fdb3a5..c5d9f3b 100644 --- a/src/main/java/me/topchetoeu/jscript/compilation/scope/FunctionScope.java +++ b/src/main/java/me/topchetoeu/jscript/compilation/scope/FunctionScope.java @@ -19,7 +19,7 @@ public final class FunctionScope { public final boolean passthrough; private Variable addCaptured(Variable var, boolean captured) { - if (captured && !this.capturables.has(var)) this.capturables.add(var); + if (captured && !this.capturables.has(var) && !this.captures.has(var)) this.capturables.add(var); return var; }