greybel-interpreter 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context.d.ts +5 -3
- package/dist/context.js +6 -5
- package/dist/interpreter.js +3 -2
- package/package.json +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export declare enum ContextType {
|
|
|
6
6
|
API = "API",
|
|
7
7
|
GLOBAL = "GLOBAL",
|
|
8
8
|
FUNCTION = "FUNCTION",
|
|
9
|
-
INJECTION = "INJECTION",
|
|
10
9
|
EXTERNAL = "EXTERNAL",
|
|
11
10
|
LOOP = "LOOP",
|
|
12
11
|
MAP = "MAP",
|
|
@@ -44,6 +43,7 @@ export interface OperationContextProcessState {
|
|
|
44
43
|
export interface OperationContextOptions {
|
|
45
44
|
target?: string;
|
|
46
45
|
isProtected?: boolean;
|
|
46
|
+
injected?: boolean;
|
|
47
47
|
type?: ContextType;
|
|
48
48
|
state?: ContextState;
|
|
49
49
|
previous?: OperationContext;
|
|
@@ -55,6 +55,7 @@ export interface OperationContextForkOptions {
|
|
|
55
55
|
type: ContextType;
|
|
56
56
|
state: ContextState;
|
|
57
57
|
target?: string;
|
|
58
|
+
injected?: boolean;
|
|
58
59
|
}
|
|
59
60
|
export declare class OperationContext {
|
|
60
61
|
target: string;
|
|
@@ -64,10 +65,11 @@ export declare class OperationContext {
|
|
|
64
65
|
type: ContextType;
|
|
65
66
|
state: ContextState;
|
|
66
67
|
scope: Scope;
|
|
67
|
-
isProtected: boolean;
|
|
68
68
|
memory: Map<string, any>;
|
|
69
69
|
cps: CPS | null;
|
|
70
70
|
processState: OperationContextProcessState;
|
|
71
|
+
isProtected: boolean;
|
|
72
|
+
injected: boolean;
|
|
71
73
|
api: Scope | null;
|
|
72
74
|
locals: Scope | null;
|
|
73
75
|
globals: Scope | null;
|
|
@@ -90,5 +92,5 @@ export declare class OperationContext {
|
|
|
90
92
|
getCallable(path: string[]): Promise<Callable>;
|
|
91
93
|
setMemory(key: string, value: any): OperationContext;
|
|
92
94
|
getMemory(key: string): any;
|
|
93
|
-
fork({ type, state, target }: OperationContextForkOptions): OperationContext;
|
|
95
|
+
fork({ type, state, target, injected }: OperationContextForkOptions): OperationContext;
|
|
94
96
|
}
|
package/dist/context.js
CHANGED
|
@@ -50,7 +50,6 @@ var ContextType;
|
|
|
50
50
|
ContextType["API"] = "API";
|
|
51
51
|
ContextType["GLOBAL"] = "GLOBAL";
|
|
52
52
|
ContextType["FUNCTION"] = "FUNCTION";
|
|
53
|
-
ContextType["INJECTION"] = "INJECTION";
|
|
54
53
|
ContextType["EXTERNAL"] = "EXTERNAL";
|
|
55
54
|
ContextType["LOOP"] = "LOOP";
|
|
56
55
|
ContextType["MAP"] = "MAP";
|
|
@@ -181,7 +180,7 @@ var Debugger = /** @class */ (function () {
|
|
|
181
180
|
return me;
|
|
182
181
|
};
|
|
183
182
|
Debugger.prototype.getBreakpoint = function (operationContext) {
|
|
184
|
-
return operationContext.
|
|
183
|
+
return !operationContext.injected && this.breakpoint;
|
|
185
184
|
};
|
|
186
185
|
Debugger.prototype.next = function () {
|
|
187
186
|
var me = this;
|
|
@@ -228,6 +227,7 @@ var OperationContext = /** @class */ (function () {
|
|
|
228
227
|
me.state = options.state || ContextState.DEFAULT;
|
|
229
228
|
me.scope = new Scope(me);
|
|
230
229
|
me.isProtected = options.isProtected || false;
|
|
230
|
+
me.injected = options.injected || false;
|
|
231
231
|
me.memory = new Map();
|
|
232
232
|
me.debugger = options.debugger || new Debugger();
|
|
233
233
|
me.cps = options.cps;
|
|
@@ -253,7 +253,7 @@ var OperationContext = /** @class */ (function () {
|
|
|
253
253
|
};
|
|
254
254
|
OperationContext.prototype.setLastActive = function (opc) {
|
|
255
255
|
var me = this;
|
|
256
|
-
if (opc.
|
|
256
|
+
if (!opc.injected) {
|
|
257
257
|
me.processState.last = opc;
|
|
258
258
|
}
|
|
259
259
|
return me;
|
|
@@ -361,7 +361,7 @@ var OperationContext = /** @class */ (function () {
|
|
|
361
361
|
return me.memory.get(key);
|
|
362
362
|
};
|
|
363
363
|
OperationContext.prototype.fork = function (_a) {
|
|
364
|
-
var type = _a.type, state = _a.state, target = _a.target;
|
|
364
|
+
var type = _a.type, state = _a.state, target = _a.target, injected = _a.injected;
|
|
365
365
|
var me = this;
|
|
366
366
|
var opc = new OperationContext({
|
|
367
367
|
target: target || me.target,
|
|
@@ -370,7 +370,8 @@ var OperationContext = /** @class */ (function () {
|
|
|
370
370
|
state: state,
|
|
371
371
|
debugger: me.debugger,
|
|
372
372
|
cps: me.cps,
|
|
373
|
-
processState: me.processState
|
|
373
|
+
processState: me.processState,
|
|
374
|
+
injected: injected || me.injected
|
|
374
375
|
});
|
|
375
376
|
if (type !== ContextType.FUNCTION) {
|
|
376
377
|
if (type !== ContextType.LOOP) {
|
package/dist/interpreter.js
CHANGED
|
@@ -115,8 +115,9 @@ var Interpreter = /** @class */ (function (_super) {
|
|
|
115
115
|
case 2:
|
|
116
116
|
body = _a.sent();
|
|
117
117
|
injectionCtx = (context || me.globalContext).fork({
|
|
118
|
-
type: context_1.ContextType.
|
|
119
|
-
state: context_1.ContextState.TEMPORARY
|
|
118
|
+
type: context_1.ContextType.CALL,
|
|
119
|
+
state: context_1.ContextState.TEMPORARY,
|
|
120
|
+
injected: true
|
|
120
121
|
});
|
|
121
122
|
return [4 /*yield*/, body.run(context)];
|
|
122
123
|
case 3:
|