jass 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/jass.rb +5 -0
- data/lib/jass/compiler.rb +5 -0
- data/lib/jass/plugin.rb +2 -1
- data/lib/jass/version.rb +1 -1
- data/vendor/node_modules/@types/estree/index.d.ts +4 -2
- data/vendor/node_modules/@types/estree/package.json +2 -2
- data/vendor/node_modules/acorn/bin/_acorn.js +12 -12
- data/vendor/node_modules/acorn/bin/run_test262.js +2 -3
- data/vendor/node_modules/acorn/bin/test262.whitelist +0 -5
- data/vendor/node_modules/acorn/dist/acorn.es.js +76 -68
- data/vendor/node_modules/acorn/dist/acorn.js +76 -68
- data/vendor/node_modules/acorn/dist/acorn_loose.es.js +42 -30
- data/vendor/node_modules/acorn/dist/acorn_loose.js +42 -30
- data/vendor/node_modules/acorn/dist/walk.es.js +47 -43
- data/vendor/node_modules/acorn/dist/walk.js +47 -43
- data/vendor/node_modules/acorn/package.json +9 -5
- data/vendor/node_modules/chalk/index.js.flow +93 -0
- data/vendor/node_modules/chalk/package.json +8 -3
- data/vendor/node_modules/color-convert/conversions.js +36 -29
- data/vendor/node_modules/color-convert/package.json +4 -4
- data/vendor/node_modules/estree-walker/index.d.ts +17 -0
- data/vendor/node_modules/estree-walker/package.json +2 -1
- data/vendor/node_modules/fill-range/index.js +2 -2
- data/vendor/node_modules/fill-range/package.json +24 -7
- data/vendor/node_modules/is-reference/node_modules/@types/estree/index.d.ts +546 -0
- data/vendor/node_modules/is-reference/node_modules/@types/estree/package.json +22 -0
- data/vendor/node_modules/math-random/browser.js +17 -0
- data/vendor/node_modules/math-random/node.js +13 -0
- data/vendor/node_modules/math-random/package.json +31 -0
- data/vendor/node_modules/math-random/test.js +26 -0
- data/vendor/node_modules/nodent-compiler/compiler.js +115 -11
- data/vendor/node_modules/nodent-compiler/{lib/output.js → output.js} +0 -0
- data/vendor/node_modules/nodent-compiler/package.json +8 -4
- data/vendor/node_modules/{nodent-compiler/lib → nodent-transform}/arboriculture.js +1340 -1107
- data/vendor/node_modules/nodent-transform/package.json +19 -0
- data/vendor/node_modules/path-parse/package.json +1 -1
- data/vendor/node_modules/pretty-ms/index.js +2 -1
- data/vendor/node_modules/pretty-ms/package.json +2 -3
- data/vendor/node_modules/randomatic/index.js +12 -2
- data/vendor/node_modules/randomatic/node_modules/is-number/index.js +6 -7
- data/vendor/node_modules/randomatic/node_modules/is-number/package.json +9 -16
- data/vendor/node_modules/randomatic/node_modules/kind-of/index.js +112 -102
- data/vendor/node_modules/randomatic/node_modules/kind-of/package.json +18 -20
- data/vendor/node_modules/randomatic/package.json +15 -13
- data/vendor/node_modules/repeat-element/index.js +1 -1
- data/vendor/node_modules/repeat-element/package.json +27 -22
- data/vendor/node_modules/resolve/lib/async.js +20 -17
- data/vendor/node_modules/resolve/lib/core.js +2 -2
- data/vendor/node_modules/resolve/lib/core.json +4 -1
- data/vendor/node_modules/resolve/lib/sync.js +52 -13
- data/vendor/node_modules/resolve/package.json +3 -3
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js +50 -12
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js +50 -12
- data/vendor/node_modules/rollup-plugin-commonjs/package.json +2 -2
- data/vendor/node_modules/rollup-plugin-commonjs/src/index.js +49 -11
- data/vendor/node_modules/rollup-plugin-commonjs/src/transform.js +1 -1
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js +82 -85
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.es.js +82 -85
- data/vendor/node_modules/rollup-plugin-node-resolve/package.json +1 -1
- data/vendor/node_modules/rollup-plugin-node-resolve/src/index.js +81 -84
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +81 -2
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js +81 -3
- data/vendor/node_modules/rollup-pluginutils/package.json +12 -6
- data/vendor/node_modules/rollup-pluginutils/src/attachScopes.js +10 -2
- data/vendor/node_modules/rollup-pluginutils/src/dataToEsm.js +69 -0
- data/vendor/node_modules/rollup-pluginutils/src/index.js +1 -0
- data/vendor/node_modules/supports-color/index.js +1 -5
- data/vendor/node_modules/supports-color/package.json +51 -51
- data/vendor/yarn.lock +65 -70
- metadata +16 -21
- data/vendor/node_modules/irregular-plurals/irregular-plurals.json +0 -146
- data/vendor/node_modules/irregular-plurals/package.json +0 -39
- data/vendor/node_modules/nodent-compiler/lib/parser.js +0 -291
- data/vendor/node_modules/path-parse/index.min.js +0 -1
- data/vendor/node_modules/path-parse/test.min.js +0 -1
- data/vendor/node_modules/plur/index.js +0 -20
- data/vendor/node_modules/plur/package.json +0 -42
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js +0 -116
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json +0 -90
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js +0 -217
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es.js +0 -55
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es6.js +0 -59
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js +0 -65
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/package.json +0 -33
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/src/estree-walker.js +0 -49
|
@@ -24,6 +24,7 @@ var LooseParser = function LooseParser(input, options) {
|
|
|
24
24
|
this.curLineStart = 0;
|
|
25
25
|
this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
|
|
26
26
|
this.inAsync = false;
|
|
27
|
+
this.inFunction = false;
|
|
27
28
|
// Load plugins
|
|
28
29
|
this.options.pluginsLoose = options.pluginsLoose || {};
|
|
29
30
|
this.loadPlugins(this.options.pluginsLoose);
|
|
@@ -110,7 +111,7 @@ LooseParser.prototype.expect = function expect (type) {
|
|
|
110
111
|
|
|
111
112
|
if (this.eat(type)) { return true }
|
|
112
113
|
for (var i = 1; i <= 2; i++) {
|
|
113
|
-
if (this$1.lookAhead(i).type
|
|
114
|
+
if (this$1.lookAhead(i).type === type) {
|
|
114
115
|
for (var j = 0; j < i; j++) { this$1.next(); }
|
|
115
116
|
return true
|
|
116
117
|
}
|
|
@@ -143,7 +144,7 @@ LooseParser.prototype.indentationAfter = function indentationAfter (pos) {
|
|
|
143
144
|
|
|
144
145
|
LooseParser.prototype.closes = function closes (closeTok, indent, line, blockHeuristic) {
|
|
145
146
|
if (this.tok.type === closeTok || this.tok.type === tokTypes.eof) { return true }
|
|
146
|
-
return line
|
|
147
|
+
return line !== this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
|
|
147
148
|
(!blockHeuristic || this.nextLineStart >= this.input.length ||
|
|
148
149
|
this.indentationAfter(this.nextLineStart) < indent)
|
|
149
150
|
};
|
|
@@ -294,7 +295,7 @@ lp.lookAhead = function(n) {
|
|
|
294
295
|
return this.ahead[n - 1]
|
|
295
296
|
};
|
|
296
297
|
|
|
297
|
-
function isDummy(node) { return node.name
|
|
298
|
+
function isDummy(node) { return node.name === "✖" }
|
|
298
299
|
|
|
299
300
|
var lp$1 = LooseParser.prototype;
|
|
300
301
|
|
|
@@ -436,9 +437,12 @@ lp$1.parseStatement = function() {
|
|
|
436
437
|
if (this.tok.type === tokTypes._catch) {
|
|
437
438
|
var clause = this.startNode();
|
|
438
439
|
this.next();
|
|
439
|
-
this.
|
|
440
|
-
|
|
441
|
-
|
|
440
|
+
if (this.eat(tokTypes.parenL)) {
|
|
441
|
+
clause.param = this.toAssignable(this.parseExprAtom(), true);
|
|
442
|
+
this.expect(tokTypes.parenR);
|
|
443
|
+
} else {
|
|
444
|
+
clause.param = null;
|
|
445
|
+
}
|
|
442
446
|
clause.body = this.parseBlock();
|
|
443
447
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
444
448
|
}
|
|
@@ -585,7 +589,7 @@ lp$1.parseClass = function(isStatement) {
|
|
|
585
589
|
this$1.parsePropertyName(method);
|
|
586
590
|
if (isDummy(method.key)) { if (isDummy(this$1.parseMaybeAssign())) { this$1.next(); } this$1.eat(tokTypes.comma); continue }
|
|
587
591
|
if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" &&
|
|
588
|
-
(this$1.tok.type
|
|
592
|
+
(this$1.tok.type !== tokTypes.parenL && this$1.tok.type !== tokTypes.braceL)) {
|
|
589
593
|
method.static = true;
|
|
590
594
|
isGenerator = this$1.eat(tokTypes.star);
|
|
591
595
|
this$1.parsePropertyName(method);
|
|
@@ -632,7 +636,7 @@ lp$1.parseClass = function(isStatement) {
|
|
|
632
636
|
};
|
|
633
637
|
|
|
634
638
|
lp$1.parseFunction = function(node, isStatement, isAsync) {
|
|
635
|
-
var oldInAsync = this.inAsync;
|
|
639
|
+
var oldInAsync = this.inAsync, oldInFunction = this.inFunction;
|
|
636
640
|
this.initFunction(node);
|
|
637
641
|
if (this.options.ecmaVersion >= 6) {
|
|
638
642
|
node.generator = this.eat(tokTypes.star);
|
|
@@ -643,10 +647,12 @@ lp$1.parseFunction = function(node, isStatement, isAsync) {
|
|
|
643
647
|
if (this.tok.type === tokTypes.name) { node.id = this.parseIdent(); }
|
|
644
648
|
else if (isStatement === true) { node.id = this.dummyIdent(); }
|
|
645
649
|
this.inAsync = node.async;
|
|
650
|
+
this.inFunction = true;
|
|
646
651
|
node.params = this.parseFunctionParams();
|
|
647
652
|
node.body = this.parseBlock();
|
|
648
653
|
this.toks.adaptDirectivePrologue(node.body.body);
|
|
649
654
|
this.inAsync = oldInAsync;
|
|
655
|
+
this.inFunction = oldInFunction;
|
|
650
656
|
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
|
|
651
657
|
};
|
|
652
658
|
|
|
@@ -701,7 +707,7 @@ lp$1.parseImport = function() {
|
|
|
701
707
|
this.eat(tokTypes.comma);
|
|
702
708
|
}
|
|
703
709
|
node.specifiers = this.parseImportSpecifierList();
|
|
704
|
-
node.source = this.eatContextual("from") && this.tok.type
|
|
710
|
+
node.source = this.eatContextual("from") && this.tok.type === tokTypes.string ? this.parseExprAtom() : this.dummyString();
|
|
705
711
|
if (elt) { node.specifiers.unshift(elt); }
|
|
706
712
|
}
|
|
707
713
|
this.semicolon();
|
|
@@ -811,7 +817,7 @@ lp$2.parseMaybeAssign = function(noIn) {
|
|
|
811
817
|
if (this.toks.isContextual("yield")) {
|
|
812
818
|
var node = this.startNode();
|
|
813
819
|
this.next();
|
|
814
|
-
if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type
|
|
820
|
+
if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type !== tokTypes.star && !this.tok.type.startsExpr)) {
|
|
815
821
|
node.delegate = false;
|
|
816
822
|
node.argument = null;
|
|
817
823
|
} else {
|
|
@@ -854,7 +860,7 @@ lp$2.parseExprOps = function(noIn) {
|
|
|
854
860
|
};
|
|
855
861
|
|
|
856
862
|
lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
|
|
857
|
-
if (this.curLineStart
|
|
863
|
+
if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) { return left }
|
|
858
864
|
var prec = this.tok.type.binop;
|
|
859
865
|
if (prec != null && (!noIn || this.tok.type !== tokTypes._in)) {
|
|
860
866
|
if (prec > minPrec) {
|
|
@@ -862,7 +868,7 @@ lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
|
|
|
862
868
|
node.left = left;
|
|
863
869
|
node.operator = this.tok.value;
|
|
864
870
|
this.next();
|
|
865
|
-
if (this.curLineStart
|
|
871
|
+
if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) {
|
|
866
872
|
node.right = this.dummyIdent();
|
|
867
873
|
} else {
|
|
868
874
|
var rightStart = this.storeCurrentPos();
|
|
@@ -879,7 +885,9 @@ lp$2.parseMaybeUnary = function(sawUnary) {
|
|
|
879
885
|
var this$1 = this;
|
|
880
886
|
|
|
881
887
|
var start = this.storeCurrentPos(), expr;
|
|
882
|
-
if (this.options.ecmaVersion >= 8 && this.
|
|
888
|
+
if (this.options.ecmaVersion >= 8 && this.toks.isContextual("await") &&
|
|
889
|
+
(this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))
|
|
890
|
+
) {
|
|
883
891
|
expr = this.parseAwait();
|
|
884
892
|
sawUnary = true;
|
|
885
893
|
} else if (this.tok.type.prefix) {
|
|
@@ -928,8 +936,8 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
|
|
|
928
936
|
var this$1 = this;
|
|
929
937
|
|
|
930
938
|
for (;;) {
|
|
931
|
-
if (this$1.curLineStart
|
|
932
|
-
if (this$1.tok.type
|
|
939
|
+
if (this$1.curLineStart !== line && this$1.curIndent <= startIndent && this$1.tokenStartsLine()) {
|
|
940
|
+
if (this$1.tok.type === tokTypes.dot && this$1.curIndent === startIndent)
|
|
933
941
|
{ --startIndent; }
|
|
934
942
|
else
|
|
935
943
|
{ return base }
|
|
@@ -940,13 +948,13 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
|
|
|
940
948
|
if (this$1.eat(tokTypes.dot)) {
|
|
941
949
|
var node = this$1.startNodeAt(start);
|
|
942
950
|
node.object = base;
|
|
943
|
-
if (this$1.curLineStart
|
|
951
|
+
if (this$1.curLineStart !== line && this$1.curIndent <= startIndent && this$1.tokenStartsLine())
|
|
944
952
|
{ node.property = this$1.dummyIdent(); }
|
|
945
953
|
else
|
|
946
954
|
{ node.property = this$1.parsePropertyAccessor() || this$1.dummyIdent(); }
|
|
947
955
|
node.computed = false;
|
|
948
956
|
base = this$1.finishNode(node, "MemberExpression");
|
|
949
|
-
} else if (this$1.tok.type
|
|
957
|
+
} else if (this$1.tok.type === tokTypes.bracketL) {
|
|
950
958
|
this$1.pushCx();
|
|
951
959
|
this$1.next();
|
|
952
960
|
var node$1 = this$1.startNodeAt(start);
|
|
@@ -956,7 +964,7 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
|
|
|
956
964
|
this$1.popCx();
|
|
957
965
|
this$1.expect(tokTypes.bracketR);
|
|
958
966
|
base = this$1.finishNode(node$1, "MemberExpression");
|
|
959
|
-
} else if (!noCalls && this$1.tok.type
|
|
967
|
+
} else if (!noCalls && this$1.tok.type === tokTypes.parenL) {
|
|
960
968
|
var exprList = this$1.parseExprList(tokTypes.parenR);
|
|
961
969
|
if (maybeAsyncArrow && this$1.eat(tokTypes.arrow))
|
|
962
970
|
{ return this$1.parseArrowExpression(this$1.startNodeAt(start), exprList, true) }
|
|
@@ -964,7 +972,7 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
|
|
|
964
972
|
node$2.callee = base;
|
|
965
973
|
node$2.arguments = exprList;
|
|
966
974
|
base = this$1.finishNode(node$2, "CallExpression");
|
|
967
|
-
} else if (this$1.tok.type
|
|
975
|
+
} else if (this$1.tok.type === tokTypes.backQuote) {
|
|
968
976
|
var node$3 = this$1.startNodeAt(start);
|
|
969
977
|
node$3.tag = base;
|
|
970
978
|
node$3.quasi = this$1.parseTemplate();
|
|
@@ -1078,7 +1086,7 @@ lp$2.parseNew = function() {
|
|
|
1078
1086
|
}
|
|
1079
1087
|
var start = this.storeCurrentPos();
|
|
1080
1088
|
node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line);
|
|
1081
|
-
if (this.tok.type
|
|
1089
|
+
if (this.tok.type === tokTypes.parenL) {
|
|
1082
1090
|
node.arguments = this.parseExprList(tokTypes.parenR);
|
|
1083
1091
|
} else {
|
|
1084
1092
|
node.arguments = [];
|
|
@@ -1172,7 +1180,7 @@ lp$2.parseObj = function() {
|
|
|
1172
1180
|
prop.value = this$1.parseMethod(isGenerator, isAsync);
|
|
1173
1181
|
} else if (this$1.options.ecmaVersion >= 5 && prop.key.type === "Identifier" &&
|
|
1174
1182
|
!prop.computed && (prop.key.name === "get" || prop.key.name === "set") &&
|
|
1175
|
-
(this$1.tok.type
|
|
1183
|
+
(this$1.tok.type !== tokTypes.comma && this$1.tok.type !== tokTypes.braceR && this$1.tok.type !== tokTypes.eq)) {
|
|
1176
1184
|
prop.kind = prop.key.name;
|
|
1177
1185
|
this$1.parsePropertyName(prop);
|
|
1178
1186
|
prop.value = this$1.parseMethod(false);
|
|
@@ -1251,13 +1259,13 @@ lp$2.initFunction = function(node) {
|
|
|
1251
1259
|
lp$2.toAssignable = function(node, binding) {
|
|
1252
1260
|
var this$1 = this;
|
|
1253
1261
|
|
|
1254
|
-
if (!node || node.type
|
|
1262
|
+
if (!node || node.type === "Identifier" || (node.type === "MemberExpression" && !binding)) {
|
|
1255
1263
|
// Okay
|
|
1256
|
-
} else if (node.type
|
|
1264
|
+
} else if (node.type === "ParenthesizedExpression") {
|
|
1257
1265
|
this.toAssignable(node.expression, binding);
|
|
1258
1266
|
} else if (this.options.ecmaVersion < 6) {
|
|
1259
1267
|
return this.dummyIdent()
|
|
1260
|
-
} else if (node.type
|
|
1268
|
+
} else if (node.type === "ObjectExpression") {
|
|
1261
1269
|
node.type = "ObjectPattern";
|
|
1262
1270
|
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
|
1263
1271
|
{
|
|
@@ -1265,15 +1273,15 @@ lp$2.toAssignable = function(node, binding) {
|
|
|
1265
1273
|
|
|
1266
1274
|
this$1.toAssignable(prop, binding);
|
|
1267
1275
|
}
|
|
1268
|
-
} else if (node.type
|
|
1276
|
+
} else if (node.type === "ArrayExpression") {
|
|
1269
1277
|
node.type = "ArrayPattern";
|
|
1270
1278
|
this.toAssignableList(node.elements, binding);
|
|
1271
|
-
} else if (node.type
|
|
1279
|
+
} else if (node.type === "Property") {
|
|
1272
1280
|
this.toAssignable(node.value, binding);
|
|
1273
|
-
} else if (node.type
|
|
1281
|
+
} else if (node.type === "SpreadElement") {
|
|
1274
1282
|
node.type = "RestElement";
|
|
1275
1283
|
this.toAssignable(node.argument, binding);
|
|
1276
|
-
} else if (node.type
|
|
1284
|
+
} else if (node.type === "AssignmentExpression") {
|
|
1277
1285
|
node.type = "AssignmentPattern";
|
|
1278
1286
|
delete node.operator;
|
|
1279
1287
|
} else {
|
|
@@ -1300,26 +1308,29 @@ lp$2.parseFunctionParams = function(params) {
|
|
|
1300
1308
|
};
|
|
1301
1309
|
|
|
1302
1310
|
lp$2.parseMethod = function(isGenerator, isAsync) {
|
|
1303
|
-
var node = this.startNode(), oldInAsync = this.inAsync;
|
|
1311
|
+
var node = this.startNode(), oldInAsync = this.inAsync, oldInFunction = this.inFunction;
|
|
1304
1312
|
this.initFunction(node);
|
|
1305
1313
|
if (this.options.ecmaVersion >= 6)
|
|
1306
1314
|
{ node.generator = !!isGenerator; }
|
|
1307
1315
|
if (this.options.ecmaVersion >= 8)
|
|
1308
1316
|
{ node.async = !!isAsync; }
|
|
1309
1317
|
this.inAsync = node.async;
|
|
1318
|
+
this.inFunction = true;
|
|
1310
1319
|
node.params = this.parseFunctionParams();
|
|
1311
1320
|
node.body = this.parseBlock();
|
|
1312
1321
|
this.toks.adaptDirectivePrologue(node.body.body);
|
|
1313
1322
|
this.inAsync = oldInAsync;
|
|
1323
|
+
this.inFunction = oldInFunction;
|
|
1314
1324
|
return this.finishNode(node, "FunctionExpression")
|
|
1315
1325
|
};
|
|
1316
1326
|
|
|
1317
1327
|
lp$2.parseArrowExpression = function(node, params, isAsync) {
|
|
1318
|
-
var oldInAsync = this.inAsync;
|
|
1328
|
+
var oldInAsync = this.inAsync, oldInFunction = this.inFunction;
|
|
1319
1329
|
this.initFunction(node);
|
|
1320
1330
|
if (this.options.ecmaVersion >= 8)
|
|
1321
1331
|
{ node.async = !!isAsync; }
|
|
1322
1332
|
this.inAsync = node.async;
|
|
1333
|
+
this.inFunction = true;
|
|
1323
1334
|
node.params = this.toAssignableList(params, true);
|
|
1324
1335
|
node.expression = this.tok.type !== tokTypes.braceL;
|
|
1325
1336
|
if (node.expression) {
|
|
@@ -1329,6 +1340,7 @@ lp$2.parseArrowExpression = function(node, params, isAsync) {
|
|
|
1329
1340
|
this.toks.adaptDirectivePrologue(node.body.body);
|
|
1330
1341
|
}
|
|
1331
1342
|
this.inAsync = oldInAsync;
|
|
1343
|
+
this.inFunction = oldInFunction;
|
|
1332
1344
|
return this.finishNode(node, "ArrowFunctionExpression")
|
|
1333
1345
|
};
|
|
1334
1346
|
|
|
@@ -28,6 +28,7 @@ var LooseParser = function LooseParser(input, options) {
|
|
|
28
28
|
this.curLineStart = 0;
|
|
29
29
|
this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
|
|
30
30
|
this.inAsync = false;
|
|
31
|
+
this.inFunction = false;
|
|
31
32
|
// Load plugins
|
|
32
33
|
this.options.pluginsLoose = options.pluginsLoose || {};
|
|
33
34
|
this.loadPlugins(this.options.pluginsLoose);
|
|
@@ -114,7 +115,7 @@ LooseParser.prototype.expect = function expect (type) {
|
|
|
114
115
|
|
|
115
116
|
if (this.eat(type)) { return true }
|
|
116
117
|
for (var i = 1; i <= 2; i++) {
|
|
117
|
-
if (this$1.lookAhead(i).type
|
|
118
|
+
if (this$1.lookAhead(i).type === type) {
|
|
118
119
|
for (var j = 0; j < i; j++) { this$1.next(); }
|
|
119
120
|
return true
|
|
120
121
|
}
|
|
@@ -147,7 +148,7 @@ LooseParser.prototype.indentationAfter = function indentationAfter (pos) {
|
|
|
147
148
|
|
|
148
149
|
LooseParser.prototype.closes = function closes (closeTok, indent, line, blockHeuristic) {
|
|
149
150
|
if (this.tok.type === closeTok || this.tok.type === __acorn.tokTypes.eof) { return true }
|
|
150
|
-
return line
|
|
151
|
+
return line !== this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
|
|
151
152
|
(!blockHeuristic || this.nextLineStart >= this.input.length ||
|
|
152
153
|
this.indentationAfter(this.nextLineStart) < indent)
|
|
153
154
|
};
|
|
@@ -298,7 +299,7 @@ lp.lookAhead = function(n) {
|
|
|
298
299
|
return this.ahead[n - 1]
|
|
299
300
|
};
|
|
300
301
|
|
|
301
|
-
function isDummy(node) { return node.name
|
|
302
|
+
function isDummy(node) { return node.name === "✖" }
|
|
302
303
|
|
|
303
304
|
var lp$1 = LooseParser.prototype;
|
|
304
305
|
|
|
@@ -440,9 +441,12 @@ lp$1.parseStatement = function() {
|
|
|
440
441
|
if (this.tok.type === __acorn.tokTypes._catch) {
|
|
441
442
|
var clause = this.startNode();
|
|
442
443
|
this.next();
|
|
443
|
-
this.
|
|
444
|
-
|
|
445
|
-
|
|
444
|
+
if (this.eat(__acorn.tokTypes.parenL)) {
|
|
445
|
+
clause.param = this.toAssignable(this.parseExprAtom(), true);
|
|
446
|
+
this.expect(__acorn.tokTypes.parenR);
|
|
447
|
+
} else {
|
|
448
|
+
clause.param = null;
|
|
449
|
+
}
|
|
446
450
|
clause.body = this.parseBlock();
|
|
447
451
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
448
452
|
}
|
|
@@ -589,7 +593,7 @@ lp$1.parseClass = function(isStatement) {
|
|
|
589
593
|
this$1.parsePropertyName(method);
|
|
590
594
|
if (isDummy(method.key)) { if (isDummy(this$1.parseMaybeAssign())) { this$1.next(); } this$1.eat(__acorn.tokTypes.comma); continue }
|
|
591
595
|
if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" &&
|
|
592
|
-
(this$1.tok.type
|
|
596
|
+
(this$1.tok.type !== __acorn.tokTypes.parenL && this$1.tok.type !== __acorn.tokTypes.braceL)) {
|
|
593
597
|
method.static = true;
|
|
594
598
|
isGenerator = this$1.eat(__acorn.tokTypes.star);
|
|
595
599
|
this$1.parsePropertyName(method);
|
|
@@ -636,7 +640,7 @@ lp$1.parseClass = function(isStatement) {
|
|
|
636
640
|
};
|
|
637
641
|
|
|
638
642
|
lp$1.parseFunction = function(node, isStatement, isAsync) {
|
|
639
|
-
var oldInAsync = this.inAsync;
|
|
643
|
+
var oldInAsync = this.inAsync, oldInFunction = this.inFunction;
|
|
640
644
|
this.initFunction(node);
|
|
641
645
|
if (this.options.ecmaVersion >= 6) {
|
|
642
646
|
node.generator = this.eat(__acorn.tokTypes.star);
|
|
@@ -647,10 +651,12 @@ lp$1.parseFunction = function(node, isStatement, isAsync) {
|
|
|
647
651
|
if (this.tok.type === __acorn.tokTypes.name) { node.id = this.parseIdent(); }
|
|
648
652
|
else if (isStatement === true) { node.id = this.dummyIdent(); }
|
|
649
653
|
this.inAsync = node.async;
|
|
654
|
+
this.inFunction = true;
|
|
650
655
|
node.params = this.parseFunctionParams();
|
|
651
656
|
node.body = this.parseBlock();
|
|
652
657
|
this.toks.adaptDirectivePrologue(node.body.body);
|
|
653
658
|
this.inAsync = oldInAsync;
|
|
659
|
+
this.inFunction = oldInFunction;
|
|
654
660
|
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
|
|
655
661
|
};
|
|
656
662
|
|
|
@@ -705,7 +711,7 @@ lp$1.parseImport = function() {
|
|
|
705
711
|
this.eat(__acorn.tokTypes.comma);
|
|
706
712
|
}
|
|
707
713
|
node.specifiers = this.parseImportSpecifierList();
|
|
708
|
-
node.source = this.eatContextual("from") && this.tok.type
|
|
714
|
+
node.source = this.eatContextual("from") && this.tok.type === __acorn.tokTypes.string ? this.parseExprAtom() : this.dummyString();
|
|
709
715
|
if (elt) { node.specifiers.unshift(elt); }
|
|
710
716
|
}
|
|
711
717
|
this.semicolon();
|
|
@@ -815,7 +821,7 @@ lp$2.parseMaybeAssign = function(noIn) {
|
|
|
815
821
|
if (this.toks.isContextual("yield")) {
|
|
816
822
|
var node = this.startNode();
|
|
817
823
|
this.next();
|
|
818
|
-
if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type
|
|
824
|
+
if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type !== __acorn.tokTypes.star && !this.tok.type.startsExpr)) {
|
|
819
825
|
node.delegate = false;
|
|
820
826
|
node.argument = null;
|
|
821
827
|
} else {
|
|
@@ -858,7 +864,7 @@ lp$2.parseExprOps = function(noIn) {
|
|
|
858
864
|
};
|
|
859
865
|
|
|
860
866
|
lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
|
|
861
|
-
if (this.curLineStart
|
|
867
|
+
if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) { return left }
|
|
862
868
|
var prec = this.tok.type.binop;
|
|
863
869
|
if (prec != null && (!noIn || this.tok.type !== __acorn.tokTypes._in)) {
|
|
864
870
|
if (prec > minPrec) {
|
|
@@ -866,7 +872,7 @@ lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
|
|
|
866
872
|
node.left = left;
|
|
867
873
|
node.operator = this.tok.value;
|
|
868
874
|
this.next();
|
|
869
|
-
if (this.curLineStart
|
|
875
|
+
if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) {
|
|
870
876
|
node.right = this.dummyIdent();
|
|
871
877
|
} else {
|
|
872
878
|
var rightStart = this.storeCurrentPos();
|
|
@@ -883,7 +889,9 @@ lp$2.parseMaybeUnary = function(sawUnary) {
|
|
|
883
889
|
var this$1 = this;
|
|
884
890
|
|
|
885
891
|
var start = this.storeCurrentPos(), expr;
|
|
886
|
-
if (this.options.ecmaVersion >= 8 && this.
|
|
892
|
+
if (this.options.ecmaVersion >= 8 && this.toks.isContextual("await") &&
|
|
893
|
+
(this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))
|
|
894
|
+
) {
|
|
887
895
|
expr = this.parseAwait();
|
|
888
896
|
sawUnary = true;
|
|
889
897
|
} else if (this.tok.type.prefix) {
|
|
@@ -932,8 +940,8 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
|
|
|
932
940
|
var this$1 = this;
|
|
933
941
|
|
|
934
942
|
for (;;) {
|
|
935
|
-
if (this$1.curLineStart
|
|
936
|
-
if (this$1.tok.type
|
|
943
|
+
if (this$1.curLineStart !== line && this$1.curIndent <= startIndent && this$1.tokenStartsLine()) {
|
|
944
|
+
if (this$1.tok.type === __acorn.tokTypes.dot && this$1.curIndent === startIndent)
|
|
937
945
|
{ --startIndent; }
|
|
938
946
|
else
|
|
939
947
|
{ return base }
|
|
@@ -944,13 +952,13 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
|
|
|
944
952
|
if (this$1.eat(__acorn.tokTypes.dot)) {
|
|
945
953
|
var node = this$1.startNodeAt(start);
|
|
946
954
|
node.object = base;
|
|
947
|
-
if (this$1.curLineStart
|
|
955
|
+
if (this$1.curLineStart !== line && this$1.curIndent <= startIndent && this$1.tokenStartsLine())
|
|
948
956
|
{ node.property = this$1.dummyIdent(); }
|
|
949
957
|
else
|
|
950
958
|
{ node.property = this$1.parsePropertyAccessor() || this$1.dummyIdent(); }
|
|
951
959
|
node.computed = false;
|
|
952
960
|
base = this$1.finishNode(node, "MemberExpression");
|
|
953
|
-
} else if (this$1.tok.type
|
|
961
|
+
} else if (this$1.tok.type === __acorn.tokTypes.bracketL) {
|
|
954
962
|
this$1.pushCx();
|
|
955
963
|
this$1.next();
|
|
956
964
|
var node$1 = this$1.startNodeAt(start);
|
|
@@ -960,7 +968,7 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
|
|
|
960
968
|
this$1.popCx();
|
|
961
969
|
this$1.expect(__acorn.tokTypes.bracketR);
|
|
962
970
|
base = this$1.finishNode(node$1, "MemberExpression");
|
|
963
|
-
} else if (!noCalls && this$1.tok.type
|
|
971
|
+
} else if (!noCalls && this$1.tok.type === __acorn.tokTypes.parenL) {
|
|
964
972
|
var exprList = this$1.parseExprList(__acorn.tokTypes.parenR);
|
|
965
973
|
if (maybeAsyncArrow && this$1.eat(__acorn.tokTypes.arrow))
|
|
966
974
|
{ return this$1.parseArrowExpression(this$1.startNodeAt(start), exprList, true) }
|
|
@@ -968,7 +976,7 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
|
|
|
968
976
|
node$2.callee = base;
|
|
969
977
|
node$2.arguments = exprList;
|
|
970
978
|
base = this$1.finishNode(node$2, "CallExpression");
|
|
971
|
-
} else if (this$1.tok.type
|
|
979
|
+
} else if (this$1.tok.type === __acorn.tokTypes.backQuote) {
|
|
972
980
|
var node$3 = this$1.startNodeAt(start);
|
|
973
981
|
node$3.tag = base;
|
|
974
982
|
node$3.quasi = this$1.parseTemplate();
|
|
@@ -1082,7 +1090,7 @@ lp$2.parseNew = function() {
|
|
|
1082
1090
|
}
|
|
1083
1091
|
var start = this.storeCurrentPos();
|
|
1084
1092
|
node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line);
|
|
1085
|
-
if (this.tok.type
|
|
1093
|
+
if (this.tok.type === __acorn.tokTypes.parenL) {
|
|
1086
1094
|
node.arguments = this.parseExprList(__acorn.tokTypes.parenR);
|
|
1087
1095
|
} else {
|
|
1088
1096
|
node.arguments = [];
|
|
@@ -1176,7 +1184,7 @@ lp$2.parseObj = function() {
|
|
|
1176
1184
|
prop.value = this$1.parseMethod(isGenerator, isAsync);
|
|
1177
1185
|
} else if (this$1.options.ecmaVersion >= 5 && prop.key.type === "Identifier" &&
|
|
1178
1186
|
!prop.computed && (prop.key.name === "get" || prop.key.name === "set") &&
|
|
1179
|
-
(this$1.tok.type
|
|
1187
|
+
(this$1.tok.type !== __acorn.tokTypes.comma && this$1.tok.type !== __acorn.tokTypes.braceR && this$1.tok.type !== __acorn.tokTypes.eq)) {
|
|
1180
1188
|
prop.kind = prop.key.name;
|
|
1181
1189
|
this$1.parsePropertyName(prop);
|
|
1182
1190
|
prop.value = this$1.parseMethod(false);
|
|
@@ -1255,13 +1263,13 @@ lp$2.initFunction = function(node) {
|
|
|
1255
1263
|
lp$2.toAssignable = function(node, binding) {
|
|
1256
1264
|
var this$1 = this;
|
|
1257
1265
|
|
|
1258
|
-
if (!node || node.type
|
|
1266
|
+
if (!node || node.type === "Identifier" || (node.type === "MemberExpression" && !binding)) {
|
|
1259
1267
|
// Okay
|
|
1260
|
-
} else if (node.type
|
|
1268
|
+
} else if (node.type === "ParenthesizedExpression") {
|
|
1261
1269
|
this.toAssignable(node.expression, binding);
|
|
1262
1270
|
} else if (this.options.ecmaVersion < 6) {
|
|
1263
1271
|
return this.dummyIdent()
|
|
1264
|
-
} else if (node.type
|
|
1272
|
+
} else if (node.type === "ObjectExpression") {
|
|
1265
1273
|
node.type = "ObjectPattern";
|
|
1266
1274
|
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
|
1267
1275
|
{
|
|
@@ -1269,15 +1277,15 @@ lp$2.toAssignable = function(node, binding) {
|
|
|
1269
1277
|
|
|
1270
1278
|
this$1.toAssignable(prop, binding);
|
|
1271
1279
|
}
|
|
1272
|
-
} else if (node.type
|
|
1280
|
+
} else if (node.type === "ArrayExpression") {
|
|
1273
1281
|
node.type = "ArrayPattern";
|
|
1274
1282
|
this.toAssignableList(node.elements, binding);
|
|
1275
|
-
} else if (node.type
|
|
1283
|
+
} else if (node.type === "Property") {
|
|
1276
1284
|
this.toAssignable(node.value, binding);
|
|
1277
|
-
} else if (node.type
|
|
1285
|
+
} else if (node.type === "SpreadElement") {
|
|
1278
1286
|
node.type = "RestElement";
|
|
1279
1287
|
this.toAssignable(node.argument, binding);
|
|
1280
|
-
} else if (node.type
|
|
1288
|
+
} else if (node.type === "AssignmentExpression") {
|
|
1281
1289
|
node.type = "AssignmentPattern";
|
|
1282
1290
|
delete node.operator;
|
|
1283
1291
|
} else {
|
|
@@ -1304,26 +1312,29 @@ lp$2.parseFunctionParams = function(params) {
|
|
|
1304
1312
|
};
|
|
1305
1313
|
|
|
1306
1314
|
lp$2.parseMethod = function(isGenerator, isAsync) {
|
|
1307
|
-
var node = this.startNode(), oldInAsync = this.inAsync;
|
|
1315
|
+
var node = this.startNode(), oldInAsync = this.inAsync, oldInFunction = this.inFunction;
|
|
1308
1316
|
this.initFunction(node);
|
|
1309
1317
|
if (this.options.ecmaVersion >= 6)
|
|
1310
1318
|
{ node.generator = !!isGenerator; }
|
|
1311
1319
|
if (this.options.ecmaVersion >= 8)
|
|
1312
1320
|
{ node.async = !!isAsync; }
|
|
1313
1321
|
this.inAsync = node.async;
|
|
1322
|
+
this.inFunction = true;
|
|
1314
1323
|
node.params = this.parseFunctionParams();
|
|
1315
1324
|
node.body = this.parseBlock();
|
|
1316
1325
|
this.toks.adaptDirectivePrologue(node.body.body);
|
|
1317
1326
|
this.inAsync = oldInAsync;
|
|
1327
|
+
this.inFunction = oldInFunction;
|
|
1318
1328
|
return this.finishNode(node, "FunctionExpression")
|
|
1319
1329
|
};
|
|
1320
1330
|
|
|
1321
1331
|
lp$2.parseArrowExpression = function(node, params, isAsync) {
|
|
1322
|
-
var oldInAsync = this.inAsync;
|
|
1332
|
+
var oldInAsync = this.inAsync, oldInFunction = this.inFunction;
|
|
1323
1333
|
this.initFunction(node);
|
|
1324
1334
|
if (this.options.ecmaVersion >= 8)
|
|
1325
1335
|
{ node.async = !!isAsync; }
|
|
1326
1336
|
this.inAsync = node.async;
|
|
1337
|
+
this.inFunction = true;
|
|
1327
1338
|
node.params = this.toAssignableList(params, true);
|
|
1328
1339
|
node.expression = this.tok.type !== __acorn.tokTypes.braceL;
|
|
1329
1340
|
if (node.expression) {
|
|
@@ -1333,6 +1344,7 @@ lp$2.parseArrowExpression = function(node, params, isAsync) {
|
|
|
1333
1344
|
this.toks.adaptDirectivePrologue(node.body.body);
|
|
1334
1345
|
}
|
|
1335
1346
|
this.inAsync = oldInAsync;
|
|
1347
|
+
this.inFunction = oldInFunction;
|
|
1336
1348
|
return this.finishNode(node, "ArrowFunctionExpression")
|
|
1337
1349
|
};
|
|
1338
1350
|
|