greybel-interpreter 1.7.9 → 1.8.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 +1 -0
- package/dist/context.js +9 -7
- package/package.json +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -95,6 +95,7 @@ export declare class OperationContext {
|
|
|
95
95
|
private static readonly lookupGlobalsType;
|
|
96
96
|
private static readonly lookupLocalsType;
|
|
97
97
|
constructor(options?: ContextOptions);
|
|
98
|
+
isAllowedInStack(op: Operation): boolean;
|
|
98
99
|
step(op: Operation): Promise<CustomValue>;
|
|
99
100
|
setLastActive(ctx: OperationContext): OperationContext;
|
|
100
101
|
getLastActive(): OperationContext;
|
package/dist/context.js
CHANGED
|
@@ -16,6 +16,7 @@ const base_1 = require("./types/base");
|
|
|
16
16
|
const default_1 = require("./types/default");
|
|
17
17
|
const map_1 = require("./types/map");
|
|
18
18
|
const path_1 = require("./utils/path");
|
|
19
|
+
const noop_1 = require("./operations/noop");
|
|
19
20
|
var ContextType;
|
|
20
21
|
(function (ContextType) {
|
|
21
22
|
ContextType[ContextType["Api"] = 0] = "Api";
|
|
@@ -158,8 +159,14 @@ class OperationContext {
|
|
|
158
159
|
this.globals = this.lookupGlobals();
|
|
159
160
|
this.locals = this.lookupLocals() || this;
|
|
160
161
|
}
|
|
162
|
+
isAllowedInStack(op) {
|
|
163
|
+
return !(op instanceof operation_1.OperationBlock) && !(op instanceof noop_1.Noop);
|
|
164
|
+
}
|
|
161
165
|
step(op) {
|
|
162
166
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
if (this.isAllowedInStack(op)) {
|
|
168
|
+
this.stackTrace.unshift(op);
|
|
169
|
+
}
|
|
163
170
|
if (!this.injected) {
|
|
164
171
|
this.target = op.target || this.target;
|
|
165
172
|
this.setLastActive(this);
|
|
@@ -168,13 +175,8 @@ class OperationContext {
|
|
|
168
175
|
yield this.debugger.resume();
|
|
169
176
|
}
|
|
170
177
|
}
|
|
171
|
-
|
|
172
|
-
if (op
|
|
173
|
-
result = yield op.handle(this);
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
this.stackTrace.unshift(op);
|
|
177
|
-
result = yield op.handle(this);
|
|
178
|
+
const result = yield op.handle(this);
|
|
179
|
+
if (this.isAllowedInStack(op)) {
|
|
178
180
|
this.stackTrace.shift();
|
|
179
181
|
}
|
|
180
182
|
return result;
|