From 3e6214659b5de2def21331678cf063a764001db4 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Tue, 5 Mar 2024 15:54:51 +0200 Subject: [PATCH] fix: use new global API --- src/java/me/topchetoeu/jscript/utils/JScriptRepl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java/me/topchetoeu/jscript/utils/JScriptRepl.java b/src/java/me/topchetoeu/jscript/utils/JScriptRepl.java index 512ea83..4dce7b4 100644 --- a/src/java/me/topchetoeu/jscript/utils/JScriptRepl.java +++ b/src/java/me/topchetoeu/jscript/utils/JScriptRepl.java @@ -87,10 +87,10 @@ public class JScriptRepl { private static void initEnv() { environment = Internals.apply(environment); - environment.global.define(false, new NativeFunction("exit", args -> { + environment.global.define(null, false, new NativeFunction("exit", args -> { throw new InterruptException(); })); - environment.global.define(false, new NativeFunction("go", args -> { + environment.global.define(null, false, new NativeFunction("go", args -> { try { var f = Path.of("do.js"); var func = args.ctx.compile(new Filename("do", "do/" + j++ + ".js"), new String(Files.readAllBytes(f))); @@ -100,7 +100,7 @@ public class JScriptRepl { throw new EngineException("Couldn't open do.js"); } })); - environment.global.define(false, new NativeFunction("log", args -> { + environment.global.define(null, false, new NativeFunction("log", args -> { for (var el : args.args) { Values.printValue(args.ctx, el); }