greybel-interpreter 0.5.8 → 0.5.9
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/custom-types/list.d.ts +1 -2
- package/dist/custom-types/list.js +8 -53
- package/dist/custom-types/map.d.ts +0 -1
- package/dist/custom-types/map.js +7 -25
- package/dist/custom-types/string.d.ts +4 -2
- package/dist/custom-types/string.js +89 -53
- package/dist/expressions/call.js +22 -21
- package/dist/expressions/path.js +6 -2
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ export declare class CustomListIterator implements Iterator<any> {
|
|
|
5
5
|
constructor(value: any);
|
|
6
6
|
next(): IteratorResult<any>;
|
|
7
7
|
}
|
|
8
|
-
export declare function itemAtIndex(list: any[], n: number): number;
|
|
8
|
+
export declare function itemAtIndex(list: any[], n: number): number | null;
|
|
9
9
|
export default class CustomList extends CustomObjectType {
|
|
10
10
|
static intrinsics: Map<string, Function>;
|
|
11
11
|
value: any[];
|
|
@@ -17,7 +17,6 @@ export default class CustomList extends CustomObjectType {
|
|
|
17
17
|
set(path: any[], value: any): Promise<void>;
|
|
18
18
|
get(path: any[]): Promise<any>;
|
|
19
19
|
getCallable(path: any[]): Promise<Callable>;
|
|
20
|
-
callMethod(method: string[], ...args: any[]): any;
|
|
21
20
|
getType(): string;
|
|
22
21
|
valueOf(): CustomList | null;
|
|
23
22
|
toString(): string;
|
|
@@ -50,35 +50,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
if (!m) return o;
|
|
56
|
-
var i = m.call(o), r, ar = [], e;
|
|
57
|
-
try {
|
|
58
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
59
|
-
}
|
|
60
|
-
catch (error) { e = { error: error }; }
|
|
61
|
-
finally {
|
|
62
|
-
try {
|
|
63
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
64
|
-
}
|
|
65
|
-
finally { if (e) throw e.error; }
|
|
66
|
-
}
|
|
67
|
-
return ar;
|
|
68
|
-
};
|
|
69
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
70
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
71
|
-
if (ar || !(i in from)) {
|
|
72
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
73
|
-
ar[i] = from[i];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
53
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
77
55
|
};
|
|
78
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79
57
|
exports.itemAtIndex = exports.CustomListIterator = void 0;
|
|
80
58
|
var operation_1 = require("../types/operation");
|
|
81
59
|
var custom_type_1 = require("../types/custom-type");
|
|
60
|
+
var string_1 = __importDefault(require("./string"));
|
|
82
61
|
var CustomListIterator = /** @class */ (function () {
|
|
83
62
|
function CustomListIterator(value) {
|
|
84
63
|
var me = this;
|
|
@@ -102,6 +81,8 @@ var CustomListIterator = /** @class */ (function () {
|
|
|
102
81
|
}());
|
|
103
82
|
exports.CustomListIterator = CustomListIterator;
|
|
104
83
|
function itemAtIndex(list, n) {
|
|
84
|
+
if (Number.isNaN(n))
|
|
85
|
+
return null;
|
|
105
86
|
n = Math.trunc(n) || 0;
|
|
106
87
|
if (n < 0)
|
|
107
88
|
n += list.length;
|
|
@@ -177,7 +158,8 @@ var CustomList = /** @class */ (function (_super) {
|
|
|
177
158
|
currentIndex = itemAtIndex(refs, Number(current));
|
|
178
159
|
if (refs.hasOwnProperty(currentIndex)) {
|
|
179
160
|
sub = refs[currentIndex];
|
|
180
|
-
if (traversalPath.length > 0 &&
|
|
161
|
+
if (traversalPath.length > 0 &&
|
|
162
|
+
(sub instanceof custom_type_1.CustomObjectType || sub instanceof string_1.default)) {
|
|
181
163
|
return [2 /*return*/, sub.get(traversalPath)];
|
|
182
164
|
}
|
|
183
165
|
if (traversalPath.length === 0) {
|
|
@@ -204,7 +186,7 @@ var CustomList = /** @class */ (function (_super) {
|
|
|
204
186
|
currentIndex = itemAtIndex(refs, Number(current));
|
|
205
187
|
if (refs.hasOwnProperty(currentIndex)) {
|
|
206
188
|
sub = refs[currentIndex];
|
|
207
|
-
if (sub instanceof custom_type_1.CustomObjectType) {
|
|
189
|
+
if (sub instanceof custom_type_1.CustomObjectType || sub instanceof string_1.default) {
|
|
208
190
|
return [2 /*return*/, sub.getCallable(traversalPath)];
|
|
209
191
|
}
|
|
210
192
|
if (traversalPath.length === 0) {
|
|
@@ -228,33 +210,6 @@ var CustomList = /** @class */ (function (_super) {
|
|
|
228
210
|
});
|
|
229
211
|
});
|
|
230
212
|
};
|
|
231
|
-
CustomList.prototype.callMethod = function (method) {
|
|
232
|
-
var _a;
|
|
233
|
-
var _b;
|
|
234
|
-
var args = [];
|
|
235
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
236
|
-
args[_i - 1] = arguments[_i];
|
|
237
|
-
}
|
|
238
|
-
if (method.length === 0) {
|
|
239
|
-
throw new Error('Unexpected method length');
|
|
240
|
-
}
|
|
241
|
-
var me = this;
|
|
242
|
-
var member = (_b = method[0]) === null || _b === void 0 ? void 0 : _b.toString();
|
|
243
|
-
if (CustomList.isNumber(member)) {
|
|
244
|
-
var memberIndex = itemAtIndex(me.value, Number(member));
|
|
245
|
-
if (!me.value.hasOwnProperty(memberIndex)) {
|
|
246
|
-
return null;
|
|
247
|
-
}
|
|
248
|
-
if (method.length > 1) {
|
|
249
|
-
return (_a = me.value[memberIndex]).callMethod.apply(_a, __spreadArray([method.slice(1)], __read(args), false));
|
|
250
|
-
}
|
|
251
|
-
return me.value[memberIndex];
|
|
252
|
-
}
|
|
253
|
-
if (!CustomList.intrinsics.has(member)) {
|
|
254
|
-
throw new Error("Cannot access ".concat(member, " in list"));
|
|
255
|
-
}
|
|
256
|
-
return CustomList.intrinsics.get(member).apply(void 0, __spreadArray([me], __read(args), false));
|
|
257
|
-
};
|
|
258
213
|
CustomList.prototype.getType = function () {
|
|
259
214
|
return 'list';
|
|
260
215
|
};
|
|
@@ -20,7 +20,6 @@ export default class CustomMap extends CustomObjectType implements Iterable<Cust
|
|
|
20
20
|
set(path: string[], value: any): Promise<void>;
|
|
21
21
|
get(path: string[]): Promise<any>;
|
|
22
22
|
getCallable(path: string[]): Promise<Callable>;
|
|
23
|
-
callMethod(method: string[], ...args: any[]): any;
|
|
24
23
|
createInstance(): CustomMap;
|
|
25
24
|
getType(): string;
|
|
26
25
|
valueOf(): CustomMap | null;
|
package/dist/custom-types/map.js
CHANGED
|
@@ -39,10 +39,14 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
39
39
|
}
|
|
40
40
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
41
41
|
};
|
|
42
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
43
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
|
+
};
|
|
42
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
46
|
exports.CustomMapIterator = void 0;
|
|
44
47
|
var custom_type_1 = require("../types/custom-type");
|
|
45
48
|
var operation_1 = require("../types/operation");
|
|
49
|
+
var string_1 = __importDefault(require("./string"));
|
|
46
50
|
var CustomMapIterator = /** @class */ (function () {
|
|
47
51
|
function CustomMapIterator(value) {
|
|
48
52
|
var me = this;
|
|
@@ -146,7 +150,8 @@ var CustomMap = /** @class */ (function (_super) {
|
|
|
146
150
|
if (current != null) {
|
|
147
151
|
if (refs.has(current)) {
|
|
148
152
|
var sub = refs.get(current);
|
|
149
|
-
if (traversalPath.length > 0 &&
|
|
153
|
+
if (traversalPath.length > 0 &&
|
|
154
|
+
(sub instanceof custom_type_1.CustomObjectType || sub instanceof string_1.default)) {
|
|
150
155
|
return sub.get(traversalPath);
|
|
151
156
|
}
|
|
152
157
|
if (traversalPath.length === 0) {
|
|
@@ -170,7 +175,7 @@ var CustomMap = /** @class */ (function (_super) {
|
|
|
170
175
|
if (current != null) {
|
|
171
176
|
if (refs.has(current)) {
|
|
172
177
|
var sub = refs.get(current);
|
|
173
|
-
if (sub instanceof custom_type_1.CustomObjectType) {
|
|
178
|
+
if (sub instanceof custom_type_1.CustomObjectType || sub instanceof string_1.default) {
|
|
174
179
|
return sub.getCallable(traversalPath);
|
|
175
180
|
}
|
|
176
181
|
if (traversalPath.length === 0) {
|
|
@@ -195,29 +200,6 @@ var CustomMap = /** @class */ (function (_super) {
|
|
|
195
200
|
context: me
|
|
196
201
|
});
|
|
197
202
|
};
|
|
198
|
-
CustomMap.prototype.callMethod = function (method) {
|
|
199
|
-
var _a;
|
|
200
|
-
var _b;
|
|
201
|
-
var args = [];
|
|
202
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
203
|
-
args[_i - 1] = arguments[_i];
|
|
204
|
-
}
|
|
205
|
-
if (method.length === 0) {
|
|
206
|
-
throw new Error('Unexpected method length');
|
|
207
|
-
}
|
|
208
|
-
var me = this;
|
|
209
|
-
var key = (_b = method[0]) === null || _b === void 0 ? void 0 : _b.toString();
|
|
210
|
-
if (method.length > 1) {
|
|
211
|
-
if (me.value.has(key)) {
|
|
212
|
-
return (_a = me.value.get(key)).callMethod.apply(_a, __spreadArray([method.slice(1)], __read(args), false));
|
|
213
|
-
}
|
|
214
|
-
throw new Error("Unexpected method path");
|
|
215
|
-
}
|
|
216
|
-
if (!CustomMap.intrinsics.has(key)) {
|
|
217
|
-
throw new Error("Cannot access ".concat(key, " in map"));
|
|
218
|
-
}
|
|
219
|
-
return CustomMap.intrinsics.get(key).apply(void 0, __spreadArray([me], __read(args), false));
|
|
220
|
-
};
|
|
221
203
|
CustomMap.prototype.createInstance = function () {
|
|
222
204
|
var me = this;
|
|
223
205
|
var newInstance = new CustomMap();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Callable } from '../types/custom-type';
|
|
1
2
|
import { CustomLiteralType } from '../types/custom-type';
|
|
2
3
|
export declare class CustomStringIterator implements Iterator<string> {
|
|
3
4
|
value: string;
|
|
@@ -5,6 +6,7 @@ export declare class CustomStringIterator implements Iterator<string> {
|
|
|
5
6
|
constructor(value: string);
|
|
6
7
|
next(): IteratorResult<string>;
|
|
7
8
|
}
|
|
9
|
+
export declare function itemAtIndex(str: any, n: number): number | null;
|
|
8
10
|
export default class CustomString extends CustomLiteralType {
|
|
9
11
|
static intrinsics: Map<string, Function>;
|
|
10
12
|
value: string;
|
|
@@ -12,8 +14,8 @@ export default class CustomString extends CustomLiteralType {
|
|
|
12
14
|
constructor(value: string);
|
|
13
15
|
slice(a: CustomLiteralType, b: CustomLiteralType): CustomString;
|
|
14
16
|
[Symbol.iterator](): CustomStringIterator;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
get(path: any[]): Promise<any>;
|
|
18
|
+
getCallable(path: any[]): Promise<Callable>;
|
|
17
19
|
getType(): string;
|
|
18
20
|
valueOf(): string | null;
|
|
19
21
|
toString(): string;
|
|
@@ -14,33 +14,44 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
finally {
|
|
26
|
-
try {
|
|
27
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
28
|
-
}
|
|
29
|
-
finally { if (e) throw e.error; }
|
|
30
|
-
}
|
|
31
|
-
return ar;
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
32
25
|
};
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
39
51
|
}
|
|
40
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
41
52
|
};
|
|
42
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.CustomStringIterator = void 0;
|
|
54
|
+
exports.itemAtIndex = exports.CustomStringIterator = void 0;
|
|
44
55
|
var custom_type_1 = require("../types/custom-type");
|
|
45
56
|
var CustomStringIterator = /** @class */ (function () {
|
|
46
57
|
function CustomStringIterator(value) {
|
|
@@ -64,6 +75,17 @@ var CustomStringIterator = /** @class */ (function () {
|
|
|
64
75
|
return CustomStringIterator;
|
|
65
76
|
}());
|
|
66
77
|
exports.CustomStringIterator = CustomStringIterator;
|
|
78
|
+
function itemAtIndex(str, n) {
|
|
79
|
+
if (Number.isNaN(n))
|
|
80
|
+
return null;
|
|
81
|
+
n = Math.trunc(n) || 0;
|
|
82
|
+
if (n < 0)
|
|
83
|
+
n += str.length;
|
|
84
|
+
if (n < 0 || n >= str.length)
|
|
85
|
+
return -1;
|
|
86
|
+
return n;
|
|
87
|
+
}
|
|
88
|
+
exports.itemAtIndex = itemAtIndex;
|
|
67
89
|
var CustomString = /** @class */ (function (_super) {
|
|
68
90
|
__extends(CustomString, _super);
|
|
69
91
|
function CustomString(value) {
|
|
@@ -80,37 +102,51 @@ var CustomString = /** @class */ (function (_super) {
|
|
|
80
102
|
CustomString.prototype[Symbol.iterator] = function () {
|
|
81
103
|
return new CustomStringIterator(this.value);
|
|
82
104
|
};
|
|
83
|
-
CustomString.prototype.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
105
|
+
CustomString.prototype.get = function (path) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
var me, traversalPath, str, current, currentIndex;
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
me = this;
|
|
110
|
+
if (path.length === 0) {
|
|
111
|
+
return [2 /*return*/, me];
|
|
112
|
+
}
|
|
113
|
+
traversalPath = [].concat(path);
|
|
114
|
+
str = me.value;
|
|
115
|
+
current = traversalPath.shift();
|
|
116
|
+
if (current != null) {
|
|
117
|
+
currentIndex = itemAtIndex(str, Number(current));
|
|
118
|
+
if (currentIndex != null && str.charAt(currentIndex) != null) {
|
|
119
|
+
return [2 /*return*/, new CustomString(str.charAt(currentIndex))];
|
|
120
|
+
}
|
|
121
|
+
else if (path.length === 1 && CustomString.intrinsics.has(current)) {
|
|
122
|
+
return [2 /*return*/, CustomString.intrinsics.get(current).bind(null, me)];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return [2 /*return*/, null];
|
|
126
|
+
});
|
|
127
|
+
});
|
|
87
128
|
};
|
|
88
|
-
CustomString.prototype.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
if (!CustomString.intrinsics.has(member)) {
|
|
111
|
-
throw new Error("Cannot access ".concat(member, " in string"));
|
|
112
|
-
}
|
|
113
|
-
return CustomString.intrinsics.get(member).apply(void 0, __spreadArray([me], __read(args), false));
|
|
129
|
+
CustomString.prototype.getCallable = function (path) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
+
var me, traversalPath, current;
|
|
132
|
+
return __generator(this, function (_a) {
|
|
133
|
+
me = this;
|
|
134
|
+
traversalPath = [].concat(path);
|
|
135
|
+
current = traversalPath.shift();
|
|
136
|
+
if (current != null) {
|
|
137
|
+
if (path.length === 1 && CustomString.intrinsics.has(current)) {
|
|
138
|
+
return [2 /*return*/, {
|
|
139
|
+
origin: CustomString.intrinsics.get(current).bind(null, me),
|
|
140
|
+
context: me
|
|
141
|
+
}];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return [2 /*return*/, {
|
|
145
|
+
origin: null,
|
|
146
|
+
context: me
|
|
147
|
+
}];
|
|
148
|
+
});
|
|
149
|
+
});
|
|
114
150
|
};
|
|
115
151
|
CustomString.prototype.getType = function () {
|
|
116
152
|
return 'string';
|
package/dist/expressions/call.js
CHANGED
|
@@ -152,25 +152,27 @@ var CallExpression = /** @class */ (function (_super) {
|
|
|
152
152
|
var evaluate = function (node) {
|
|
153
153
|
return __awaiter(this, void 0, void 0, function () {
|
|
154
154
|
var args, pathExpr, callable_1, _a, callable, _b;
|
|
155
|
-
var _c, _d
|
|
156
|
-
return __generator(this, function (
|
|
157
|
-
switch (
|
|
155
|
+
var _c, _d;
|
|
156
|
+
return __generator(this, function (_e) {
|
|
157
|
+
switch (_e.label) {
|
|
158
158
|
case 0:
|
|
159
159
|
if (node instanceof expression_1.Expression) {
|
|
160
160
|
return [2 /*return*/, node.get(opc)];
|
|
161
161
|
}
|
|
162
162
|
return [4 /*yield*/, node.resolveArgs(operationContext)];
|
|
163
163
|
case 1:
|
|
164
|
-
args =
|
|
164
|
+
args = _e.sent();
|
|
165
165
|
return [4 /*yield*/, node.path.get(opc, me.expr)];
|
|
166
166
|
case 2:
|
|
167
|
-
pathExpr =
|
|
167
|
+
pathExpr = _e.sent();
|
|
168
168
|
operationContext.debugger.debug('Line', me.ast.start.line, 'CallExpression', 'pathExpr', pathExpr);
|
|
169
|
-
if (!pathExpr.handle) return [3 /*break*/,
|
|
170
|
-
if (!(0, typer_1.isCustomMap)(pathExpr.handle)
|
|
169
|
+
if (!pathExpr.handle) return [3 /*break*/, 7];
|
|
170
|
+
if (!((0, typer_1.isCustomMap)(pathExpr.handle) ||
|
|
171
|
+
(0, typer_1.isCustomList)(pathExpr.handle) ||
|
|
172
|
+
(0, typer_1.isCustomString)(pathExpr.handle))) return [3 /*break*/, 6];
|
|
171
173
|
return [4 /*yield*/, pathExpr.handle.getCallable(pathExpr.path)];
|
|
172
174
|
case 3:
|
|
173
|
-
callable_1 =
|
|
175
|
+
callable_1 = _e.sent();
|
|
174
176
|
if (!(callable_1.origin instanceof operation_1.Operation)) return [3 /*break*/, 4];
|
|
175
177
|
opc.setMemory('args', args);
|
|
176
178
|
return [2 /*return*/, callable_1.origin.run(opc)];
|
|
@@ -178,23 +180,22 @@ var CallExpression = /** @class */ (function (_super) {
|
|
|
178
180
|
if (!(callable_1.origin instanceof Function)) return [3 /*break*/, 6];
|
|
179
181
|
_a = typer_1.cast;
|
|
180
182
|
return [4 /*yield*/, (_c = callable_1.origin).call.apply(_c, __spreadArray([pathExpr.handle], __read(args), false))];
|
|
181
|
-
case 5: return [2 /*return*/, _a.apply(void 0, [
|
|
183
|
+
case 5: return [2 /*return*/, _a.apply(void 0, [_e.sent()])];
|
|
182
184
|
case 6:
|
|
183
|
-
operationContext.debugger.raise('Unexpected handle call', me,
|
|
184
|
-
|
|
185
|
-
case 7: return [
|
|
186
|
-
case 8:
|
|
187
|
-
|
|
188
|
-
callable = _f.sent();
|
|
185
|
+
operationContext.debugger.raise('Unexpected handle call', me, pathExpr);
|
|
186
|
+
_e.label = 7;
|
|
187
|
+
case 7: return [4 /*yield*/, opc.getCallable(pathExpr.path)];
|
|
188
|
+
case 8:
|
|
189
|
+
callable = _e.sent();
|
|
189
190
|
opc.setMemory('args', args);
|
|
190
|
-
if (!(callable.origin instanceof operation_1.Operation)) return [3 /*break*/,
|
|
191
|
+
if (!(callable.origin instanceof operation_1.Operation)) return [3 /*break*/, 9];
|
|
191
192
|
return [2 /*return*/, callable.origin.run(opc)];
|
|
192
|
-
case
|
|
193
|
-
if (!(callable.origin instanceof Function)) return [3 /*break*/,
|
|
193
|
+
case 9:
|
|
194
|
+
if (!(callable.origin instanceof Function)) return [3 /*break*/, 11];
|
|
194
195
|
_b = typer_1.cast;
|
|
195
|
-
return [4 /*yield*/, (
|
|
196
|
-
case
|
|
197
|
-
case
|
|
196
|
+
return [4 /*yield*/, (_d = callable.origin).call.apply(_d, __spreadArray([callable.context], __read(args), false))];
|
|
197
|
+
case 10: return [2 /*return*/, _b.apply(void 0, [_e.sent()])];
|
|
198
|
+
case 11: return [2 /*return*/, (0, typer_1.cast)(callable.origin)];
|
|
198
199
|
}
|
|
199
200
|
});
|
|
200
201
|
});
|
package/dist/expressions/path.js
CHANGED
|
@@ -338,7 +338,9 @@ var PathExpression = /** @class */ (function (_super) {
|
|
|
338
338
|
if (!(resultExpr.path.length === 0)) return [3 /*break*/, 2];
|
|
339
339
|
return [2 /*return*/, resultExpr.handle];
|
|
340
340
|
case 2:
|
|
341
|
-
if (!(0, typer_1.isCustomMap)(resultExpr.handle)
|
|
341
|
+
if (!((0, typer_1.isCustomMap)(resultExpr.handle) ||
|
|
342
|
+
(0, typer_1.isCustomList)(resultExpr.handle) ||
|
|
343
|
+
(0, typer_1.isCustomString)(resultExpr.handle))) return [3 /*break*/, 7];
|
|
342
344
|
context = resultExpr.handle;
|
|
343
345
|
return [4 /*yield*/, context.get(resultExpr.path)];
|
|
344
346
|
case 3:
|
|
@@ -351,7 +353,9 @@ var PathExpression = /** @class */ (function (_super) {
|
|
|
351
353
|
return [4 /*yield*/, value_1.call(context)];
|
|
352
354
|
case 5: return [2 /*return*/, _a.apply(void 0, [_c.sent()])];
|
|
353
355
|
case 6: return [2 /*return*/, value_1];
|
|
354
|
-
case 7:
|
|
356
|
+
case 7:
|
|
357
|
+
operationContext.debugger.raise('Unexpected handle get', me, resultExpr);
|
|
358
|
+
_c.label = 8;
|
|
355
359
|
case 8: return [4 /*yield*/, operationContext.get(resultExpr.path)];
|
|
356
360
|
case 9:
|
|
357
361
|
value = _c.sent();
|