greybel-interpreter 1.8.1 → 1.8.3
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 -1
- package/dist/context.js +9 -8
- package/dist/operations/for.js +3 -1
- package/dist/operations/while.js +3 -1
- package/package.json +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ export declare class OperationContext {
|
|
|
95
95
|
private static readonly lookupGlobalsType;
|
|
96
96
|
private static readonly lookupLocalsType;
|
|
97
97
|
constructor(options?: ContextOptions);
|
|
98
|
-
|
|
98
|
+
isIgnoredInDebugging(op: Operation): boolean;
|
|
99
99
|
step(op: Operation): Promise<CustomValue>;
|
|
100
100
|
setLastActive(ctx: OperationContext): OperationContext;
|
|
101
101
|
getLastActive(): OperationContext;
|
package/dist/context.js
CHANGED
|
@@ -11,12 +11,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.OperationContext = exports.FunctionState = exports.LoopState = exports.ProcessState = exports.Debugger = exports.Scope = exports.ContextState = exports.ContextType = void 0;
|
|
13
13
|
const handler_container_1 = require("./handler-container");
|
|
14
|
+
const noop_1 = require("./operations/noop");
|
|
14
15
|
const operation_1 = require("./operations/operation");
|
|
15
16
|
const base_1 = require("./types/base");
|
|
16
17
|
const default_1 = require("./types/default");
|
|
17
18
|
const map_1 = require("./types/map");
|
|
18
19
|
const path_1 = require("./utils/path");
|
|
19
|
-
const noop_1 = require("./operations/noop");
|
|
20
20
|
var ContextType;
|
|
21
21
|
(function (ContextType) {
|
|
22
22
|
ContextType[ContextType["Api"] = 0] = "Api";
|
|
@@ -155,18 +155,21 @@ class OperationContext {
|
|
|
155
155
|
this.cps = options.cps || null;
|
|
156
156
|
this.processState = options.processState || new ProcessState();
|
|
157
157
|
this.environmentVariables = options.environmentVariables || new Map();
|
|
158
|
+
this.functionState = new FunctionState();
|
|
159
|
+
this.loopState = new LoopState();
|
|
158
160
|
this.api = this.lookupApi();
|
|
159
161
|
this.globals = this.lookupGlobals();
|
|
160
162
|
this.locals = this.lookupLocals() || this;
|
|
161
163
|
}
|
|
162
|
-
|
|
163
|
-
return
|
|
164
|
+
isIgnoredInDebugging(op) {
|
|
165
|
+
return op instanceof operation_1.OperationBlock || op instanceof noop_1.Noop;
|
|
164
166
|
}
|
|
165
167
|
step(op) {
|
|
166
168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
if (this.
|
|
168
|
-
|
|
169
|
+
if (this.isIgnoredInDebugging(op)) {
|
|
170
|
+
return op.handle(this);
|
|
169
171
|
}
|
|
172
|
+
this.stackTrace.unshift(op);
|
|
170
173
|
if (!this.injected) {
|
|
171
174
|
this.target = op.target || this.target;
|
|
172
175
|
this.setLastActive(this);
|
|
@@ -176,9 +179,7 @@ class OperationContext {
|
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
181
|
const result = yield op.handle(this);
|
|
179
|
-
|
|
180
|
-
this.stackTrace.shift();
|
|
181
|
-
}
|
|
182
|
+
this.stackTrace.shift();
|
|
182
183
|
return result;
|
|
183
184
|
});
|
|
184
185
|
}
|
package/dist/operations/for.js
CHANGED
|
@@ -60,7 +60,9 @@ class For extends operation_1.OperationBlock {
|
|
|
60
60
|
forCtx.set(idxIdentifier, new number_1.CustomNumber(index++));
|
|
61
61
|
forCtx.set(varIdentifier, current);
|
|
62
62
|
yield this.block.handle(forCtx);
|
|
63
|
-
if (loopState.isBreak ||
|
|
63
|
+
if (loopState.isBreak ||
|
|
64
|
+
forCtx.functionState.isReturn ||
|
|
65
|
+
ctx.isExit()) {
|
|
64
66
|
resolve(default_1.DefaultType.Void);
|
|
65
67
|
return;
|
|
66
68
|
}
|
package/dist/operations/while.js
CHANGED
|
@@ -45,7 +45,9 @@ class While extends operation_1.OperationBlock {
|
|
|
45
45
|
}
|
|
46
46
|
loopState.isContinue = false;
|
|
47
47
|
yield this.block.handle(whileCtx);
|
|
48
|
-
if (loopState.isBreak ||
|
|
48
|
+
if (loopState.isBreak ||
|
|
49
|
+
whileCtx.functionState.isReturn ||
|
|
50
|
+
ctx.isExit()) {
|
|
49
51
|
resolve(default_1.DefaultType.Void);
|
|
50
52
|
return;
|
|
51
53
|
}
|