diff --git a/src/me/topchetoeu/jscript/Main.java b/src/me/topchetoeu/jscript/Main.java index 6dd6463..d195a6c 100644 --- a/src/me/topchetoeu/jscript/Main.java +++ b/src/me/topchetoeu/jscript/Main.java @@ -100,10 +100,13 @@ public class Main { Reading.resourceToString("js/ts.js"), null ).await(); System.out.println("Loaded typescript!"); + + var ctx = new Context(engine).pushEnv(env.child()); + engine.pushMsg( - false, new Context(engine).pushEnv(env.child()), + false, ctx, new Filename("jscript", "internals/bootstrap.js"), Reading.resourceToString("js/bootstrap.js"), null, - tsEnv.global.obj, env, new ArrayValue(null, Reading.resourceToString("js/lib.d.ts")) + tsEnv.global.get(ctx, "ts"), env, new ArrayValue(null, Reading.resourceToString("js/lib.d.ts")) ).await(); } catch (EngineException e) { diff --git a/src/me/topchetoeu/jscript/interop/OverloadFunction.java b/src/me/topchetoeu/jscript/interop/OverloadFunction.java index 3ec35ec..ee0470a 100644 --- a/src/me/topchetoeu/jscript/interop/OverloadFunction.java +++ b/src/me/topchetoeu/jscript/interop/OverloadFunction.java @@ -11,6 +11,7 @@ import me.topchetoeu.jscript.engine.values.FunctionValue; import me.topchetoeu.jscript.engine.values.Values; import me.topchetoeu.jscript.exceptions.ConvertException; import me.topchetoeu.jscript.exceptions.EngineException; +import me.topchetoeu.jscript.exceptions.InterruptException; public class OverloadFunction extends FunctionValue { public final List overloads = new ArrayList<>(); @@ -87,6 +88,9 @@ public class OverloadFunction extends FunctionValue { e.printStackTrace(); throw EngineException.ofType("Unexpected value of 'undefined'.").add(name, loc); } + else if (e.getTargetException() instanceof InterruptException || e.getTargetException() instanceof InterruptedException) { + throw new InterruptException(); + } else { throw EngineException.ofError(e.getTargetException().getMessage()).add(name, loc); }