gobstones-code-runner 0.0.8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/htmls/gobstones-code-runner.html +705 -460
- data/lib/gobstones/code-runner/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f7ef66628bf9b72a8a81c6a2bb22cf1fd2a219c5e3a34a1b939ae1d2cd4da3a
|
4
|
+
data.tar.gz: bc604bcb3c94bcbd4aa273afd35e234c5e834159babfaf3a181a3fd26b6c3906
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af4ec3a49236ae4346e8279885c1786ffcbac4c96de3d3dc786a36e72034296c887761ceb34e6d923960aa7624ffbf1f4f3d7e1affc00fcd88de01d3f60964bd
|
7
|
+
data.tar.gz: d38df24298a0d95e10aa94186c4b887520999a3ed9a186710c374e2654a559b9d47efd8c426dbcd4ea60b16665075a93276dcef46d007aa4d46b5077b62d6317
|
@@ -4474,7 +4474,7 @@ var GbsRuntimeError = exports.GbsRuntimeError = function (_GbsInterpreterExcept3
|
|
4474
4474
|
Object.defineProperty(exports, "__esModule", {
|
4475
4475
|
value: true
|
4476
4476
|
});
|
4477
|
-
exports.ASTConstructorDeclaration = exports.ASTFieldBinding = exports.ASTExprFunctionCall = exports.ASTExprStructureUpdate = exports.ASTExprStructure = exports.ASTExprTuple = exports.ASTExprRange = exports.ASTExprList = exports.ASTExprChoose = exports.ASTExprConstantString = exports.ASTExprConstantNumber = exports.ASTExprVariable = exports.ASTPatternTimeout = exports.ASTPatternTuple = exports.ASTPatternStructure = exports.ASTPatternNumber = exports.ASTPatternWildcard = exports.ASTStmtProcedureCall = exports.ASTStmtAssignTuple = exports.ASTStmtAssignVariable = exports.ASTSwitchBranch = exports.ASTStmtSwitch = exports.ASTStmtWhile = exports.ASTStmtForeach = exports.ASTStmtRepeat = exports.ASTStmtIf = exports.ASTStmtReturn = exports.ASTStmtBlock = exports.ASTDefType = exports.ASTDefFunction = exports.ASTDefProcedure = exports.ASTDefInteractiveProgram = exports.ASTDefProgram = exports.ASTMain = exports.ASTNode = exports.N_ConstructorDeclaration = exports.N_FieldBinding = exports.N_SwitchBranch = exports.N_ExprFunctionCall = exports.N_ExprStructureUpdate = exports.N_ExprStructure = exports.N_ExprTuple = exports.N_ExprRange = exports.N_ExprList = exports.N_ExprChoose = exports.N_ExprConstantString = exports.N_ExprConstantNumber = exports.N_ExprVariable = exports.N_PatternTimeout = exports.N_PatternTuple = exports.N_PatternStructure = exports.N_PatternNumber = exports.N_PatternWildcard = exports.N_StmtProcedureCall = exports.N_StmtAssignTuple = exports.N_StmtAssignVariable = exports.N_StmtSwitch = exports.N_StmtWhile = exports.N_StmtForeach = exports.N_StmtRepeat = exports.N_StmtIf = exports.N_StmtReturn = exports.N_StmtBlock = exports.N_DefType = exports.N_DefFunction = exports.N_DefProcedure = exports.N_DefInteractiveProgram = exports.N_DefProgram = exports.N_Main = undefined;
|
4477
|
+
exports.ASTConstructorDeclaration = exports.ASTFieldBinding = exports.ASTExprFunctionCall = exports.ASTExprStructureUpdate = exports.ASTExprStructure = exports.ASTExprTuple = exports.ASTExprRange = exports.ASTExprList = exports.ASTExprChoose = exports.ASTExprConstantString = exports.ASTExprConstantNumber = exports.ASTExprVariable = exports.ASTPatternTimeout = exports.ASTPatternTuple = exports.ASTPatternStructure = exports.ASTPatternNumber = exports.ASTPatternVariable = exports.ASTPatternWildcard = exports.ASTStmtProcedureCall = exports.ASTStmtAssignTuple = exports.ASTStmtAssignVariable = exports.ASTSwitchBranch = exports.ASTStmtSwitch = exports.ASTStmtWhile = exports.ASTStmtForeach = exports.ASTStmtRepeat = exports.ASTStmtIf = exports.ASTStmtReturn = exports.ASTStmtBlock = exports.ASTDefType = exports.ASTDefFunction = exports.ASTDefProcedure = exports.ASTDefInteractiveProgram = exports.ASTDefProgram = exports.ASTMain = exports.ASTNode = exports.N_ConstructorDeclaration = exports.N_FieldBinding = exports.N_SwitchBranch = exports.N_ExprFunctionCall = exports.N_ExprStructureUpdate = exports.N_ExprStructure = exports.N_ExprTuple = exports.N_ExprRange = exports.N_ExprList = exports.N_ExprChoose = exports.N_ExprConstantString = exports.N_ExprConstantNumber = exports.N_ExprVariable = exports.N_PatternTimeout = exports.N_PatternTuple = exports.N_PatternStructure = exports.N_PatternNumber = exports.N_PatternVariable = exports.N_PatternWildcard = exports.N_StmtProcedureCall = exports.N_StmtAssignTuple = exports.N_StmtAssignVariable = exports.N_StmtSwitch = exports.N_StmtWhile = exports.N_StmtForeach = exports.N_StmtRepeat = exports.N_StmtIf = exports.N_StmtReturn = exports.N_StmtBlock = exports.N_DefType = exports.N_DefFunction = exports.N_DefProcedure = exports.N_DefInteractiveProgram = exports.N_DefProgram = exports.N_Main = undefined;
|
4478
4478
|
|
4479
4479
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
4480
4480
|
|
@@ -4508,6 +4508,7 @@ var N_StmtAssignTuple = exports.N_StmtAssignTuple = Symbol.for('N_StmtAssignTupl
|
|
4508
4508
|
var N_StmtProcedureCall = exports.N_StmtProcedureCall = Symbol.for('N_StmtProcedureCall');
|
4509
4509
|
/* Patterns */
|
4510
4510
|
var N_PatternWildcard = exports.N_PatternWildcard = Symbol.for('N_PatternWildcard');
|
4511
|
+
var N_PatternVariable = exports.N_PatternVariable = Symbol.for('N_PatternVariable');
|
4511
4512
|
var N_PatternNumber = exports.N_PatternNumber = Symbol.for('N_PatternNumber');
|
4512
4513
|
var N_PatternStructure = exports.N_PatternStructure = Symbol.for('N_PatternStructure');
|
4513
4514
|
var N_PatternTuple = exports.N_PatternTuple = Symbol.for('N_PatternTuple');
|
@@ -4935,14 +4936,14 @@ var ASTStmtRepeat = exports.ASTStmtRepeat = function (_ASTNode10) {
|
|
4935
4936
|
var ASTStmtForeach = exports.ASTStmtForeach = function (_ASTNode11) {
|
4936
4937
|
_inherits(ASTStmtForeach, _ASTNode11);
|
4937
4938
|
|
4938
|
-
function ASTStmtForeach(
|
4939
|
+
function ASTStmtForeach(pattern, range, body) {
|
4939
4940
|
_classCallCheck(this, ASTStmtForeach);
|
4940
4941
|
|
4941
|
-
return _possibleConstructorReturn(this, (ASTStmtForeach.__proto__ || Object.getPrototypeOf(ASTStmtForeach)).call(this, N_StmtForeach, [
|
4942
|
+
return _possibleConstructorReturn(this, (ASTStmtForeach.__proto__ || Object.getPrototypeOf(ASTStmtForeach)).call(this, N_StmtForeach, [pattern, range, body]));
|
4942
4943
|
}
|
4943
4944
|
|
4944
4945
|
_createClass(ASTStmtForeach, [{
|
4945
|
-
key: '
|
4946
|
+
key: 'pattern',
|
4946
4947
|
get: function get() {
|
4947
4948
|
return this._children[0];
|
4948
4949
|
}
|
@@ -5117,7 +5118,7 @@ var ASTPatternWildcard = exports.ASTPatternWildcard = function (_ASTNode18) {
|
|
5117
5118
|
}
|
5118
5119
|
|
5119
5120
|
_createClass(ASTPatternWildcard, [{
|
5120
|
-
key: '
|
5121
|
+
key: 'boundVariables',
|
5121
5122
|
get: function get() {
|
5122
5123
|
return [];
|
5123
5124
|
}
|
@@ -5126,8 +5127,32 @@ var ASTPatternWildcard = exports.ASTPatternWildcard = function (_ASTNode18) {
|
|
5126
5127
|
return ASTPatternWildcard;
|
5127
5128
|
}(ASTNode);
|
5128
5129
|
|
5129
|
-
var
|
5130
|
-
_inherits(
|
5130
|
+
var ASTPatternVariable = exports.ASTPatternVariable = function (_ASTNode19) {
|
5131
|
+
_inherits(ASTPatternVariable, _ASTNode19);
|
5132
|
+
|
5133
|
+
function ASTPatternVariable(variableName) {
|
5134
|
+
_classCallCheck(this, ASTPatternVariable);
|
5135
|
+
|
5136
|
+
return _possibleConstructorReturn(this, (ASTPatternVariable.__proto__ || Object.getPrototypeOf(ASTPatternVariable)).call(this, N_PatternVariable, [variableName]));
|
5137
|
+
}
|
5138
|
+
|
5139
|
+
_createClass(ASTPatternVariable, [{
|
5140
|
+
key: 'variableName',
|
5141
|
+
get: function get() {
|
5142
|
+
return this._children[0];
|
5143
|
+
}
|
5144
|
+
}, {
|
5145
|
+
key: 'boundVariables',
|
5146
|
+
get: function get() {
|
5147
|
+
return [this._children[0]];
|
5148
|
+
}
|
5149
|
+
}]);
|
5150
|
+
|
5151
|
+
return ASTPatternVariable;
|
5152
|
+
}(ASTNode);
|
5153
|
+
|
5154
|
+
var ASTPatternNumber = exports.ASTPatternNumber = function (_ASTNode20) {
|
5155
|
+
_inherits(ASTPatternNumber, _ASTNode20);
|
5131
5156
|
|
5132
5157
|
function ASTPatternNumber(number) {
|
5133
5158
|
_classCallCheck(this, ASTPatternNumber);
|
@@ -5141,7 +5166,7 @@ var ASTPatternNumber = exports.ASTPatternNumber = function (_ASTNode19) {
|
|
5141
5166
|
return this._children[0];
|
5142
5167
|
}
|
5143
5168
|
}, {
|
5144
|
-
key: '
|
5169
|
+
key: 'boundVariables',
|
5145
5170
|
get: function get() {
|
5146
5171
|
return [];
|
5147
5172
|
}
|
@@ -5150,8 +5175,8 @@ var ASTPatternNumber = exports.ASTPatternNumber = function (_ASTNode19) {
|
|
5150
5175
|
return ASTPatternNumber;
|
5151
5176
|
}(ASTNode);
|
5152
5177
|
|
5153
|
-
var ASTPatternStructure = exports.ASTPatternStructure = function (
|
5154
|
-
_inherits(ASTPatternStructure,
|
5178
|
+
var ASTPatternStructure = exports.ASTPatternStructure = function (_ASTNode21) {
|
5179
|
+
_inherits(ASTPatternStructure, _ASTNode21);
|
5155
5180
|
|
5156
5181
|
function ASTPatternStructure(constructorName, parameters) {
|
5157
5182
|
_classCallCheck(this, ASTPatternStructure);
|
@@ -5165,7 +5190,7 @@ var ASTPatternStructure = exports.ASTPatternStructure = function (_ASTNode20) {
|
|
5165
5190
|
return this._children[0];
|
5166
5191
|
}
|
5167
5192
|
}, {
|
5168
|
-
key: '
|
5193
|
+
key: 'boundVariables',
|
5169
5194
|
get: function get() {
|
5170
5195
|
return this._children[1];
|
5171
5196
|
}
|
@@ -5174,8 +5199,8 @@ var ASTPatternStructure = exports.ASTPatternStructure = function (_ASTNode20) {
|
|
5174
5199
|
return ASTPatternStructure;
|
5175
5200
|
}(ASTNode);
|
5176
5201
|
|
5177
|
-
var ASTPatternTuple = exports.ASTPatternTuple = function (
|
5178
|
-
_inherits(ASTPatternTuple,
|
5202
|
+
var ASTPatternTuple = exports.ASTPatternTuple = function (_ASTNode22) {
|
5203
|
+
_inherits(ASTPatternTuple, _ASTNode22);
|
5179
5204
|
|
5180
5205
|
function ASTPatternTuple(parameters) {
|
5181
5206
|
_classCallCheck(this, ASTPatternTuple);
|
@@ -5184,7 +5209,7 @@ var ASTPatternTuple = exports.ASTPatternTuple = function (_ASTNode21) {
|
|
5184
5209
|
}
|
5185
5210
|
|
5186
5211
|
_createClass(ASTPatternTuple, [{
|
5187
|
-
key: '
|
5212
|
+
key: 'boundVariables',
|
5188
5213
|
get: function get() {
|
5189
5214
|
return this._children;
|
5190
5215
|
}
|
@@ -5193,8 +5218,8 @@ var ASTPatternTuple = exports.ASTPatternTuple = function (_ASTNode21) {
|
|
5193
5218
|
return ASTPatternTuple;
|
5194
5219
|
}(ASTNode);
|
5195
5220
|
|
5196
|
-
var ASTPatternTimeout = exports.ASTPatternTimeout = function (
|
5197
|
-
_inherits(ASTPatternTimeout,
|
5221
|
+
var ASTPatternTimeout = exports.ASTPatternTimeout = function (_ASTNode23) {
|
5222
|
+
_inherits(ASTPatternTimeout, _ASTNode23);
|
5198
5223
|
|
5199
5224
|
function ASTPatternTimeout(timeout) {
|
5200
5225
|
_classCallCheck(this, ASTPatternTimeout);
|
@@ -5203,7 +5228,7 @@ var ASTPatternTimeout = exports.ASTPatternTimeout = function (_ASTNode22) {
|
|
5203
5228
|
}
|
5204
5229
|
|
5205
5230
|
_createClass(ASTPatternTimeout, [{
|
5206
|
-
key: '
|
5231
|
+
key: 'boundVariables',
|
5207
5232
|
get: function get() {
|
5208
5233
|
return [];
|
5209
5234
|
}
|
@@ -5219,8 +5244,8 @@ var ASTPatternTimeout = exports.ASTPatternTimeout = function (_ASTNode22) {
|
|
5219
5244
|
|
5220
5245
|
/* Expressions */
|
5221
5246
|
|
5222
|
-
var ASTExprVariable = exports.ASTExprVariable = function (
|
5223
|
-
_inherits(ASTExprVariable,
|
5247
|
+
var ASTExprVariable = exports.ASTExprVariable = function (_ASTNode24) {
|
5248
|
+
_inherits(ASTExprVariable, _ASTNode24);
|
5224
5249
|
|
5225
5250
|
function ASTExprVariable(variableName) {
|
5226
5251
|
_classCallCheck(this, ASTExprVariable);
|
@@ -5238,8 +5263,8 @@ var ASTExprVariable = exports.ASTExprVariable = function (_ASTNode23) {
|
|
5238
5263
|
return ASTExprVariable;
|
5239
5264
|
}(ASTNode);
|
5240
5265
|
|
5241
|
-
var ASTExprConstantNumber = exports.ASTExprConstantNumber = function (
|
5242
|
-
_inherits(ASTExprConstantNumber,
|
5266
|
+
var ASTExprConstantNumber = exports.ASTExprConstantNumber = function (_ASTNode25) {
|
5267
|
+
_inherits(ASTExprConstantNumber, _ASTNode25);
|
5243
5268
|
|
5244
5269
|
function ASTExprConstantNumber(number) {
|
5245
5270
|
_classCallCheck(this, ASTExprConstantNumber);
|
@@ -5257,8 +5282,8 @@ var ASTExprConstantNumber = exports.ASTExprConstantNumber = function (_ASTNode24
|
|
5257
5282
|
return ASTExprConstantNumber;
|
5258
5283
|
}(ASTNode);
|
5259
5284
|
|
5260
|
-
var ASTExprConstantString = exports.ASTExprConstantString = function (
|
5261
|
-
_inherits(ASTExprConstantString,
|
5285
|
+
var ASTExprConstantString = exports.ASTExprConstantString = function (_ASTNode26) {
|
5286
|
+
_inherits(ASTExprConstantString, _ASTNode26);
|
5262
5287
|
|
5263
5288
|
function ASTExprConstantString(string) {
|
5264
5289
|
_classCallCheck(this, ASTExprConstantString);
|
@@ -5276,8 +5301,8 @@ var ASTExprConstantString = exports.ASTExprConstantString = function (_ASTNode25
|
|
5276
5301
|
return ASTExprConstantString;
|
5277
5302
|
}(ASTNode);
|
5278
5303
|
|
5279
|
-
var ASTExprChoose = exports.ASTExprChoose = function (
|
5280
|
-
_inherits(ASTExprChoose,
|
5304
|
+
var ASTExprChoose = exports.ASTExprChoose = function (_ASTNode27) {
|
5305
|
+
_inherits(ASTExprChoose, _ASTNode27);
|
5281
5306
|
|
5282
5307
|
function ASTExprChoose(condition, trueExpr, falseExpr) {
|
5283
5308
|
_classCallCheck(this, ASTExprChoose);
|
@@ -5305,8 +5330,8 @@ var ASTExprChoose = exports.ASTExprChoose = function (_ASTNode26) {
|
|
5305
5330
|
return ASTExprChoose;
|
5306
5331
|
}(ASTNode);
|
5307
5332
|
|
5308
|
-
var ASTExprList = exports.ASTExprList = function (
|
5309
|
-
_inherits(ASTExprList,
|
5333
|
+
var ASTExprList = exports.ASTExprList = function (_ASTNode28) {
|
5334
|
+
_inherits(ASTExprList, _ASTNode28);
|
5310
5335
|
|
5311
5336
|
function ASTExprList(elements) {
|
5312
5337
|
_classCallCheck(this, ASTExprList);
|
@@ -5324,8 +5349,8 @@ var ASTExprList = exports.ASTExprList = function (_ASTNode27) {
|
|
5324
5349
|
return ASTExprList;
|
5325
5350
|
}(ASTNode);
|
5326
5351
|
|
5327
|
-
var ASTExprRange = exports.ASTExprRange = function (
|
5328
|
-
_inherits(ASTExprRange,
|
5352
|
+
var ASTExprRange = exports.ASTExprRange = function (_ASTNode29) {
|
5353
|
+
_inherits(ASTExprRange, _ASTNode29);
|
5329
5354
|
|
5330
5355
|
// Note: second may be null
|
5331
5356
|
function ASTExprRange(first, second, last) {
|
@@ -5354,8 +5379,8 @@ var ASTExprRange = exports.ASTExprRange = function (_ASTNode28) {
|
|
5354
5379
|
return ASTExprRange;
|
5355
5380
|
}(ASTNode);
|
5356
5381
|
|
5357
|
-
var ASTExprTuple = exports.ASTExprTuple = function (
|
5358
|
-
_inherits(ASTExprTuple,
|
5382
|
+
var ASTExprTuple = exports.ASTExprTuple = function (_ASTNode30) {
|
5383
|
+
_inherits(ASTExprTuple, _ASTNode30);
|
5359
5384
|
|
5360
5385
|
function ASTExprTuple(elements) {
|
5361
5386
|
_classCallCheck(this, ASTExprTuple);
|
@@ -5373,8 +5398,8 @@ var ASTExprTuple = exports.ASTExprTuple = function (_ASTNode29) {
|
|
5373
5398
|
return ASTExprTuple;
|
5374
5399
|
}(ASTNode);
|
5375
5400
|
|
5376
|
-
var ASTExprStructure = exports.ASTExprStructure = function (
|
5377
|
-
_inherits(ASTExprStructure,
|
5401
|
+
var ASTExprStructure = exports.ASTExprStructure = function (_ASTNode31) {
|
5402
|
+
_inherits(ASTExprStructure, _ASTNode31);
|
5378
5403
|
|
5379
5404
|
function ASTExprStructure(constructorName, fieldBindings) {
|
5380
5405
|
_classCallCheck(this, ASTExprStructure);
|
@@ -5428,8 +5453,8 @@ var ASTExprStructure = exports.ASTExprStructure = function (_ASTNode30) {
|
|
5428
5453
|
return ASTExprStructure;
|
5429
5454
|
}(ASTNode);
|
5430
5455
|
|
5431
|
-
var ASTExprStructureUpdate = exports.ASTExprStructureUpdate = function (
|
5432
|
-
_inherits(ASTExprStructureUpdate,
|
5456
|
+
var ASTExprStructureUpdate = exports.ASTExprStructureUpdate = function (_ASTNode32) {
|
5457
|
+
_inherits(ASTExprStructureUpdate, _ASTNode32);
|
5433
5458
|
|
5434
5459
|
function ASTExprStructureUpdate(constructorName, original, fieldBindings) {
|
5435
5460
|
_classCallCheck(this, ASTExprStructureUpdate);
|
@@ -5488,8 +5513,8 @@ var ASTExprStructureUpdate = exports.ASTExprStructureUpdate = function (_ASTNode
|
|
5488
5513
|
return ASTExprStructureUpdate;
|
5489
5514
|
}(ASTNode);
|
5490
5515
|
|
5491
|
-
var ASTExprFunctionCall = exports.ASTExprFunctionCall = function (
|
5492
|
-
_inherits(ASTExprFunctionCall,
|
5516
|
+
var ASTExprFunctionCall = exports.ASTExprFunctionCall = function (_ASTNode33) {
|
5517
|
+
_inherits(ASTExprFunctionCall, _ASTNode33);
|
5493
5518
|
|
5494
5519
|
function ASTExprFunctionCall(functionName, args) {
|
5495
5520
|
_classCallCheck(this, ASTExprFunctionCall);
|
@@ -5512,8 +5537,8 @@ var ASTExprFunctionCall = exports.ASTExprFunctionCall = function (_ASTNode32) {
|
|
5512
5537
|
return ASTExprFunctionCall;
|
5513
5538
|
}(ASTNode);
|
5514
5539
|
|
5515
|
-
var ASTFieldBinding = exports.ASTFieldBinding = function (
|
5516
|
-
_inherits(ASTFieldBinding,
|
5540
|
+
var ASTFieldBinding = exports.ASTFieldBinding = function (_ASTNode34) {
|
5541
|
+
_inherits(ASTFieldBinding, _ASTNode34);
|
5517
5542
|
|
5518
5543
|
function ASTFieldBinding(fieldName, value) {
|
5519
5544
|
_classCallCheck(this, ASTFieldBinding);
|
@@ -5536,8 +5561,8 @@ var ASTFieldBinding = exports.ASTFieldBinding = function (_ASTNode33) {
|
|
5536
5561
|
return ASTFieldBinding;
|
5537
5562
|
}(ASTNode);
|
5538
5563
|
|
5539
|
-
var ASTConstructorDeclaration = exports.ASTConstructorDeclaration = function (
|
5540
|
-
_inherits(ASTConstructorDeclaration,
|
5564
|
+
var ASTConstructorDeclaration = exports.ASTConstructorDeclaration = function (_ASTNode35) {
|
5565
|
+
_inherits(ASTConstructorDeclaration, _ASTNode35);
|
5541
5566
|
|
5542
5567
|
function ASTConstructorDeclaration(constructorName, fieldNames) {
|
5543
5568
|
_classCallCheck(this, ASTConstructorDeclaration);
|
@@ -8498,6 +8523,7 @@ var T_LBRACK = exports.T_LBRACK = Symbol.for('T_LBRACK');
|
|
8498
8523
|
var T_RBRACK = exports.T_RBRACK = Symbol.for('T_RBRACK');
|
8499
8524
|
var T_COMMA = exports.T_COMMA = Symbol.for('T_COMMA');
|
8500
8525
|
var T_SEMICOLON = exports.T_SEMICOLON = Symbol.for('T_SEMICOLON');
|
8526
|
+
var T_ELLIPSIS = exports.T_ELLIPSIS = Symbol.for('T_ELLIPSIS');
|
8501
8527
|
var T_RANGE = exports.T_RANGE = Symbol.for('T_RANGE');
|
8502
8528
|
var T_GETS = exports.T_GETS = Symbol.for('T_GETS');
|
8503
8529
|
var T_PIPE = exports.T_PIPE = Symbol.for('T_PIPE');
|
@@ -8829,6 +8855,10 @@ var LOCALE_ES = exports.LOCALE_ES = {
|
|
8829
8855
|
return 'Se encontró un "' + delimiter + '" ' + 'pero no había ' + openingDelimiterName(delimiter) + '.';
|
8830
8856
|
},
|
8831
8857
|
|
8858
|
+
'errmsg:unknown-language-option': function errmsgUnknownLanguageOption(option) {
|
8859
|
+
return 'Opción desconocida. "' + option + '".';
|
8860
|
+
},
|
8861
|
+
|
8832
8862
|
/* Parser */
|
8833
8863
|
'errmsg:empty-source': 'El programa está vacío.',
|
8834
8864
|
|
@@ -8947,6 +8977,10 @@ var LOCALE_ES = exports.LOCALE_ES = {
|
|
8947
8977
|
|
8948
8978
|
'errmsg:wildcard-pattern-should-be-last': 'El comodín "_" tiene que ser la última rama del switch.',
|
8949
8979
|
|
8980
|
+
'errmsg:variable-pattern-should-be-last': function errmsgVariablePatternShouldBeLast(name) {
|
8981
|
+
return 'El patrón variable "' + name + '" tiene que ser la última rama del switch.';
|
8982
|
+
},
|
8983
|
+
|
8950
8984
|
'errmsg:numeric-pattern-repeats-number': function errmsgNumericPatternRepeatsNumber(number) {
|
8951
8985
|
return 'Hay dos ramas distintas para el número "' + number + '".';
|
8952
8986
|
},
|
@@ -8985,7 +9019,13 @@ var LOCALE_ES = exports.LOCALE_ES = {
|
|
8985
9019
|
return 'El constructor "' + constructorName + '" corresponde a un ' + 'evento, y solamente se puede manejar implícitamente ' + 'en un programa interactivo (el usuario no puede construir ' + 'instancias).';
|
8986
9020
|
},
|
8987
9021
|
|
9022
|
+
'errmsg:forbidden-extension-destructuring-foreach': 'El índice de la repetición indexada debe ser un identificador.',
|
9023
|
+
|
9024
|
+
'errmsg:patterns-in-foreach-must-not-be-events': 'El patrón de un foreach no puede ser un evento.',
|
9025
|
+
|
8988
9026
|
/* Runtime errors (virtual machine) */
|
9027
|
+
'errmsg:ellipsis': 'El programa todavía no está completo.',
|
9028
|
+
|
8989
9029
|
'errmsg:undefined-variable': function errmsgUndefinedVariable(variableName) {
|
8990
9030
|
return 'La variable "' + variableName + '" no está definida.';
|
8991
9031
|
},
|
@@ -9064,6 +9104,8 @@ var LOCALE_ES = exports.LOCALE_ES = {
|
|
9064
9104
|
|
9065
9105
|
'errmsg:switch-does-not-match': 'El valor analizado no coincide con ninguna de las ramas del switch.',
|
9066
9106
|
|
9107
|
+
'errmsg:foreach-pattern-does-not-match': 'El elemento no coincide con el patrón esperado por el foreach.',
|
9108
|
+
|
9067
9109
|
'errmsg:cannot-divide-by-zero': 'No se puede dividir por cero.',
|
9068
9110
|
|
9069
9111
|
'errmsg:list-cannot-be-empty': 'La lista no puede ser vacía.',
|
@@ -13228,7 +13270,33 @@ var Runner = exports.Runner = function () {
|
|
13228
13270
|
}, {
|
13229
13271
|
key: 'parse',
|
13230
13272
|
value: function parse(input) {
|
13231
|
-
|
13273
|
+
var parser = new _parser.Parser(input);
|
13274
|
+
this._ast = parser.parse();
|
13275
|
+
|
13276
|
+
var _iteratorNormalCompletion = true;
|
13277
|
+
var _didIteratorError = false;
|
13278
|
+
var _iteratorError = undefined;
|
13279
|
+
|
13280
|
+
try {
|
13281
|
+
for (var _iterator = parser.getLanguageOptions()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
13282
|
+
var option = _step.value;
|
13283
|
+
|
13284
|
+
this._setLanguageOption(option);
|
13285
|
+
}
|
13286
|
+
} catch (err) {
|
13287
|
+
_didIteratorError = true;
|
13288
|
+
_iteratorError = err;
|
13289
|
+
} finally {
|
13290
|
+
try {
|
13291
|
+
if (!_iteratorNormalCompletion && _iterator.return) {
|
13292
|
+
_iterator.return();
|
13293
|
+
}
|
13294
|
+
} finally {
|
13295
|
+
if (_didIteratorError) {
|
13296
|
+
throw _iteratorError;
|
13297
|
+
}
|
13298
|
+
}
|
13299
|
+
}
|
13232
13300
|
}
|
13233
13301
|
}, {
|
13234
13302
|
key: 'enableLintCheck',
|
@@ -13272,10 +13340,22 @@ var Runner = exports.Runner = function () {
|
|
13272
13340
|
this._result = this._vm.runEventWithTimeout(eventValue, millisecs);
|
13273
13341
|
}
|
13274
13342
|
}, {
|
13275
|
-
key: '
|
13343
|
+
key: '_setLanguageOption',
|
13344
|
+
|
13276
13345
|
|
13346
|
+
/* Evaluate language options set by the LANGUAGE pragma */
|
13347
|
+
value: function _setLanguageOption(option) {
|
13348
|
+
if (option === 'DestructuringForeach') {
|
13349
|
+
this.enableLintCheck('forbidden-extension-destructuring-foreach', false);
|
13350
|
+
} else {
|
13351
|
+
throw Error('Unknown language option: ' + option);
|
13352
|
+
}
|
13353
|
+
}
|
13277
13354
|
|
13278
13355
|
/* Dynamic stack of regions */
|
13356
|
+
|
13357
|
+
}, {
|
13358
|
+
key: 'regionStack',
|
13279
13359
|
value: function regionStack() {
|
13280
13360
|
return this._vm.regionStack();
|
13281
13361
|
}
|
@@ -13289,45 +13369,18 @@ var Runner = exports.Runner = function () {
|
|
13289
13369
|
var symtable = new _symtable.SymbolTable();
|
13290
13370
|
|
13291
13371
|
/* Populate symbol table with primitive types */
|
13292
|
-
var _iteratorNormalCompletion = true;
|
13293
|
-
var _didIteratorError = false;
|
13294
|
-
var _iteratorError = undefined;
|
13295
|
-
|
13296
|
-
try {
|
13297
|
-
for (var _iterator = this._primitives.types()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
13298
|
-
var type = _step.value;
|
13299
|
-
|
13300
|
-
symtable.defType(this._astDefType(type));
|
13301
|
-
}
|
13302
|
-
|
13303
|
-
/* Populate symbol table with primitive procedures */
|
13304
|
-
} catch (err) {
|
13305
|
-
_didIteratorError = true;
|
13306
|
-
_iteratorError = err;
|
13307
|
-
} finally {
|
13308
|
-
try {
|
13309
|
-
if (!_iteratorNormalCompletion && _iterator.return) {
|
13310
|
-
_iterator.return();
|
13311
|
-
}
|
13312
|
-
} finally {
|
13313
|
-
if (_didIteratorError) {
|
13314
|
-
throw _iteratorError;
|
13315
|
-
}
|
13316
|
-
}
|
13317
|
-
}
|
13318
|
-
|
13319
13372
|
var _iteratorNormalCompletion2 = true;
|
13320
13373
|
var _didIteratorError2 = false;
|
13321
13374
|
var _iteratorError2 = undefined;
|
13322
13375
|
|
13323
13376
|
try {
|
13324
|
-
for (var _iterator2 = this._primitives.
|
13325
|
-
var
|
13377
|
+
for (var _iterator2 = this._primitives.types()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
13378
|
+
var type = _step2.value;
|
13326
13379
|
|
13327
|
-
symtable.
|
13380
|
+
symtable.defType(this._astDefType(type));
|
13328
13381
|
}
|
13329
13382
|
|
13330
|
-
/* Populate symbol table with primitive
|
13383
|
+
/* Populate symbol table with primitive procedures */
|
13331
13384
|
} catch (err) {
|
13332
13385
|
_didIteratorError2 = true;
|
13333
13386
|
_iteratorError2 = err;
|
@@ -13348,11 +13401,13 @@ var Runner = exports.Runner = function () {
|
|
13348
13401
|
var _iteratorError3 = undefined;
|
13349
13402
|
|
13350
13403
|
try {
|
13351
|
-
for (var _iterator3 = this._primitives.
|
13352
|
-
var
|
13404
|
+
for (var _iterator3 = this._primitives.procedures()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
13405
|
+
var procedureName = _step3.value;
|
13353
13406
|
|
13354
|
-
symtable.
|
13407
|
+
symtable.defProcedure(this._astDefProcedure(procedureName));
|
13355
13408
|
}
|
13409
|
+
|
13410
|
+
/* Populate symbol table with primitive functions */
|
13356
13411
|
} catch (err) {
|
13357
13412
|
_didIteratorError3 = true;
|
13358
13413
|
_iteratorError3 = err;
|
@@ -13368,21 +13423,15 @@ var Runner = exports.Runner = function () {
|
|
13368
13423
|
}
|
13369
13424
|
}
|
13370
13425
|
|
13371
|
-
return symtable;
|
13372
|
-
}
|
13373
|
-
}, {
|
13374
|
-
key: '_astDefType',
|
13375
|
-
value: function _astDefType(type) {
|
13376
|
-
var constructorDeclarations = [];
|
13377
13426
|
var _iteratorNormalCompletion4 = true;
|
13378
13427
|
var _didIteratorError4 = false;
|
13379
13428
|
var _iteratorError4 = undefined;
|
13380
13429
|
|
13381
13430
|
try {
|
13382
|
-
for (var _iterator4 = this._primitives.
|
13383
|
-
var
|
13431
|
+
for (var _iterator4 = this._primitives.functions()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
13432
|
+
var functionName = _step4.value;
|
13384
13433
|
|
13385
|
-
|
13434
|
+
symtable.defFunction(this._astDefFunction(functionName));
|
13386
13435
|
}
|
13387
13436
|
} catch (err) {
|
13388
13437
|
_didIteratorError4 = true;
|
@@ -13399,6 +13448,37 @@ var Runner = exports.Runner = function () {
|
|
13399
13448
|
}
|
13400
13449
|
}
|
13401
13450
|
|
13451
|
+
return symtable;
|
13452
|
+
}
|
13453
|
+
}, {
|
13454
|
+
key: '_astDefType',
|
13455
|
+
value: function _astDefType(type) {
|
13456
|
+
var constructorDeclarations = [];
|
13457
|
+
var _iteratorNormalCompletion5 = true;
|
13458
|
+
var _didIteratorError5 = false;
|
13459
|
+
var _iteratorError5 = undefined;
|
13460
|
+
|
13461
|
+
try {
|
13462
|
+
for (var _iterator5 = this._primitives.typeConstructors(type)[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
13463
|
+
var _constructor = _step5.value;
|
13464
|
+
|
13465
|
+
constructorDeclarations.push(this._astConstructorDeclaration(type, _constructor));
|
13466
|
+
}
|
13467
|
+
} catch (err) {
|
13468
|
+
_didIteratorError5 = true;
|
13469
|
+
_iteratorError5 = err;
|
13470
|
+
} finally {
|
13471
|
+
try {
|
13472
|
+
if (!_iteratorNormalCompletion5 && _iterator5.return) {
|
13473
|
+
_iterator5.return();
|
13474
|
+
}
|
13475
|
+
} finally {
|
13476
|
+
if (_didIteratorError5) {
|
13477
|
+
throw _iteratorError5;
|
13478
|
+
}
|
13479
|
+
}
|
13480
|
+
}
|
13481
|
+
|
13402
13482
|
return new _ast.ASTDefType(tok(_token.T_UPPERID, type), constructorDeclarations);
|
13403
13483
|
}
|
13404
13484
|
}, {
|
@@ -13425,27 +13505,27 @@ var Runner = exports.Runner = function () {
|
|
13425
13505
|
key: '_astConstructorDeclaration',
|
13426
13506
|
value: function _astConstructorDeclaration(type, constructor) {
|
13427
13507
|
var fields = [];
|
13428
|
-
var
|
13429
|
-
var
|
13430
|
-
var
|
13508
|
+
var _iteratorNormalCompletion6 = true;
|
13509
|
+
var _didIteratorError6 = false;
|
13510
|
+
var _iteratorError6 = undefined;
|
13431
13511
|
|
13432
13512
|
try {
|
13433
|
-
for (var
|
13434
|
-
var field =
|
13513
|
+
for (var _iterator6 = this._primitives.constructorFields(type, constructor)[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
|
13514
|
+
var field = _step6.value;
|
13435
13515
|
|
13436
13516
|
fields.push(tok(_token.T_LOWERID, field));
|
13437
13517
|
}
|
13438
13518
|
} catch (err) {
|
13439
|
-
|
13440
|
-
|
13519
|
+
_didIteratorError6 = true;
|
13520
|
+
_iteratorError6 = err;
|
13441
13521
|
} finally {
|
13442
13522
|
try {
|
13443
|
-
if (!
|
13444
|
-
|
13523
|
+
if (!_iteratorNormalCompletion6 && _iterator6.return) {
|
13524
|
+
_iterator6.return();
|
13445
13525
|
}
|
13446
13526
|
} finally {
|
13447
|
-
if (
|
13448
|
-
throw
|
13527
|
+
if (_didIteratorError6) {
|
13528
|
+
throw _iteratorError6;
|
13449
13529
|
}
|
13450
13530
|
}
|
13451
13531
|
}
|
@@ -13639,6 +13719,15 @@ var Parser = exports.Parser = function () {
|
|
13639
13719
|
return new _ast.ASTMain(definitions);
|
13640
13720
|
}
|
13641
13721
|
|
13722
|
+
/* Return the list of all language options collected by the tokenizer.
|
13723
|
+
* Language options are set by the LANGUAGE pragma. */
|
13724
|
+
|
13725
|
+
}, {
|
13726
|
+
key: 'getLanguageOptions',
|
13727
|
+
value: function getLanguageOptions() {
|
13728
|
+
return this._lexer.getLanguageOptions();
|
13729
|
+
}
|
13730
|
+
|
13642
13731
|
/** Definitions **/
|
13643
13732
|
|
13644
13733
|
}, {
|
@@ -13819,6 +13908,8 @@ var Parser = exports.Parser = function () {
|
|
13819
13908
|
key: '_parsePureStatement',
|
13820
13909
|
value: function _parsePureStatement() {
|
13821
13910
|
switch (this._currentToken.tag) {
|
13911
|
+
case _token.T_ELLIPSIS:
|
13912
|
+
return this._parseStmtEllipsis();
|
13822
13913
|
case _token.T_RETURN:
|
13823
13914
|
return this._parseStmtReturn();
|
13824
13915
|
case _token.T_IF:
|
@@ -13869,6 +13960,16 @@ var Parser = exports.Parser = function () {
|
|
13869
13960
|
result.endPos = endPos;
|
13870
13961
|
return result;
|
13871
13962
|
}
|
13963
|
+
}, {
|
13964
|
+
key: '_parseStmtEllipsis',
|
13965
|
+
value: function _parseStmtEllipsis() {
|
13966
|
+
var startPos = this._currentToken.startPos;
|
13967
|
+
this._match(_token.T_ELLIPSIS);
|
13968
|
+
var result = new _ast.ASTStmtProcedureCall(new _token.Token(_token.T_UPPERID, (0, _i18n.i18n)('PRIM:BOOM'), startPos, startPos), [new _ast.ASTExprConstantString(new _token.Token(_token.T_STRING, (0, _i18n.i18n)('errmsg:ellipsis')))]);
|
13969
|
+
result.startPos = startPos;
|
13970
|
+
result.endPos = this._currentToken.startPos;
|
13971
|
+
return result;
|
13972
|
+
}
|
13872
13973
|
}, {
|
13873
13974
|
key: '_parseStmtReturn',
|
13874
13975
|
value: function _parseStmtReturn() {
|
@@ -13935,11 +14036,11 @@ var Parser = exports.Parser = function () {
|
|
13935
14036
|
value: function _parseStmtForeach() {
|
13936
14037
|
var startPos = this._currentToken.startPos;
|
13937
14038
|
this._match(_token.T_FOREACH);
|
13938
|
-
var
|
14039
|
+
var pattern = this._parsePattern();
|
13939
14040
|
this._match(_token.T_IN);
|
13940
14041
|
var range = this._parseExpression();
|
13941
14042
|
var body = this._parseStmtBlock();
|
13942
|
-
var result = new _ast.ASTStmtForeach(
|
14043
|
+
var result = new _ast.ASTStmtForeach(pattern, range, body);
|
13943
14044
|
result.startPos = startPos;
|
13944
14045
|
result.endPos = body.endPos;
|
13945
14046
|
return result;
|
@@ -14048,6 +14149,8 @@ var Parser = exports.Parser = function () {
|
|
14048
14149
|
switch (this._currentToken.tag) {
|
14049
14150
|
case _token.T_UNDERSCORE:
|
14050
14151
|
return this._parsePatternWildcard();
|
14152
|
+
case _token.T_LOWERID:
|
14153
|
+
return this._parsePatternVariable();
|
14051
14154
|
case _token.T_NUM:case _token.T_MINUS:
|
14052
14155
|
return this._parsePatternNumber();
|
14053
14156
|
case _token.T_UPPERID:
|
@@ -14071,6 +14174,16 @@ var Parser = exports.Parser = function () {
|
|
14071
14174
|
result.endPos = endPos;
|
14072
14175
|
return result;
|
14073
14176
|
}
|
14177
|
+
}, {
|
14178
|
+
key: '_parsePatternVariable',
|
14179
|
+
value: function _parsePatternVariable() {
|
14180
|
+
var startPos = this._currentToken.startPos;
|
14181
|
+
var id = this._parseLowerid();
|
14182
|
+
var result = new _ast.ASTPatternVariable(id);
|
14183
|
+
result.startPos = startPos;
|
14184
|
+
result.endPos = id.endPos;
|
14185
|
+
return result;
|
14186
|
+
}
|
14074
14187
|
}, {
|
14075
14188
|
key: '_parsePatternNumber',
|
14076
14189
|
value: function _parsePatternNumber() {
|
@@ -14258,6 +14371,8 @@ var Parser = exports.Parser = function () {
|
|
14258
14371
|
key: '_parseExprAtom',
|
14259
14372
|
value: function _parseExprAtom() {
|
14260
14373
|
switch (this._currentToken.tag) {
|
14374
|
+
case _token.T_ELLIPSIS:
|
14375
|
+
return this._parseExprEllipsis();
|
14261
14376
|
case _token.T_LOWERID:
|
14262
14377
|
return this._parseExprVariableOrFunctionCall();
|
14263
14378
|
case _token.T_NUM:
|
@@ -14276,6 +14391,16 @@ var Parser = exports.Parser = function () {
|
|
14276
14391
|
return fail(this._currentToken.startPos, this._currentToken.endPos, 'expected-but-found', [(0, _i18n.i18n)('expression'), (0, _i18n.i18n)(Symbol.keyFor(this._currentToken.tag))]);
|
14277
14392
|
}
|
14278
14393
|
}
|
14394
|
+
}, {
|
14395
|
+
key: '_parseExprEllipsis',
|
14396
|
+
value: function _parseExprEllipsis() {
|
14397
|
+
var startPos = this._currentToken.startPos;
|
14398
|
+
this._match(_token.T_ELLIPSIS);
|
14399
|
+
var result = new _ast.ASTExprFunctionCall(new _token.Token(_token.T_LOWERID, (0, _i18n.i18n)('PRIM:boom'), startPos, startPos), [new _ast.ASTExprConstantString(new _token.Token(_token.T_STRING, (0, _i18n.i18n)('errmsg:ellipsis')))]);
|
14400
|
+
result.startPos = startPos;
|
14401
|
+
result.endPos = this._currentToken.startPos;
|
14402
|
+
return result;
|
14403
|
+
}
|
14279
14404
|
}, {
|
14280
14405
|
key: '_parseExprVariableOrFunctionCall',
|
14281
14406
|
value: function _parseExprVariableOrFunctionCall() {
|
@@ -14829,7 +14954,7 @@ KEYWORDS[(0, _i18n.i18n)('CONS:TIMEOUT')] = _token.T_TIMEOUT;
|
|
14829
14954
|
var SYMBOLS = [
|
14830
14955
|
/* Various delimiters */
|
14831
14956
|
['(', _token.T_LPAREN], [')', _token.T_RPAREN], ['{', _token.T_LBRACE], ['}', _token.T_RBRACE], ['[', _token.T_LBRACK], // For lists and ranges
|
14832
|
-
[']', _token.T_RBRACK], [',', _token.T_COMMA], [';', _token.T_SEMICOLON],
|
14957
|
+
[']', _token.T_RBRACK], [',', _token.T_COMMA], [';', _token.T_SEMICOLON], ['...', _token.T_ELLIPSIS], // For intentionally incomplete programs
|
14833
14958
|
/* Range operator */
|
14834
14959
|
['..', _token.T_RANGE],
|
14835
14960
|
/* Assignment */
|
@@ -14846,6 +14971,9 @@ var SYMBOLS = [
|
|
14846
14971
|
/* Functions */
|
14847
14972
|
['++', _token.T_CONCAT], ['+', _token.T_PLUS], ['-', _token.T_MINUS], ['*', _token.T_TIMES], ['^', _token.T_POW]];
|
14848
14973
|
|
14974
|
+
/* Valid language options accepted by the LANGUAGE pragma */
|
14975
|
+
var LANGUAGE_OPTIONS = ['DestructuringForeach'];
|
14976
|
+
|
14849
14977
|
function leadingZeroes(string) {
|
14850
14978
|
return string.length >= 0 && string[0] === '0';
|
14851
14979
|
}
|
@@ -14890,6 +15018,12 @@ var Lexer = exports.Lexer = function () {
|
|
14890
15018
|
* Pending attributes are used by the parser to decorate any procedure
|
14891
15019
|
* or function definition. */
|
14892
15020
|
this._pendingAttributes = {};
|
15021
|
+
|
15022
|
+
/* A list of language options, enabled by the LANGUAGE pragma.
|
15023
|
+
* Language options are interpreted by the runner to initialize.
|
15024
|
+
* the remaining modules (linter, compiler, runtime, ...)
|
15025
|
+
* accordingly. */
|
15026
|
+
this._languageOptions = [];
|
14893
15027
|
}
|
14894
15028
|
|
14895
15029
|
/* Return the next token from the input */
|
@@ -15217,6 +15351,9 @@ var Lexer = exports.Lexer = function () {
|
|
15217
15351
|
var key = pragma[1];
|
15218
15352
|
var value = pragma.slice(2, pragma.length).join('@');
|
15219
15353
|
this.setAttribute(key, value);
|
15354
|
+
} else if (pragma[0] === 'LANGUAGE' && pragma.length === 2) {
|
15355
|
+
var languageOption = pragma[1];
|
15356
|
+
this.addLanguageOption(languageOption);
|
15220
15357
|
} else {
|
15221
15358
|
this._emitWarning(startPos, this._reader, 'unknown-pragma', [pragma[0]]);
|
15222
15359
|
}
|
@@ -15275,6 +15412,30 @@ var Lexer = exports.Lexer = function () {
|
|
15275
15412
|
value: function setAttribute(key, value) {
|
15276
15413
|
this._pendingAttributes[key] = value;
|
15277
15414
|
}
|
15415
|
+
|
15416
|
+
/*
|
15417
|
+
* Interface for handling language options.
|
15418
|
+
*
|
15419
|
+
* The pragma LANGUAGE@option sets the given option.
|
15420
|
+
*
|
15421
|
+
* The runner module reads these options to initialize the
|
15422
|
+
* linter/compiler/runtime.
|
15423
|
+
*/
|
15424
|
+
|
15425
|
+
}, {
|
15426
|
+
key: 'getLanguageOptions',
|
15427
|
+
value: function getLanguageOptions() {
|
15428
|
+
return this._languageOptions;
|
15429
|
+
}
|
15430
|
+
}, {
|
15431
|
+
key: 'addLanguageOption',
|
15432
|
+
value: function addLanguageOption(option) {
|
15433
|
+
if (LANGUAGE_OPTIONS.indexOf(option) !== -1) {
|
15434
|
+
this._languageOptions.push(option);
|
15435
|
+
} else {
|
15436
|
+
fail(this._reader, this._reader, 'unknown-language-option', [option]);
|
15437
|
+
}
|
15438
|
+
}
|
15278
15439
|
}]);
|
15279
15440
|
|
15280
15441
|
return Lexer;
|
@@ -15343,17 +15504,20 @@ var Linter = exports.Linter = function () {
|
|
15343
15504
|
* If a check is disabled, it does not produce a syntax error.
|
15344
15505
|
*/
|
15345
15506
|
this._enabledLinterChecks = {
|
15507
|
+
// Linter options
|
15346
15508
|
'source-should-have-a-program-definition': true,
|
15347
15509
|
'procedure-should-not-have-return': true,
|
15348
15510
|
'function-should-have-return': true,
|
15349
15511
|
'return-statement-not-allowed-here': true,
|
15350
15512
|
'wildcard-pattern-should-be-last': true,
|
15513
|
+
'variable-pattern-should-be-last': true,
|
15351
15514
|
'structure-pattern-repeats-constructor': true,
|
15352
15515
|
'structure-pattern-repeats-tuple-arity': true,
|
15353
15516
|
'structure-pattern-repeats-timeout': true,
|
15354
15517
|
'pattern-does-not-match-type': true,
|
15355
15518
|
'patterns-in-interactive-program-must-be-events': true,
|
15356
15519
|
'patterns-in-switch-must-not-be-events': true,
|
15520
|
+
'patterns-in-foreach-must-not-be-events': true,
|
15357
15521
|
'repeated-variable-in-tuple-assignment': true,
|
15358
15522
|
'constructor-used-as-procedure': true,
|
15359
15523
|
'undefined-procedure': true,
|
@@ -15368,7 +15532,9 @@ var Linter = exports.Linter = function () {
|
|
15368
15532
|
'function-arity-mismatch': true,
|
15369
15533
|
'type-used-as-constructor': true,
|
15370
15534
|
'procedure-used-as-constructor': true,
|
15371
|
-
'undeclared-constructor': true
|
15535
|
+
'undeclared-constructor': true,
|
15536
|
+
// Extensions
|
15537
|
+
'forbidden-extension-destructuring-foreach': true
|
15372
15538
|
};
|
15373
15539
|
}
|
15374
15540
|
|
@@ -15694,37 +15860,17 @@ var Linter = exports.Linter = function () {
|
|
15694
15860
|
}, {
|
15695
15861
|
key: '_lintStmtForeach',
|
15696
15862
|
value: function _lintStmtForeach(statement) {
|
15863
|
+
this._lintStmtForeachPattern(statement.pattern);
|
15697
15864
|
this._lintExpression(statement.range);
|
15698
|
-
this._symtable.addNewLocalName(statement.index, _symtable.LocalIndex);
|
15699
|
-
this._lintStatement(statement.body);
|
15700
|
-
this._symtable.removeLocalName(statement.index);
|
15701
|
-
}
|
15702
|
-
}, {
|
15703
|
-
key: '_lintStmtWhile',
|
15704
|
-
value: function _lintStmtWhile(statement) {
|
15705
|
-
this._lintExpression(statement.condition);
|
15706
|
-
this._lintStatement(statement.body);
|
15707
|
-
}
|
15708
|
-
}, {
|
15709
|
-
key: '_lintStmtSwitch',
|
15710
|
-
value: function _lintStmtSwitch(statement) {
|
15711
|
-
this._lintExpression(statement.subject);
|
15712
|
-
this._lintSwitchBranches(statement.branches, false /* !isInteractiveProgram */
|
15713
|
-
);
|
15714
|
-
}
|
15715
|
-
}, {
|
15716
|
-
key: '_lintSwitchBranches',
|
15717
|
-
value: function _lintSwitchBranches(branches, isInteractiveProgram) {
|
15718
|
-
/* Check that each pattern is well-formed */
|
15719
15865
|
var _iteratorNormalCompletion6 = true;
|
15720
15866
|
var _didIteratorError6 = false;
|
15721
15867
|
var _iteratorError6 = undefined;
|
15722
15868
|
|
15723
15869
|
try {
|
15724
|
-
for (var _iterator6 =
|
15725
|
-
var
|
15870
|
+
for (var _iterator6 = statement.pattern.boundVariables[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
|
15871
|
+
var variable = _step6.value;
|
15726
15872
|
|
15727
|
-
this.
|
15873
|
+
this._symtable.addNewLocalName(variable, _symtable.LocalIndex);
|
15728
15874
|
}
|
15729
15875
|
} catch (err) {
|
15730
15876
|
_didIteratorError6 = true;
|
@@ -15741,25 +15887,16 @@ var Linter = exports.Linter = function () {
|
|
15741
15887
|
}
|
15742
15888
|
}
|
15743
15889
|
|
15744
|
-
this.
|
15745
|
-
this._switchBranchesCheckNoRepeats(branches);
|
15746
|
-
this._switchBranchesCheckCompatible(branches);
|
15747
|
-
if (isInteractiveProgram) {
|
15748
|
-
this._switchBranchesCheckTypeEvent(branches);
|
15749
|
-
} else {
|
15750
|
-
this._switchBranchesCheckTypeNotEvent(branches);
|
15751
|
-
}
|
15752
|
-
|
15753
|
-
/* Lint recursively each branch */
|
15890
|
+
this._lintStatement(statement.body);
|
15754
15891
|
var _iteratorNormalCompletion7 = true;
|
15755
15892
|
var _didIteratorError7 = false;
|
15756
15893
|
var _iteratorError7 = undefined;
|
15757
15894
|
|
15758
15895
|
try {
|
15759
|
-
for (var _iterator7 =
|
15760
|
-
var
|
15896
|
+
for (var _iterator7 = statement.pattern.boundVariables[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
|
15897
|
+
var _variable = _step7.value;
|
15761
15898
|
|
15762
|
-
this.
|
15899
|
+
this._symtable.removeLocalName(_variable);
|
15763
15900
|
}
|
15764
15901
|
} catch (err) {
|
15765
15902
|
_didIteratorError7 = true;
|
@@ -15776,14 +15913,41 @@ var Linter = exports.Linter = function () {
|
|
15776
15913
|
}
|
15777
15914
|
}
|
15778
15915
|
}
|
15916
|
+
}, {
|
15917
|
+
key: '_lintStmtForeachPattern',
|
15918
|
+
value: function _lintStmtForeachPattern(pattern) {
|
15919
|
+
/* If "DestructuringForeach" is disabled, forbid complex patterns.
|
15920
|
+
* Allow only variable patterns (indices). */
|
15921
|
+
if (pattern.tag !== _ast.N_PatternVariable) {
|
15922
|
+
this._lintCheck(pattern.startPos, pattern.endPos, 'forbidden-extension-destructuring-foreach', []);
|
15923
|
+
}
|
15779
15924
|
|
15780
|
-
|
15925
|
+
/* Check that the pattern itself is well-formed */
|
15926
|
+
this._lintPattern(pattern);
|
15781
15927
|
|
15928
|
+
/* The pattern in a foreach cannot be an event */
|
15929
|
+
var patternType = this._patternType(pattern);
|
15930
|
+
if (patternType === (0, _i18n.i18n)('TYPE:Event')) {
|
15931
|
+
this._lintCheck(pattern.startPos, pattern.endPos, 'patterns-in-foreach-must-not-be-events', []);
|
15932
|
+
}
|
15933
|
+
}
|
15782
15934
|
}, {
|
15783
|
-
key: '
|
15784
|
-
value: function
|
15785
|
-
|
15786
|
-
|
15935
|
+
key: '_lintStmtWhile',
|
15936
|
+
value: function _lintStmtWhile(statement) {
|
15937
|
+
this._lintExpression(statement.condition);
|
15938
|
+
this._lintStatement(statement.body);
|
15939
|
+
}
|
15940
|
+
}, {
|
15941
|
+
key: '_lintStmtSwitch',
|
15942
|
+
value: function _lintStmtSwitch(statement) {
|
15943
|
+
this._lintExpression(statement.subject);
|
15944
|
+
this._lintSwitchBranches(statement.branches, false /* !isInteractiveProgram */
|
15945
|
+
);
|
15946
|
+
}
|
15947
|
+
}, {
|
15948
|
+
key: '_lintSwitchBranches',
|
15949
|
+
value: function _lintSwitchBranches(branches, isInteractiveProgram) {
|
15950
|
+
/* Check that each pattern is well-formed */
|
15787
15951
|
var _iteratorNormalCompletion8 = true;
|
15788
15952
|
var _didIteratorError8 = false;
|
15789
15953
|
var _iteratorError8 = undefined;
|
@@ -15792,11 +15956,7 @@ var Linter = exports.Linter = function () {
|
|
15792
15956
|
for (var _iterator8 = branches[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
|
15793
15957
|
var branch = _step8.value;
|
15794
15958
|
|
15795
|
-
|
15796
|
-
|
15797
|
-
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'wildcard-pattern-should-be-last', []);
|
15798
|
-
}
|
15799
|
-
i++;
|
15959
|
+
this._lintPattern(branch.pattern);
|
15800
15960
|
}
|
15801
15961
|
} catch (err) {
|
15802
15962
|
_didIteratorError8 = true;
|
@@ -15812,60 +15972,26 @@ var Linter = exports.Linter = function () {
|
|
15812
15972
|
}
|
15813
15973
|
}
|
15814
15974
|
}
|
15815
|
-
}
|
15816
15975
|
|
15817
|
-
|
15818
|
-
|
15976
|
+
this._switchBranchesCheckWildcardAndVariable(branches);
|
15977
|
+
this._switchBranchesCheckNoRepeats(branches);
|
15978
|
+
this._switchBranchesCheckCompatible(branches);
|
15979
|
+
if (isInteractiveProgram) {
|
15980
|
+
this._switchBranchesCheckTypeEvent(branches);
|
15981
|
+
} else {
|
15982
|
+
this._switchBranchesCheckTypeNotEvent(branches);
|
15983
|
+
}
|
15819
15984
|
|
15820
|
-
|
15821
|
-
key: '_switchBranchesCheckNoRepeats',
|
15822
|
-
value: function _switchBranchesCheckNoRepeats(branches) {
|
15823
|
-
var coveredNumbers = {};
|
15824
|
-
var coveredConstructors = {};
|
15825
|
-
var coveredTuples = {};
|
15826
|
-
var coveredTimeout = false;
|
15985
|
+
/* Lint recursively each branch */
|
15827
15986
|
var _iteratorNormalCompletion9 = true;
|
15828
15987
|
var _didIteratorError9 = false;
|
15829
15988
|
var _iteratorError9 = undefined;
|
15830
15989
|
|
15831
15990
|
try {
|
15832
15991
|
for (var _iterator9 = branches[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
|
15833
|
-
var
|
15992
|
+
var _branch = _step9.value;
|
15834
15993
|
|
15835
|
-
|
15836
|
-
case _ast.N_PatternWildcard:
|
15837
|
-
/* Already checked in _switchBranchesCheckWildcard */
|
15838
|
-
break;
|
15839
|
-
case _ast.N_PatternNumber:
|
15840
|
-
var number = branch.pattern.number.value;
|
15841
|
-
if (number in coveredNumbers) {
|
15842
|
-
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'numeric-pattern-repeats-number', [number]);
|
15843
|
-
}
|
15844
|
-
coveredNumbers[number] = true;
|
15845
|
-
break;
|
15846
|
-
case _ast.N_PatternStructure:
|
15847
|
-
var constructorName = branch.pattern.constructorName.value;
|
15848
|
-
if (constructorName in coveredConstructors) {
|
15849
|
-
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'structure-pattern-repeats-constructor', [constructorName]);
|
15850
|
-
}
|
15851
|
-
coveredConstructors[constructorName] = true;
|
15852
|
-
break;
|
15853
|
-
case _ast.N_PatternTuple:
|
15854
|
-
var arity = branch.pattern.parameters.length;
|
15855
|
-
if (arity in coveredTuples) {
|
15856
|
-
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'structure-pattern-repeats-tuple-arity', [arity]);
|
15857
|
-
}
|
15858
|
-
coveredTuples[arity] = true;
|
15859
|
-
break;
|
15860
|
-
case _ast.N_PatternTimeout:
|
15861
|
-
if (coveredTimeout) {
|
15862
|
-
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'structure-pattern-repeats-timeout', []);
|
15863
|
-
}
|
15864
|
-
coveredTimeout = true;
|
15865
|
-
break;
|
15866
|
-
default:
|
15867
|
-
throw Error('Linter: pattern "' + Symbol.keyFor(branch.pattern.tag) + '" not implemented.');
|
15868
|
-
}
|
15994
|
+
this._lintSwitchBranchBody(_branch);
|
15869
15995
|
}
|
15870
15996
|
} catch (err) {
|
15871
15997
|
_didIteratorError9 = true;
|
@@ -15883,13 +16009,13 @@ var Linter = exports.Linter = function () {
|
|
15883
16009
|
}
|
15884
16010
|
}
|
15885
16011
|
|
15886
|
-
/* Check that
|
15887
|
-
* i.e. that they belong to the same type */
|
16012
|
+
/* Check that there is at most one wildcard/variable pattern at the end */
|
15888
16013
|
|
15889
16014
|
}, {
|
15890
|
-
key: '
|
15891
|
-
value: function
|
15892
|
-
var
|
16015
|
+
key: '_switchBranchesCheckWildcardAndVariable',
|
16016
|
+
value: function _switchBranchesCheckWildcardAndVariable(branches) {
|
16017
|
+
var i = 0;
|
16018
|
+
var n = branches.length;
|
15893
16019
|
var _iteratorNormalCompletion10 = true;
|
15894
16020
|
var _didIteratorError10 = false;
|
15895
16021
|
var _iteratorError10 = undefined;
|
@@ -15898,12 +16024,13 @@ var Linter = exports.Linter = function () {
|
|
15898
16024
|
for (var _iterator10 = branches[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
|
15899
16025
|
var branch = _step10.value;
|
15900
16026
|
|
15901
|
-
|
15902
|
-
|
15903
|
-
|
15904
|
-
|
15905
|
-
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'pattern-
|
16027
|
+
if (branch.pattern.tag === _ast.N_PatternWildcard && i !== n - 1) {
|
16028
|
+
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'wildcard-pattern-should-be-last', []);
|
16029
|
+
}
|
16030
|
+
if (branch.pattern.tag === _ast.N_PatternVariable && i !== n - 1) {
|
16031
|
+
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'variable-pattern-should-be-last', [branch.pattern.variableName.value]);
|
15906
16032
|
}
|
16033
|
+
i++;
|
15907
16034
|
}
|
15908
16035
|
} catch (err) {
|
15909
16036
|
_didIteratorError10 = true;
|
@@ -15921,11 +16048,16 @@ var Linter = exports.Linter = function () {
|
|
15921
16048
|
}
|
15922
16049
|
}
|
15923
16050
|
|
15924
|
-
/* Check that there are
|
16051
|
+
/* Check that there are no repeated constructors in a sequence
|
16052
|
+
* of branches. */
|
15925
16053
|
|
15926
16054
|
}, {
|
15927
|
-
key: '
|
15928
|
-
value: function
|
16055
|
+
key: '_switchBranchesCheckNoRepeats',
|
16056
|
+
value: function _switchBranchesCheckNoRepeats(branches) {
|
16057
|
+
var coveredNumbers = {};
|
16058
|
+
var coveredConstructors = {};
|
16059
|
+
var coveredTuples = {};
|
16060
|
+
var coveredTimeout = false;
|
15929
16061
|
var _iteratorNormalCompletion11 = true;
|
15930
16062
|
var _didIteratorError11 = false;
|
15931
16063
|
var _iteratorError11 = undefined;
|
@@ -15934,9 +16066,39 @@ var Linter = exports.Linter = function () {
|
|
15934
16066
|
for (var _iterator11 = branches[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {
|
15935
16067
|
var branch = _step11.value;
|
15936
16068
|
|
15937
|
-
|
15938
|
-
|
15939
|
-
|
16069
|
+
switch (branch.pattern.tag) {
|
16070
|
+
case _ast.N_PatternWildcard:case _ast.N_PatternVariable:
|
16071
|
+
/* Already checked in _switchBranchesCheckWildcardAndVariable */
|
16072
|
+
break;
|
16073
|
+
case _ast.N_PatternNumber:
|
16074
|
+
var number = branch.pattern.number.value;
|
16075
|
+
if (number in coveredNumbers) {
|
16076
|
+
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'numeric-pattern-repeats-number', [number]);
|
16077
|
+
}
|
16078
|
+
coveredNumbers[number] = true;
|
16079
|
+
break;
|
16080
|
+
case _ast.N_PatternStructure:
|
16081
|
+
var constructorName = branch.pattern.constructorName.value;
|
16082
|
+
if (constructorName in coveredConstructors) {
|
16083
|
+
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'structure-pattern-repeats-constructor', [constructorName]);
|
16084
|
+
}
|
16085
|
+
coveredConstructors[constructorName] = true;
|
16086
|
+
break;
|
16087
|
+
case _ast.N_PatternTuple:
|
16088
|
+
var arity = branch.pattern.boundVariables.length;
|
16089
|
+
if (arity in coveredTuples) {
|
16090
|
+
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'structure-pattern-repeats-tuple-arity', [arity]);
|
16091
|
+
}
|
16092
|
+
coveredTuples[arity] = true;
|
16093
|
+
break;
|
16094
|
+
case _ast.N_PatternTimeout:
|
16095
|
+
if (coveredTimeout) {
|
16096
|
+
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'structure-pattern-repeats-timeout', []);
|
16097
|
+
}
|
16098
|
+
coveredTimeout = true;
|
16099
|
+
break;
|
16100
|
+
default:
|
16101
|
+
throw Error('Linter: pattern "' + Symbol.keyFor(branch.pattern.tag) + '" not implemented.');
|
15940
16102
|
}
|
15941
16103
|
}
|
15942
16104
|
} catch (err) {
|
@@ -15955,11 +16117,13 @@ var Linter = exports.Linter = function () {
|
|
15955
16117
|
}
|
15956
16118
|
}
|
15957
16119
|
|
15958
|
-
/* Check that
|
16120
|
+
/* Check that constructors are compatible,
|
16121
|
+
* i.e. that they belong to the same type */
|
15959
16122
|
|
15960
16123
|
}, {
|
15961
|
-
key: '
|
15962
|
-
value: function
|
16124
|
+
key: '_switchBranchesCheckCompatible',
|
16125
|
+
value: function _switchBranchesCheckCompatible(branches) {
|
16126
|
+
var expectedType = null;
|
15963
16127
|
var _iteratorNormalCompletion12 = true;
|
15964
16128
|
var _didIteratorError12 = false;
|
15965
16129
|
var _iteratorError12 = undefined;
|
@@ -15969,8 +16133,10 @@ var Linter = exports.Linter = function () {
|
|
15969
16133
|
var branch = _step12.value;
|
15970
16134
|
|
15971
16135
|
var patternType = this._patternType(branch.pattern);
|
15972
|
-
if (
|
15973
|
-
|
16136
|
+
if (expectedType === null) {
|
16137
|
+
expectedType = patternType;
|
16138
|
+
} else if (patternType !== null && expectedType !== patternType) {
|
16139
|
+
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'pattern-does-not-match-type', [(0, _i18n.i18n)('<pattern-type>')(expectedType), (0, _i18n.i18n)('<pattern-type>')(patternType)]);
|
15974
16140
|
}
|
15975
16141
|
}
|
15976
16142
|
} catch (err) {
|
@@ -15989,20 +16155,23 @@ var Linter = exports.Linter = function () {
|
|
15989
16155
|
}
|
15990
16156
|
}
|
15991
16157
|
|
15992
|
-
/*
|
16158
|
+
/* Check that there are patterns are of type Event */
|
15993
16159
|
|
15994
16160
|
}, {
|
15995
|
-
key: '
|
15996
|
-
value: function
|
16161
|
+
key: '_switchBranchesCheckTypeEvent',
|
16162
|
+
value: function _switchBranchesCheckTypeEvent(branches) {
|
15997
16163
|
var _iteratorNormalCompletion13 = true;
|
15998
16164
|
var _didIteratorError13 = false;
|
15999
16165
|
var _iteratorError13 = undefined;
|
16000
16166
|
|
16001
16167
|
try {
|
16002
|
-
for (var _iterator13 =
|
16003
|
-
var
|
16168
|
+
for (var _iterator13 = branches[Symbol.iterator](), _step13; !(_iteratorNormalCompletion13 = (_step13 = _iterator13.next()).done); _iteratorNormalCompletion13 = true) {
|
16169
|
+
var branch = _step13.value;
|
16004
16170
|
|
16005
|
-
this.
|
16171
|
+
var patternType = this._patternType(branch.pattern);
|
16172
|
+
if (patternType !== null && patternType !== (0, _i18n.i18n)('TYPE:Event')) {
|
16173
|
+
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'patterns-in-interactive-program-must-be-events', []);
|
16174
|
+
}
|
16006
16175
|
}
|
16007
16176
|
} catch (err) {
|
16008
16177
|
_didIteratorError13 = true;
|
@@ -16018,17 +16187,25 @@ var Linter = exports.Linter = function () {
|
|
16018
16187
|
}
|
16019
16188
|
}
|
16020
16189
|
}
|
16190
|
+
}
|
16021
16191
|
|
16022
|
-
|
16192
|
+
/* Check that there are no patterns of type Event */
|
16193
|
+
|
16194
|
+
}, {
|
16195
|
+
key: '_switchBranchesCheckTypeNotEvent',
|
16196
|
+
value: function _switchBranchesCheckTypeNotEvent(branches) {
|
16023
16197
|
var _iteratorNormalCompletion14 = true;
|
16024
16198
|
var _didIteratorError14 = false;
|
16025
16199
|
var _iteratorError14 = undefined;
|
16026
16200
|
|
16027
16201
|
try {
|
16028
|
-
for (var _iterator14 =
|
16029
|
-
var
|
16202
|
+
for (var _iterator14 = branches[Symbol.iterator](), _step14; !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true) {
|
16203
|
+
var branch = _step14.value;
|
16030
16204
|
|
16031
|
-
this.
|
16205
|
+
var patternType = this._patternType(branch.pattern);
|
16206
|
+
if (patternType === (0, _i18n.i18n)('TYPE:Event')) {
|
16207
|
+
this._lintCheck(branch.pattern.startPos, branch.pattern.endPos, 'patterns-in-switch-must-not-be-events', []);
|
16208
|
+
}
|
16032
16209
|
}
|
16033
16210
|
} catch (err) {
|
16034
16211
|
_didIteratorError14 = true;
|
@@ -16046,20 +16223,77 @@ var Linter = exports.Linter = function () {
|
|
16046
16223
|
}
|
16047
16224
|
}
|
16048
16225
|
|
16226
|
+
/* Recursively lint the body of each branch. Locally bind variables. */
|
16227
|
+
|
16228
|
+
}, {
|
16229
|
+
key: '_lintSwitchBranchBody',
|
16230
|
+
value: function _lintSwitchBranchBody(branch) {
|
16231
|
+
var _iteratorNormalCompletion15 = true;
|
16232
|
+
var _didIteratorError15 = false;
|
16233
|
+
var _iteratorError15 = undefined;
|
16234
|
+
|
16235
|
+
try {
|
16236
|
+
for (var _iterator15 = branch.pattern.boundVariables[Symbol.iterator](), _step15; !(_iteratorNormalCompletion15 = (_step15 = _iterator15.next()).done); _iteratorNormalCompletion15 = true) {
|
16237
|
+
var variable = _step15.value;
|
16238
|
+
|
16239
|
+
this._symtable.addNewLocalName(variable, _symtable.LocalParameter);
|
16240
|
+
}
|
16241
|
+
} catch (err) {
|
16242
|
+
_didIteratorError15 = true;
|
16243
|
+
_iteratorError15 = err;
|
16244
|
+
} finally {
|
16245
|
+
try {
|
16246
|
+
if (!_iteratorNormalCompletion15 && _iterator15.return) {
|
16247
|
+
_iterator15.return();
|
16248
|
+
}
|
16249
|
+
} finally {
|
16250
|
+
if (_didIteratorError15) {
|
16251
|
+
throw _iteratorError15;
|
16252
|
+
}
|
16253
|
+
}
|
16254
|
+
}
|
16255
|
+
|
16256
|
+
this._lintStatement(branch.body);
|
16257
|
+
var _iteratorNormalCompletion16 = true;
|
16258
|
+
var _didIteratorError16 = false;
|
16259
|
+
var _iteratorError16 = undefined;
|
16260
|
+
|
16261
|
+
try {
|
16262
|
+
for (var _iterator16 = branch.pattern.boundVariables[Symbol.iterator](), _step16; !(_iteratorNormalCompletion16 = (_step16 = _iterator16.next()).done); _iteratorNormalCompletion16 = true) {
|
16263
|
+
var _variable2 = _step16.value;
|
16264
|
+
|
16265
|
+
this._symtable.removeLocalName(_variable2);
|
16266
|
+
}
|
16267
|
+
} catch (err) {
|
16268
|
+
_didIteratorError16 = true;
|
16269
|
+
_iteratorError16 = err;
|
16270
|
+
} finally {
|
16271
|
+
try {
|
16272
|
+
if (!_iteratorNormalCompletion16 && _iterator16.return) {
|
16273
|
+
_iterator16.return();
|
16274
|
+
}
|
16275
|
+
} finally {
|
16276
|
+
if (_didIteratorError16) {
|
16277
|
+
throw _iteratorError16;
|
16278
|
+
}
|
16279
|
+
}
|
16280
|
+
}
|
16281
|
+
}
|
16282
|
+
|
16049
16283
|
/* Return a description of the type of a pattern */
|
16050
16284
|
|
16051
16285
|
}, {
|
16052
16286
|
key: '_patternType',
|
16053
16287
|
value: function _patternType(pattern) {
|
16054
16288
|
switch (pattern.tag) {
|
16055
|
-
case _ast.N_PatternWildcard:
|
16289
|
+
case _ast.N_PatternWildcard:case _ast.N_PatternVariable:
|
16056
16290
|
return null;
|
16057
16291
|
case _ast.N_PatternNumber:
|
16058
16292
|
return (0, _i18n.i18n)('TYPE:Integer');
|
16059
16293
|
case _ast.N_PatternStructure:
|
16060
16294
|
return this._symtable.constructorType(pattern.constructorName.value);
|
16061
16295
|
case _ast.N_PatternTuple:
|
16062
|
-
return '_TUPLE_' + pattern.
|
16296
|
+
return '_TUPLE_' + pattern.boundVariables.length.toString();
|
16063
16297
|
case _ast.N_PatternTimeout:
|
16064
16298
|
return (0, _i18n.i18n)('TYPE:Event');
|
16065
16299
|
default:
|
@@ -16076,13 +16310,13 @@ var Linter = exports.Linter = function () {
|
|
16076
16310
|
key: '_lintStmtAssignTuple',
|
16077
16311
|
value: function _lintStmtAssignTuple(statement) {
|
16078
16312
|
var variables = {};
|
16079
|
-
var
|
16080
|
-
var
|
16081
|
-
var
|
16313
|
+
var _iteratorNormalCompletion17 = true;
|
16314
|
+
var _didIteratorError17 = false;
|
16315
|
+
var _iteratorError17 = undefined;
|
16082
16316
|
|
16083
16317
|
try {
|
16084
|
-
for (var
|
16085
|
-
var variable =
|
16318
|
+
for (var _iterator17 = statement.variables[Symbol.iterator](), _step17; !(_iteratorNormalCompletion17 = (_step17 = _iterator17.next()).done); _iteratorNormalCompletion17 = true) {
|
16319
|
+
var variable = _step17.value;
|
16086
16320
|
|
16087
16321
|
this._symtable.setLocalName(variable, _symtable.LocalVariable);
|
16088
16322
|
if (variable.value in variables) {
|
@@ -16091,16 +16325,16 @@ var Linter = exports.Linter = function () {
|
|
16091
16325
|
variables[variable.value] = true;
|
16092
16326
|
}
|
16093
16327
|
} catch (err) {
|
16094
|
-
|
16095
|
-
|
16328
|
+
_didIteratorError17 = true;
|
16329
|
+
_iteratorError17 = err;
|
16096
16330
|
} finally {
|
16097
16331
|
try {
|
16098
|
-
if (!
|
16099
|
-
|
16332
|
+
if (!_iteratorNormalCompletion17 && _iterator17.return) {
|
16333
|
+
_iterator17.return();
|
16100
16334
|
}
|
16101
16335
|
} finally {
|
16102
|
-
if (
|
16103
|
-
throw
|
16336
|
+
if (_didIteratorError17) {
|
16337
|
+
throw _iteratorError17;
|
16104
16338
|
}
|
16105
16339
|
}
|
16106
16340
|
}
|
@@ -16129,27 +16363,27 @@ var Linter = exports.Linter = function () {
|
|
16129
16363
|
}
|
16130
16364
|
|
16131
16365
|
/* Check all the arguments */
|
16132
|
-
var
|
16133
|
-
var
|
16134
|
-
var
|
16366
|
+
var _iteratorNormalCompletion18 = true;
|
16367
|
+
var _didIteratorError18 = false;
|
16368
|
+
var _iteratorError18 = undefined;
|
16135
16369
|
|
16136
16370
|
try {
|
16137
|
-
for (var
|
16138
|
-
var argument =
|
16371
|
+
for (var _iterator18 = statement.args[Symbol.iterator](), _step18; !(_iteratorNormalCompletion18 = (_step18 = _iterator18.next()).done); _iteratorNormalCompletion18 = true) {
|
16372
|
+
var argument = _step18.value;
|
16139
16373
|
|
16140
16374
|
this._lintExpression(argument);
|
16141
16375
|
}
|
16142
16376
|
} catch (err) {
|
16143
|
-
|
16144
|
-
|
16377
|
+
_didIteratorError18 = true;
|
16378
|
+
_iteratorError18 = err;
|
16145
16379
|
} finally {
|
16146
16380
|
try {
|
16147
|
-
if (!
|
16148
|
-
|
16381
|
+
if (!_iteratorNormalCompletion18 && _iterator18.return) {
|
16382
|
+
_iterator18.return();
|
16149
16383
|
}
|
16150
16384
|
} finally {
|
16151
|
-
if (
|
16152
|
-
throw
|
16385
|
+
if (_didIteratorError18) {
|
16386
|
+
throw _iteratorError18;
|
16153
16387
|
}
|
16154
16388
|
}
|
16155
16389
|
}
|
@@ -16163,6 +16397,8 @@ var Linter = exports.Linter = function () {
|
|
16163
16397
|
switch (pattern.tag) {
|
16164
16398
|
case _ast.N_PatternWildcard:
|
16165
16399
|
return this._lintPatternWildcard(pattern);
|
16400
|
+
case _ast.N_PatternVariable:
|
16401
|
+
return this._lintPatternVariable(pattern);
|
16166
16402
|
case _ast.N_PatternNumber:
|
16167
16403
|
return this._lintPatternNumber(pattern);
|
16168
16404
|
case _ast.N_PatternStructure:
|
@@ -16180,6 +16416,11 @@ var Linter = exports.Linter = function () {
|
|
16180
16416
|
value: function _lintPatternWildcard(pattern) {
|
16181
16417
|
/* No restrictions */
|
16182
16418
|
}
|
16419
|
+
}, {
|
16420
|
+
key: '_lintPatternVariable',
|
16421
|
+
value: function _lintPatternVariable(pattern) {
|
16422
|
+
/* No restrictions */
|
16423
|
+
}
|
16183
16424
|
}, {
|
16184
16425
|
key: '_lintPatternNumber',
|
16185
16426
|
value: function _lintPatternNumber(pattern) {
|
@@ -16201,7 +16442,7 @@ var Linter = exports.Linter = function () {
|
|
16201
16442
|
* Note: constructor patterns with 0 arguments are always allowed.
|
16202
16443
|
*/
|
16203
16444
|
var expected = this._symtable.constructorFields(name).length;
|
16204
|
-
var received = pattern.
|
16445
|
+
var received = pattern.boundVariables.length;
|
16205
16446
|
if (received > 0 && expected !== received) {
|
16206
16447
|
this._lintCheck(pattern.startPos, pattern.endPos, 'structure-pattern-arity-mismatch', [name, expected, received]);
|
16207
16448
|
}
|
@@ -16274,27 +16515,27 @@ var Linter = exports.Linter = function () {
|
|
16274
16515
|
}, {
|
16275
16516
|
key: '_lintExprList',
|
16276
16517
|
value: function _lintExprList(expression) {
|
16277
|
-
var
|
16278
|
-
var
|
16279
|
-
var
|
16518
|
+
var _iteratorNormalCompletion19 = true;
|
16519
|
+
var _didIteratorError19 = false;
|
16520
|
+
var _iteratorError19 = undefined;
|
16280
16521
|
|
16281
16522
|
try {
|
16282
|
-
for (var
|
16283
|
-
var element =
|
16523
|
+
for (var _iterator19 = expression.elements[Symbol.iterator](), _step19; !(_iteratorNormalCompletion19 = (_step19 = _iterator19.next()).done); _iteratorNormalCompletion19 = true) {
|
16524
|
+
var element = _step19.value;
|
16284
16525
|
|
16285
16526
|
this._lintExpression(element);
|
16286
16527
|
}
|
16287
16528
|
} catch (err) {
|
16288
|
-
|
16289
|
-
|
16529
|
+
_didIteratorError19 = true;
|
16530
|
+
_iteratorError19 = err;
|
16290
16531
|
} finally {
|
16291
16532
|
try {
|
16292
|
-
if (!
|
16293
|
-
|
16533
|
+
if (!_iteratorNormalCompletion19 && _iterator19.return) {
|
16534
|
+
_iterator19.return();
|
16294
16535
|
}
|
16295
16536
|
} finally {
|
16296
|
-
if (
|
16297
|
-
throw
|
16537
|
+
if (_didIteratorError19) {
|
16538
|
+
throw _iteratorError19;
|
16298
16539
|
}
|
16299
16540
|
}
|
16300
16541
|
}
|
@@ -16311,27 +16552,27 @@ var Linter = exports.Linter = function () {
|
|
16311
16552
|
}, {
|
16312
16553
|
key: '_lintExprTuple',
|
16313
16554
|
value: function _lintExprTuple(expression) {
|
16314
|
-
var
|
16315
|
-
var
|
16316
|
-
var
|
16555
|
+
var _iteratorNormalCompletion20 = true;
|
16556
|
+
var _didIteratorError20 = false;
|
16557
|
+
var _iteratorError20 = undefined;
|
16317
16558
|
|
16318
16559
|
try {
|
16319
|
-
for (var
|
16320
|
-
var element =
|
16560
|
+
for (var _iterator20 = expression.elements[Symbol.iterator](), _step20; !(_iteratorNormalCompletion20 = (_step20 = _iterator20.next()).done); _iteratorNormalCompletion20 = true) {
|
16561
|
+
var element = _step20.value;
|
16321
16562
|
|
16322
16563
|
this._lintExpression(element);
|
16323
16564
|
}
|
16324
16565
|
} catch (err) {
|
16325
|
-
|
16326
|
-
|
16566
|
+
_didIteratorError20 = true;
|
16567
|
+
_iteratorError20 = err;
|
16327
16568
|
} finally {
|
16328
16569
|
try {
|
16329
|
-
if (!
|
16330
|
-
|
16570
|
+
if (!_iteratorNormalCompletion20 && _iterator20.return) {
|
16571
|
+
_iterator20.return();
|
16331
16572
|
}
|
16332
16573
|
} finally {
|
16333
|
-
if (
|
16334
|
-
throw
|
16574
|
+
if (_didIteratorError20) {
|
16575
|
+
throw _iteratorError20;
|
16335
16576
|
}
|
16336
16577
|
}
|
16337
16578
|
}
|
@@ -16380,27 +16621,27 @@ var Linter = exports.Linter = function () {
|
|
16380
16621
|
}
|
16381
16622
|
|
16382
16623
|
/* Recursively check expressions in field bindings */
|
16383
|
-
var
|
16384
|
-
var
|
16385
|
-
var
|
16624
|
+
var _iteratorNormalCompletion21 = true;
|
16625
|
+
var _didIteratorError21 = false;
|
16626
|
+
var _iteratorError21 = undefined;
|
16386
16627
|
|
16387
16628
|
try {
|
16388
|
-
for (var
|
16389
|
-
var fieldBinding =
|
16629
|
+
for (var _iterator21 = expression.fieldBindings[Symbol.iterator](), _step21; !(_iteratorNormalCompletion21 = (_step21 = _iterator21.next()).done); _iteratorNormalCompletion21 = true) {
|
16630
|
+
var fieldBinding = _step21.value;
|
16390
16631
|
|
16391
16632
|
this._lintExpression(fieldBinding.value);
|
16392
16633
|
}
|
16393
16634
|
} catch (err) {
|
16394
|
-
|
16395
|
-
|
16635
|
+
_didIteratorError21 = true;
|
16636
|
+
_iteratorError21 = err;
|
16396
16637
|
} finally {
|
16397
16638
|
try {
|
16398
|
-
if (!
|
16399
|
-
|
16639
|
+
if (!_iteratorNormalCompletion21 && _iterator21.return) {
|
16640
|
+
_iterator21.return();
|
16400
16641
|
}
|
16401
16642
|
} finally {
|
16402
|
-
if (
|
16403
|
-
throw
|
16643
|
+
if (_didIteratorError21) {
|
16644
|
+
throw _iteratorError21;
|
16404
16645
|
}
|
16405
16646
|
}
|
16406
16647
|
}
|
@@ -16414,13 +16655,13 @@ var Linter = exports.Linter = function () {
|
|
16414
16655
|
value: function _checkStructureNoRepeatedFields(constructorName, expression) {
|
16415
16656
|
var declaredFields = expression.fieldNames();
|
16416
16657
|
var seen = {};
|
16417
|
-
var
|
16418
|
-
var
|
16419
|
-
var
|
16658
|
+
var _iteratorNormalCompletion22 = true;
|
16659
|
+
var _didIteratorError22 = false;
|
16660
|
+
var _iteratorError22 = undefined;
|
16420
16661
|
|
16421
16662
|
try {
|
16422
|
-
for (var
|
16423
|
-
var fieldName =
|
16663
|
+
for (var _iterator22 = declaredFields[Symbol.iterator](), _step22; !(_iteratorNormalCompletion22 = (_step22 = _iterator22.next()).done); _iteratorNormalCompletion22 = true) {
|
16664
|
+
var fieldName = _step22.value;
|
16424
16665
|
|
16425
16666
|
if (fieldName in seen) {
|
16426
16667
|
this._lintCheck(expression.startPos, expression.endPos, 'structure-construction-repeated-field', [constructorName, fieldName]);
|
@@ -16428,16 +16669,16 @@ var Linter = exports.Linter = function () {
|
|
16428
16669
|
seen[fieldName] = true;
|
16429
16670
|
}
|
16430
16671
|
} catch (err) {
|
16431
|
-
|
16432
|
-
|
16672
|
+
_didIteratorError22 = true;
|
16673
|
+
_iteratorError22 = err;
|
16433
16674
|
} finally {
|
16434
16675
|
try {
|
16435
|
-
if (!
|
16436
|
-
|
16676
|
+
if (!_iteratorNormalCompletion22 && _iterator22.return) {
|
16677
|
+
_iterator22.return();
|
16437
16678
|
}
|
16438
16679
|
} finally {
|
16439
|
-
if (
|
16440
|
-
throw
|
16680
|
+
if (_didIteratorError22) {
|
16681
|
+
throw _iteratorError22;
|
16441
16682
|
}
|
16442
16683
|
}
|
16443
16684
|
}
|
@@ -16451,29 +16692,29 @@ var Linter = exports.Linter = function () {
|
|
16451
16692
|
value: function _checkStructureBindingsCorrect(constructorName, expression) {
|
16452
16693
|
var declaredFields = expression.fieldNames();
|
16453
16694
|
var constructorFields = this._symtable.constructorFields(constructorName);
|
16454
|
-
var
|
16455
|
-
var
|
16456
|
-
var
|
16695
|
+
var _iteratorNormalCompletion23 = true;
|
16696
|
+
var _didIteratorError23 = false;
|
16697
|
+
var _iteratorError23 = undefined;
|
16457
16698
|
|
16458
16699
|
try {
|
16459
|
-
for (var
|
16460
|
-
var fieldName =
|
16700
|
+
for (var _iterator23 = declaredFields[Symbol.iterator](), _step23; !(_iteratorNormalCompletion23 = (_step23 = _iterator23.next()).done); _iteratorNormalCompletion23 = true) {
|
16701
|
+
var fieldName = _step23.value;
|
16461
16702
|
|
16462
16703
|
if (constructorFields.indexOf(fieldName) === -1) {
|
16463
16704
|
this._lintCheck(expression.startPos, expression.endPos, 'structure-construction-invalid-field', [constructorName, fieldName]);
|
16464
16705
|
}
|
16465
16706
|
}
|
16466
16707
|
} catch (err) {
|
16467
|
-
|
16468
|
-
|
16708
|
+
_didIteratorError23 = true;
|
16709
|
+
_iteratorError23 = err;
|
16469
16710
|
} finally {
|
16470
16711
|
try {
|
16471
|
-
if (!
|
16472
|
-
|
16712
|
+
if (!_iteratorNormalCompletion23 && _iterator23.return) {
|
16713
|
+
_iterator23.return();
|
16473
16714
|
}
|
16474
16715
|
} finally {
|
16475
|
-
if (
|
16476
|
-
throw
|
16716
|
+
if (_didIteratorError23) {
|
16717
|
+
throw _iteratorError23;
|
16477
16718
|
}
|
16478
16719
|
}
|
16479
16720
|
}
|
@@ -16487,29 +16728,29 @@ var Linter = exports.Linter = function () {
|
|
16487
16728
|
value: function _checkStructureBindingsComplete(constructorName, expression) {
|
16488
16729
|
var declaredFields = expression.fieldNames();
|
16489
16730
|
var constructorFields = this._symtable.constructorFields(constructorName);
|
16490
|
-
var
|
16491
|
-
var
|
16492
|
-
var
|
16731
|
+
var _iteratorNormalCompletion24 = true;
|
16732
|
+
var _didIteratorError24 = false;
|
16733
|
+
var _iteratorError24 = undefined;
|
16493
16734
|
|
16494
16735
|
try {
|
16495
|
-
for (var
|
16496
|
-
var fieldName =
|
16736
|
+
for (var _iterator24 = constructorFields[Symbol.iterator](), _step24; !(_iteratorNormalCompletion24 = (_step24 = _iterator24.next()).done); _iteratorNormalCompletion24 = true) {
|
16737
|
+
var fieldName = _step24.value;
|
16497
16738
|
|
16498
16739
|
if (declaredFields.indexOf(fieldName) === -1) {
|
16499
16740
|
this._lintCheck(expression.startPos, expression.endPos, 'structure-construction-missing-field', [constructorName, fieldName]);
|
16500
16741
|
}
|
16501
16742
|
}
|
16502
16743
|
} catch (err) {
|
16503
|
-
|
16504
|
-
|
16744
|
+
_didIteratorError24 = true;
|
16745
|
+
_iteratorError24 = err;
|
16505
16746
|
} finally {
|
16506
16747
|
try {
|
16507
|
-
if (!
|
16508
|
-
|
16748
|
+
if (!_iteratorNormalCompletion24 && _iterator24.return) {
|
16749
|
+
_iterator24.return();
|
16509
16750
|
}
|
16510
16751
|
} finally {
|
16511
|
-
if (
|
16512
|
-
throw
|
16752
|
+
if (_didIteratorError24) {
|
16753
|
+
throw _iteratorError24;
|
16513
16754
|
}
|
16514
16755
|
}
|
16515
16756
|
}
|
@@ -16550,27 +16791,27 @@ var Linter = exports.Linter = function () {
|
|
16550
16791
|
}
|
16551
16792
|
|
16552
16793
|
/* Recursively check arguments */
|
16553
|
-
var
|
16554
|
-
var
|
16555
|
-
var
|
16794
|
+
var _iteratorNormalCompletion25 = true;
|
16795
|
+
var _didIteratorError25 = false;
|
16796
|
+
var _iteratorError25 = undefined;
|
16556
16797
|
|
16557
16798
|
try {
|
16558
|
-
for (var
|
16559
|
-
var argument =
|
16799
|
+
for (var _iterator25 = expression.args[Symbol.iterator](), _step25; !(_iteratorNormalCompletion25 = (_step25 = _iterator25.next()).done); _iteratorNormalCompletion25 = true) {
|
16800
|
+
var argument = _step25.value;
|
16560
16801
|
|
16561
16802
|
this._lintExpression(argument);
|
16562
16803
|
}
|
16563
16804
|
} catch (err) {
|
16564
|
-
|
16565
|
-
|
16805
|
+
_didIteratorError25 = true;
|
16806
|
+
_iteratorError25 = err;
|
16566
16807
|
} finally {
|
16567
16808
|
try {
|
16568
|
-
if (!
|
16569
|
-
|
16809
|
+
if (!_iteratorNormalCompletion25 && _iterator25.return) {
|
16810
|
+
_iterator25.return();
|
16570
16811
|
}
|
16571
16812
|
} finally {
|
16572
|
-
if (
|
16573
|
-
throw
|
16813
|
+
if (_didIteratorError25) {
|
16814
|
+
throw _iteratorError25;
|
16574
16815
|
}
|
16575
16816
|
}
|
16576
16817
|
}
|
@@ -16968,10 +17209,10 @@ var Compiler = exports.Compiler = function () {
|
|
16968
17209
|
* PrimitiveCall "<", 2 ;|
|
16969
17210
|
* JumpIfFalse labelEnd ;/
|
16970
17211
|
*
|
16971
|
-
* PushVariable _list
|
16972
|
-
* PushVariable _pos
|
16973
|
-
* PrimitiveCall "_unsafeListNth", 2
|
16974
|
-
*
|
17212
|
+
* PushVariable _list ;\ get the `pos`-th element of the
|
17213
|
+
* PushVariable _pos ;| list and match the value
|
17214
|
+
* PrimitiveCall "_unsafeListNth", 2 ;| with the pattern of the foreach
|
17215
|
+
* [match with the pattern or fail] ;/
|
16975
17216
|
*
|
16976
17217
|
* <body>
|
16977
17218
|
*
|
@@ -16985,7 +17226,7 @@ var Compiler = exports.Compiler = function () {
|
|
16985
17226
|
* UnsetVariable _list
|
16986
17227
|
* UnsetVariable _n
|
16987
17228
|
* UnsetVariable _pos
|
16988
|
-
*
|
17229
|
+
* [unset all the variables bound by the pattern]
|
16989
17230
|
*/
|
16990
17231
|
|
16991
17232
|
}, {
|
@@ -16999,9 +17240,45 @@ var Compiler = exports.Compiler = function () {
|
|
16999
17240
|
|
17000
17241
|
this._compileExpression(statement.range);
|
17001
17242
|
this._produceList(statement.range.startPos, statement.range.endPos, [new _instruction.ITypeCheck(new _value.TypeList(new _value.TypeAny())), new _instruction.ISetVariable(list), new _instruction.IPushVariable(list), new _instruction.IPrimitiveCall('_unsafeListLength', 1), new _instruction.ISetVariable(n)]);
|
17002
|
-
this._produceList(statement.startPos, statement.endPos, [new _instruction.IPushInteger(0), new _instruction.ISetVariable(pos), new _instruction.ILabel(labelStart), new _instruction.IPushVariable(pos), new _instruction.IPushVariable(n), new _instruction.IPrimitiveCall('<', 2), new _instruction.IJumpIfFalse(labelEnd), new _instruction.IPushVariable(list), new _instruction.IPushVariable(pos), new _instruction.IPrimitiveCall('_unsafeListNth', 2)
|
17243
|
+
this._produceList(statement.startPos, statement.endPos, [new _instruction.IPushInteger(0), new _instruction.ISetVariable(pos), new _instruction.ILabel(labelStart), new _instruction.IPushVariable(pos), new _instruction.IPushVariable(n), new _instruction.IPrimitiveCall('<', 2), new _instruction.IJumpIfFalse(labelEnd), new _instruction.IPushVariable(list), new _instruction.IPushVariable(pos), new _instruction.IPrimitiveCall('_unsafeListNth', 2)]);
|
17244
|
+
this._compileMatchForeachPatternOrFail(statement.pattern);
|
17003
17245
|
this._compileStatement(statement.body);
|
17004
|
-
this._produceList(statement.startPos, statement.endPos, [new _instruction.IPushVariable(pos), new _instruction.IPushInteger(1), new _instruction.IPrimitiveCall('+', 2), new _instruction.ISetVariable(pos), new _instruction.IJump(labelStart), new _instruction.ILabel(labelEnd), new _instruction.IUnsetVariable(list), new _instruction.IUnsetVariable(n), new _instruction.IUnsetVariable(pos)
|
17246
|
+
this._produceList(statement.startPos, statement.endPos, [new _instruction.IPushVariable(pos), new _instruction.IPushInteger(1), new _instruction.IPrimitiveCall('+', 2), new _instruction.ISetVariable(pos), new _instruction.IJump(labelStart), new _instruction.ILabel(labelEnd), new _instruction.IUnsetVariable(list), new _instruction.IUnsetVariable(n), new _instruction.IUnsetVariable(pos)]);
|
17247
|
+
this._compilePatternUnbind(statement.pattern);
|
17248
|
+
}
|
17249
|
+
|
17250
|
+
/* Attempt to match the pattern against the top of the stack.
|
17251
|
+
* If the pattern matches, bind its variables.
|
17252
|
+
* Otherwise, issue an error message.
|
17253
|
+
* Always pops the top of the stack.
|
17254
|
+
*/
|
17255
|
+
|
17256
|
+
}, {
|
17257
|
+
key: '_compileMatchForeachPatternOrFail',
|
17258
|
+
value: function _compileMatchForeachPatternOrFail(pattern) {
|
17259
|
+
switch (pattern.tag) {
|
17260
|
+
case _ast.N_PatternWildcard:
|
17261
|
+
this._produce(pattern.startPos, pattern.endPos, new _instruction.IPop());
|
17262
|
+
return;
|
17263
|
+
case _ast.N_PatternVariable:
|
17264
|
+
this._produce(pattern.startPos, pattern.endPos, new _instruction.ISetVariable(pattern.variableName.value));
|
17265
|
+
return;
|
17266
|
+
default:
|
17267
|
+
/* Attempt to match, issuing an error message if there is no match:
|
17268
|
+
*
|
17269
|
+
* [if subject matches pattern, jump to L]
|
17270
|
+
* [error message: no match]
|
17271
|
+
* L:
|
17272
|
+
* [bind pattern to subject]
|
17273
|
+
* [pop subject]
|
17274
|
+
*/
|
17275
|
+
var label = this._freshLabel();
|
17276
|
+
this._compilePatternCheck(pattern, label);
|
17277
|
+
this._produceList(pattern.startPos, pattern.endPos, [new _instruction.IPushString('foreach-pattern-does-not-match'), new _instruction.IPrimitiveCall('_FAIL', 1), new _instruction.ILabel(label)]);
|
17278
|
+
this._compilePatternBind(pattern);
|
17279
|
+
this._produce(pattern.startPos, pattern.endPos, new _instruction.IPop());
|
17280
|
+
return;
|
17281
|
+
}
|
17005
17282
|
}
|
17006
17283
|
|
17007
17284
|
/* labelStart:
|
@@ -17204,6 +17481,8 @@ var Compiler = exports.Compiler = function () {
|
|
17204
17481
|
switch (pattern.tag) {
|
17205
17482
|
case _ast.N_PatternWildcard:
|
17206
17483
|
return this._compilePatternCheckWildcard(pattern, targetLabel);
|
17484
|
+
case _ast.N_PatternVariable:
|
17485
|
+
return this._compilePatternCheckVariable(pattern, targetLabel);
|
17207
17486
|
case _ast.N_PatternNumber:
|
17208
17487
|
return this._compilePatternCheckNumber(pattern, targetLabel);
|
17209
17488
|
case _ast.N_PatternStructure:
|
@@ -17221,6 +17500,11 @@ var Compiler = exports.Compiler = function () {
|
|
17221
17500
|
value: function _compilePatternCheckWildcard(pattern, targetLabel) {
|
17222
17501
|
this._produce(pattern.startPos, pattern.endPos, new _instruction.IJump(targetLabel));
|
17223
17502
|
}
|
17503
|
+
}, {
|
17504
|
+
key: '_compilePatternCheckVariable',
|
17505
|
+
value: function _compilePatternCheckVariable(pattern, targetLabel) {
|
17506
|
+
this._produce(pattern.startPos, pattern.endPos, new _instruction.IJump(targetLabel));
|
17507
|
+
}
|
17224
17508
|
}, {
|
17225
17509
|
key: '_compilePatternCheckNumber',
|
17226
17510
|
value: function _compilePatternCheckNumber(pattern, targetLabel) {
|
@@ -17245,14 +17529,14 @@ var Compiler = exports.Compiler = function () {
|
|
17245
17529
|
/* Check that the type of the value coincides with the type
|
17246
17530
|
* of the tuple */
|
17247
17531
|
var anys = [];
|
17248
|
-
for (var i = 0; i < pattern.
|
17532
|
+
for (var i = 0; i < pattern.boundVariables.length; i++) {
|
17249
17533
|
anys.push(new _value.TypeAny());
|
17250
17534
|
}
|
17251
17535
|
var expectedType = new _value.TypeTuple(anys);
|
17252
17536
|
this._produce(pattern.startPos, pattern.endPos, new _instruction.ITypeCheck(expectedType));
|
17253
17537
|
|
17254
17538
|
/* Jump if the value matches */
|
17255
|
-
this._produce(pattern.startPos, pattern.endPos, new _instruction.IJumpIfTuple(pattern.
|
17539
|
+
this._produce(pattern.startPos, pattern.endPos, new _instruction.IJumpIfTuple(pattern.boundVariables.length, targetLabel));
|
17256
17540
|
}
|
17257
17541
|
}, {
|
17258
17542
|
key: '_compilePatternCheckTimeout',
|
@@ -17262,7 +17546,8 @@ var Compiler = exports.Compiler = function () {
|
|
17262
17546
|
|
17263
17547
|
/* Pattern binding are instructions that bind the parameters
|
17264
17548
|
* of a pattern to the corresponding parts of the value currently
|
17265
|
-
* at the top of the stack.
|
17549
|
+
* at the top of the stack. The value at the top of the stack
|
17550
|
+
* is never popped (it must be duplicated if necessary).
|
17266
17551
|
*/
|
17267
17552
|
|
17268
17553
|
}, {
|
@@ -17271,6 +17556,9 @@ var Compiler = exports.Compiler = function () {
|
|
17271
17556
|
switch (pattern.tag) {
|
17272
17557
|
case _ast.N_PatternWildcard:
|
17273
17558
|
return; /* No parameters to bind */
|
17559
|
+
case _ast.N_PatternVariable:
|
17560
|
+
this._compilePatternBindVariable(pattern);
|
17561
|
+
return;
|
17274
17562
|
case _ast.N_PatternNumber:
|
17275
17563
|
return; /* No parameters to bind */
|
17276
17564
|
case _ast.N_PatternStructure:
|
@@ -17285,29 +17573,34 @@ var Compiler = exports.Compiler = function () {
|
|
17285
17573
|
throw Error('Compiler: Pattern binding not implemented: ' + Symbol.keyFor(pattern.tag));
|
17286
17574
|
}
|
17287
17575
|
}
|
17576
|
+
}, {
|
17577
|
+
key: '_compilePatternBindVariable',
|
17578
|
+
value: function _compilePatternBindVariable(pattern) {
|
17579
|
+
this._produceList(pattern.startPos, pattern.endPos, [new _instruction.IDup(), new _instruction.ISetVariable(pattern.variableName.value)]);
|
17580
|
+
}
|
17288
17581
|
}, {
|
17289
17582
|
key: '_compilePatternBindStructure',
|
17290
17583
|
value: function _compilePatternBindStructure(pattern) {
|
17291
|
-
/* Allow pattern with no parameters, even if the constructor
|
17584
|
+
/* Allow structure pattern with no parameters, even if the constructor
|
17292
17585
|
* has parameters */
|
17293
|
-
if (pattern.
|
17586
|
+
if (pattern.boundVariables.length === 0) {
|
17294
17587
|
return;
|
17295
17588
|
}
|
17296
17589
|
|
17297
17590
|
var constructorName = pattern.constructorName.value;
|
17298
17591
|
var fieldNames = this._symtable.constructorFields(constructorName);
|
17299
17592
|
for (var i = 0; i < fieldNames.length; i++) {
|
17300
|
-
var
|
17593
|
+
var variable = pattern.boundVariables[i];
|
17301
17594
|
var fieldName = fieldNames[i];
|
17302
|
-
this._produceList(pattern.startPos, pattern.endPos, [new _instruction.IReadStructureField(fieldName), new _instruction.ISetVariable(
|
17595
|
+
this._produceList(pattern.startPos, pattern.endPos, [new _instruction.IReadStructureField(fieldName), new _instruction.ISetVariable(variable.value)]);
|
17303
17596
|
}
|
17304
17597
|
}
|
17305
17598
|
}, {
|
17306
17599
|
key: '_compilePatternBindTuple',
|
17307
17600
|
value: function _compilePatternBindTuple(pattern) {
|
17308
|
-
for (var index = 0; index < pattern.
|
17309
|
-
var
|
17310
|
-
this._produceList(pattern.startPos, pattern.endPos, [new _instruction.IReadTupleComponent(index), new _instruction.ISetVariable(
|
17601
|
+
for (var index = 0; index < pattern.boundVariables.length; index++) {
|
17602
|
+
var variable = pattern.boundVariables[index];
|
17603
|
+
this._produceList(pattern.startPos, pattern.endPos, [new _instruction.IReadTupleComponent(index), new _instruction.ISetVariable(variable.value)]);
|
17311
17604
|
}
|
17312
17605
|
}
|
17313
17606
|
|
@@ -17317,35 +17610,15 @@ var Compiler = exports.Compiler = function () {
|
|
17317
17610
|
}, {
|
17318
17611
|
key: '_compilePatternUnbind',
|
17319
17612
|
value: function _compilePatternUnbind(pattern) {
|
17320
|
-
switch (pattern.tag) {
|
17321
|
-
case _ast.N_PatternWildcard:
|
17322
|
-
return; /* No parameters to unbind */
|
17323
|
-
case _ast.N_PatternNumber:
|
17324
|
-
return; /* No parameters to unbind */
|
17325
|
-
case _ast.N_PatternStructure:
|
17326
|
-
this._compilePatternUnbindStructure(pattern);
|
17327
|
-
return;
|
17328
|
-
case _ast.N_PatternTuple:
|
17329
|
-
this._compilePatternUnbindTuple(pattern);
|
17330
|
-
return;
|
17331
|
-
case _ast.N_PatternTimeout:
|
17332
|
-
return; /* No parameters to unbind */
|
17333
|
-
default:
|
17334
|
-
throw Error('Compiler: Pattern unbinding not implemented: ' + Symbol.keyFor(pattern.tag));
|
17335
|
-
}
|
17336
|
-
}
|
17337
|
-
}, {
|
17338
|
-
key: '_compilePatternUnbindStructure',
|
17339
|
-
value: function _compilePatternUnbindStructure(pattern) {
|
17340
17613
|
var _iteratorNormalCompletion6 = true;
|
17341
17614
|
var _didIteratorError6 = false;
|
17342
17615
|
var _iteratorError6 = undefined;
|
17343
17616
|
|
17344
17617
|
try {
|
17345
|
-
for (var _iterator6 = pattern.
|
17346
|
-
var
|
17618
|
+
for (var _iterator6 = pattern.boundVariables[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
|
17619
|
+
var variable = _step6.value;
|
17347
17620
|
|
17348
|
-
this._produceList(pattern.startPos, pattern.endPos, [new _instruction.IUnsetVariable(
|
17621
|
+
this._produceList(pattern.startPos, pattern.endPos, [new _instruction.IUnsetVariable(variable.value)]);
|
17349
17622
|
}
|
17350
17623
|
} catch (err) {
|
17351
17624
|
_didIteratorError6 = true;
|
@@ -17362,34 +17635,6 @@ var Compiler = exports.Compiler = function () {
|
|
17362
17635
|
}
|
17363
17636
|
}
|
17364
17637
|
}
|
17365
|
-
}, {
|
17366
|
-
key: '_compilePatternUnbindTuple',
|
17367
|
-
value: function _compilePatternUnbindTuple(pattern) {
|
17368
|
-
var _iteratorNormalCompletion7 = true;
|
17369
|
-
var _didIteratorError7 = false;
|
17370
|
-
var _iteratorError7 = undefined;
|
17371
|
-
|
17372
|
-
try {
|
17373
|
-
for (var _iterator7 = pattern.parameters[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
|
17374
|
-
var parameter = _step7.value;
|
17375
|
-
|
17376
|
-
this._produceList(pattern.startPos, pattern.endPos, [new _instruction.IUnsetVariable(parameter.value)]);
|
17377
|
-
}
|
17378
|
-
} catch (err) {
|
17379
|
-
_didIteratorError7 = true;
|
17380
|
-
_iteratorError7 = err;
|
17381
|
-
} finally {
|
17382
|
-
try {
|
17383
|
-
if (!_iteratorNormalCompletion7 && _iterator7.return) {
|
17384
|
-
_iterator7.return();
|
17385
|
-
}
|
17386
|
-
} finally {
|
17387
|
-
if (_didIteratorError7) {
|
17388
|
-
throw _iteratorError7;
|
17389
|
-
}
|
17390
|
-
}
|
17391
|
-
}
|
17392
|
-
}
|
17393
17638
|
|
17394
17639
|
/* Expressions are compiled to instructions that make the size
|
17395
17640
|
* of the local stack grow in exactly one.
|
@@ -17489,27 +17734,27 @@ var Compiler = exports.Compiler = function () {
|
|
17489
17734
|
}, {
|
17490
17735
|
key: '_compileExprList',
|
17491
17736
|
value: function _compileExprList(expression) {
|
17492
|
-
var
|
17493
|
-
var
|
17494
|
-
var
|
17737
|
+
var _iteratorNormalCompletion7 = true;
|
17738
|
+
var _didIteratorError7 = false;
|
17739
|
+
var _iteratorError7 = undefined;
|
17495
17740
|
|
17496
17741
|
try {
|
17497
|
-
for (var
|
17498
|
-
var element =
|
17742
|
+
for (var _iterator7 = expression.elements[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
|
17743
|
+
var element = _step7.value;
|
17499
17744
|
|
17500
17745
|
this._compileExpression(element);
|
17501
17746
|
}
|
17502
17747
|
} catch (err) {
|
17503
|
-
|
17504
|
-
|
17748
|
+
_didIteratorError7 = true;
|
17749
|
+
_iteratorError7 = err;
|
17505
17750
|
} finally {
|
17506
17751
|
try {
|
17507
|
-
if (!
|
17508
|
-
|
17752
|
+
if (!_iteratorNormalCompletion7 && _iterator7.return) {
|
17753
|
+
_iterator7.return();
|
17509
17754
|
}
|
17510
17755
|
} finally {
|
17511
|
-
if (
|
17512
|
-
throw
|
17756
|
+
if (_didIteratorError7) {
|
17757
|
+
throw _iteratorError7;
|
17513
17758
|
}
|
17514
17759
|
}
|
17515
17760
|
}
|
@@ -17539,27 +17784,27 @@ var Compiler = exports.Compiler = function () {
|
|
17539
17784
|
}, {
|
17540
17785
|
key: '_compileExprTuple',
|
17541
17786
|
value: function _compileExprTuple(expression) {
|
17542
|
-
var
|
17543
|
-
var
|
17544
|
-
var
|
17787
|
+
var _iteratorNormalCompletion8 = true;
|
17788
|
+
var _didIteratorError8 = false;
|
17789
|
+
var _iteratorError8 = undefined;
|
17545
17790
|
|
17546
17791
|
try {
|
17547
|
-
for (var
|
17548
|
-
var element =
|
17792
|
+
for (var _iterator8 = expression.elements[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
|
17793
|
+
var element = _step8.value;
|
17549
17794
|
|
17550
17795
|
this._compileExpression(element);
|
17551
17796
|
}
|
17552
17797
|
} catch (err) {
|
17553
|
-
|
17554
|
-
|
17798
|
+
_didIteratorError8 = true;
|
17799
|
+
_iteratorError8 = err;
|
17555
17800
|
} finally {
|
17556
17801
|
try {
|
17557
|
-
if (!
|
17558
|
-
|
17802
|
+
if (!_iteratorNormalCompletion8 && _iterator8.return) {
|
17803
|
+
_iterator8.return();
|
17559
17804
|
}
|
17560
17805
|
} finally {
|
17561
|
-
if (
|
17562
|
-
throw
|
17806
|
+
if (_didIteratorError8) {
|
17807
|
+
throw _iteratorError8;
|
17563
17808
|
}
|
17564
17809
|
}
|
17565
17810
|
}
|
@@ -17570,28 +17815,28 @@ var Compiler = exports.Compiler = function () {
|
|
17570
17815
|
key: '_compileExprStructure',
|
17571
17816
|
value: function _compileExprStructure(expression) {
|
17572
17817
|
var fieldNames = [];
|
17573
|
-
var
|
17574
|
-
var
|
17575
|
-
var
|
17818
|
+
var _iteratorNormalCompletion9 = true;
|
17819
|
+
var _didIteratorError9 = false;
|
17820
|
+
var _iteratorError9 = undefined;
|
17576
17821
|
|
17577
17822
|
try {
|
17578
|
-
for (var
|
17579
|
-
var fieldBinding =
|
17823
|
+
for (var _iterator9 = expression.fieldBindings[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
|
17824
|
+
var fieldBinding = _step9.value;
|
17580
17825
|
|
17581
17826
|
this._compileExpression(fieldBinding.value);
|
17582
17827
|
fieldNames.push(fieldBinding.fieldName.value);
|
17583
17828
|
}
|
17584
17829
|
} catch (err) {
|
17585
|
-
|
17586
|
-
|
17830
|
+
_didIteratorError9 = true;
|
17831
|
+
_iteratorError9 = err;
|
17587
17832
|
} finally {
|
17588
17833
|
try {
|
17589
|
-
if (!
|
17590
|
-
|
17834
|
+
if (!_iteratorNormalCompletion9 && _iterator9.return) {
|
17835
|
+
_iterator9.return();
|
17591
17836
|
}
|
17592
17837
|
} finally {
|
17593
|
-
if (
|
17594
|
-
throw
|
17838
|
+
if (_didIteratorError9) {
|
17839
|
+
throw _iteratorError9;
|
17595
17840
|
}
|
17596
17841
|
}
|
17597
17842
|
}
|
@@ -17605,28 +17850,28 @@ var Compiler = exports.Compiler = function () {
|
|
17605
17850
|
value: function _compileExprStructureUpdate(expression) {
|
17606
17851
|
this._compileExpression(expression.original);
|
17607
17852
|
var fieldNames = [];
|
17608
|
-
var
|
17609
|
-
var
|
17610
|
-
var
|
17853
|
+
var _iteratorNormalCompletion10 = true;
|
17854
|
+
var _didIteratorError10 = false;
|
17855
|
+
var _iteratorError10 = undefined;
|
17611
17856
|
|
17612
17857
|
try {
|
17613
|
-
for (var
|
17614
|
-
var fieldBinding =
|
17858
|
+
for (var _iterator10 = expression.fieldBindings[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
|
17859
|
+
var fieldBinding = _step10.value;
|
17615
17860
|
|
17616
17861
|
this._compileExpression(fieldBinding.value);
|
17617
17862
|
fieldNames.push(fieldBinding.fieldName.value);
|
17618
17863
|
}
|
17619
17864
|
} catch (err) {
|
17620
|
-
|
17621
|
-
|
17865
|
+
_didIteratorError10 = true;
|
17866
|
+
_iteratorError10 = err;
|
17622
17867
|
} finally {
|
17623
17868
|
try {
|
17624
|
-
if (!
|
17625
|
-
|
17869
|
+
if (!_iteratorNormalCompletion10 && _iterator10.return) {
|
17870
|
+
_iterator10.return();
|
17626
17871
|
}
|
17627
17872
|
} finally {
|
17628
|
-
if (
|
17629
|
-
throw
|
17873
|
+
if (_didIteratorError10) {
|
17874
|
+
throw _iteratorError10;
|
17630
17875
|
}
|
17631
17876
|
}
|
17632
17877
|
}
|
@@ -17653,27 +17898,27 @@ var Compiler = exports.Compiler = function () {
|
|
17653
17898
|
} else if (functionName === '||') {
|
17654
17899
|
this._compileExprFunctionCallOr(expression);
|
17655
17900
|
} else {
|
17656
|
-
var
|
17657
|
-
var
|
17658
|
-
var
|
17901
|
+
var _iteratorNormalCompletion11 = true;
|
17902
|
+
var _didIteratorError11 = false;
|
17903
|
+
var _iteratorError11 = undefined;
|
17659
17904
|
|
17660
17905
|
try {
|
17661
|
-
for (var
|
17662
|
-
var argument =
|
17906
|
+
for (var _iterator11 = expression.args[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {
|
17907
|
+
var argument = _step11.value;
|
17663
17908
|
|
17664
17909
|
this._compileExpression(argument);
|
17665
17910
|
}
|
17666
17911
|
} catch (err) {
|
17667
|
-
|
17668
|
-
|
17912
|
+
_didIteratorError11 = true;
|
17913
|
+
_iteratorError11 = err;
|
17669
17914
|
} finally {
|
17670
17915
|
try {
|
17671
|
-
if (!
|
17672
|
-
|
17916
|
+
if (!_iteratorNormalCompletion11 && _iterator11.return) {
|
17917
|
+
_iterator11.return();
|
17673
17918
|
}
|
17674
17919
|
} finally {
|
17675
|
-
if (
|
17676
|
-
throw
|
17920
|
+
if (_didIteratorError11) {
|
17921
|
+
throw _iteratorError11;
|
17677
17922
|
}
|
17678
17923
|
}
|
17679
17924
|
}
|
@@ -17762,27 +18007,27 @@ var Compiler = exports.Compiler = function () {
|
|
17762
18007
|
}, {
|
17763
18008
|
key: '_produceList',
|
17764
18009
|
value: function _produceList(startPos, endPos, instructions) {
|
17765
|
-
var
|
17766
|
-
var
|
17767
|
-
var
|
18010
|
+
var _iteratorNormalCompletion12 = true;
|
18011
|
+
var _didIteratorError12 = false;
|
18012
|
+
var _iteratorError12 = undefined;
|
17768
18013
|
|
17769
18014
|
try {
|
17770
|
-
for (var
|
17771
|
-
var instruction =
|
18015
|
+
for (var _iterator12 = instructions[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
|
18016
|
+
var instruction = _step12.value;
|
17772
18017
|
|
17773
18018
|
this._produce(startPos, endPos, instruction);
|
17774
18019
|
}
|
17775
18020
|
} catch (err) {
|
17776
|
-
|
17777
|
-
|
18021
|
+
_didIteratorError12 = true;
|
18022
|
+
_iteratorError12 = err;
|
17778
18023
|
} finally {
|
17779
18024
|
try {
|
17780
|
-
if (!
|
17781
|
-
|
18025
|
+
if (!_iteratorNormalCompletion12 && _iterator12.return) {
|
18026
|
+
_iterator12.return();
|
17782
18027
|
}
|
17783
18028
|
} finally {
|
17784
|
-
if (
|
17785
|
-
throw
|
18029
|
+
if (_didIteratorError12) {
|
18030
|
+
throw _iteratorError12;
|
17786
18031
|
}
|
17787
18032
|
}
|
17788
18033
|
}
|