greybel-interpreter 1.9.2 → 1.9.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.
|
@@ -30,7 +30,7 @@ class Assign extends operation_1.Operation {
|
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
const resolveResult = yield this.left.getResult(ctx);
|
|
32
32
|
const rightValue = yield this.right.handle(ctx);
|
|
33
|
-
if (resolveResult.handle !==
|
|
33
|
+
if (resolveResult.handle !== null) {
|
|
34
34
|
const resultValueCtx = resolveResult.handle;
|
|
35
35
|
resultValueCtx.set(resolveResult.path, rightValue);
|
|
36
36
|
}
|
package/dist/operations/call.js
CHANGED
|
@@ -44,7 +44,7 @@ class Call extends operation_1.Operation {
|
|
|
44
44
|
resolveResult.handle instanceof map_1.CustomMap) {
|
|
45
45
|
return func.run(ctx.functionState.context, fnArgs, ctx, resolveResult.handle.isa);
|
|
46
46
|
}
|
|
47
|
-
return func.run(resolveResult.handle, fnArgs, ctx);
|
|
47
|
+
return func.run(resolveResult.handle || default_1.DefaultType.Void, fnArgs, ctx);
|
|
48
48
|
}
|
|
49
49
|
return default_1.DefaultType.Void;
|
|
50
50
|
});
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.FunctionReference = void 0;
|
|
13
|
-
const default_1 = require("../types/default");
|
|
14
13
|
const operation_1 = require("./operation");
|
|
15
14
|
const resolve_1 = require("./resolve");
|
|
16
15
|
class FunctionReference extends operation_1.Operation {
|
|
@@ -28,7 +27,7 @@ class FunctionReference extends operation_1.Operation {
|
|
|
28
27
|
handle(ctx) {
|
|
29
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
29
|
const refResult = yield this.ref.getResult(ctx);
|
|
31
|
-
if (refResult.handle !==
|
|
30
|
+
if (refResult.handle !== null) {
|
|
32
31
|
if (refResult.path.count() === 0) {
|
|
33
32
|
return refResult.handle;
|
|
34
33
|
}
|
|
@@ -37,7 +37,7 @@ export declare class SegmentContainer {
|
|
|
37
37
|
}
|
|
38
38
|
export declare class ResolveResult {
|
|
39
39
|
readonly path: Path<CustomValue>;
|
|
40
|
-
readonly handle: CustomValue;
|
|
40
|
+
readonly handle: CustomValue | null;
|
|
41
41
|
constructor(path: Path<CustomValue>, handle: CustomValue);
|
|
42
42
|
}
|
|
43
43
|
export declare class Resolve extends Operation {
|
|
@@ -148,7 +148,7 @@ class Resolve extends operation_1.Operation {
|
|
|
148
148
|
getResult(ctx) {
|
|
149
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
150
|
let traversedPath = new path_1.Path();
|
|
151
|
-
let handle =
|
|
151
|
+
let handle = null;
|
|
152
152
|
const maxIndex = this.path.count();
|
|
153
153
|
const lastIndex = maxIndex - 1;
|
|
154
154
|
for (let index = 0; index < maxIndex; index++) {
|
|
@@ -163,7 +163,7 @@ class Resolve extends operation_1.Operation {
|
|
|
163
163
|
break;
|
|
164
164
|
}
|
|
165
165
|
const previous = handle;
|
|
166
|
-
if (handle !==
|
|
166
|
+
if (handle !== null) {
|
|
167
167
|
if (handle instanceof with_intrinsics_1.CustomValueWithIntrinsics) {
|
|
168
168
|
const customValueCtx = handle;
|
|
169
169
|
handle = customValueCtx.get(traversedPath);
|
|
@@ -208,24 +208,26 @@ class Resolve extends operation_1.Operation {
|
|
|
208
208
|
if (result === null) {
|
|
209
209
|
result = yield this.getResult(ctx);
|
|
210
210
|
}
|
|
211
|
-
if (result.handle !==
|
|
211
|
+
if (result.handle !== null) {
|
|
212
212
|
if (result.path.count() === 0) {
|
|
213
213
|
if (autoCall && result.handle instanceof function_1.CustomFunction) {
|
|
214
214
|
return result.handle.run(default_1.DefaultType.Void, [], ctx);
|
|
215
215
|
}
|
|
216
216
|
return result.handle;
|
|
217
217
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
if (
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
218
|
+
if (result.handle instanceof with_intrinsics_1.CustomValueWithIntrinsics) {
|
|
219
|
+
const customValueCtx = result.handle;
|
|
220
|
+
const child = customValueCtx.get(result.path);
|
|
221
|
+
if (autoCall && child instanceof function_1.CustomFunction) {
|
|
222
|
+
if (this.path.isSuper() &&
|
|
223
|
+
ctx.functionState.context &&
|
|
224
|
+
customValueCtx instanceof map_1.CustomMap) {
|
|
225
|
+
return child.run(ctx.functionState.context, [], ctx, customValueCtx.isa);
|
|
226
|
+
}
|
|
227
|
+
return child.run(customValueCtx, [], ctx);
|
|
225
228
|
}
|
|
226
|
-
return child
|
|
229
|
+
return child;
|
|
227
230
|
}
|
|
228
|
-
return child;
|
|
229
231
|
}
|
|
230
232
|
const handle = ctx.get(result.path);
|
|
231
233
|
if (autoCall && handle instanceof function_1.CustomFunction) {
|