MCPcopy Create free account
hub / github.com/dynjs/dynjs / ExecutionContext

Class ExecutionContext

src/main/java/org/dynjs/runtime/ExecutionContext.java:20–675  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18import java.util.TimeZone;
19
20public class ExecutionContext implements CompilationContext {
21
22 public static ExecutionContext createGlobalExecutionContext(DynJS runtime) {
23 // 10.4.1.1
24 LexicalEnvironment env = LexicalEnvironment.newGlobalEnvironment(runtime);
25 return new ExecutionContext(runtime, null, env, env, runtime.getGlobalContext().getObject(), false);
26 }
27
28 public static ExecutionContext createDefaultGlobalExecutionContext(DynJS runtime) {
29 // 10.4.1.1
30 LexicalEnvironment env = LexicalEnvironment.newGlobalEnvironment(runtime);
31 ExecutionContext context = new ExecutionContext(runtime, null, env, env, runtime.getGlobalContext().getObject(), false);
32 context.blockManager = new BlockManager();
33 return context;
34 }
35
36 public static ExecutionContext createGlobalExecutionContext(DynJS runtime, InitializationListener listener) {
37 ExecutionContext context = ExecutionContext.createEvalExecutionContext(runtime);
38 listener.initialize(context);
39 return context;
40 }
41
42 public static ExecutionContext createEvalExecutionContext(DynJS runtime) {
43 // 10.4.2 (no caller)
44 return createGlobalExecutionContext(runtime);
45 }
46
47 private DynJS runtime;
48 private ExecutionContext parent;
49 private LexicalEnvironment lexicalEnvironment;
50 private LexicalEnvironment variableEnvironment;
51 private Object thisBinding;
52 private boolean strict;
53 private boolean inEval;
54
55
56 private int lineNumber;
57 private int columnNumber;
58 private String fileName;
59 private String debugContext = "<eval>";
60 private VariableValues vars;
61
62 // Just stash functions passed into this context with no processing. IRScope will detect things like 'attributes' and
63 // generate those on a case-by-case basis.
64 private Object[] functionParameters;
65
66 private Object functionReference;
67
68 private List<StackElement> throwStack;
69
70 private BlockManager blockManager;
71
72 public ExecutionContext(DynJS runtime, ExecutionContext parent, LexicalEnvironment lexicalEnvironment, LexicalEnvironment variableEnvironment, Object thisBinding, boolean strict) {
73 this.runtime = runtime;
74 this.parent = parent;
75 this.lexicalEnvironment = lexicalEnvironment;
76 this.variableEnvironment = variableEnvironment;
77 this.thisBinding = thisBinding;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected