greybel-interpreter 1.8.0 → 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 +6 -2
- 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,9 +159,12 @@ 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* () {
|
|
163
|
-
if (
|
|
167
|
+
if (this.isAllowedInStack(op)) {
|
|
164
168
|
this.stackTrace.unshift(op);
|
|
165
169
|
}
|
|
166
170
|
if (!this.injected) {
|
|
@@ -172,7 +176,7 @@ class OperationContext {
|
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
178
|
const result = yield op.handle(this);
|
|
175
|
-
if (
|
|
179
|
+
if (this.isAllowedInStack(op)) {
|
|
176
180
|
this.stackTrace.shift();
|
|
177
181
|
}
|
|
178
182
|
return result;
|