greybel-interpreter 0.2.2 → 0.2.6
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/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/context.d.ts +21 -15
- package/dist/context.js +142 -149
- package/dist/custom-types/map.d.ts +2 -2
- package/dist/custom-types/map.js +85 -136
- package/dist/expressions/assign.js +1 -1
- package/dist/expressions/binary-negated-expression.js +1 -1
- package/dist/expressions/call.js +2 -2
- package/dist/expressions/import.js +1 -1
- package/dist/expressions/include.js +1 -1
- package/dist/expressions/list.js +1 -1
- package/dist/expressions/logical-and-binary.js +1 -1
- package/dist/expressions/map.js +1 -1
- package/dist/expressions/path.js +1 -1
- package/dist/interpreter.js +1 -1
- package/dist/operations/argument.js +36 -22
- package/dist/operations/body.js +2 -1
- package/dist/operations/function.js +7 -4
- package/dist/operations/top.js +0 -1
- package/package.json +1 -1
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/dist/context.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import CustomMap from './custom-types/map';
|
|
1
2
|
import { Operation } from './types/operation';
|
|
2
3
|
import { Expression } from './types/expression';
|
|
3
4
|
import { Callable } from './types/custom-type';
|
|
@@ -16,12 +17,9 @@ export declare enum ContextState {
|
|
|
16
17
|
TEMPORARY = "TEMPORARY",
|
|
17
18
|
DEFAULT = "DEFAULT"
|
|
18
19
|
}
|
|
19
|
-
export declare class Scope {
|
|
20
|
+
export declare class Scope extends CustomMap {
|
|
20
21
|
context: OperationContext;
|
|
21
|
-
refs: Map<string, any>;
|
|
22
22
|
constructor(context: OperationContext);
|
|
23
|
-
valueOf(): Map<string, any>;
|
|
24
|
-
extend(map?: Map<string, any>): Scope;
|
|
25
23
|
set(path: string[], value: any): Promise<void>;
|
|
26
24
|
get(path: string[]): Promise<any>;
|
|
27
25
|
getCallable(path: string[]): Promise<Callable>;
|
|
@@ -34,7 +32,7 @@ export declare class Debugger {
|
|
|
34
32
|
raise(message: string, ...args: any[]): void;
|
|
35
33
|
debug(message: string, ...args: any[]): void;
|
|
36
34
|
setBreakpoint(state: boolean): Debugger;
|
|
37
|
-
getBreakpoint(): boolean;
|
|
35
|
+
getBreakpoint(operationContext: OperationContext): boolean;
|
|
38
36
|
next(): Debugger;
|
|
39
37
|
resume(): Promise<void>;
|
|
40
38
|
interact(operationContext: OperationContext, item: Operation | Expression): void;
|
|
@@ -46,36 +44,44 @@ export interface OperationContextProcessState {
|
|
|
46
44
|
export interface OperationContextOptions {
|
|
47
45
|
target?: string;
|
|
48
46
|
isProtected?: boolean;
|
|
49
|
-
type?:
|
|
50
|
-
state?:
|
|
47
|
+
type?: ContextType;
|
|
48
|
+
state?: ContextState;
|
|
51
49
|
previous?: OperationContext;
|
|
52
50
|
debugger?: Debugger;
|
|
53
51
|
cps?: CPS;
|
|
54
52
|
processState?: OperationContextProcessState;
|
|
55
53
|
}
|
|
56
54
|
export interface OperationContextForkOptions {
|
|
57
|
-
type:
|
|
58
|
-
state:
|
|
55
|
+
type: ContextType;
|
|
56
|
+
state: ContextState;
|
|
59
57
|
target?: string;
|
|
60
58
|
}
|
|
61
59
|
export declare class OperationContext {
|
|
62
60
|
target: string;
|
|
61
|
+
line: number;
|
|
63
62
|
debugger: Debugger;
|
|
64
63
|
previous: OperationContext | null;
|
|
65
|
-
type:
|
|
66
|
-
state:
|
|
64
|
+
type: ContextType;
|
|
65
|
+
state: ContextState;
|
|
67
66
|
scope: Scope;
|
|
68
67
|
isProtected: boolean;
|
|
69
68
|
memory: Map<string, any>;
|
|
70
69
|
cps: CPS | null;
|
|
71
70
|
processState: OperationContextProcessState;
|
|
71
|
+
api: Scope | null;
|
|
72
|
+
locals: Scope | null;
|
|
73
|
+
globals: Scope | null;
|
|
72
74
|
constructor(options: OperationContextOptions);
|
|
73
|
-
|
|
75
|
+
lookupType(validate: (type: ContextType) => boolean): Scope;
|
|
76
|
+
lookupAPI(): Scope;
|
|
77
|
+
lookupGlobals(): Scope;
|
|
78
|
+
lookupLocals(): Scope;
|
|
79
|
+
valueOf(): CustomMap;
|
|
74
80
|
extend(map: Map<string, any>): OperationContext;
|
|
75
|
-
set(path: any[], value: any): Promise<
|
|
76
|
-
get(path: any[]): any
|
|
81
|
+
set(path: any[], value: any): Promise<void>;
|
|
82
|
+
get(path: any[]): Promise<any>;
|
|
83
|
+
getCallable(path: string[]): Promise<Callable>;
|
|
77
84
|
setMemory(key: string, value: any): OperationContext;
|
|
78
85
|
getMemory(key: string): any;
|
|
79
|
-
getCallable(path: string[]): Promise<Callable>;
|
|
80
86
|
fork({ type, state, target }: OperationContextForkOptions): OperationContext;
|
|
81
87
|
}
|
package/dist/context.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
2
17
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
18
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
19
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -65,11 +80,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
65
80
|
};
|
|
66
81
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67
82
|
exports.OperationContext = exports.Debugger = exports.Scope = exports.ContextState = exports.ContextType = void 0;
|
|
68
|
-
var
|
|
69
|
-
var number_1 = __importDefault(require("./custom-types/number"));
|
|
70
|
-
var string_1 = __importDefault(require("./custom-types/string"));
|
|
71
|
-
var nil_1 = __importDefault(require("./custom-types/nil"));
|
|
72
|
-
var custom_type_1 = require("./types/custom-type");
|
|
83
|
+
var map_1 = __importDefault(require("./custom-types/map"));
|
|
73
84
|
var greybel_core_1 = require("greybel-core");
|
|
74
85
|
var ContextType;
|
|
75
86
|
(function (ContextType) {
|
|
@@ -87,128 +98,98 @@ var ContextState;
|
|
|
87
98
|
ContextState["TEMPORARY"] = "TEMPORARY";
|
|
88
99
|
ContextState["DEFAULT"] = "DEFAULT";
|
|
89
100
|
})(ContextState = exports.ContextState || (exports.ContextState = {}));
|
|
90
|
-
var Scope = /** @class */ (function () {
|
|
101
|
+
var Scope = /** @class */ (function (_super) {
|
|
102
|
+
__extends(Scope, _super);
|
|
91
103
|
function Scope(context) {
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
var _this = _super.call(this) || this;
|
|
105
|
+
_this.context = context;
|
|
106
|
+
return _this;
|
|
95
107
|
}
|
|
96
|
-
Scope.prototype.valueOf = function () {
|
|
97
|
-
return this.refs;
|
|
98
|
-
};
|
|
99
|
-
Scope.prototype.extend = function (map) {
|
|
100
|
-
if (map === void 0) { map = new Map(); }
|
|
101
|
-
var me = this;
|
|
102
|
-
me.refs = new Map(__spreadArray(__spreadArray([], __read(me.refs.entries()), false), __read(map.entries()), false));
|
|
103
|
-
return me;
|
|
104
|
-
};
|
|
105
108
|
Scope.prototype.set = function (path, value) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
else if (me.context.previous && !me.context.previous.isProtected) {
|
|
124
|
-
me.context.previous.set(path, value);
|
|
125
|
-
return [2 /*return*/];
|
|
126
|
-
}
|
|
127
|
-
else if (traversalPath.length > 0) {
|
|
128
|
-
throw new Error("Cannot set path ".concat(path.join('.')));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (origin &&
|
|
132
|
-
!(origin instanceof boolean_1.default) &&
|
|
133
|
-
!(origin instanceof string_1.default) &&
|
|
134
|
-
!(origin instanceof number_1.default) &&
|
|
135
|
-
!(origin instanceof nil_1.default)) {
|
|
136
|
-
origin.set(last, value);
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
throw new Error("Cannot set path ".concat(path.join('.')));
|
|
140
|
-
}
|
|
141
|
-
return [2 /*return*/];
|
|
142
|
-
});
|
|
143
|
-
});
|
|
109
|
+
var me = this;
|
|
110
|
+
var traversalPath = [].concat(path);
|
|
111
|
+
var current = traversalPath.shift();
|
|
112
|
+
if (current != null) {
|
|
113
|
+
if (current === 'locals') {
|
|
114
|
+
return me.context.locals.set(traversalPath, value);
|
|
115
|
+
}
|
|
116
|
+
else if (current === 'globals') {
|
|
117
|
+
return me.context.globals.set(traversalPath, value);
|
|
118
|
+
}
|
|
119
|
+
else if (me.context.locals != null) {
|
|
120
|
+
return map_1.default.prototype.set.call(me.context.locals, path, value);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
throw new Error("Cannot set path ".concat(path.join('.')));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
144
126
|
};
|
|
145
127
|
Scope.prototype.get = function (path) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
}
|
|
128
|
+
var _a, _b, _c;
|
|
129
|
+
var me = this;
|
|
130
|
+
var traversalPath = [].concat(path);
|
|
131
|
+
var current = traversalPath.shift();
|
|
132
|
+
if (current != null) {
|
|
133
|
+
if (current === 'locals') {
|
|
134
|
+
return traversalPath.length === 0
|
|
135
|
+
? Promise.resolve(me.context.locals)
|
|
136
|
+
: me.context.locals.get(traversalPath);
|
|
137
|
+
}
|
|
138
|
+
else if (current === 'globals') {
|
|
139
|
+
return traversalPath.length === 0
|
|
140
|
+
? Promise.resolve(me.context.globals)
|
|
141
|
+
: me.context.globals.get(traversalPath);
|
|
142
|
+
}
|
|
143
|
+
else if ((_a = me.context.locals) === null || _a === void 0 ? void 0 : _a.value.has(current)) {
|
|
144
|
+
return map_1.default.prototype.get.call(me.context.locals, path);
|
|
145
|
+
}
|
|
146
|
+
else if ((_b = me.context.globals) === null || _b === void 0 ? void 0 : _b.value.has(current)) {
|
|
147
|
+
return map_1.default.prototype.get.call(me.context.globals, path);
|
|
148
|
+
}
|
|
149
|
+
else if ((_c = me.context.api) === null || _c === void 0 ? void 0 : _c.value.has(current)) {
|
|
150
|
+
return map_1.default.prototype.get.call(me.context.api, path);
|
|
151
|
+
}
|
|
152
|
+
else if (me.value.has(current)) {
|
|
153
|
+
return _super.prototype.get.call(this, path);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
throw new Error("Cannot get path ".concat(path.join('.')));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
177
160
|
};
|
|
178
161
|
Scope.prototype.getCallable = function (path) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}];
|
|
207
|
-
});
|
|
162
|
+
var _a, _b, _c;
|
|
163
|
+
var me = this;
|
|
164
|
+
var traversalPath = [].concat(path);
|
|
165
|
+
var current = traversalPath.shift();
|
|
166
|
+
if (current != null) {
|
|
167
|
+
if (current === 'locals') {
|
|
168
|
+
return me.context.locals.getCallable(traversalPath);
|
|
169
|
+
}
|
|
170
|
+
else if (current === 'globals') {
|
|
171
|
+
return me.context.globals.getCallable(traversalPath);
|
|
172
|
+
}
|
|
173
|
+
else if ((_a = me.context.locals) === null || _a === void 0 ? void 0 : _a.value.has(current)) {
|
|
174
|
+
return map_1.default.prototype.getCallable.call(me.context.locals, path);
|
|
175
|
+
}
|
|
176
|
+
else if ((_b = me.context.globals) === null || _b === void 0 ? void 0 : _b.value.has(current)) {
|
|
177
|
+
return map_1.default.prototype.getCallable.call(me.context.globals, path);
|
|
178
|
+
}
|
|
179
|
+
else if ((_c = me.context.api) === null || _c === void 0 ? void 0 : _c.value.has(current)) {
|
|
180
|
+
return map_1.default.prototype.getCallable.call(me.context.api, path);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
return _super.prototype.getCallable.call(this, path);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return Promise.resolve({
|
|
187
|
+
origin: me,
|
|
188
|
+
context: null
|
|
208
189
|
});
|
|
209
190
|
};
|
|
210
191
|
return Scope;
|
|
211
|
-
}());
|
|
192
|
+
}(map_1.default));
|
|
212
193
|
exports.Scope = Scope;
|
|
213
194
|
var Debugger = /** @class */ (function () {
|
|
214
195
|
function Debugger() {
|
|
@@ -236,8 +217,8 @@ var Debugger = /** @class */ (function () {
|
|
|
236
217
|
me.breakpoint = state;
|
|
237
218
|
return me;
|
|
238
219
|
};
|
|
239
|
-
Debugger.prototype.getBreakpoint = function () {
|
|
240
|
-
return this.breakpoint;
|
|
220
|
+
Debugger.prototype.getBreakpoint = function (operationContext) {
|
|
221
|
+
return operationContext.type !== ContextType.INJECTION && this.breakpoint;
|
|
241
222
|
};
|
|
242
223
|
Debugger.prototype.next = function () {
|
|
243
224
|
var me = this;
|
|
@@ -311,6 +292,7 @@ var OperationContext = /** @class */ (function () {
|
|
|
311
292
|
function OperationContext(options) {
|
|
312
293
|
var me = this;
|
|
313
294
|
me.target = options.target || 'unknown';
|
|
295
|
+
me.line = -1;
|
|
314
296
|
me.previous = options.previous || null;
|
|
315
297
|
me.type = options.type || ContextType.API;
|
|
316
298
|
me.state = options.state || ContextState.DEFAULT;
|
|
@@ -322,7 +304,33 @@ var OperationContext = /** @class */ (function () {
|
|
|
322
304
|
me.processState = options.processState || {
|
|
323
305
|
exit: false
|
|
324
306
|
};
|
|
307
|
+
me.api = me.lookupAPI();
|
|
308
|
+
me.globals = me.lookupGlobals();
|
|
309
|
+
me.locals = me.lookupLocals();
|
|
325
310
|
}
|
|
311
|
+
OperationContext.prototype.lookupType = function (validate) {
|
|
312
|
+
var me = this;
|
|
313
|
+
if (validate(me.type)) {
|
|
314
|
+
return me.scope;
|
|
315
|
+
}
|
|
316
|
+
var current = me.previous;
|
|
317
|
+
while (current) {
|
|
318
|
+
if (validate(current.type)) {
|
|
319
|
+
return current.scope;
|
|
320
|
+
}
|
|
321
|
+
current = current.previous;
|
|
322
|
+
}
|
|
323
|
+
return null;
|
|
324
|
+
};
|
|
325
|
+
OperationContext.prototype.lookupAPI = function () {
|
|
326
|
+
return this.lookupType(function (type) { return [ContextType.API].includes(type); });
|
|
327
|
+
};
|
|
328
|
+
OperationContext.prototype.lookupGlobals = function () {
|
|
329
|
+
return this.lookupType(function (type) { return [ContextType.GLOBAL].includes(type); });
|
|
330
|
+
};
|
|
331
|
+
OperationContext.prototype.lookupLocals = function () {
|
|
332
|
+
return this.lookupType(function (type) { return [ContextType.GLOBAL, ContextType.FUNCTION].includes(type); });
|
|
333
|
+
};
|
|
326
334
|
OperationContext.prototype.valueOf = function () {
|
|
327
335
|
return this.scope.valueOf();
|
|
328
336
|
};
|
|
@@ -339,25 +347,13 @@ var OperationContext = /** @class */ (function () {
|
|
|
339
347
|
};
|
|
340
348
|
OperationContext.prototype.set = function (path, value) {
|
|
341
349
|
var _a;
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
return
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
return [4 /*yield*/, ((_a = me.previous) === null || _a === void 0 ? void 0 : _a.set(path, value))];
|
|
350
|
-
case 1:
|
|
351
|
-
_b.sent();
|
|
352
|
-
return [3 /*break*/, 4];
|
|
353
|
-
case 2: return [4 /*yield*/, me.scope.set(path, value)];
|
|
354
|
-
case 3:
|
|
355
|
-
_b.sent();
|
|
356
|
-
_b.label = 4;
|
|
357
|
-
case 4: return [2 /*return*/, me];
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
});
|
|
350
|
+
var me = this;
|
|
351
|
+
if (me.state === ContextState.TEMPORARY) {
|
|
352
|
+
return (_a = me.previous) === null || _a === void 0 ? void 0 : _a.set(path, value);
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
return me.scope.set(path, value);
|
|
356
|
+
}
|
|
361
357
|
};
|
|
362
358
|
OperationContext.prototype.get = function (path) {
|
|
363
359
|
var _a;
|
|
@@ -367,6 +363,14 @@ var OperationContext = /** @class */ (function () {
|
|
|
367
363
|
}
|
|
368
364
|
return me.scope.get(path);
|
|
369
365
|
};
|
|
366
|
+
OperationContext.prototype.getCallable = function (path) {
|
|
367
|
+
var _a;
|
|
368
|
+
var me = this;
|
|
369
|
+
if (me.state === ContextState.TEMPORARY) {
|
|
370
|
+
return (_a = me.previous) === null || _a === void 0 ? void 0 : _a.getCallable(path);
|
|
371
|
+
}
|
|
372
|
+
return me.scope.getCallable(path);
|
|
373
|
+
};
|
|
370
374
|
OperationContext.prototype.setMemory = function (key, value) {
|
|
371
375
|
var me = this;
|
|
372
376
|
me.memory.set(key, value);
|
|
@@ -376,14 +380,6 @@ var OperationContext = /** @class */ (function () {
|
|
|
376
380
|
var me = this;
|
|
377
381
|
return me.memory.get(key);
|
|
378
382
|
};
|
|
379
|
-
OperationContext.prototype.getCallable = function (path) {
|
|
380
|
-
var _a;
|
|
381
|
-
var me = this;
|
|
382
|
-
if (me.state === ContextState.TEMPORARY) {
|
|
383
|
-
return (_a = me.previous) === null || _a === void 0 ? void 0 : _a.getCallable(path);
|
|
384
|
-
}
|
|
385
|
-
return me.scope.getCallable(path);
|
|
386
|
-
};
|
|
387
383
|
OperationContext.prototype.fork = function (_a) {
|
|
388
384
|
var type = _a.type, state = _a.state, target = _a.target;
|
|
389
385
|
var me = this;
|
|
@@ -396,9 +392,6 @@ var OperationContext = /** @class */ (function () {
|
|
|
396
392
|
cps: me.cps,
|
|
397
393
|
processState: me.processState
|
|
398
394
|
});
|
|
399
|
-
if (me.type === ContextType.FUNCTION || me.type === ContextType.GLOBAL) {
|
|
400
|
-
opc.scope.refs.set('locals', opc.scope);
|
|
401
|
-
}
|
|
402
395
|
if (type !== ContextType.FUNCTION) {
|
|
403
396
|
if (type !== ContextType.LOOP) {
|
|
404
397
|
opc.setMemory('loopContext', me.getMemory('loopContext'));
|
|
@@ -13,14 +13,14 @@ export default class CustomMap extends CustomObjectType implements Iterable<Cust
|
|
|
13
13
|
static intrinsics: Map<string, Function>;
|
|
14
14
|
value: Map<string, any>;
|
|
15
15
|
isInstance: boolean;
|
|
16
|
-
constructor(value
|
|
16
|
+
constructor(value?: Map<string, any>);
|
|
17
17
|
[Symbol.iterator](): CustomMapIterator;
|
|
18
18
|
extend(value: Map<string, any>): CustomMap;
|
|
19
19
|
set(path: string[], value: any): Promise<void>;
|
|
20
20
|
get(path: string[]): Promise<any>;
|
|
21
21
|
getCallable(path: string[]): Promise<Callable>;
|
|
22
22
|
callMethod(method: string[], ...args: any[]): any;
|
|
23
|
-
|
|
23
|
+
createInstance(): CustomMap;
|
|
24
24
|
getType(): string;
|
|
25
25
|
valueOf(): CustomMap | null;
|
|
26
26
|
toString(): string;
|
package/dist/custom-types/map.js
CHANGED
|
@@ -14,42 +14,6 @@ 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 __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
|
-
});
|
|
25
|
-
};
|
|
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 };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
17
|
var __read = (this && this.__read) || function (o, n) {
|
|
54
18
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
55
19
|
if (!m) return o;
|
|
@@ -111,7 +75,7 @@ var CustomMap = /** @class */ (function (_super) {
|
|
|
111
75
|
function CustomMap(value) {
|
|
112
76
|
var _this = _super.call(this) || this;
|
|
113
77
|
var me = _this;
|
|
114
|
-
me.value = new Map(
|
|
78
|
+
me.value = value || new Map();
|
|
115
79
|
me.isInstance = false;
|
|
116
80
|
return _this;
|
|
117
81
|
}
|
|
@@ -124,107 +88,92 @@ var CustomMap = /** @class */ (function (_super) {
|
|
|
124
88
|
return me;
|
|
125
89
|
};
|
|
126
90
|
CustomMap.prototype.set = function (path, value) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
origin =
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
origin = origin.get(current);
|
|
139
|
-
if (origin instanceof custom_type_1.CustomObjectType) {
|
|
140
|
-
return [2 /*return*/, origin.set(traversalPath.concat(last), value)];
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
throw new Error("Cannot set path ".concat(path.join('.')));
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
if (origin) {
|
|
148
|
-
if (value instanceof operation_1.FunctionOperationBase) {
|
|
149
|
-
origin.set(last, value.fork(me));
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
origin.set(last, value);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
throw new Error("Cannot set path ".concat(path.join('.')));
|
|
91
|
+
var me = this;
|
|
92
|
+
var traversalPath = [].concat(path);
|
|
93
|
+
var refs = me.value;
|
|
94
|
+
var last = traversalPath.pop();
|
|
95
|
+
var current = traversalPath.shift();
|
|
96
|
+
var origin = refs;
|
|
97
|
+
if (current != null) {
|
|
98
|
+
if (origin.has(current)) {
|
|
99
|
+
origin = origin.get(current);
|
|
100
|
+
if (origin instanceof custom_type_1.CustomObjectType) {
|
|
101
|
+
return origin.set(traversalPath.concat(last), value);
|
|
157
102
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
throw new Error("Cannot set path ".concat(path.join('.')));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (origin) {
|
|
109
|
+
if (value instanceof operation_1.FunctionOperationBase) {
|
|
110
|
+
origin.set(last, value.fork(me));
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
origin.set(last, value);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
throw new Error("Cannot set path ".concat(path.join('.')));
|
|
118
|
+
}
|
|
161
119
|
};
|
|
162
120
|
CustomMap.prototype.get = function (path) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
origin =
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
origin = origin.get(currentValue);
|
|
178
|
-
if (traversalPath.length > 0 && origin instanceof custom_type_1.CustomObjectType) {
|
|
179
|
-
return [2 /*return*/, origin.get(traversalPath)];
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
else if (path.length === 1 && CustomMap.intrinsics.has(currentValue)) {
|
|
183
|
-
return [2 /*return*/, CustomMap.intrinsics.get(currentValue).bind(null, me)];
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
throw new Error("Cannot get path ".concat(path.join('.')));
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
return [2 /*return*/, null];
|
|
121
|
+
var me = this;
|
|
122
|
+
if (path.length === 0) {
|
|
123
|
+
return Promise.resolve(me);
|
|
124
|
+
}
|
|
125
|
+
var traversalPath = [].concat(path);
|
|
126
|
+
var refs = me.value;
|
|
127
|
+
var current = traversalPath.shift();
|
|
128
|
+
var currentValue = current.valueOf();
|
|
129
|
+
var origin = refs;
|
|
130
|
+
if (currentValue != null) {
|
|
131
|
+
if (origin.has(currentValue)) {
|
|
132
|
+
origin = origin.get(currentValue);
|
|
133
|
+
if (traversalPath.length > 0 && origin instanceof custom_type_1.CustomObjectType) {
|
|
134
|
+
return origin.get(traversalPath);
|
|
191
135
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
136
|
+
}
|
|
137
|
+
else if (path.length === 1 && CustomMap.intrinsics.has(currentValue)) {
|
|
138
|
+
return Promise.resolve(CustomMap.intrinsics.get(currentValue).bind(null, me));
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
throw new Error("Cannot get path ".concat(path.join('.')));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
return Promise.resolve(origin);
|
|
195
148
|
};
|
|
196
149
|
CustomMap.prototype.getCallable = function (path) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (origin instanceof custom_type_1.CustomObjectType) {
|
|
210
|
-
return [2 /*return*/, origin.getCallable(traversalPath)];
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
else if (path.length === 1 && CustomMap.intrinsics.has(current)) {
|
|
214
|
-
return [2 /*return*/, {
|
|
215
|
-
origin: CustomMap.intrinsics.get(current).bind(null, me),
|
|
216
|
-
context: me
|
|
217
|
-
}];
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
throw new Error("Cannot get path ".concat(path.join('.')));
|
|
221
|
-
}
|
|
150
|
+
var me = this;
|
|
151
|
+
var traversalPath = [].concat(path);
|
|
152
|
+
var refs = me.value;
|
|
153
|
+
var current = traversalPath.shift();
|
|
154
|
+
var origin = refs;
|
|
155
|
+
var context;
|
|
156
|
+
if (current != null) {
|
|
157
|
+
if (origin.has(current)) {
|
|
158
|
+
context = origin;
|
|
159
|
+
origin = origin.get(current);
|
|
160
|
+
if (origin instanceof custom_type_1.CustomObjectType) {
|
|
161
|
+
return origin.getCallable(traversalPath);
|
|
222
162
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
163
|
+
}
|
|
164
|
+
else if (path.length === 1 && CustomMap.intrinsics.has(current)) {
|
|
165
|
+
return Promise.resolve({
|
|
166
|
+
origin: CustomMap.intrinsics.get(current).bind(null, me),
|
|
167
|
+
context: me
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
throw new Error("Cannot get path ".concat(path.join('.')));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return Promise.resolve({
|
|
175
|
+
origin: origin,
|
|
176
|
+
context: context
|
|
228
177
|
});
|
|
229
178
|
};
|
|
230
179
|
CustomMap.prototype.callMethod = function (method) {
|
|
@@ -249,21 +198,21 @@ var CustomMap = /** @class */ (function (_super) {
|
|
|
249
198
|
}
|
|
250
199
|
return CustomMap.intrinsics.get(key).apply(void 0, __spreadArray([me], __read(args), false));
|
|
251
200
|
};
|
|
252
|
-
CustomMap.prototype.
|
|
201
|
+
CustomMap.prototype.createInstance = function () {
|
|
253
202
|
var me = this;
|
|
254
|
-
var
|
|
255
|
-
var newInstance = new CustomMap(value);
|
|
203
|
+
var newInstance = new CustomMap();
|
|
256
204
|
newInstance.isInstance = true;
|
|
257
205
|
me.value.forEach(function (item, key) {
|
|
258
|
-
value.set(key, item instanceof operation_1.FunctionOperationBase
|
|
206
|
+
newInstance.value.set(key, item instanceof operation_1.FunctionOperationBase
|
|
259
207
|
? item.fork(newInstance)
|
|
260
208
|
: item);
|
|
261
209
|
});
|
|
262
210
|
return newInstance;
|
|
263
211
|
};
|
|
264
212
|
CustomMap.prototype.getType = function () {
|
|
213
|
+
var _a;
|
|
265
214
|
var me = this;
|
|
266
|
-
return me.value.get('classID') || 'map';
|
|
215
|
+
return ((_a = me.value.get('classID')) === null || _a === void 0 ? void 0 : _a.toString()) || 'map';
|
|
267
216
|
};
|
|
268
217
|
CustomMap.prototype.valueOf = function () {
|
|
269
218
|
var me = this;
|
|
@@ -162,7 +162,7 @@ var AssignExpression = /** @class */ (function (_super) {
|
|
|
162
162
|
});
|
|
163
163
|
});
|
|
164
164
|
};
|
|
165
|
-
operationContext.debugger.debug('AssignExpression', 'get', 'expr', me.expr);
|
|
165
|
+
operationContext.debugger.debug('Line', me.ast.line, 'AssignExpression', 'get', 'expr', me.expr);
|
|
166
166
|
return [4 /*yield*/, evaluate(me.expr)];
|
|
167
167
|
case 1: return [2 /*return*/, _a.sent()];
|
|
168
168
|
}
|
|
@@ -123,7 +123,7 @@ var BinaryNegatedExpression = /** @class */ (function (_super) {
|
|
|
123
123
|
});
|
|
124
124
|
});
|
|
125
125
|
};
|
|
126
|
-
operationContext.debugger.debug('BinaryNegatedExpression', 'get', 'expr', me.expr);
|
|
126
|
+
operationContext.debugger.debug('Line', me.ast.line, 'BinaryNegatedExpression', 'get', 'expr', me.expr);
|
|
127
127
|
return evaluate(me.expr);
|
|
128
128
|
};
|
|
129
129
|
return BinaryNegatedExpression;
|
package/dist/expressions/call.js
CHANGED
|
@@ -169,7 +169,7 @@ var CallExpression = /** @class */ (function (_super) {
|
|
|
169
169
|
return [4 /*yield*/, node.path.get(opc, me.expr)];
|
|
170
170
|
case 2:
|
|
171
171
|
pathExpr = _f.sent();
|
|
172
|
-
operationContext.debugger.debug('CallExpression', 'pathExpr', pathExpr);
|
|
172
|
+
operationContext.debugger.debug('Line', me.ast.line, 'CallExpression', 'pathExpr', pathExpr);
|
|
173
173
|
if (!pathExpr.handle) return [3 /*break*/, 8];
|
|
174
174
|
if (!(0, typer_1.isCustomMap)(pathExpr.handle)) return [3 /*break*/, 7];
|
|
175
175
|
return [4 /*yield*/, pathExpr.handle.getCallable(pathExpr.path)];
|
|
@@ -203,7 +203,7 @@ var CallExpression = /** @class */ (function (_super) {
|
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
205
|
};
|
|
206
|
-
operationContext.debugger.debug('CallExpression', 'get', 'expr', me.expr);
|
|
206
|
+
operationContext.debugger.debug('Line', me.ast.line, 'CallExpression', 'get', 'expr', me.expr);
|
|
207
207
|
return evaluate(me.expr);
|
|
208
208
|
};
|
|
209
209
|
return CallExpression;
|
|
@@ -143,7 +143,7 @@ var ImportExpression = /** @class */ (function (_super) {
|
|
|
143
143
|
});
|
|
144
144
|
});
|
|
145
145
|
};
|
|
146
|
-
operationContext.debugger.debug('ImportExpression', 'get', 'expr', me.expr);
|
|
146
|
+
operationContext.debugger.debug('Line', me.ast.line, 'ImportExpression', 'get', 'expr', me.expr);
|
|
147
147
|
return [4 /*yield*/, evaluate(me.expr)];
|
|
148
148
|
case 1: return [2 /*return*/, _a.sent()];
|
|
149
149
|
}
|
|
@@ -120,7 +120,7 @@ var IncludeExpression = /** @class */ (function (_super) {
|
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
};
|
|
123
|
-
operationContext.debugger.debug('IncludeExpression', 'get', 'expr', me.expr);
|
|
123
|
+
operationContext.debugger.debug('Line', me.ast.line, 'IncludeExpression', 'get', 'expr', me.expr);
|
|
124
124
|
return [4 /*yield*/, evaluate(me.expr)];
|
|
125
125
|
case 1: return [2 /*return*/, _a.sent()];
|
|
126
126
|
}
|
package/dist/expressions/list.js
CHANGED
|
@@ -126,7 +126,7 @@ var ListExpression = /** @class */ (function (_super) {
|
|
|
126
126
|
});
|
|
127
127
|
});
|
|
128
128
|
};
|
|
129
|
-
operationContext.debugger.debug('ListExpression', 'get', 'expr', me.expr);
|
|
129
|
+
operationContext.debugger.debug('Line', me.ast.line, 'ListExpression', 'get', 'expr', me.expr);
|
|
130
130
|
return evaluate(me.expr.values);
|
|
131
131
|
};
|
|
132
132
|
return ListExpression;
|
|
@@ -204,7 +204,7 @@ var LogicalAndBinaryExpression = /** @class */ (function (_super) {
|
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
206
|
}); };
|
|
207
|
-
operationContext.debugger.debug('LogicalAndBinaryExpression', 'get', 'expr', me.expr);
|
|
207
|
+
operationContext.debugger.debug('Line', me.ast.line, 'LogicalAndBinaryExpression', 'get', 'expr', me.expr);
|
|
208
208
|
return evaluate(me.expr);
|
|
209
209
|
};
|
|
210
210
|
return LogicalAndBinaryExpression;
|
package/dist/expressions/map.js
CHANGED
|
@@ -188,7 +188,7 @@ var MapExpression = /** @class */ (function (_super) {
|
|
|
188
188
|
});
|
|
189
189
|
});
|
|
190
190
|
};
|
|
191
|
-
operationContext.debugger.debug('MapExpression', 'get', 'expr', me.expr);
|
|
191
|
+
operationContext.debugger.debug('Line', me.ast.line, 'MapExpression', 'get', 'expr', me.expr);
|
|
192
192
|
return evaluate(me.expr.values);
|
|
193
193
|
};
|
|
194
194
|
return MapExpression;
|
package/dist/expressions/path.js
CHANGED
|
@@ -315,7 +315,7 @@ var PathExpression = /** @class */ (function (_super) {
|
|
|
315
315
|
});
|
|
316
316
|
});
|
|
317
317
|
};
|
|
318
|
-
operationContext.debugger.debug('PathExpression', 'get', 'expr', me.expr);
|
|
318
|
+
operationContext.debugger.debug('Line', me.ast.line, 'PathExpression', 'get', 'expr', me.expr);
|
|
319
319
|
return [4 /*yield*/, evaluate(me.expr)];
|
|
320
320
|
case 1:
|
|
321
321
|
resultExpr = _c.sent();
|
package/dist/interpreter.js
CHANGED
|
@@ -99,7 +99,7 @@ var Interpreter = /** @class */ (function () {
|
|
|
99
99
|
topOperation = new (_b.apply(top_1.default, _c.concat([(_d.body = _e.sent(),
|
|
100
100
|
_d)])))();
|
|
101
101
|
mainContext.extend(me.api);
|
|
102
|
-
mainContext.scope.
|
|
102
|
+
mainContext.scope.value.set('params', (0, typer_1.cast)(me.params));
|
|
103
103
|
me.context = mainContext;
|
|
104
104
|
return [2 /*return*/, topOperation.run(mainContext)
|
|
105
105
|
.catch(function (err) {
|
|
@@ -61,10 +61,14 @@ var __values = (this && this.__values) || function(o) {
|
|
|
61
61
|
};
|
|
62
62
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
63
63
|
};
|
|
64
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
65
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
66
|
+
};
|
|
64
67
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
68
|
var typer_1 = require("../typer");
|
|
66
69
|
var operation_1 = require("../types/operation");
|
|
67
70
|
var expression_1 = require("../types/expression");
|
|
71
|
+
var assign_1 = __importDefault(require("../expressions/assign"));
|
|
68
72
|
var ArgumentOperation = /** @class */ (function (_super) {
|
|
69
73
|
__extends(ArgumentOperation, _super);
|
|
70
74
|
function ArgumentOperation(ast) {
|
|
@@ -76,50 +80,60 @@ var ArgumentOperation = /** @class */ (function (_super) {
|
|
|
76
80
|
}
|
|
77
81
|
ArgumentOperation.prototype.get = function (operationContext) {
|
|
78
82
|
return __awaiter(this, void 0, void 0, function () {
|
|
79
|
-
var me, stack, args, stack_1, stack_1_1, entity, _a, _b, e_1_1;
|
|
80
|
-
var e_1,
|
|
81
|
-
return __generator(this, function (
|
|
82
|
-
switch (
|
|
83
|
+
var me, stack, args, stack_1, stack_1_1, entity, _a, _b, _c, _d, e_1_1;
|
|
84
|
+
var e_1, _e;
|
|
85
|
+
return __generator(this, function (_f) {
|
|
86
|
+
switch (_f.label) {
|
|
83
87
|
case 0:
|
|
84
88
|
me = this;
|
|
85
89
|
stack = me.stack;
|
|
86
90
|
args = [];
|
|
87
|
-
|
|
91
|
+
_f.label = 1;
|
|
88
92
|
case 1:
|
|
89
|
-
|
|
93
|
+
_f.trys.push([1, 11, 12, 13]);
|
|
90
94
|
stack_1 = __values(stack), stack_1_1 = stack_1.next();
|
|
91
|
-
|
|
95
|
+
_f.label = 2;
|
|
92
96
|
case 2:
|
|
93
|
-
if (!!stack_1_1.done) return [3 /*break*/,
|
|
97
|
+
if (!!stack_1_1.done) return [3 /*break*/, 10];
|
|
94
98
|
entity = stack_1_1.value;
|
|
95
99
|
if (!(0, typer_1.isCustomValue)(entity)) return [3 /*break*/, 3];
|
|
96
100
|
args.push(entity);
|
|
97
|
-
return [3 /*break*/,
|
|
101
|
+
return [3 /*break*/, 9];
|
|
98
102
|
case 3:
|
|
99
|
-
if (!(entity instanceof
|
|
100
|
-
_b = (_a = args).push;
|
|
103
|
+
if (!(entity instanceof assign_1.default)) return [3 /*break*/, 6];
|
|
101
104
|
return [4 /*yield*/, entity.get(operationContext, me)];
|
|
102
105
|
case 4:
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
_f.sent();
|
|
107
|
+
_b = (_a = args).push;
|
|
108
|
+
return [4 /*yield*/, entity.expr.left.get(operationContext)];
|
|
105
109
|
case 5:
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
_b.apply(_a, [_f.sent()]);
|
|
111
|
+
return [3 /*break*/, 9];
|
|
108
112
|
case 6:
|
|
113
|
+
if (!(entity instanceof expression_1.Expression)) return [3 /*break*/, 8];
|
|
114
|
+
_d = (_c = args).push;
|
|
115
|
+
return [4 /*yield*/, entity.get(operationContext, me)];
|
|
116
|
+
case 7:
|
|
117
|
+
_d.apply(_c, [_f.sent()]);
|
|
118
|
+
return [3 /*break*/, 9];
|
|
119
|
+
case 8:
|
|
120
|
+
operationContext.debugger.raise('Unexpected argument', me, entity);
|
|
121
|
+
_f.label = 9;
|
|
122
|
+
case 9:
|
|
109
123
|
stack_1_1 = stack_1.next();
|
|
110
124
|
return [3 /*break*/, 2];
|
|
111
|
-
case
|
|
112
|
-
case
|
|
113
|
-
e_1_1 =
|
|
125
|
+
case 10: return [3 /*break*/, 13];
|
|
126
|
+
case 11:
|
|
127
|
+
e_1_1 = _f.sent();
|
|
114
128
|
e_1 = { error: e_1_1 };
|
|
115
|
-
return [3 /*break*/,
|
|
116
|
-
case
|
|
129
|
+
return [3 /*break*/, 13];
|
|
130
|
+
case 12:
|
|
117
131
|
try {
|
|
118
|
-
if (stack_1_1 && !stack_1_1.done && (
|
|
132
|
+
if (stack_1_1 && !stack_1_1.done && (_e = stack_1.return)) _e.call(stack_1);
|
|
119
133
|
}
|
|
120
134
|
finally { if (e_1) throw e_1.error; }
|
|
121
135
|
return [7 /*endfinally*/];
|
|
122
|
-
case
|
|
136
|
+
case 13: return [2 /*return*/, args];
|
|
123
137
|
}
|
|
124
138
|
});
|
|
125
139
|
});
|
package/dist/operations/body.js
CHANGED
|
@@ -100,7 +100,8 @@ var BodyOperation = /** @class */ (function (_super) {
|
|
|
100
100
|
case 2:
|
|
101
101
|
if (!!_b.done) return [3 /*break*/, 10];
|
|
102
102
|
entity = _b.value;
|
|
103
|
-
|
|
103
|
+
operationContext.line = entity.ast.line;
|
|
104
|
+
if (!dbgr.getBreakpoint(operationContext)) return [3 /*break*/, 4];
|
|
104
105
|
dbgr.interact(operationContext, entity);
|
|
105
106
|
return [4 /*yield*/, dbgr.resume()];
|
|
106
107
|
case 3:
|
|
@@ -110,14 +110,17 @@ var FunctionOperation = /** @class */ (function (_super) {
|
|
|
110
110
|
max = args.length;
|
|
111
111
|
_a.label = 2;
|
|
112
112
|
case 2:
|
|
113
|
-
if (!(index < max)) return [3 /*break*/,
|
|
114
|
-
return [
|
|
113
|
+
if (!(index < max)) return [3 /*break*/, 5];
|
|
114
|
+
if (!incArgs[index]) return [3 /*break*/, 4];
|
|
115
|
+
return [4 /*yield*/, opc.set(args[index].path, incArgs[index])];
|
|
115
116
|
case 3:
|
|
116
117
|
_a.sent();
|
|
118
|
+
_a.label = 4;
|
|
119
|
+
case 4:
|
|
117
120
|
index++;
|
|
118
121
|
return [3 /*break*/, 2];
|
|
119
|
-
case
|
|
120
|
-
case
|
|
122
|
+
case 5: return [4 /*yield*/, me.body.run(opc)];
|
|
123
|
+
case 6:
|
|
121
124
|
_a.sent();
|
|
122
125
|
return [2 /*return*/, functionContext.value];
|
|
123
126
|
}
|
package/dist/operations/top.js
CHANGED