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; }