greybel-interpreter 1.1.2 → 1.1.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.
- package/dist/operations/for.js +4 -1
- package/package.json +3 -3
package/dist/operations/for.js
CHANGED
|
@@ -56,6 +56,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
56
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
57
|
var context_1 = require("../context");
|
|
58
58
|
var default_1 = __importDefault(require("../types/default"));
|
|
59
|
+
var number_1 = __importDefault(require("../types/number"));
|
|
59
60
|
var block_1 = __importDefault(require("./block"));
|
|
60
61
|
var operation_1 = __importDefault(require("./operation"));
|
|
61
62
|
var resolve_1 = __importDefault(require("./resolve"));
|
|
@@ -90,7 +91,7 @@ var For = /** @class */ (function (_super) {
|
|
|
90
91
|
};
|
|
91
92
|
For.prototype.handle = function (ctx) {
|
|
92
93
|
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
-
var forCtx, resolveResult, iteratorValue, loopState;
|
|
94
|
+
var forCtx, resolveResult, iteratorValue, loopState, index;
|
|
94
95
|
var _this = this;
|
|
95
96
|
return __generator(this, function (_a) {
|
|
96
97
|
switch (_a.label) {
|
|
@@ -106,6 +107,7 @@ var For = /** @class */ (function (_super) {
|
|
|
106
107
|
case 2:
|
|
107
108
|
iteratorValue = (_a.sent());
|
|
108
109
|
loopState = new context_1.LoopState();
|
|
110
|
+
index = 0;
|
|
109
111
|
forCtx.loopState = loopState;
|
|
110
112
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
111
113
|
var iterator = iteratorValue[Symbol.iterator]();
|
|
@@ -122,6 +124,7 @@ var For = /** @class */ (function (_super) {
|
|
|
122
124
|
}
|
|
123
125
|
current = iteratorResult.value;
|
|
124
126
|
loopState.isContinue = false;
|
|
127
|
+
forCtx.set("__".concat(resolveResult.path, "_idx"), new number_1.default(index++));
|
|
125
128
|
forCtx.set(resolveResult.path, current);
|
|
126
129
|
return [4 /*yield*/, this.block.handle(forCtx)];
|
|
127
130
|
case 1:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "greybel-interpreter",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Interpreter",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"watch": "tsc -w -p .",
|
|
11
11
|
"clean": "rm -rf dist",
|
|
12
12
|
"test": "jest ./tests",
|
|
13
|
-
"lint": "eslint
|
|
14
|
-
"lint:fix": "eslint --fix
|
|
13
|
+
"lint": "eslint ./src/**/*.ts",
|
|
14
|
+
"lint:fix": "eslint --fix ./src/**/*.ts"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|