From f8b9776f281c6929b44d0ad46b8006e5497560df Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Thu, 9 Jan 2025 00:09:18 +0200 Subject: [PATCH] fix: for-in loop doesn't declare its binding when it has to --- .../me/topchetoeu/jscript/compilation/control/ForInNode.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/topchetoeu/jscript/compilation/control/ForInNode.java b/src/main/java/me/topchetoeu/jscript/compilation/control/ForInNode.java index d620bd9..1af9179 100644 --- a/src/main/java/me/topchetoeu/jscript/compilation/control/ForInNode.java +++ b/src/main/java/me/topchetoeu/jscript/compilation/control/ForInNode.java @@ -21,7 +21,9 @@ public class ForInNode extends Node { @Override public void resolve(CompileResult target) { body.resolve(target); - binding.resolve(target); + if (isDecl) { + target.scope.define(binding.name); + } } @Override public void compileFunctions(CompileResult target) {