greybel-interpreter 2.2.19 → 2.2.20
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 +8 -4
- package/package.json +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ export declare class OperationContext {
|
|
|
92
92
|
injected: boolean;
|
|
93
93
|
readonly api: OperationContext;
|
|
94
94
|
readonly locals: OperationContext;
|
|
95
|
+
readonly outer: OperationContext;
|
|
95
96
|
readonly globals: OperationContext;
|
|
96
97
|
private static readonly lookupApiType;
|
|
97
98
|
private static readonly lookupGlobalsType;
|
package/dist/context.js
CHANGED
|
@@ -40,7 +40,7 @@ class Scope extends map_1.CustomMap {
|
|
|
40
40
|
this.context = context;
|
|
41
41
|
}
|
|
42
42
|
get(path) {
|
|
43
|
-
var _a, _b;
|
|
43
|
+
var _a, _b, _c;
|
|
44
44
|
if (path instanceof base_1.CustomValue) {
|
|
45
45
|
return this.get(new path_1.Path([path]));
|
|
46
46
|
}
|
|
@@ -52,10 +52,13 @@ class Scope extends map_1.CustomMap {
|
|
|
52
52
|
if (this.has(path)) {
|
|
53
53
|
return super.get(path);
|
|
54
54
|
}
|
|
55
|
-
else if ((_a = this.context.
|
|
55
|
+
else if ((_a = this.context.outer) === null || _a === void 0 ? void 0 : _a.scope.has(path)) {
|
|
56
|
+
return this.context.outer.scope.get(path);
|
|
57
|
+
}
|
|
58
|
+
else if ((_b = this.context.globals) === null || _b === void 0 ? void 0 : _b.scope.has(path)) {
|
|
56
59
|
return this.context.globals.scope.get(path);
|
|
57
60
|
}
|
|
58
|
-
else if ((
|
|
61
|
+
else if ((_c = this.context.api) === null || _c === void 0 ? void 0 : _c.scope.has(path)) {
|
|
59
62
|
return this.context.api.scope.get(path);
|
|
60
63
|
}
|
|
61
64
|
else if (path.count() === 1 && map_1.CustomMap.getIntrinsics().has(current)) {
|
|
@@ -149,7 +152,7 @@ class FunctionState {
|
|
|
149
152
|
exports.FunctionState = FunctionState;
|
|
150
153
|
class OperationContext {
|
|
151
154
|
constructor(options = {}) {
|
|
152
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
155
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
153
156
|
this.target = (_a = options.target) !== null && _a !== void 0 ? _a : 'unknown';
|
|
154
157
|
this.stackTrace = (_b = options.stackTrace) !== null && _b !== void 0 ? _b : [];
|
|
155
158
|
this.previous = (_c = options.previous) !== null && _c !== void 0 ? _c : null;
|
|
@@ -168,6 +171,7 @@ class OperationContext {
|
|
|
168
171
|
this.api = this.lookupApi();
|
|
169
172
|
this.globals = this.lookupGlobals();
|
|
170
173
|
this.locals = (_o = this.lookupLocals()) !== null && _o !== void 0 ? _o : this;
|
|
174
|
+
this.outer = (_q = (_p = this.locals.previous) === null || _p === void 0 ? void 0 : _p.lookupLocals()) !== null && _q !== void 0 ? _q : null;
|
|
171
175
|
}
|
|
172
176
|
isIgnoredInDebugging(op) {
|
|
173
177
|
return op instanceof operation_1.OperationBlock || op instanceof noop_1.Noop;
|