fix: several more fixes

This commit is contained in:
TopchetoEU 2023-11-05 19:44:44 +02:00
parent e326847287
commit b66acd3089
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4
2 changed files with 9 additions and 2 deletions

View File

@ -100,10 +100,13 @@ public class Main {
Reading.resourceToString("js/ts.js"), null Reading.resourceToString("js/ts.js"), null
).await(); ).await();
System.out.println("Loaded typescript!"); System.out.println("Loaded typescript!");
var ctx = new Context(engine).pushEnv(env.child());
engine.pushMsg( engine.pushMsg(
false, new Context(engine).pushEnv(env.child()), false, ctx,
new Filename("jscript", "internals/bootstrap.js"), Reading.resourceToString("js/bootstrap.js"), null, 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(); ).await();
} }
catch (EngineException e) { catch (EngineException e) {

View File

@ -11,6 +11,7 @@ import me.topchetoeu.jscript.engine.values.FunctionValue;
import me.topchetoeu.jscript.engine.values.Values; import me.topchetoeu.jscript.engine.values.Values;
import me.topchetoeu.jscript.exceptions.ConvertException; import me.topchetoeu.jscript.exceptions.ConvertException;
import me.topchetoeu.jscript.exceptions.EngineException; import me.topchetoeu.jscript.exceptions.EngineException;
import me.topchetoeu.jscript.exceptions.InterruptException;
public class OverloadFunction extends FunctionValue { public class OverloadFunction extends FunctionValue {
public final List<Overload> overloads = new ArrayList<>(); public final List<Overload> overloads = new ArrayList<>();
@ -87,6 +88,9 @@ public class OverloadFunction extends FunctionValue {
e.printStackTrace(); e.printStackTrace();
throw EngineException.ofType("Unexpected value of 'undefined'.").add(name, loc); throw EngineException.ofType("Unexpected value of 'undefined'.").add(name, loc);
} }
else if (e.getTargetException() instanceof InterruptException || e.getTargetException() instanceof InterruptedException) {
throw new InterruptException();
}
else { else {
throw EngineException.ofError(e.getTargetException().getMessage()).add(name, loc); throw EngineException.ofError(e.getTargetException().getMessage()).add(name, loc);
} }