greybel-interpreter 0.2.5 → 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.
|
@@ -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
|
});
|
|
@@ -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
|
}
|