From d8e46c3149bb3c2ecd2027b77ee8dd768a8b1e4b Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 31 Mar 2024 16:11:32 +0300 Subject: [PATCH] fix: clone environment correctly --- .../me/topchetoeu/jscript/utils/debug/SimpleDebugger.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/java/me/topchetoeu/jscript/utils/debug/SimpleDebugger.java b/src/java/me/topchetoeu/jscript/utils/debug/SimpleDebugger.java index aa19abc..313dded 100644 --- a/src/java/me/topchetoeu/jscript/utils/debug/SimpleDebugger.java +++ b/src/java/me/topchetoeu/jscript/utils/debug/SimpleDebugger.java @@ -192,7 +192,7 @@ public class SimpleDebugger implements Debugger { } public ObjRef(Context ctx, ObjectValue obj) { - this.ctx = ctx; + this.ctx = ctx.environment.context(); this.obj = obj; } } @@ -349,8 +349,7 @@ public class SimpleDebugger implements Debugger { } private JSONMap serializeObj(Context ctx, Object val, boolean byValue) { val = Values.normalize(null, val); - var newEnv = new Environment(); - newEnv.addAll(ctx); + var newEnv = ctx.environment.child(); newEnv.add(DebugContext.IGNORE); ctx = newEnv.context();