Module support #11
@ -26,11 +26,11 @@ public class Context {
|
||||
return env.empty() ? null : env.peek();
|
||||
}
|
||||
|
||||
public Context pushEnv(Environment env) {
|
||||
private Context pushEnv(Environment env) {
|
||||
this.env.push(env);
|
||||
return this;
|
||||
}
|
||||
public void popEnv() {
|
||||
private void popEnv() {
|
||||
if (!env.empty()) this.env.pop();
|
||||
}
|
||||
|
||||
|
@ -106,10 +106,6 @@ public class Environment implements PermissionsProvider {
|
||||
return permissions == null || permissions.hasPermission(perm);
|
||||
}
|
||||
|
||||
public Context context(Engine engine) {
|
||||
return new Context(engine).pushEnv(this);
|
||||
}
|
||||
|
||||
public static Symbol getSymbol(String name) {
|
||||
if (symbols.containsKey(name)) return symbols.get(name);
|
||||
else {
|
||||
|
@ -482,7 +482,7 @@ public class SimpleDebugger implements Debugger {
|
||||
|
||||
env.global = new GlobalScope(codeFrame.local);
|
||||
|
||||
var ctx = new Context(engine).pushEnv(env);
|
||||
var ctx = new Context(engine, env);
|
||||
var awaiter = engine.pushMsg(false, ctx.environment(), new Filename("jscript", "eval"), code, codeFrame.frame.thisArg, codeFrame.frame.args);
|
||||
|
||||
engine.run(true);
|
||||
|
@ -741,7 +741,7 @@ public class Values {
|
||||
try {
|
||||
if (err instanceof EngineException) {
|
||||
var ee = ((EngineException)err);
|
||||
System.out.println(prefix + " " + ee.toString(new Context(ee.engine).pushEnv(ee.env)));
|
||||
System.out.println(prefix + " " + ee.toString(new Context(ee.engine, ee.env)));
|
||||
}
|
||||
else if (err instanceof SyntaxException) {
|
||||
System.out.println("Syntax error:" + ((SyntaxException)err).msg);
|
||||
|
@ -37,7 +37,7 @@ public class EngineException extends RuntimeException {
|
||||
if (function.equals("")) function = null;
|
||||
|
||||
if (ctx == null) this.ctx = null;
|
||||
else this.ctx = new Context(ctx.engine).pushEnv(ctx.environment());
|
||||
else this.ctx = new Context(ctx.engine, ctx.environment());
|
||||
this.location = location;
|
||||
this.function = function;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import me.topchetoeu.jscript.interop.Native;
|
||||
private void next(Context ctx, Object inducedValue, Object inducedError) {
|
||||
Object res = null;
|
||||
ctx.pushFrame(frame);
|
||||
ctx.pushEnv(frame.function.environment);
|
||||
|
||||
awaiting = false;
|
||||
while (!awaiting) {
|
||||
|
Loading…
Reference in New Issue
Block a user