@tinacms/app 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/appFiles/node_modules/.package-lock.json +16 -16
- package/appFiles/node_modules/@babel/generator/lib/buffer.js +1 -16
- package/appFiles/node_modules/@babel/generator/lib/buffer.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/base.js +0 -2
- package/appFiles/node_modules/@babel/generator/lib/generators/base.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/classes.js +0 -6
- package/appFiles/node_modules/@babel/generator/lib/generators/classes.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/expressions.js +1 -6
- package/appFiles/node_modules/@babel/generator/lib/generators/expressions.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/flow.js +0 -2
- package/appFiles/node_modules/@babel/generator/lib/generators/flow.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/methods.js +4 -11
- package/appFiles/node_modules/@babel/generator/lib/generators/methods.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/modules.js +0 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/modules.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/statements.js +0 -3
- package/appFiles/node_modules/@babel/generator/lib/generators/statements.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/types.js +1 -5
- package/appFiles/node_modules/@babel/generator/lib/generators/types.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/generators/typescript.js +2 -4
- package/appFiles/node_modules/@babel/generator/lib/generators/typescript.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/index.js +0 -6
- package/appFiles/node_modules/@babel/generator/lib/index.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/node/index.js +0 -1
- package/appFiles/node_modules/@babel/generator/lib/node/index.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/node/parentheses.js +3 -14
- package/appFiles/node_modules/@babel/generator/lib/node/parentheses.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/node/whitespace.js +1 -15
- package/appFiles/node_modules/@babel/generator/lib/node/whitespace.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/printer.js +5 -45
- package/appFiles/node_modules/@babel/generator/lib/printer.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/lib/source-map.js +0 -4
- package/appFiles/node_modules/@babel/generator/lib/source-map.js.map +1 -1
- package/appFiles/node_modules/@babel/generator/package.json +2 -2
- package/appFiles/node_modules/@babel/parser/lib/index.js +147 -673
- package/appFiles/node_modules/@babel/parser/lib/index.js.map +1 -1
- package/appFiles/node_modules/@babel/parser/package.json +1 -1
- package/appFiles/node_modules/@babel/runtime/helpers/applyDecs2203.js +170 -167
- package/appFiles/node_modules/@babel/runtime/helpers/applyDecs2203R.js +188 -0
- package/appFiles/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js +170 -167
- package/appFiles/node_modules/@babel/runtime/helpers/esm/applyDecs2203R.js +187 -0
- package/appFiles/node_modules/@babel/runtime/package.json +10 -1
- package/appFiles/node_modules/@babel/traverse/lib/context.js +2 -14
- package/appFiles/node_modules/@babel/traverse/lib/context.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/index.js +1 -4
- package/appFiles/node_modules/@babel/traverse/lib/index.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/ancestry.js +0 -19
- package/appFiles/node_modules/@babel/traverse/lib/path/ancestry.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/comments.js +0 -2
- package/appFiles/node_modules/@babel/traverse/lib/path/comments.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/context.js +5 -21
- package/appFiles/node_modules/@babel/traverse/lib/path/context.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/conversion.js +6 -30
- package/appFiles/node_modules/@babel/traverse/lib/path/conversion.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/evaluation.js +14 -20
- package/appFiles/node_modules/@babel/traverse/lib/path/evaluation.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/family.js +3 -9
- package/appFiles/node_modules/@babel/traverse/lib/path/family.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/index.js +1 -6
- package/appFiles/node_modules/@babel/traverse/lib/path/index.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/inference/index.js +1 -9
- package/appFiles/node_modules/@babel/traverse/lib/path/inference/index.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js +1 -13
- package/appFiles/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/inference/inferers.js +2 -5
- package/appFiles/node_modules/@babel/traverse/lib/path/inference/inferers.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/introspection.js +16 -62
- package/appFiles/node_modules/@babel/traverse/lib/path/introspection.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/hoister.js +1 -22
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/hoister.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js +1 -7
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js +0 -2
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/virtual-types.js +0 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/lib/virtual-types.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/modification.js +7 -24
- package/appFiles/node_modules/@babel/traverse/lib/path/modification.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/removal.js +0 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/removal.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/path/replacement.js +2 -16
- package/appFiles/node_modules/@babel/traverse/lib/path/replacement.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/scope/binding.js +1 -6
- package/appFiles/node_modules/@babel/traverse/lib/scope/binding.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/scope/index.js +9 -53
- package/appFiles/node_modules/@babel/traverse/lib/scope/index.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/scope/lib/renamer.js +4 -8
- package/appFiles/node_modules/@babel/traverse/lib/scope/lib/renamer.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/lib/visitors.js +2 -23
- package/appFiles/node_modules/@babel/traverse/lib/visitors.js.map +1 -1
- package/appFiles/node_modules/@babel/traverse/package.json +2 -2
- package/appFiles/node_modules/css-to-react-native/README.md +4 -2
- package/appFiles/node_modules/css-to-react-native/index.js +13 -6
- package/appFiles/node_modules/css-to-react-native/package.json +2 -1
- package/appFiles/node_modules/css-to-react-native/src/__tests__/fontVariant.js +8 -0
- package/appFiles/node_modules/css-to-react-native/src/transforms/fontVariant.js +14 -0
- package/appFiles/node_modules/css-to-react-native/src/transforms/index.js +5 -7
- package/appFiles/src/fields/rich-text/monaco/index.tsx +12 -10
- package/appFiles/src/fields/rich-text/monaco/mdx.js +41 -35
- package/appFiles/src/lib/machines/document-machine.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -4
|
@@ -35,7 +35,6 @@ class SourceLocation {
|
|
|
35
35
|
this.end = end;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
38
|
function createPositionWithColumnOffset(position, columnOffset) {
|
|
40
39
|
const {
|
|
41
40
|
line,
|
|
@@ -51,12 +50,10 @@ var ParseErrorCode = {
|
|
|
51
50
|
};
|
|
52
51
|
const reflect = (keys, last = keys.length - 1) => ({
|
|
53
52
|
get() {
|
|
54
|
-
return keys.reduce((object, key) =>
|
|
55
|
-
object[key], this);
|
|
53
|
+
return keys.reduce((object, key) => object[key], this);
|
|
56
54
|
},
|
|
57
55
|
set(value) {
|
|
58
|
-
keys.reduce(
|
|
59
|
-
(item, key, i) => i === last ? item[key] = value : item[key], this);
|
|
56
|
+
keys.reduce((item, key, i) => i === last ? item[key] = value : item[key], this);
|
|
60
57
|
}
|
|
61
58
|
});
|
|
62
59
|
const instantiate = (constructor, properties, descriptors) => Object.keys(descriptors).map(key => [key, descriptors[key]]).filter(([, descriptor]) => !!descriptor).map(([key, descriptor]) => [key, typeof descriptor === "function" ? {
|
|
@@ -445,7 +442,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
445
442
|
}
|
|
446
443
|
return file;
|
|
447
444
|
}
|
|
448
|
-
|
|
449
445
|
parseRegExpLiteral({
|
|
450
446
|
pattern,
|
|
451
447
|
flags
|
|
@@ -453,9 +449,7 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
453
449
|
let regex = null;
|
|
454
450
|
try {
|
|
455
451
|
regex = new RegExp(pattern, flags);
|
|
456
|
-
} catch (e) {
|
|
457
|
-
}
|
|
458
|
-
|
|
452
|
+
} catch (e) {}
|
|
459
453
|
const node = this.estreeParseLiteral(regex);
|
|
460
454
|
node.regex = {
|
|
461
455
|
pattern,
|
|
@@ -463,7 +457,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
463
457
|
};
|
|
464
458
|
return node;
|
|
465
459
|
}
|
|
466
|
-
|
|
467
460
|
parseBigIntLiteral(value) {
|
|
468
461
|
let bigInt;
|
|
469
462
|
try {
|
|
@@ -475,7 +468,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
475
468
|
node.bigint = String(node.value || value);
|
|
476
469
|
return node;
|
|
477
470
|
}
|
|
478
|
-
|
|
479
471
|
parseDecimalLiteral(value) {
|
|
480
472
|
const decimal = null;
|
|
481
473
|
const node = this.estreeParseLiteral(decimal);
|
|
@@ -485,21 +477,18 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
485
477
|
estreeParseLiteral(value) {
|
|
486
478
|
return this.parseLiteral(value, "Literal");
|
|
487
479
|
}
|
|
488
|
-
|
|
489
480
|
parseStringLiteral(value) {
|
|
490
481
|
return this.estreeParseLiteral(value);
|
|
491
482
|
}
|
|
492
483
|
parseNumericLiteral(value) {
|
|
493
484
|
return this.estreeParseLiteral(value);
|
|
494
485
|
}
|
|
495
|
-
|
|
496
486
|
parseNullLiteral() {
|
|
497
487
|
return this.estreeParseLiteral(null);
|
|
498
488
|
}
|
|
499
489
|
parseBooleanLiteral(value) {
|
|
500
490
|
return this.estreeParseLiteral(value);
|
|
501
491
|
}
|
|
502
|
-
|
|
503
492
|
directiveToStmt(directive) {
|
|
504
493
|
const expression = directive.value;
|
|
505
494
|
delete directive.value;
|
|
@@ -513,7 +502,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
513
502
|
delete expression.extra;
|
|
514
503
|
return stmt;
|
|
515
504
|
}
|
|
516
|
-
|
|
517
505
|
initFunction(node, isAsync) {
|
|
518
506
|
super.initFunction(node, isAsync);
|
|
519
507
|
node.expression = false;
|
|
@@ -579,7 +567,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
579
567
|
}
|
|
580
568
|
return node.name;
|
|
581
569
|
}
|
|
582
|
-
|
|
583
570
|
parseLiteral(value, type) {
|
|
584
571
|
const node = super.parseLiteral(value, type);
|
|
585
572
|
node.raw = node.extra.raw;
|
|
@@ -590,20 +577,17 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
590
577
|
super.parseFunctionBody(node, allowExpression, isMethod);
|
|
591
578
|
node.expression = node.body.type !== "BlockStatement";
|
|
592
579
|
}
|
|
593
|
-
|
|
594
580
|
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
|
|
595
581
|
let funcNode = this.startNode();
|
|
596
582
|
funcNode.kind = node.kind;
|
|
597
|
-
funcNode = super.parseMethod(
|
|
598
|
-
funcNode, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
|
|
583
|
+
funcNode = super.parseMethod(funcNode, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
|
|
599
584
|
funcNode.type = "FunctionExpression";
|
|
600
585
|
delete funcNode.kind;
|
|
601
586
|
node.value = funcNode;
|
|
602
587
|
if (type === "ClassPrivateMethod") {
|
|
603
588
|
node.computed = false;
|
|
604
589
|
}
|
|
605
|
-
return this.finishNode(
|
|
606
|
-
node, "MethodDefinition");
|
|
590
|
+
return this.finishNode(node, "MethodDefinition");
|
|
607
591
|
}
|
|
608
592
|
parseClassProperty(...args) {
|
|
609
593
|
const propertyNode = super.parseClassProperty(...args);
|
|
@@ -695,8 +679,7 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
695
679
|
}
|
|
696
680
|
return node;
|
|
697
681
|
}
|
|
698
|
-
toReferencedArguments(node
|
|
699
|
-
) {
|
|
682
|
+
toReferencedArguments(node) {
|
|
700
683
|
if (node.type === "ImportExpression") {
|
|
701
684
|
return;
|
|
702
685
|
}
|
|
@@ -710,23 +693,19 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
710
693
|
node.exported = null;
|
|
711
694
|
break;
|
|
712
695
|
case "ExportNamedDeclaration":
|
|
713
|
-
if (node.specifiers.length === 1 &&
|
|
714
|
-
node.specifiers[0].type === "ExportNamespaceSpecifier") {
|
|
696
|
+
if (node.specifiers.length === 1 && node.specifiers[0].type === "ExportNamespaceSpecifier") {
|
|
715
697
|
node.type = "ExportAllDeclaration";
|
|
716
698
|
node.exported = node.specifiers[0].exported;
|
|
717
699
|
delete node.specifiers;
|
|
718
700
|
}
|
|
719
|
-
|
|
720
701
|
case "ExportDefaultDeclaration":
|
|
721
702
|
{
|
|
722
703
|
var _declaration$decorato;
|
|
723
704
|
const {
|
|
724
705
|
declaration
|
|
725
706
|
} = node;
|
|
726
|
-
if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && ((_declaration$decorato = declaration.decorators) == null ? void 0 : _declaration$decorato.length) > 0 &&
|
|
727
|
-
|
|
728
|
-
this.resetStartLocation(node,
|
|
729
|
-
exportStartLoc);
|
|
707
|
+
if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && ((_declaration$decorato = declaration.decorators) == null ? void 0 : _declaration$decorato.length) > 0 && declaration.start === node.start) {
|
|
708
|
+
this.resetStartLocation(node, exportStartLoc);
|
|
730
709
|
}
|
|
731
710
|
}
|
|
732
711
|
break;
|
|
@@ -739,7 +718,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
739
718
|
if (node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression") {
|
|
740
719
|
node.type = node.type.substring(8);
|
|
741
720
|
}
|
|
742
|
-
|
|
743
721
|
if (state.stop) {
|
|
744
722
|
const chain = this.startNodeAtNode(node);
|
|
745
723
|
chain.expression = node;
|
|
@@ -759,7 +737,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
759
737
|
isOptionalChain(node) {
|
|
760
738
|
return node.type === "ChainExpression";
|
|
761
739
|
}
|
|
762
|
-
|
|
763
740
|
isObjectProperty(node) {
|
|
764
741
|
return node.type === "Property" && node.kind === "init" && !node.method;
|
|
765
742
|
}
|
|
@@ -793,7 +770,6 @@ const types = {
|
|
|
793
770
|
j_cTag: new TokContext("</tag"),
|
|
794
771
|
j_expr: new TokContext("<tag>...</tag>", true)
|
|
795
772
|
};
|
|
796
|
-
|
|
797
773
|
{
|
|
798
774
|
types.template = new TokContext("`", true);
|
|
799
775
|
}
|
|
@@ -831,7 +807,6 @@ class ExportedTokenType {
|
|
|
831
807
|
}
|
|
832
808
|
}
|
|
833
809
|
}
|
|
834
|
-
|
|
835
810
|
const keywords$1 = new Map();
|
|
836
811
|
function createKeyword(name, options = {}) {
|
|
837
812
|
options.keyword = name;
|
|
@@ -875,7 +850,6 @@ function createKeywordLike(name, options = {}) {
|
|
|
875
850
|
tokenTypes.push(new ExportedTokenType("name", options));
|
|
876
851
|
return tokenTypeCounter;
|
|
877
852
|
}
|
|
878
|
-
|
|
879
853
|
const tt = {
|
|
880
854
|
bracketL: createToken("[", {
|
|
881
855
|
beforeExpr,
|
|
@@ -953,7 +927,6 @@ const tt = {
|
|
|
953
927
|
startsExpr
|
|
954
928
|
}),
|
|
955
929
|
interpreterDirective: createToken("#!..."),
|
|
956
|
-
|
|
957
930
|
eq: createToken("=", {
|
|
958
931
|
beforeExpr,
|
|
959
932
|
isAssign
|
|
@@ -974,7 +947,6 @@ const tt = {
|
|
|
974
947
|
beforeExpr,
|
|
975
948
|
isAssign
|
|
976
949
|
}),
|
|
977
|
-
|
|
978
950
|
incDec: createToken("++/--", {
|
|
979
951
|
prefix,
|
|
980
952
|
postfix,
|
|
@@ -1122,7 +1094,6 @@ const tt = {
|
|
|
1122
1094
|
_while: createKeyword("while", {
|
|
1123
1095
|
isLoop
|
|
1124
1096
|
}),
|
|
1125
|
-
|
|
1126
1097
|
_as: createKeywordLike("as", {
|
|
1127
1098
|
startsExpr
|
|
1128
1099
|
}),
|
|
@@ -1237,7 +1208,6 @@ const tt = {
|
|
|
1237
1208
|
name: createToken("name", {
|
|
1238
1209
|
startsExpr
|
|
1239
1210
|
}),
|
|
1240
|
-
|
|
1241
1211
|
string: createToken("string", {
|
|
1242
1212
|
startsExpr
|
|
1243
1213
|
}),
|
|
@@ -1353,10 +1323,8 @@ let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\
|
|
|
1353
1323
|
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
1354
1324
|
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
1355
1325
|
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
1356
|
-
|
|
1357
1326
|
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191];
|
|
1358
1327
|
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
1359
|
-
|
|
1360
1328
|
function isInAstralSet(code, set) {
|
|
1361
1329
|
let pos = 0x10000;
|
|
1362
1330
|
for (let i = 0, length = set.length; i < length; i += 2) {
|
|
@@ -1367,7 +1335,6 @@ function isInAstralSet(code, set) {
|
|
|
1367
1335
|
}
|
|
1368
1336
|
return false;
|
|
1369
1337
|
}
|
|
1370
|
-
|
|
1371
1338
|
function isIdentifierStart(code) {
|
|
1372
1339
|
if (code < 65) return code === 36;
|
|
1373
1340
|
if (code <= 90) return true;
|
|
@@ -1378,7 +1345,6 @@ function isIdentifierStart(code) {
|
|
|
1378
1345
|
}
|
|
1379
1346
|
return isInAstralSet(code, astralIdentifierStartCodes);
|
|
1380
1347
|
}
|
|
1381
|
-
|
|
1382
1348
|
function isIdentifierChar(code) {
|
|
1383
1349
|
if (code < 48) return code === 36;
|
|
1384
1350
|
if (code < 58) return true;
|
|
@@ -1400,19 +1366,15 @@ const reservedWords = {
|
|
|
1400
1366
|
const keywords = new Set(reservedWords.keyword);
|
|
1401
1367
|
const reservedWordsStrictSet = new Set(reservedWords.strict);
|
|
1402
1368
|
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
|
1403
|
-
|
|
1404
1369
|
function isReservedWord(word, inModule) {
|
|
1405
1370
|
return inModule && word === "await" || word === "enum";
|
|
1406
1371
|
}
|
|
1407
|
-
|
|
1408
1372
|
function isStrictReservedWord(word, inModule) {
|
|
1409
1373
|
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
|
1410
1374
|
}
|
|
1411
|
-
|
|
1412
1375
|
function isStrictBindOnlyReservedWord(word) {
|
|
1413
1376
|
return reservedWordsStrictBindSet.has(word);
|
|
1414
1377
|
}
|
|
1415
|
-
|
|
1416
1378
|
function isStrictBindReservedWord(word, inModule) {
|
|
1417
1379
|
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
|
1418
1380
|
}
|
|
@@ -1423,11 +1385,7 @@ function isKeyword(word) {
|
|
|
1423
1385
|
function isIteratorStart(current, next, next2) {
|
|
1424
1386
|
return current === 64 && next === 64 && isIdentifierStart(next2);
|
|
1425
1387
|
}
|
|
1426
|
-
|
|
1427
|
-
const reservedWordLikeSet = new Set(["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete",
|
|
1428
|
-
"implements", "interface", "let", "package", "private", "protected", "public", "static", "yield",
|
|
1429
|
-
"eval", "arguments",
|
|
1430
|
-
"enum", "await"]);
|
|
1388
|
+
const reservedWordLikeSet = new Set(["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "eval", "arguments", "enum", "await"]);
|
|
1431
1389
|
function canBeReservedWord(word) {
|
|
1432
1390
|
return reservedWordLikeSet.has(word);
|
|
1433
1391
|
}
|
|
@@ -1455,7 +1413,6 @@ const BIND_KIND_VALUE = 0b000000000001,
|
|
|
1455
1413
|
BIND_FLAGS_TS_EXPORT_ONLY = 0b0010000000000,
|
|
1456
1414
|
BIND_FLAGS_FLOW_DECLARE_FN = 0b0100000000000,
|
|
1457
1415
|
BIND_FLAGS_TS_IMPORT = 0b1000000000000;
|
|
1458
|
-
|
|
1459
1416
|
const BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_CLASS,
|
|
1460
1417
|
BIND_LEXICAL = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL | 0,
|
|
1461
1418
|
BIND_VAR = BIND_KIND_VALUE | 0 | BIND_SCOPE_VAR | 0,
|
|
@@ -1474,7 +1431,6 @@ const CLASS_ELEMENT_FLAG_STATIC = 0b100,
|
|
|
1474
1431
|
CLASS_ELEMENT_KIND_GETTER = 0b010,
|
|
1475
1432
|
CLASS_ELEMENT_KIND_SETTER = 0b001,
|
|
1476
1433
|
CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_KIND_SETTER;
|
|
1477
|
-
|
|
1478
1434
|
const CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FLAG_STATIC,
|
|
1479
1435
|
CLASS_ELEMENT_STATIC_SETTER = CLASS_ELEMENT_KIND_SETTER | CLASS_ELEMENT_FLAG_STATIC,
|
|
1480
1436
|
CLASS_ELEMENT_INSTANCE_GETTER = CLASS_ELEMENT_KIND_GETTER,
|
|
@@ -1482,7 +1438,6 @@ const CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FL
|
|
|
1482
1438
|
CLASS_ELEMENT_OTHER = 0;
|
|
1483
1439
|
|
|
1484
1440
|
class Scope {
|
|
1485
|
-
|
|
1486
1441
|
constructor(flags) {
|
|
1487
1442
|
this.var = new Set();
|
|
1488
1443
|
this.lexical = new Set();
|
|
@@ -1490,7 +1445,6 @@ class Scope {
|
|
|
1490
1445
|
this.flags = flags;
|
|
1491
1446
|
}
|
|
1492
1447
|
}
|
|
1493
|
-
|
|
1494
1448
|
class ScopeHandler {
|
|
1495
1449
|
constructor(parser, inModule) {
|
|
1496
1450
|
this.parser = void 0;
|
|
@@ -1548,7 +1502,6 @@ class ScopeHandler {
|
|
|
1548
1502
|
const scope = this.scopeStack.pop();
|
|
1549
1503
|
return scope.flags;
|
|
1550
1504
|
}
|
|
1551
|
-
|
|
1552
1505
|
treatFunctionsAsVarInScope(scope) {
|
|
1553
1506
|
return !!(scope.flags & (SCOPE_FUNCTION | SCOPE_STATIC_BLOCK) || !this.parser.inModule && scope.flags & SCOPE_PROGRAM);
|
|
1554
1507
|
}
|
|
@@ -1605,8 +1558,7 @@ class ScopeHandler {
|
|
|
1605
1558
|
name
|
|
1606
1559
|
} = id;
|
|
1607
1560
|
const topLevelScope = this.scopeStack[0];
|
|
1608
|
-
if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) &&
|
|
1609
|
-
!topLevelScope.functions.has(name)) {
|
|
1561
|
+
if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) && !topLevelScope.functions.has(name)) {
|
|
1610
1562
|
this.undefinedExports.set(name, id.loc.start);
|
|
1611
1563
|
}
|
|
1612
1564
|
}
|
|
@@ -1623,7 +1575,6 @@ class ScopeHandler {
|
|
|
1623
1575
|
}
|
|
1624
1576
|
}
|
|
1625
1577
|
}
|
|
1626
|
-
|
|
1627
1578
|
currentThisScopeFlags() {
|
|
1628
1579
|
for (let i = this.scopeStack.length - 1;; i--) {
|
|
1629
1580
|
const {
|
|
@@ -1705,7 +1656,6 @@ function setTrailingComments(node, comments) {
|
|
|
1705
1656
|
node.trailingComments.unshift(...comments);
|
|
1706
1657
|
}
|
|
1707
1658
|
}
|
|
1708
|
-
|
|
1709
1659
|
function setLeadingComments(node, comments) {
|
|
1710
1660
|
if (node.leadingComments === undefined) {
|
|
1711
1661
|
node.leadingComments = comments;
|
|
@@ -1713,7 +1663,6 @@ function setLeadingComments(node, comments) {
|
|
|
1713
1663
|
node.leadingComments.unshift(...comments);
|
|
1714
1664
|
}
|
|
1715
1665
|
}
|
|
1716
|
-
|
|
1717
1666
|
function setInnerComments(node, comments) {
|
|
1718
1667
|
if (node.innerComments === undefined) {
|
|
1719
1668
|
node.innerComments = comments;
|
|
@@ -1721,7 +1670,6 @@ function setInnerComments(node, comments) {
|
|
|
1721
1670
|
node.innerComments.unshift(...comments);
|
|
1722
1671
|
}
|
|
1723
1672
|
}
|
|
1724
|
-
|
|
1725
1673
|
function adjustInnerComments(node, elements, commentWS) {
|
|
1726
1674
|
let lastElement = null;
|
|
1727
1675
|
let i = elements.length;
|
|
@@ -1739,7 +1687,6 @@ class CommentsParser extends BaseParser {
|
|
|
1739
1687
|
if (this.filename) comment.loc.filename = this.filename;
|
|
1740
1688
|
this.state.comments.push(comment);
|
|
1741
1689
|
}
|
|
1742
|
-
|
|
1743
1690
|
processComment(node) {
|
|
1744
1691
|
const {
|
|
1745
1692
|
commentStack
|
|
@@ -1770,7 +1717,6 @@ class CommentsParser extends BaseParser {
|
|
|
1770
1717
|
}
|
|
1771
1718
|
}
|
|
1772
1719
|
}
|
|
1773
|
-
|
|
1774
1720
|
finalizeComment(commentWS) {
|
|
1775
1721
|
const {
|
|
1776
1722
|
comments
|
|
@@ -1825,7 +1771,6 @@ class CommentsParser extends BaseParser {
|
|
|
1825
1771
|
}
|
|
1826
1772
|
}
|
|
1827
1773
|
}
|
|
1828
|
-
|
|
1829
1774
|
finalizeRemainingComments() {
|
|
1830
1775
|
const {
|
|
1831
1776
|
commentStack
|
|
@@ -1835,7 +1780,6 @@ class CommentsParser extends BaseParser {
|
|
|
1835
1780
|
}
|
|
1836
1781
|
this.state.commentStack = [];
|
|
1837
1782
|
}
|
|
1838
|
-
|
|
1839
1783
|
resetPreviousNodeTrailingComments(node) {
|
|
1840
1784
|
const {
|
|
1841
1785
|
commentStack
|
|
@@ -1849,7 +1793,6 @@ class CommentsParser extends BaseParser {
|
|
|
1849
1793
|
commentWS.leadingNode = null;
|
|
1850
1794
|
}
|
|
1851
1795
|
}
|
|
1852
|
-
|
|
1853
1796
|
takeSurroundingComments(node, start, end) {
|
|
1854
1797
|
const {
|
|
1855
1798
|
commentStack
|
|
@@ -1874,7 +1817,6 @@ class CommentsParser extends BaseParser {
|
|
|
1874
1817
|
|
|
1875
1818
|
const lineBreak = /\r\n?|[\n\u2028\u2029]/;
|
|
1876
1819
|
const lineBreakG = new RegExp(lineBreak.source, "g");
|
|
1877
|
-
|
|
1878
1820
|
function isNewLine(code) {
|
|
1879
1821
|
switch (code) {
|
|
1880
1822
|
case 10:
|
|
@@ -1888,12 +1830,7 @@ function isNewLine(code) {
|
|
|
1888
1830
|
}
|
|
1889
1831
|
const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
1890
1832
|
const skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/y;
|
|
1891
|
-
|
|
1892
|
-
const skipWhiteSpaceToLineBreak = new RegExp(
|
|
1893
|
-
"(?=(" +
|
|
1894
|
-
skipWhiteSpaceInLine.source + "))\\1" +
|
|
1895
|
-
/(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source, "y");
|
|
1896
|
-
|
|
1833
|
+
const skipWhiteSpaceToLineBreak = new RegExp("(?=(" + skipWhiteSpaceInLine.source + "))\\1" + /(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source, "y");
|
|
1897
1834
|
function isWhitespace(code) {
|
|
1898
1835
|
switch (code) {
|
|
1899
1836
|
case 0x0009:
|
|
@@ -1988,7 +1925,6 @@ class State {
|
|
|
1988
1925
|
if (!skipArrays && Array.isArray(val)) {
|
|
1989
1926
|
val = val.slice();
|
|
1990
1927
|
}
|
|
1991
|
-
|
|
1992
1928
|
state[key] = val;
|
|
1993
1929
|
}
|
|
1994
1930
|
return state;
|
|
@@ -2085,7 +2021,6 @@ function isStringEnd(type, ch, input, pos) {
|
|
|
2085
2021
|
function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
2086
2022
|
const throwOnInvalid = !inTemplate;
|
|
2087
2023
|
pos++;
|
|
2088
|
-
|
|
2089
2024
|
const res = ch => ({
|
|
2090
2025
|
pos,
|
|
2091
2026
|
ch,
|
|
@@ -2209,7 +2144,6 @@ function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumS
|
|
|
2209
2144
|
};
|
|
2210
2145
|
errors.unexpectedNumericSeparator(pos, lineStart, curLine);
|
|
2211
2146
|
}
|
|
2212
|
-
|
|
2213
2147
|
++pos;
|
|
2214
2148
|
continue;
|
|
2215
2149
|
}
|
|
@@ -2289,7 +2223,6 @@ function buildPosition(pos, lineStart, curLine) {
|
|
|
2289
2223
|
return new Position(curLine, pos - lineStart, pos);
|
|
2290
2224
|
}
|
|
2291
2225
|
const VALID_REGEX_FLAGS = new Set([103, 109, 115, 105, 121, 117, 100, 118]);
|
|
2292
|
-
|
|
2293
2226
|
class Token {
|
|
2294
2227
|
constructor(state) {
|
|
2295
2228
|
this.type = state.type;
|
|
@@ -2299,9 +2232,7 @@ class Token {
|
|
|
2299
2232
|
this.loc = new SourceLocation(state.startLoc, state.endLoc);
|
|
2300
2233
|
}
|
|
2301
2234
|
}
|
|
2302
|
-
|
|
2303
2235
|
class Tokenizer extends CommentsParser {
|
|
2304
|
-
|
|
2305
2236
|
constructor(options, input) {
|
|
2306
2237
|
super();
|
|
2307
2238
|
this.isLookahead = void 0;
|
|
@@ -2353,7 +2284,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2353
2284
|
this.tokens.push(token);
|
|
2354
2285
|
++this.state.tokensLength;
|
|
2355
2286
|
}
|
|
2356
|
-
|
|
2357
2287
|
next() {
|
|
2358
2288
|
this.checkKeywordEscapes();
|
|
2359
2289
|
if (this.options.tokens) {
|
|
@@ -2372,11 +2302,9 @@ class Tokenizer extends CommentsParser {
|
|
|
2372
2302
|
return false;
|
|
2373
2303
|
}
|
|
2374
2304
|
}
|
|
2375
|
-
|
|
2376
2305
|
match(type) {
|
|
2377
2306
|
return this.state.type === type;
|
|
2378
2307
|
}
|
|
2379
|
-
|
|
2380
2308
|
createLookaheadState(state) {
|
|
2381
2309
|
return {
|
|
2382
2310
|
pos: state.pos,
|
|
@@ -2393,7 +2321,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2393
2321
|
curPosition: state.curPosition
|
|
2394
2322
|
};
|
|
2395
2323
|
}
|
|
2396
|
-
|
|
2397
2324
|
lookahead() {
|
|
2398
2325
|
const old = this.state;
|
|
2399
2326
|
this.state = this.createLookaheadState(old);
|
|
@@ -2424,7 +2351,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2424
2351
|
}
|
|
2425
2352
|
return cp;
|
|
2426
2353
|
}
|
|
2427
|
-
|
|
2428
2354
|
setStrict(strict) {
|
|
2429
2355
|
this.state.strict = strict;
|
|
2430
2356
|
if (strict) {
|
|
@@ -2437,7 +2363,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2437
2363
|
curContext() {
|
|
2438
2364
|
return this.state.context[this.state.context.length - 1];
|
|
2439
2365
|
}
|
|
2440
|
-
|
|
2441
2366
|
nextToken() {
|
|
2442
2367
|
this.skipSpace();
|
|
2443
2368
|
this.state.start = this.state.pos;
|
|
@@ -2448,7 +2373,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2448
2373
|
}
|
|
2449
2374
|
this.getTokenFromCode(this.codePointAtPos(this.state.pos));
|
|
2450
2375
|
}
|
|
2451
|
-
|
|
2452
2376
|
skipBlockComment(commentEnd) {
|
|
2453
2377
|
let startLoc;
|
|
2454
2378
|
if (!this.isLookahead) startLoc = this.state.curPosition();
|
|
@@ -2465,9 +2389,7 @@ class Tokenizer extends CommentsParser {
|
|
|
2465
2389
|
++this.state.curLine;
|
|
2466
2390
|
this.state.lineStart = lineBreakG.lastIndex;
|
|
2467
2391
|
}
|
|
2468
|
-
|
|
2469
2392
|
if (this.isLookahead) return;
|
|
2470
|
-
|
|
2471
2393
|
const comment = {
|
|
2472
2394
|
type: "CommentBlock",
|
|
2473
2395
|
value: this.input.slice(start + 2, end),
|
|
@@ -2488,9 +2410,7 @@ class Tokenizer extends CommentsParser {
|
|
|
2488
2410
|
ch = this.input.charCodeAt(this.state.pos);
|
|
2489
2411
|
}
|
|
2490
2412
|
}
|
|
2491
|
-
|
|
2492
2413
|
if (this.isLookahead) return;
|
|
2493
|
-
|
|
2494
2414
|
const end = this.state.pos;
|
|
2495
2415
|
const value = this.input.slice(start + startSkip, end);
|
|
2496
2416
|
const comment = {
|
|
@@ -2503,7 +2423,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2503
2423
|
if (this.options.tokens) this.pushToken(comment);
|
|
2504
2424
|
return comment;
|
|
2505
2425
|
}
|
|
2506
|
-
|
|
2507
2426
|
skipSpace() {
|
|
2508
2427
|
const spaceStart = this.state.pos;
|
|
2509
2428
|
const comments = [];
|
|
@@ -2593,7 +2512,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2593
2512
|
this.state.commentStack.push(commentWhitespace);
|
|
2594
2513
|
}
|
|
2595
2514
|
}
|
|
2596
|
-
|
|
2597
2515
|
finishToken(type, val) {
|
|
2598
2516
|
this.state.end = this.state.pos;
|
|
2599
2517
|
this.state.endLoc = this.state.curPosition();
|
|
@@ -2608,7 +2526,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2608
2526
|
this.state.type = type;
|
|
2609
2527
|
this.updateContext();
|
|
2610
2528
|
}
|
|
2611
|
-
|
|
2612
2529
|
readToken_numberSign() {
|
|
2613
2530
|
if (this.state.pos === 0 && this.readToken_interpreter()) {
|
|
2614
2531
|
return;
|
|
@@ -2682,13 +2599,11 @@ class Tokenizer extends CommentsParser {
|
|
|
2682
2599
|
let type = code === 42 ? 55 : 54;
|
|
2683
2600
|
let width = 1;
|
|
2684
2601
|
let next = this.input.charCodeAt(this.state.pos + 1);
|
|
2685
|
-
|
|
2686
2602
|
if (code === 42 && next === 42) {
|
|
2687
2603
|
width++;
|
|
2688
2604
|
next = this.input.charCodeAt(this.state.pos + 2);
|
|
2689
2605
|
type = 57;
|
|
2690
2606
|
}
|
|
2691
|
-
|
|
2692
2607
|
if (next === 61 && !this.state.inType) {
|
|
2693
2608
|
width++;
|
|
2694
2609
|
type = code === 37 ? 33 : 30;
|
|
@@ -2720,7 +2635,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2720
2635
|
this.finishToken(9);
|
|
2721
2636
|
return;
|
|
2722
2637
|
}
|
|
2723
|
-
|
|
2724
2638
|
if (this.hasPlugin("recordAndTuple") && next === 93) {
|
|
2725
2639
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
2726
2640
|
throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, {
|
|
@@ -2740,36 +2654,29 @@ class Tokenizer extends CommentsParser {
|
|
|
2740
2654
|
}
|
|
2741
2655
|
readToken_caret() {
|
|
2742
2656
|
const next = this.input.charCodeAt(this.state.pos + 1);
|
|
2743
|
-
|
|
2744
2657
|
if (next === 61 && !this.state.inType) {
|
|
2745
2658
|
this.finishOp(32, 2);
|
|
2746
|
-
}
|
|
2747
|
-
else if (next === 94 &&
|
|
2748
|
-
this.hasPlugin(["pipelineOperator", {
|
|
2659
|
+
} else if (next === 94 && this.hasPlugin(["pipelineOperator", {
|
|
2749
2660
|
proposal: "hack",
|
|
2750
2661
|
topicToken: "^^"
|
|
2751
2662
|
}])) {
|
|
2752
2663
|
this.finishOp(37, 2);
|
|
2753
|
-
|
|
2754
2664
|
const lookaheadCh = this.input.codePointAt(this.state.pos);
|
|
2755
2665
|
if (lookaheadCh === 94) {
|
|
2756
2666
|
throw this.unexpected();
|
|
2757
2667
|
}
|
|
2758
|
-
}
|
|
2759
|
-
else {
|
|
2668
|
+
} else {
|
|
2760
2669
|
this.finishOp(44, 1);
|
|
2761
2670
|
}
|
|
2762
2671
|
}
|
|
2763
2672
|
readToken_atSign() {
|
|
2764
2673
|
const next = this.input.charCodeAt(this.state.pos + 1);
|
|
2765
|
-
|
|
2766
2674
|
if (next === 64 && this.hasPlugin(["pipelineOperator", {
|
|
2767
2675
|
proposal: "hack",
|
|
2768
2676
|
topicToken: "@@"
|
|
2769
2677
|
}])) {
|
|
2770
2678
|
this.finishOp(38, 2);
|
|
2771
|
-
}
|
|
2772
|
-
else {
|
|
2679
|
+
} else {
|
|
2773
2680
|
this.finishOp(26, 1);
|
|
2774
2681
|
}
|
|
2775
2682
|
}
|
|
@@ -2856,11 +2763,9 @@ class Tokenizer extends CommentsParser {
|
|
|
2856
2763
|
}
|
|
2857
2764
|
getTokenFromCode(code) {
|
|
2858
2765
|
switch (code) {
|
|
2859
|
-
|
|
2860
2766
|
case 46:
|
|
2861
2767
|
this.readToken_dot();
|
|
2862
2768
|
return;
|
|
2863
|
-
|
|
2864
2769
|
case 40:
|
|
2865
2770
|
++this.state.pos;
|
|
2866
2771
|
this.finishToken(10);
|
|
@@ -2884,7 +2789,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2884
2789
|
at: this.state.curPosition()
|
|
2885
2790
|
});
|
|
2886
2791
|
}
|
|
2887
|
-
|
|
2888
2792
|
this.state.pos += 2;
|
|
2889
2793
|
this.finishToken(2);
|
|
2890
2794
|
} else {
|
|
@@ -2903,7 +2807,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2903
2807
|
at: this.state.curPosition()
|
|
2904
2808
|
});
|
|
2905
2809
|
}
|
|
2906
|
-
|
|
2907
2810
|
this.state.pos += 2;
|
|
2908
2811
|
this.finishToken(6);
|
|
2909
2812
|
} else {
|
|
@@ -2956,12 +2859,10 @@ class Tokenizer extends CommentsParser {
|
|
|
2956
2859
|
case 57:
|
|
2957
2860
|
this.readNumber(false);
|
|
2958
2861
|
return;
|
|
2959
|
-
|
|
2960
2862
|
case 34:
|
|
2961
2863
|
case 39:
|
|
2962
2864
|
this.readString(code);
|
|
2963
2865
|
return;
|
|
2964
|
-
|
|
2965
2866
|
case 47:
|
|
2966
2867
|
this.readToken_slash();
|
|
2967
2868
|
return;
|
|
@@ -3053,12 +2954,10 @@ class Tokenizer extends CommentsParser {
|
|
|
3053
2954
|
const content = this.input.slice(start, pos);
|
|
3054
2955
|
++pos;
|
|
3055
2956
|
let mods = "";
|
|
3056
|
-
const nextPos = () =>
|
|
3057
|
-
createPositionWithColumnOffset(startLoc, pos + 2 - start);
|
|
2957
|
+
const nextPos = () => createPositionWithColumnOffset(startLoc, pos + 2 - start);
|
|
3058
2958
|
while (pos < this.length) {
|
|
3059
2959
|
const cp = this.codePointAtPos(pos);
|
|
3060
2960
|
const char = String.fromCharCode(cp);
|
|
3061
|
-
|
|
3062
2961
|
if (VALID_REGEX_FLAGS.has(cp)) {
|
|
3063
2962
|
if (cp === 118) {
|
|
3064
2963
|
this.expectPlugin("regexpUnicodeSets", nextPos());
|
|
@@ -3095,7 +2994,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3095
2994
|
flags: mods
|
|
3096
2995
|
});
|
|
3097
2996
|
}
|
|
3098
|
-
|
|
3099
2997
|
readInt(radix, len, forceLen = false, allowNumSeparator = true) {
|
|
3100
2998
|
const {
|
|
3101
2999
|
n,
|
|
@@ -3136,7 +3034,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3136
3034
|
}
|
|
3137
3035
|
this.finishToken(132, val);
|
|
3138
3036
|
}
|
|
3139
|
-
|
|
3140
3037
|
readNumber(startsWithDot) {
|
|
3141
3038
|
const start = this.state.pos;
|
|
3142
3039
|
const startLoc = this.state.curPosition();
|
|
@@ -3211,7 +3108,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3211
3108
|
at: this.state.curPosition()
|
|
3212
3109
|
});
|
|
3213
3110
|
}
|
|
3214
|
-
|
|
3215
3111
|
const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
|
|
3216
3112
|
if (isBigInt) {
|
|
3217
3113
|
this.finishToken(133, str);
|
|
@@ -3224,7 +3120,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3224
3120
|
const val = isOctal ? parseInt(str, 8) : parseFloat(str);
|
|
3225
3121
|
this.finishToken(132, val);
|
|
3226
3122
|
}
|
|
3227
|
-
|
|
3228
3123
|
readCodePoint(throwOnInvalid) {
|
|
3229
3124
|
const {
|
|
3230
3125
|
code,
|
|
@@ -3239,14 +3134,12 @@ class Tokenizer extends CommentsParser {
|
|
|
3239
3134
|
pos,
|
|
3240
3135
|
curLine,
|
|
3241
3136
|
lineStart
|
|
3242
|
-
} = readStringContents(quote === 34 ? "double" : "single", this.input, this.state.pos + 1,
|
|
3243
|
-
this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
|
|
3137
|
+
} = readStringContents(quote === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
|
|
3244
3138
|
this.state.pos = pos + 1;
|
|
3245
3139
|
this.state.lineStart = lineStart;
|
|
3246
3140
|
this.state.curLine = curLine;
|
|
3247
3141
|
this.finishToken(131, str);
|
|
3248
3142
|
}
|
|
3249
|
-
|
|
3250
3143
|
readTemplateContinuation() {
|
|
3251
3144
|
if (!this.match(8)) {
|
|
3252
3145
|
this.unexpected(null, 8);
|
|
@@ -3254,7 +3147,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3254
3147
|
this.state.pos--;
|
|
3255
3148
|
this.readTemplateToken();
|
|
3256
3149
|
}
|
|
3257
|
-
|
|
3258
3150
|
readTemplateToken() {
|
|
3259
3151
|
const opening = this.input[this.state.pos];
|
|
3260
3152
|
const {
|
|
@@ -3263,8 +3155,7 @@ class Tokenizer extends CommentsParser {
|
|
|
3263
3155
|
pos,
|
|
3264
3156
|
curLine,
|
|
3265
3157
|
lineStart
|
|
3266
|
-
} = readStringContents("template", this.input, this.state.pos + 1,
|
|
3267
|
-
this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
|
|
3158
|
+
} = readStringContents("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
|
|
3268
3159
|
this.state.pos = pos + 1;
|
|
3269
3160
|
this.state.lineStart = lineStart;
|
|
3270
3161
|
this.state.curLine = curLine;
|
|
@@ -3290,7 +3181,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3290
3181
|
this.state.strictErrors.set(index, [toParseError, at]);
|
|
3291
3182
|
}
|
|
3292
3183
|
}
|
|
3293
|
-
|
|
3294
3184
|
readWord1(firstCode) {
|
|
3295
3185
|
this.state.containsEsc = false;
|
|
3296
3186
|
let word = "";
|
|
@@ -3332,7 +3222,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3332
3222
|
}
|
|
3333
3223
|
return word + this.input.slice(chunkStart, this.state.pos);
|
|
3334
3224
|
}
|
|
3335
|
-
|
|
3336
3225
|
readWord(firstCode) {
|
|
3337
3226
|
const word = this.readWord1(firstCode);
|
|
3338
3227
|
const type = keywords$1.get(word);
|
|
@@ -3353,7 +3242,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3353
3242
|
});
|
|
3354
3243
|
}
|
|
3355
3244
|
}
|
|
3356
|
-
|
|
3357
3245
|
raise(toParseError, raiseProperties) {
|
|
3358
3246
|
const {
|
|
3359
3247
|
at
|
|
@@ -3368,7 +3256,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3368
3256
|
if (!this.isLookahead) this.state.errors.push(error);
|
|
3369
3257
|
return error;
|
|
3370
3258
|
}
|
|
3371
|
-
|
|
3372
3259
|
raiseOverwrite(toParseError, raiseProperties) {
|
|
3373
3260
|
const {
|
|
3374
3261
|
at
|
|
@@ -3389,9 +3276,7 @@ class Tokenizer extends CommentsParser {
|
|
|
3389
3276
|
}
|
|
3390
3277
|
return this.raise(toParseError, raiseProperties);
|
|
3391
3278
|
}
|
|
3392
|
-
|
|
3393
3279
|
updateContext(prevType) {}
|
|
3394
|
-
|
|
3395
3280
|
unexpected(loc, type) {
|
|
3396
3281
|
throw this.raise(Errors.UnexpectedToken, {
|
|
3397
3282
|
expected: type ? tokenLabelName(type) : null,
|
|
@@ -3446,9 +3331,7 @@ class ClassScopeHandler {
|
|
|
3446
3331
|
}
|
|
3447
3332
|
exit() {
|
|
3448
3333
|
const oldClassScope = this.stack.pop();
|
|
3449
|
-
|
|
3450
3334
|
const current = this.current();
|
|
3451
|
-
|
|
3452
3335
|
for (const [name, loc] of Array.from(oldClassScope.undefinedPrivateNames)) {
|
|
3453
3336
|
if (current) {
|
|
3454
3337
|
if (!current.undefinedPrivateNames.has(name)) {
|
|
@@ -3476,7 +3359,6 @@ class ClassScopeHandler {
|
|
|
3476
3359
|
const newStatic = elementType & CLASS_ELEMENT_FLAG_STATIC;
|
|
3477
3360
|
const oldKind = accessor & CLASS_ELEMENT_KIND_ACCESSOR;
|
|
3478
3361
|
const newKind = elementType & CLASS_ELEMENT_KIND_ACCESSOR;
|
|
3479
|
-
|
|
3480
3362
|
redefined = oldKind === newKind || oldStatic !== newStatic;
|
|
3481
3363
|
if (!redefined) loneAccessors.delete(name);
|
|
3482
3364
|
} else if (!redefined) {
|
|
@@ -3554,7 +3436,6 @@ class ExpressionScopeHandler {
|
|
|
3554
3436
|
exit() {
|
|
3555
3437
|
this.stack.pop();
|
|
3556
3438
|
}
|
|
3557
|
-
|
|
3558
3439
|
recordParameterInitializerError(toParseError, {
|
|
3559
3440
|
at: node
|
|
3560
3441
|
}) {
|
|
@@ -3576,7 +3457,6 @@ class ExpressionScopeHandler {
|
|
|
3576
3457
|
}
|
|
3577
3458
|
this.parser.raise(toParseError, origin);
|
|
3578
3459
|
}
|
|
3579
|
-
|
|
3580
3460
|
recordArrowParameterBindingError(error, {
|
|
3581
3461
|
at: node
|
|
3582
3462
|
}) {
|
|
@@ -3595,7 +3475,6 @@ class ExpressionScopeHandler {
|
|
|
3595
3475
|
return;
|
|
3596
3476
|
}
|
|
3597
3477
|
}
|
|
3598
|
-
|
|
3599
3478
|
recordAsyncArrowParametersError({
|
|
3600
3479
|
at
|
|
3601
3480
|
}) {
|
|
@@ -3645,13 +3524,11 @@ function newExpressionScope() {
|
|
|
3645
3524
|
return new ExpressionScope();
|
|
3646
3525
|
}
|
|
3647
3526
|
|
|
3648
|
-
const
|
|
3649
|
-
PARAM = 0b0000,
|
|
3527
|
+
const PARAM = 0b0000,
|
|
3650
3528
|
PARAM_YIELD = 0b0001,
|
|
3651
3529
|
PARAM_AWAIT = 0b0010,
|
|
3652
3530
|
PARAM_RETURN = 0b0100,
|
|
3653
3531
|
PARAM_IN = 0b1000;
|
|
3654
|
-
|
|
3655
3532
|
class ProductionParameterHandler {
|
|
3656
3533
|
constructor() {
|
|
3657
3534
|
this.stacks = [];
|
|
@@ -3683,7 +3560,6 @@ function functionFlags(isAsync, isGenerator) {
|
|
|
3683
3560
|
}
|
|
3684
3561
|
|
|
3685
3562
|
class UtilParser extends Tokenizer {
|
|
3686
|
-
|
|
3687
3563
|
addExtra(node, key, value, enumerable = true) {
|
|
3688
3564
|
if (!node) return;
|
|
3689
3565
|
const extra = node.extra = node.extra || {};
|
|
@@ -3696,7 +3572,6 @@ class UtilParser extends Tokenizer {
|
|
|
3696
3572
|
});
|
|
3697
3573
|
}
|
|
3698
3574
|
}
|
|
3699
|
-
|
|
3700
3575
|
isContextual(token) {
|
|
3701
3576
|
return this.state.type === token && !this.state.containsEsc;
|
|
3702
3577
|
}
|
|
@@ -3704,8 +3579,7 @@ class UtilParser extends Tokenizer {
|
|
|
3704
3579
|
const nameEnd = nameStart + name.length;
|
|
3705
3580
|
if (this.input.slice(nameStart, nameEnd) === name) {
|
|
3706
3581
|
const nextCh = this.input.charCodeAt(nameEnd);
|
|
3707
|
-
return !(isIdentifierChar(nextCh) ||
|
|
3708
|
-
(nextCh & 0xfc00) === 0xd800);
|
|
3582
|
+
return !(isIdentifierChar(nextCh) || (nextCh & 0xfc00) === 0xd800);
|
|
3709
3583
|
}
|
|
3710
3584
|
return false;
|
|
3711
3585
|
}
|
|
@@ -3713,7 +3587,6 @@ class UtilParser extends Tokenizer {
|
|
|
3713
3587
|
const next = this.nextTokenStart();
|
|
3714
3588
|
return this.isUnparsedContextual(next, name);
|
|
3715
3589
|
}
|
|
3716
|
-
|
|
3717
3590
|
eatContextual(token) {
|
|
3718
3591
|
if (this.isContextual(token)) {
|
|
3719
3592
|
this.next();
|
|
@@ -3721,7 +3594,6 @@ class UtilParser extends Tokenizer {
|
|
|
3721
3594
|
}
|
|
3722
3595
|
return false;
|
|
3723
3596
|
}
|
|
3724
|
-
|
|
3725
3597
|
expectContextual(token, toParseError) {
|
|
3726
3598
|
if (!this.eatContextual(token)) {
|
|
3727
3599
|
if (toParseError != null) {
|
|
@@ -3732,7 +3604,6 @@ class UtilParser extends Tokenizer {
|
|
|
3732
3604
|
throw this.unexpected(null, token);
|
|
3733
3605
|
}
|
|
3734
3606
|
}
|
|
3735
|
-
|
|
3736
3607
|
canInsertSemicolon() {
|
|
3737
3608
|
return this.match(137) || this.match(8) || this.hasPrecedingLineBreak();
|
|
3738
3609
|
}
|
|
@@ -3746,18 +3617,15 @@ class UtilParser extends Tokenizer {
|
|
|
3746
3617
|
isLineTerminator() {
|
|
3747
3618
|
return this.eat(13) || this.canInsertSemicolon();
|
|
3748
3619
|
}
|
|
3749
|
-
|
|
3750
3620
|
semicolon(allowAsi = true) {
|
|
3751
3621
|
if (allowAsi ? this.isLineTerminator() : this.eat(13)) return;
|
|
3752
3622
|
this.raise(Errors.MissingSemicolon, {
|
|
3753
3623
|
at: this.state.lastTokEndLoc
|
|
3754
3624
|
});
|
|
3755
3625
|
}
|
|
3756
|
-
|
|
3757
3626
|
expect(type, loc) {
|
|
3758
3627
|
this.eat(type) || this.unexpected(loc, type);
|
|
3759
3628
|
}
|
|
3760
|
-
|
|
3761
3629
|
tryParse(fn, oldState = this.state.clone()) {
|
|
3762
3630
|
const abortSignal = {
|
|
3763
3631
|
node: null
|
|
@@ -3841,19 +3709,15 @@ class UtilParser extends Tokenizer {
|
|
|
3841
3709
|
this.unexpected(optionalParametersLoc);
|
|
3842
3710
|
}
|
|
3843
3711
|
}
|
|
3844
|
-
|
|
3845
3712
|
isLiteralPropertyName() {
|
|
3846
3713
|
return tokenIsLiteralPropertyName(this.state.type);
|
|
3847
3714
|
}
|
|
3848
|
-
|
|
3849
3715
|
isPrivateName(node) {
|
|
3850
3716
|
return node.type === "PrivateName";
|
|
3851
3717
|
}
|
|
3852
|
-
|
|
3853
3718
|
getPrivateNameSV(node) {
|
|
3854
3719
|
return node.id.name;
|
|
3855
3720
|
}
|
|
3856
|
-
|
|
3857
3721
|
hasPropertyAsPrivateName(node) {
|
|
3858
3722
|
return (node.type === "MemberExpression" || node.type === "OptionalMemberExpression") && this.isPrivateName(node.property);
|
|
3859
3723
|
}
|
|
@@ -3871,7 +3735,6 @@ class UtilParser extends Tokenizer {
|
|
|
3871
3735
|
this.state.labels = [];
|
|
3872
3736
|
const oldExportedIdentifiers = this.exportedIdentifiers;
|
|
3873
3737
|
this.exportedIdentifiers = new Set();
|
|
3874
|
-
|
|
3875
3738
|
const oldInModule = this.inModule;
|
|
3876
3739
|
this.inModule = inModule;
|
|
3877
3740
|
const oldScope = this.scope;
|
|
@@ -3886,7 +3749,6 @@ class UtilParser extends Tokenizer {
|
|
|
3886
3749
|
return () => {
|
|
3887
3750
|
this.state.labels = oldLabels;
|
|
3888
3751
|
this.exportedIdentifiers = oldExportedIdentifiers;
|
|
3889
|
-
|
|
3890
3752
|
this.inModule = oldInModule;
|
|
3891
3753
|
this.scope = oldScope;
|
|
3892
3754
|
this.prodParam = oldProdParam;
|
|
@@ -3911,7 +3773,6 @@ class UtilParser extends Tokenizer {
|
|
|
3911
3773
|
}
|
|
3912
3774
|
}
|
|
3913
3775
|
}
|
|
3914
|
-
|
|
3915
3776
|
class ExpressionErrors {
|
|
3916
3777
|
constructor() {
|
|
3917
3778
|
this.shorthandAssignLoc = null;
|
|
@@ -4004,15 +3865,12 @@ class NodeUtils extends UtilParser {
|
|
|
4004
3865
|
startNodeAt(loc) {
|
|
4005
3866
|
return new Node(this, loc.index, loc);
|
|
4006
3867
|
}
|
|
4007
|
-
|
|
4008
3868
|
startNodeAtNode(type) {
|
|
4009
3869
|
return this.startNodeAt(type.loc.start);
|
|
4010
3870
|
}
|
|
4011
|
-
|
|
4012
3871
|
finishNode(node, type) {
|
|
4013
3872
|
return this.finishNodeAt(node, type, this.state.lastTokEndLoc);
|
|
4014
3873
|
}
|
|
4015
|
-
|
|
4016
3874
|
finishNodeAt(node, type, endLoc) {
|
|
4017
3875
|
node.type = type;
|
|
4018
3876
|
node.end = endLoc.index;
|
|
@@ -4031,14 +3889,12 @@ class NodeUtils extends UtilParser {
|
|
|
4031
3889
|
node.loc.end = endLoc;
|
|
4032
3890
|
if (this.options.ranges) node.range[1] = endLoc.index;
|
|
4033
3891
|
}
|
|
4034
|
-
|
|
4035
3892
|
resetStartLocationFromNode(node, locationNode) {
|
|
4036
3893
|
this.resetStartLocation(node, locationNode.loc.start);
|
|
4037
3894
|
}
|
|
4038
3895
|
}
|
|
4039
3896
|
|
|
4040
3897
|
const reservedTypes = new Set(["_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void"]);
|
|
4041
|
-
|
|
4042
3898
|
const FlowErrors = ParseErrorEnum`flow`({
|
|
4043
3899
|
AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
|
|
4044
3900
|
AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",
|
|
@@ -4132,7 +3988,6 @@ const FlowErrors = ParseErrorEnum`flow`({
|
|
|
4132
3988
|
UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.",
|
|
4133
3989
|
UnterminatedFlowComment: "Unterminated flow-comment."
|
|
4134
3990
|
});
|
|
4135
|
-
|
|
4136
3991
|
function isEsModuleType(bodyElement) {
|
|
4137
3992
|
return bodyElement.type === "DeclareExportAllDeclaration" || bodyElement.type === "DeclareExportDeclaration" && (!bodyElement.declaration || bodyElement.declaration.type !== "TypeAlias" && bodyElement.declaration.type !== "InterfaceDeclaration");
|
|
4138
3993
|
}
|
|
@@ -4148,7 +4003,6 @@ const exportSuggestions = {
|
|
|
4148
4003
|
type: "export type",
|
|
4149
4004
|
interface: "export interface"
|
|
4150
4005
|
};
|
|
4151
|
-
|
|
4152
4006
|
function partition(list, test) {
|
|
4153
4007
|
const list1 = [];
|
|
4154
4008
|
const list2 = [];
|
|
@@ -4158,7 +4012,6 @@ function partition(list, test) {
|
|
|
4158
4012
|
return [list1, list2];
|
|
4159
4013
|
}
|
|
4160
4014
|
const FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/;
|
|
4161
|
-
|
|
4162
4015
|
var flow = (superClass => class FlowParserMixin extends superClass {
|
|
4163
4016
|
constructor(...args) {
|
|
4164
4017
|
super(...args);
|
|
@@ -4381,18 +4234,11 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4381
4234
|
suggestion: exportSuggestions[label]
|
|
4382
4235
|
});
|
|
4383
4236
|
}
|
|
4384
|
-
if (this.match(74) ||
|
|
4385
|
-
this.match(68) ||
|
|
4386
|
-
this.match(80) ||
|
|
4387
|
-
this.isContextual(129)) {
|
|
4237
|
+
if (this.match(74) || this.match(68) || this.match(80) || this.isContextual(129)) {
|
|
4388
4238
|
node.declaration = this.flowParseDeclare(this.startNode());
|
|
4389
4239
|
node.default = false;
|
|
4390
4240
|
return this.finishNode(node, "DeclareExportDeclaration");
|
|
4391
|
-
} else if (this.match(55) ||
|
|
4392
|
-
this.match(5) ||
|
|
4393
|
-
this.isContextual(127) ||
|
|
4394
|
-
this.isContextual(128) ||
|
|
4395
|
-
this.isContextual(129)) {
|
|
4241
|
+
} else if (this.match(55) || this.match(5) || this.isContextual(127) || this.isContextual(128) || this.isContextual(129)) {
|
|
4396
4242
|
node = this.parseExport(node, null);
|
|
4397
4243
|
if (node.type === "ExportNamedDeclaration") {
|
|
4398
4244
|
node.type = "ExportDeclaration";
|
|
@@ -4429,7 +4275,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4429
4275
|
this.flowParseInterfaceish(node);
|
|
4430
4276
|
return this.finishNode(node, "DeclareInterface");
|
|
4431
4277
|
}
|
|
4432
|
-
|
|
4433
4278
|
flowParseInterfaceish(node, isClass = false) {
|
|
4434
4279
|
node.id = this.flowParseRestrictedIdentifier(!isClass, true);
|
|
4435
4280
|
this.scope.declareName(node.id.name, isClass ? BIND_FUNCTION : BIND_LEXICAL, node.id.loc.start);
|
|
@@ -4498,7 +4343,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4498
4343
|
this.checkReservedType(this.state.value, this.state.startLoc, declaration);
|
|
4499
4344
|
return this.parseIdentifier(liberal);
|
|
4500
4345
|
}
|
|
4501
|
-
|
|
4502
4346
|
flowParseTypeAlias(node) {
|
|
4503
4347
|
node.id = this.flowParseRestrictedIdentifier(false, true);
|
|
4504
4348
|
this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.loc.start);
|
|
@@ -4520,7 +4364,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4520
4364
|
} else {
|
|
4521
4365
|
node.typeParameters = null;
|
|
4522
4366
|
}
|
|
4523
|
-
|
|
4524
4367
|
node.supertype = null;
|
|
4525
4368
|
if (this.match(14)) {
|
|
4526
4369
|
node.supertype = this.flowParseTypeInitialiser(14);
|
|
@@ -4532,7 +4375,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4532
4375
|
this.semicolon();
|
|
4533
4376
|
return this.finishNode(node, "OpaqueType");
|
|
4534
4377
|
}
|
|
4535
|
-
|
|
4536
4378
|
flowParseTypeParameter(requireDefault = false) {
|
|
4537
4379
|
const nodeStartLoc = this.state.startLoc;
|
|
4538
4380
|
const node = this.startNode();
|
|
@@ -4558,7 +4400,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4558
4400
|
const node = this.startNode();
|
|
4559
4401
|
node.params = [];
|
|
4560
4402
|
this.state.inType = true;
|
|
4561
|
-
|
|
4562
4403
|
if (this.match(47) || this.match(140)) {
|
|
4563
4404
|
this.next();
|
|
4564
4405
|
} else {
|
|
@@ -4637,7 +4478,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4637
4478
|
}
|
|
4638
4479
|
flowParseObjectTypeIndexer(node, isStatic, variance) {
|
|
4639
4480
|
node.static = isStatic;
|
|
4640
|
-
|
|
4641
4481
|
if (this.lookahead().type === 14) {
|
|
4642
4482
|
node.id = this.flowParseObjectPropertyKey();
|
|
4643
4483
|
node.key = this.flowParseTypeInitialiser();
|
|
@@ -4745,7 +4585,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4745
4585
|
}
|
|
4746
4586
|
if (allowStatic && this.isContextual(104)) {
|
|
4747
4587
|
const lookahead = this.lookahead();
|
|
4748
|
-
|
|
4749
4588
|
if (lookahead.type !== 14 && lookahead.type !== 17) {
|
|
4750
4589
|
this.next();
|
|
4751
4590
|
isStatic = true;
|
|
@@ -4797,7 +4636,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4797
4636
|
}
|
|
4798
4637
|
}
|
|
4799
4638
|
this.expect(endDelim);
|
|
4800
|
-
|
|
4801
4639
|
if (allowSpread) {
|
|
4802
4640
|
nodeStart.inexact = inexact;
|
|
4803
4641
|
}
|
|
@@ -4876,7 +4714,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4876
4714
|
return this.finishNode(node, "ObjectTypeProperty");
|
|
4877
4715
|
}
|
|
4878
4716
|
}
|
|
4879
|
-
|
|
4880
4717
|
flowCheckGetterSetterParams(property) {
|
|
4881
4718
|
const paramCount = property.kind === "get" ? 0 : 1;
|
|
4882
4719
|
const length = property.value.params.length + (property.value.rest ? 1 : 0);
|
|
@@ -5025,7 +4862,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5025
4862
|
return this.flowParseGenericType(startLoc, id);
|
|
5026
4863
|
}
|
|
5027
4864
|
}
|
|
5028
|
-
|
|
5029
4865
|
flowParsePrimaryType() {
|
|
5030
4866
|
const startLoc = this.state.startLoc;
|
|
5031
4867
|
const node = this.startNode();
|
|
@@ -5068,7 +4904,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5068
4904
|
return this.finishNode(node, "FunctionTypeAnnotation");
|
|
5069
4905
|
case 10:
|
|
5070
4906
|
this.next();
|
|
5071
|
-
|
|
5072
4907
|
if (!this.match(11) && !this.match(21)) {
|
|
5073
4908
|
if (tokenIsIdentifier(this.state.type) || this.match(78)) {
|
|
5074
4909
|
const token = this.lookahead().type;
|
|
@@ -5081,7 +4916,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5081
4916
|
this.state.noAnonFunctionType = false;
|
|
5082
4917
|
type = this.flowParseType();
|
|
5083
4918
|
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
5084
|
-
|
|
5085
4919
|
if (this.state.noAnonFunctionType || !(this.match(12) || this.match(11) && this.lookahead().type === 19)) {
|
|
5086
4920
|
this.expect(11);
|
|
5087
4921
|
return type;
|
|
@@ -5174,11 +5008,9 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5174
5008
|
this.expect(3);
|
|
5175
5009
|
if (seenOptionalIndexedAccess) {
|
|
5176
5010
|
node.optional = optional;
|
|
5177
|
-
type = this.finishNode(
|
|
5178
|
-
node, "OptionalIndexedAccessType");
|
|
5011
|
+
type = this.finishNode(node, "OptionalIndexedAccessType");
|
|
5179
5012
|
} else {
|
|
5180
|
-
type = this.finishNode(
|
|
5181
|
-
node, "IndexedAccessType");
|
|
5013
|
+
type = this.finishNode(node, "IndexedAccessType");
|
|
5182
5014
|
}
|
|
5183
5015
|
}
|
|
5184
5016
|
}
|
|
@@ -5274,7 +5106,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5274
5106
|
}
|
|
5275
5107
|
return variance;
|
|
5276
5108
|
}
|
|
5277
|
-
|
|
5278
5109
|
parseFunctionBody(node, allowExpressionBody, isMethod = false) {
|
|
5279
5110
|
if (allowExpressionBody) {
|
|
5280
5111
|
return this.forwardNoArrowParamsConversionAt(node, () => super.parseFunctionBody(node, true, isMethod));
|
|
@@ -5284,13 +5115,11 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5284
5115
|
parseFunctionBodyAndFinish(node, type, isMethod = false) {
|
|
5285
5116
|
if (this.match(14)) {
|
|
5286
5117
|
const typeNode = this.startNode();
|
|
5287
|
-
[typeNode.typeAnnotation,
|
|
5288
|
-
node.predicate] = this.flowParseTypeAndPredicateInitialiser();
|
|
5118
|
+
[typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
|
|
5289
5119
|
node.returnType = typeNode.typeAnnotation ? this.finishNode(typeNode, "TypeAnnotation") : null;
|
|
5290
5120
|
}
|
|
5291
5121
|
return super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
5292
5122
|
}
|
|
5293
|
-
|
|
5294
5123
|
parseStatementLike(flags) {
|
|
5295
5124
|
if (this.state.strict && this.isContextual(127)) {
|
|
5296
5125
|
const lookahead = this.lookahead();
|
|
@@ -5310,7 +5139,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5310
5139
|
}
|
|
5311
5140
|
return stmt;
|
|
5312
5141
|
}
|
|
5313
|
-
|
|
5314
5142
|
parseExpressionStatement(node, expr, decorators) {
|
|
5315
5143
|
if (expr.type === "Identifier") {
|
|
5316
5144
|
if (expr.name === "declare") {
|
|
@@ -5329,7 +5157,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5329
5157
|
}
|
|
5330
5158
|
return super.parseExpressionStatement(node, expr, decorators);
|
|
5331
5159
|
}
|
|
5332
|
-
|
|
5333
5160
|
shouldParseExportDeclaration() {
|
|
5334
5161
|
const {
|
|
5335
5162
|
type
|
|
@@ -5360,10 +5187,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5360
5187
|
if (!this.match(17)) return expr;
|
|
5361
5188
|
if (this.state.maybeInArrowParameters) {
|
|
5362
5189
|
const nextCh = this.lookaheadCharCode();
|
|
5363
|
-
if (nextCh === 44 ||
|
|
5364
|
-
nextCh === 61 ||
|
|
5365
|
-
nextCh === 58 ||
|
|
5366
|
-
nextCh === 41) {
|
|
5190
|
+
if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41) {
|
|
5367
5191
|
this.setOptionalParametersError(refExpressionErrors);
|
|
5368
5192
|
return expr;
|
|
5369
5193
|
}
|
|
@@ -5424,7 +5248,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5424
5248
|
failed
|
|
5425
5249
|
};
|
|
5426
5250
|
}
|
|
5427
|
-
|
|
5428
5251
|
getArrowLikeExpressions(node, disallowInvalid) {
|
|
5429
5252
|
const stack = [node];
|
|
5430
5253
|
const arrows = [];
|
|
@@ -5450,8 +5273,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5450
5273
|
}
|
|
5451
5274
|
finishArrowValidation(node) {
|
|
5452
5275
|
var _node$extra;
|
|
5453
|
-
this.toAssignableList(
|
|
5454
|
-
node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, false);
|
|
5276
|
+
this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, false);
|
|
5455
5277
|
this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW);
|
|
5456
5278
|
super.checkParams(node, false, true);
|
|
5457
5279
|
this.scope.exit();
|
|
@@ -5580,7 +5402,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5580
5402
|
readIterator() {
|
|
5581
5403
|
const word = super.readWord1();
|
|
5582
5404
|
const fullWord = "@@" + word;
|
|
5583
|
-
|
|
5584
5405
|
if (!this.isIterator(word) || !this.state.inType) {
|
|
5585
5406
|
this.raise(Errors.InvalidIdentifier, {
|
|
5586
5407
|
at: this.state.curPosition(),
|
|
@@ -5589,7 +5410,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5589
5410
|
}
|
|
5590
5411
|
this.finishToken(130, fullWord);
|
|
5591
5412
|
}
|
|
5592
|
-
|
|
5593
5413
|
getTokenFromCode(code) {
|
|
5594
5414
|
const next = this.input.charCodeAt(this.state.pos + 1);
|
|
5595
5415
|
if (code === 123 && next === 124) {
|
|
@@ -5621,7 +5441,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5621
5441
|
}
|
|
5622
5442
|
super.toAssignable(node, isLHS);
|
|
5623
5443
|
}
|
|
5624
|
-
|
|
5625
5444
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
5626
5445
|
for (let i = 0; i < exprList.length; i++) {
|
|
5627
5446
|
const expr = exprList[i];
|
|
@@ -5631,7 +5450,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5631
5450
|
}
|
|
5632
5451
|
super.toAssignableList(exprList, trailingCommaLoc, isLHS);
|
|
5633
5452
|
}
|
|
5634
|
-
|
|
5635
5453
|
toReferencedList(exprList, isParenthesizedExpr) {
|
|
5636
5454
|
for (let i = 0; i < exprList.length; i++) {
|
|
5637
5455
|
var _expr$extra;
|
|
@@ -5646,7 +5464,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5646
5464
|
}
|
|
5647
5465
|
parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
|
|
5648
5466
|
const node = super.parseArrayLike(close, canBePattern, isTuple, refExpressionErrors);
|
|
5649
|
-
|
|
5650
5467
|
if (canBePattern && !this.state.maybeInArrowParameters) {
|
|
5651
5468
|
this.toReferencedList(node.elements);
|
|
5652
5469
|
}
|
|
@@ -5655,7 +5472,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5655
5472
|
isValidLVal(type, isParenthesized, binding) {
|
|
5656
5473
|
return type === "TypeCastExpression" || super.isValidLVal(type, isParenthesized, binding);
|
|
5657
5474
|
}
|
|
5658
|
-
|
|
5659
5475
|
parseClassProperty(node) {
|
|
5660
5476
|
if (this.match(14)) {
|
|
5661
5477
|
node.typeAnnotation = this.flowParseTypeAnnotation();
|
|
@@ -5668,18 +5484,15 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5668
5484
|
}
|
|
5669
5485
|
return super.parseClassPrivateProperty(node);
|
|
5670
5486
|
}
|
|
5671
|
-
|
|
5672
5487
|
isClassMethod() {
|
|
5673
5488
|
return this.match(47) || super.isClassMethod();
|
|
5674
5489
|
}
|
|
5675
|
-
|
|
5676
5490
|
isClassProperty() {
|
|
5677
5491
|
return this.match(14) || super.isClassProperty();
|
|
5678
5492
|
}
|
|
5679
5493
|
isNonstaticConstructor(method) {
|
|
5680
5494
|
return !this.match(14) && super.isNonstaticConstructor(method);
|
|
5681
5495
|
}
|
|
5682
|
-
|
|
5683
5496
|
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
|
5684
5497
|
if (method.variance) {
|
|
5685
5498
|
this.unexpected(method.variance.loc.start);
|
|
@@ -5696,9 +5509,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5696
5509
|
at: method
|
|
5697
5510
|
});
|
|
5698
5511
|
}
|
|
5699
|
-
} else if (
|
|
5700
|
-
method.type === "MethodDefinition" && isConstructor &&
|
|
5701
|
-
method.value.params) {
|
|
5512
|
+
} else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
|
|
5702
5513
|
const params = method.value.params;
|
|
5703
5514
|
if (params.length > 0 && this.isThisParam(params[0])) {
|
|
5704
5515
|
this.raise(FlowErrors.ThisParamBannedInConstructor, {
|
|
@@ -5717,7 +5528,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5717
5528
|
}
|
|
5718
5529
|
super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync);
|
|
5719
5530
|
}
|
|
5720
|
-
|
|
5721
5531
|
parseClassSuper(node) {
|
|
5722
5532
|
super.parseClassSuper(node);
|
|
5723
5533
|
if (node.superClass && this.match(47)) {
|
|
@@ -5757,20 +5567,17 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5757
5567
|
parsePropertyNamePrefixOperator(node) {
|
|
5758
5568
|
node.variance = this.flowParseVariance();
|
|
5759
5569
|
}
|
|
5760
|
-
|
|
5761
5570
|
parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
|
|
5762
5571
|
if (prop.variance) {
|
|
5763
5572
|
this.unexpected(prop.variance.loc.start);
|
|
5764
5573
|
}
|
|
5765
5574
|
delete prop.variance;
|
|
5766
5575
|
let typeParameters;
|
|
5767
|
-
|
|
5768
5576
|
if (this.match(47) && !isAccessor) {
|
|
5769
5577
|
typeParameters = this.flowParseTypeParameterDeclaration();
|
|
5770
5578
|
if (!this.match(10)) this.unexpected();
|
|
5771
5579
|
}
|
|
5772
5580
|
const result = super.parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
|
|
5773
|
-
|
|
5774
5581
|
if (typeParameters) {
|
|
5775
5582
|
(result.value || result).typeParameters = typeParameters;
|
|
5776
5583
|
}
|
|
@@ -5832,7 +5639,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5832
5639
|
specifier.local = hasTypeImportKind(node) ? this.flowParseRestrictedIdentifier(true, true) : this.parseIdentifier();
|
|
5833
5640
|
node.specifiers.push(this.finishImportSpecifier(specifier, type));
|
|
5834
5641
|
}
|
|
5835
|
-
|
|
5836
5642
|
maybeParseDefaultImportSpecifier(node) {
|
|
5837
5643
|
node.importKind = "value";
|
|
5838
5644
|
let kind = null;
|
|
@@ -5846,7 +5652,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5846
5652
|
const {
|
|
5847
5653
|
type
|
|
5848
5654
|
} = lh;
|
|
5849
|
-
|
|
5850
5655
|
if (kind === "type" && type === 55) {
|
|
5851
5656
|
this.unexpected(null, lh.type);
|
|
5852
5657
|
}
|
|
@@ -5857,10 +5662,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5857
5662
|
}
|
|
5858
5663
|
return super.maybeParseDefaultImportSpecifier(node);
|
|
5859
5664
|
}
|
|
5860
|
-
|
|
5861
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport,
|
|
5862
|
-
isMaybeTypeOnly,
|
|
5863
|
-
bindingType) {
|
|
5665
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
5864
5666
|
const firstIdent = specifier.imported;
|
|
5865
5667
|
let specifierTypeKind = null;
|
|
5866
5668
|
if (firstIdent.type === "Identifier") {
|
|
@@ -5925,7 +5727,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5925
5727
|
return super.parseBindingAtom();
|
|
5926
5728
|
}
|
|
5927
5729
|
}
|
|
5928
|
-
|
|
5929
5730
|
parseFunctionParams(node, allowModifiers) {
|
|
5930
5731
|
const kind = node.kind;
|
|
5931
5732
|
if (kind !== "get" && kind !== "set" && this.match(47)) {
|
|
@@ -5933,7 +5734,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5933
5734
|
}
|
|
5934
5735
|
super.parseFunctionParams(node, allowModifiers);
|
|
5935
5736
|
}
|
|
5936
|
-
|
|
5937
5737
|
parseVarId(decl, kind) {
|
|
5938
5738
|
super.parseVarId(decl, kind);
|
|
5939
5739
|
if (this.match(14)) {
|
|
@@ -5941,7 +5741,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5941
5741
|
this.resetEndLocation(decl.id);
|
|
5942
5742
|
}
|
|
5943
5743
|
}
|
|
5944
|
-
|
|
5945
5744
|
parseAsyncArrowFromCallExpression(node, call) {
|
|
5946
5745
|
if (this.match(14)) {
|
|
5947
5746
|
const oldNoAnonFunctionType = this.state.noAnonFunctionType;
|
|
@@ -5951,11 +5750,9 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5951
5750
|
}
|
|
5952
5751
|
return super.parseAsyncArrowFromCallExpression(node, call);
|
|
5953
5752
|
}
|
|
5954
|
-
|
|
5955
5753
|
shouldParseAsyncArrow() {
|
|
5956
5754
|
return this.match(14) || super.shouldParseAsyncArrow();
|
|
5957
5755
|
}
|
|
5958
|
-
|
|
5959
5756
|
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
|
|
5960
5757
|
var _jsx;
|
|
5961
5758
|
let state = null;
|
|
@@ -5963,9 +5760,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5963
5760
|
if (this.hasPlugin("jsx") && (this.match(140) || this.match(47))) {
|
|
5964
5761
|
state = this.state.clone();
|
|
5965
5762
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
5966
|
-
|
|
5967
5763
|
if (!jsx.error) return jsx.node;
|
|
5968
|
-
|
|
5969
5764
|
const {
|
|
5970
5765
|
context
|
|
5971
5766
|
} = this.state;
|
|
@@ -5986,9 +5781,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5986
5781
|
this.resetStartLocationFromNode(result, typeParameters);
|
|
5987
5782
|
return result;
|
|
5988
5783
|
});
|
|
5989
|
-
|
|
5990
5784
|
if ((_arrowExpression$extr = arrowExpression.extra) != null && _arrowExpression$extr.parenthesized) abort();
|
|
5991
|
-
|
|
5992
5785
|
const expr = this.maybeUnwrapTypeCastExpression(arrowExpression);
|
|
5993
5786
|
if (expr.type !== "ArrowFunctionExpression") abort();
|
|
5994
5787
|
expr.typeParameters = typeParameters;
|
|
@@ -5996,8 +5789,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5996
5789
|
return arrowExpression;
|
|
5997
5790
|
}, state);
|
|
5998
5791
|
let arrowExpression = null;
|
|
5999
|
-
if (arrow.node &&
|
|
6000
|
-
this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
|
|
5792
|
+
if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
|
|
6001
5793
|
if (!arrow.error && !arrow.aborted) {
|
|
6002
5794
|
if (arrow.node.async) {
|
|
6003
5795
|
this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, {
|
|
@@ -6006,10 +5798,8 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6006
5798
|
}
|
|
6007
5799
|
return arrow.node;
|
|
6008
5800
|
}
|
|
6009
|
-
|
|
6010
5801
|
arrowExpression = arrow.node;
|
|
6011
5802
|
}
|
|
6012
|
-
|
|
6013
5803
|
if ((_jsx2 = jsx) != null && _jsx2.node) {
|
|
6014
5804
|
this.state = jsx.failState;
|
|
6015
5805
|
return jsx.node;
|
|
@@ -6020,31 +5810,26 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6020
5810
|
}
|
|
6021
5811
|
if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
|
|
6022
5812
|
if (arrow.thrown) throw arrow.error;
|
|
6023
|
-
|
|
6024
5813
|
throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, {
|
|
6025
5814
|
at: typeParameters
|
|
6026
5815
|
});
|
|
6027
5816
|
}
|
|
6028
5817
|
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
6029
5818
|
}
|
|
6030
|
-
|
|
6031
5819
|
parseArrow(node) {
|
|
6032
5820
|
if (this.match(14)) {
|
|
6033
5821
|
const result = this.tryParse(() => {
|
|
6034
5822
|
const oldNoAnonFunctionType = this.state.noAnonFunctionType;
|
|
6035
5823
|
this.state.noAnonFunctionType = true;
|
|
6036
5824
|
const typeNode = this.startNode();
|
|
6037
|
-
[typeNode.typeAnnotation,
|
|
6038
|
-
node.predicate] = this.flowParseTypeAndPredicateInitialiser();
|
|
5825
|
+
[typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
|
|
6039
5826
|
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
6040
5827
|
if (this.canInsertSemicolon()) this.unexpected();
|
|
6041
5828
|
if (!this.match(19)) this.unexpected();
|
|
6042
5829
|
return typeNode;
|
|
6043
5830
|
});
|
|
6044
5831
|
if (result.thrown) return null;
|
|
6045
|
-
|
|
6046
5832
|
if (result.error) this.state = result.failState;
|
|
6047
|
-
|
|
6048
5833
|
node.returnType = result.node.typeAnnotation ? this.finishNode(result.node, "TypeAnnotation") : null;
|
|
6049
5834
|
}
|
|
6050
5835
|
return super.parseArrow(node);
|
|
@@ -6063,7 +5848,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6063
5848
|
if (isArrowFunction && this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
|
|
6064
5849
|
return;
|
|
6065
5850
|
}
|
|
6066
|
-
|
|
6067
5851
|
for (let i = 0; i < node.params.length; i++) {
|
|
6068
5852
|
if (this.isThisParam(node.params[i]) && i > 0) {
|
|
6069
5853
|
this.raise(FlowErrors.ThisParamMustBeFirst, {
|
|
@@ -6086,7 +5870,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6086
5870
|
} else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
|
|
6087
5871
|
const state = this.state.clone();
|
|
6088
5872
|
const arrow = this.tryParse(abort => this.parseAsyncArrowWithTypeParameters(startLoc) || abort(), state);
|
|
6089
|
-
|
|
6090
5873
|
if (!arrow.error && !arrow.aborted) return arrow.node;
|
|
6091
5874
|
const result = this.tryParse(() => super.parseSubscripts(base, startLoc, noCalls), state);
|
|
6092
5875
|
if (result.node && !result.error) return result.node;
|
|
@@ -6199,8 +5982,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6199
5982
|
pos
|
|
6200
5983
|
} = this.state;
|
|
6201
5984
|
let shiftToFirstNonWhiteSpace = 2;
|
|
6202
|
-
while ([32, 9].includes(
|
|
6203
|
-
this.input.charCodeAt(pos + shiftToFirstNonWhiteSpace))) {
|
|
5985
|
+
while ([32, 9].includes(this.input.charCodeAt(pos + shiftToFirstNonWhiteSpace))) {
|
|
6204
5986
|
shiftToFirstNonWhiteSpace++;
|
|
6205
5987
|
}
|
|
6206
5988
|
const ch2 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos);
|
|
@@ -6208,15 +5990,12 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6208
5990
|
if (ch2 === 58 && ch3 === 58) {
|
|
6209
5991
|
return shiftToFirstNonWhiteSpace + 2;
|
|
6210
5992
|
}
|
|
6211
|
-
|
|
6212
5993
|
if (this.input.slice(shiftToFirstNonWhiteSpace + pos, shiftToFirstNonWhiteSpace + pos + 12) === "flow-include") {
|
|
6213
5994
|
return shiftToFirstNonWhiteSpace + 12;
|
|
6214
5995
|
}
|
|
6215
|
-
|
|
6216
5996
|
if (ch2 === 58 && ch3 !== 58) {
|
|
6217
5997
|
return shiftToFirstNonWhiteSpace;
|
|
6218
5998
|
}
|
|
6219
|
-
|
|
6220
5999
|
return false;
|
|
6221
6000
|
}
|
|
6222
6001
|
hasFlowCommentCompletion() {
|
|
@@ -6227,7 +6006,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6227
6006
|
});
|
|
6228
6007
|
}
|
|
6229
6008
|
}
|
|
6230
|
-
|
|
6231
6009
|
flowEnumErrorBooleanMemberNotInitialized(loc, {
|
|
6232
6010
|
enumName,
|
|
6233
6011
|
memberName
|
|
@@ -6577,7 +6355,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6577
6355
|
node.body = this.flowEnumBody(this.startNode(), id);
|
|
6578
6356
|
return this.finishNode(node, "EnumDeclaration");
|
|
6579
6357
|
}
|
|
6580
|
-
|
|
6581
6358
|
isLookaheadToken_lt() {
|
|
6582
6359
|
const next = this.nextTokenStart();
|
|
6583
6360
|
if (this.input.charCodeAt(next) === 60) {
|
|
@@ -6863,11 +6640,9 @@ const JsxErrors = ParseErrorEnum`jsx`({
|
|
|
6863
6640
|
UnterminatedJsxContent: "Unterminated JSX contents.",
|
|
6864
6641
|
UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
|
|
6865
6642
|
});
|
|
6866
|
-
|
|
6867
6643
|
function isFragment(object) {
|
|
6868
6644
|
return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false;
|
|
6869
6645
|
}
|
|
6870
|
-
|
|
6871
6646
|
function getQualifiedJSXName(object) {
|
|
6872
6647
|
if (object.type === "JSXIdentifier") {
|
|
6873
6648
|
return object.name;
|
|
@@ -6878,11 +6653,9 @@ function getQualifiedJSXName(object) {
|
|
|
6878
6653
|
if (object.type === "JSXMemberExpression") {
|
|
6879
6654
|
return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
|
|
6880
6655
|
}
|
|
6881
|
-
|
|
6882
6656
|
throw new Error("Node had unexpected type: " + object.type);
|
|
6883
6657
|
}
|
|
6884
6658
|
var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
6885
|
-
|
|
6886
6659
|
jsxReadToken() {
|
|
6887
6660
|
let out = "";
|
|
6888
6661
|
let chunkStart = this.state.pos;
|
|
@@ -6912,7 +6685,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
6912
6685
|
break;
|
|
6913
6686
|
case 62:
|
|
6914
6687
|
case 125:
|
|
6915
|
-
|
|
6916
6688
|
default:
|
|
6917
6689
|
if (isNewLine(ch)) {
|
|
6918
6690
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
@@ -6993,11 +6765,9 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
6993
6765
|
}
|
|
6994
6766
|
}
|
|
6995
6767
|
}
|
|
6996
|
-
|
|
6997
6768
|
this.state.pos = startPos;
|
|
6998
6769
|
return "&";
|
|
6999
6770
|
}
|
|
7000
|
-
|
|
7001
6771
|
jsxReadWord() {
|
|
7002
6772
|
let ch;
|
|
7003
6773
|
const start = this.state.pos;
|
|
@@ -7006,7 +6776,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7006
6776
|
} while (isIdentifierChar(ch) || ch === 45);
|
|
7007
6777
|
return this.finishToken(138, this.input.slice(start, this.state.pos));
|
|
7008
6778
|
}
|
|
7009
|
-
|
|
7010
6779
|
jsxParseIdentifier() {
|
|
7011
6780
|
const node = this.startNode();
|
|
7012
6781
|
if (this.match(138)) {
|
|
@@ -7019,7 +6788,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7019
6788
|
this.next();
|
|
7020
6789
|
return this.finishNode(node, "JSXIdentifier");
|
|
7021
6790
|
}
|
|
7022
|
-
|
|
7023
6791
|
jsxParseNamespacedName() {
|
|
7024
6792
|
const startLoc = this.state.startLoc;
|
|
7025
6793
|
const name = this.jsxParseIdentifier();
|
|
@@ -7029,7 +6797,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7029
6797
|
node.name = this.jsxParseIdentifier();
|
|
7030
6798
|
return this.finishNode(node, "JSXNamespacedName");
|
|
7031
6799
|
}
|
|
7032
|
-
|
|
7033
6800
|
jsxParseElementName() {
|
|
7034
6801
|
const startLoc = this.state.startLoc;
|
|
7035
6802
|
let node = this.jsxParseNamespacedName();
|
|
@@ -7044,7 +6811,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7044
6811
|
}
|
|
7045
6812
|
return node;
|
|
7046
6813
|
}
|
|
7047
|
-
|
|
7048
6814
|
jsxParseAttributeValue() {
|
|
7049
6815
|
let node;
|
|
7050
6816
|
switch (this.state.type) {
|
|
@@ -7068,12 +6834,10 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7068
6834
|
});
|
|
7069
6835
|
}
|
|
7070
6836
|
}
|
|
7071
|
-
|
|
7072
6837
|
jsxParseEmptyExpression() {
|
|
7073
6838
|
const node = this.startNodeAt(this.state.lastTokEndLoc);
|
|
7074
6839
|
return this.finishNodeAt(node, "JSXEmptyExpression", this.state.startLoc);
|
|
7075
6840
|
}
|
|
7076
|
-
|
|
7077
6841
|
jsxParseSpreadChild(node) {
|
|
7078
6842
|
this.next();
|
|
7079
6843
|
node.expression = this.parseExpression();
|
|
@@ -7082,7 +6846,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7082
6846
|
this.expect(8);
|
|
7083
6847
|
return this.finishNode(node, "JSXSpreadChild");
|
|
7084
6848
|
}
|
|
7085
|
-
|
|
7086
6849
|
jsxParseExpressionContainer(node, previousContext) {
|
|
7087
6850
|
if (this.match(8)) {
|
|
7088
6851
|
node.expression = this.jsxParseEmptyExpression();
|
|
@@ -7095,7 +6858,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7095
6858
|
this.expect(8);
|
|
7096
6859
|
return this.finishNode(node, "JSXExpressionContainer");
|
|
7097
6860
|
}
|
|
7098
|
-
|
|
7099
6861
|
jsxParseAttribute() {
|
|
7100
6862
|
const node = this.startNode();
|
|
7101
6863
|
if (this.match(5)) {
|
|
@@ -7112,7 +6874,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7112
6874
|
node.value = this.eat(29) ? this.jsxParseAttributeValue() : null;
|
|
7113
6875
|
return this.finishNode(node, "JSXAttribute");
|
|
7114
6876
|
}
|
|
7115
|
-
|
|
7116
6877
|
jsxParseOpeningElementAt(startLoc) {
|
|
7117
6878
|
const node = this.startNodeAt(startLoc);
|
|
7118
6879
|
if (this.eat(141)) {
|
|
@@ -7131,7 +6892,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7131
6892
|
this.expect(141);
|
|
7132
6893
|
return this.finishNode(node, "JSXOpeningElement");
|
|
7133
6894
|
}
|
|
7134
|
-
|
|
7135
6895
|
jsxParseClosingElementAt(startLoc) {
|
|
7136
6896
|
const node = this.startNodeAt(startLoc);
|
|
7137
6897
|
if (this.eat(141)) {
|
|
@@ -7141,7 +6901,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7141
6901
|
this.expect(141);
|
|
7142
6902
|
return this.finishNode(node, "JSXClosingElement");
|
|
7143
6903
|
}
|
|
7144
|
-
|
|
7145
6904
|
jsxParseElementAt(startLoc) {
|
|
7146
6905
|
const node = this.startNodeAt(startLoc);
|
|
7147
6906
|
const children = [];
|
|
@@ -7211,7 +6970,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7211
6970
|
}
|
|
7212
6971
|
return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
|
|
7213
6972
|
}
|
|
7214
|
-
|
|
7215
6973
|
jsxParseElement() {
|
|
7216
6974
|
const startLoc = this.state.startLoc;
|
|
7217
6975
|
this.next();
|
|
@@ -7223,7 +6981,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7223
6981
|
} = this.state;
|
|
7224
6982
|
context[context.length - 1] = newContext;
|
|
7225
6983
|
}
|
|
7226
|
-
|
|
7227
6984
|
parseExprAtom(refExpressionErrors) {
|
|
7228
6985
|
if (this.match(139)) {
|
|
7229
6986
|
return this.parseLiteral(this.state.value, "JSXText");
|
|
@@ -7298,7 +7055,6 @@ class TypeScriptScope extends Scope {
|
|
|
7298
7055
|
this.exportOnlyBindings = new Set();
|
|
7299
7056
|
}
|
|
7300
7057
|
}
|
|
7301
|
-
|
|
7302
7058
|
class TypeScriptScopeHandler extends ScopeHandler {
|
|
7303
7059
|
constructor(...args) {
|
|
7304
7060
|
super(...args);
|
|
@@ -7306,7 +7062,6 @@ class TypeScriptScopeHandler extends ScopeHandler {
|
|
|
7306
7062
|
}
|
|
7307
7063
|
createScope(flags) {
|
|
7308
7064
|
this.importsStack.push(new Set());
|
|
7309
|
-
|
|
7310
7065
|
return new TypeScriptScope(flags);
|
|
7311
7066
|
}
|
|
7312
7067
|
enter(flags) {
|
|
@@ -7429,8 +7184,7 @@ const TSErrors = ParseErrorEnum`typescript`({
|
|
|
7429
7184
|
}) => `'declare' is not allowed in ${kind}ters.`,
|
|
7430
7185
|
DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
|
|
7431
7186
|
DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
|
|
7432
|
-
DuplicateAccessibilityModifier:
|
|
7433
|
-
({
|
|
7187
|
+
DuplicateAccessibilityModifier: ({
|
|
7434
7188
|
modifier
|
|
7435
7189
|
}) => `Accessibility modifier already seen.`,
|
|
7436
7190
|
DuplicateModifier: ({
|
|
@@ -7504,7 +7258,6 @@ const TSErrors = ParseErrorEnum`typescript`({
|
|
|
7504
7258
|
type
|
|
7505
7259
|
}) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`
|
|
7506
7260
|
});
|
|
7507
|
-
|
|
7508
7261
|
function keywordTypeFromName(value) {
|
|
7509
7262
|
switch (value) {
|
|
7510
7263
|
case "any":
|
|
@@ -7551,7 +7304,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7551
7304
|
this.next();
|
|
7552
7305
|
return this.tsTokenCanFollowModifier();
|
|
7553
7306
|
}
|
|
7554
|
-
|
|
7555
7307
|
tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
|
|
7556
7308
|
if (!tokenIsIdentifier(this.state.type) && this.state.type !== 58) {
|
|
7557
7309
|
return undefined;
|
|
@@ -7567,7 +7319,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7567
7319
|
}
|
|
7568
7320
|
return undefined;
|
|
7569
7321
|
}
|
|
7570
|
-
|
|
7571
7322
|
tsParseModifiers({
|
|
7572
7323
|
modified,
|
|
7573
7324
|
allowedModifiers,
|
|
@@ -7666,7 +7417,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7666
7417
|
tsParseDelimitedList(kind, parseElement, refTrailingCommaPos) {
|
|
7667
7418
|
return nonNull(this.tsParseDelimitedListWorker(kind, parseElement, true, refTrailingCommaPos));
|
|
7668
7419
|
}
|
|
7669
|
-
|
|
7670
7420
|
tsParseDelimitedListWorker(kind, parseElement, expectSuccess, refTrailingCommaPos) {
|
|
7671
7421
|
const result = [];
|
|
7672
7422
|
let trailingCommaPos = -1;
|
|
@@ -7722,7 +7472,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7722
7472
|
at: this.state.startLoc
|
|
7723
7473
|
});
|
|
7724
7474
|
}
|
|
7725
|
-
|
|
7726
7475
|
node.argument = super.parseExprAtom();
|
|
7727
7476
|
this.expect(11);
|
|
7728
7477
|
if (this.eat(16)) {
|
|
@@ -7785,7 +7534,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7785
7534
|
errorTemplate: TSErrors.InvalidModifierOnTypeParameter
|
|
7786
7535
|
});
|
|
7787
7536
|
}
|
|
7788
|
-
|
|
7789
7537
|
tsParseNoneModifiers(node) {
|
|
7790
7538
|
this.tsParseModifiers({
|
|
7791
7539
|
modified: node,
|
|
@@ -7817,8 +7565,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7817
7565
|
const refTrailingCommaPos = {
|
|
7818
7566
|
value: -1
|
|
7819
7567
|
};
|
|
7820
|
-
node.params = this.tsParseBracketedList("TypeParametersOrArguments",
|
|
7821
|
-
this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
|
|
7568
|
+
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
|
|
7822
7569
|
if (node.params.length === 0) {
|
|
7823
7570
|
this.raise(TSErrors.EmptyTypeParameters, {
|
|
7824
7571
|
at: node
|
|
@@ -7829,10 +7576,8 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7829
7576
|
}
|
|
7830
7577
|
return this.finishNode(node, "TSTypeParameterDeclaration");
|
|
7831
7578
|
}
|
|
7832
|
-
|
|
7833
7579
|
tsFillSignature(returnToken, signature) {
|
|
7834
7580
|
const returnTokenRequired = returnToken === 19;
|
|
7835
|
-
|
|
7836
7581
|
const paramsKey = "parameters";
|
|
7837
7582
|
const returnTypeKey = "typeAnnotation";
|
|
7838
7583
|
signature.typeParameters = this.tsTryParseTypeParameters();
|
|
@@ -7881,7 +7626,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7881
7626
|
const id = this.parseIdentifier();
|
|
7882
7627
|
id.typeAnnotation = this.tsParseTypeAnnotation();
|
|
7883
7628
|
this.resetEndLocation(id);
|
|
7884
|
-
|
|
7885
7629
|
this.expect(3);
|
|
7886
7630
|
node.parameters = [id];
|
|
7887
7631
|
const type = this.tsTryParseTypeAnnotation();
|
|
@@ -8055,7 +7799,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8055
7799
|
tsParseTupleType() {
|
|
8056
7800
|
const node = this.startNode();
|
|
8057
7801
|
node.elementTypes = this.tsParseBracketedList("TupleElementTypes", this.tsParseTupleElementType.bind(this), true, false);
|
|
8058
|
-
|
|
8059
7802
|
let seenOptionalElement = false;
|
|
8060
7803
|
let labeledElements = null;
|
|
8061
7804
|
node.elementTypes.forEach(elementNode => {
|
|
@@ -8069,7 +7812,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8069
7812
|
});
|
|
8070
7813
|
}
|
|
8071
7814
|
seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
|
|
8072
|
-
|
|
8073
7815
|
let checkType = type;
|
|
8074
7816
|
if (type === "TSRestType") {
|
|
8075
7817
|
elementNode = elementNode.typeAnnotation;
|
|
@@ -8086,7 +7828,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8086
7828
|
return this.finishNode(node, "TSTupleType");
|
|
8087
7829
|
}
|
|
8088
7830
|
tsParseTupleElementType() {
|
|
8089
|
-
|
|
8090
7831
|
const {
|
|
8091
7832
|
startLoc
|
|
8092
7833
|
} = this.state;
|
|
@@ -8133,7 +7874,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8133
7874
|
if (abstract) this.next();
|
|
8134
7875
|
this.next();
|
|
8135
7876
|
}
|
|
8136
|
-
|
|
8137
7877
|
this.tsInAllowConditionalTypesContext(() => this.tsFillSignature(19, node));
|
|
8138
7878
|
return this.finishNode(node, type);
|
|
8139
7879
|
}
|
|
@@ -8247,8 +7987,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8247
7987
|
node.operator = operator;
|
|
8248
7988
|
node.typeAnnotation = this.tsParseTypeOperatorOrHigher();
|
|
8249
7989
|
if (operator === "readonly") {
|
|
8250
|
-
this.tsCheckTypeAnnotationForReadOnly(
|
|
8251
|
-
node);
|
|
7990
|
+
this.tsCheckTypeAnnotationForReadOnly(node);
|
|
8252
7991
|
}
|
|
8253
7992
|
return this.finishNode(node, "TSTypeOperator");
|
|
8254
7993
|
}
|
|
@@ -8384,14 +8123,12 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8384
8123
|
if (!asserts) {
|
|
8385
8124
|
return this.tsParseTypeAnnotation(false, t);
|
|
8386
8125
|
}
|
|
8387
|
-
|
|
8388
8126
|
node.parameterName = this.parseIdentifier();
|
|
8389
8127
|
node.asserts = asserts;
|
|
8390
8128
|
node.typeAnnotation = null;
|
|
8391
8129
|
t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
|
|
8392
8130
|
return this.finishNode(t, "TSTypeAnnotation");
|
|
8393
8131
|
}
|
|
8394
|
-
|
|
8395
8132
|
const type = this.tsParseTypeAnnotation(false);
|
|
8396
8133
|
node.parameterName = typePredicateVariable;
|
|
8397
8134
|
node.typeAnnotation = type;
|
|
@@ -8440,7 +8177,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8440
8177
|
});
|
|
8441
8178
|
return this.finishNode(t, "TSTypeAnnotation");
|
|
8442
8179
|
}
|
|
8443
|
-
|
|
8444
8180
|
tsParseType() {
|
|
8445
8181
|
assert(this.state.inType);
|
|
8446
8182
|
const type = this.tsParseNonConditionalType();
|
|
@@ -8550,7 +8286,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8550
8286
|
this.state.context = oldContext;
|
|
8551
8287
|
}
|
|
8552
8288
|
}
|
|
8553
|
-
|
|
8554
8289
|
tsInType(cb) {
|
|
8555
8290
|
const oldInType = this.state.inType;
|
|
8556
8291
|
this.state.inType = true;
|
|
@@ -8690,7 +8425,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8690
8425
|
this.expect(11);
|
|
8691
8426
|
return this.finishNode(node, "TSExternalModuleReference");
|
|
8692
8427
|
}
|
|
8693
|
-
|
|
8694
8428
|
tsLookAhead(f) {
|
|
8695
8429
|
const state = this.state.clone();
|
|
8696
8430
|
const res = f();
|
|
@@ -8698,8 +8432,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8698
8432
|
return res;
|
|
8699
8433
|
}
|
|
8700
8434
|
tsTryParseAndCatch(f) {
|
|
8701
|
-
const result = this.tryParse(abort =>
|
|
8702
|
-
f() || abort());
|
|
8435
|
+
const result = this.tryParse(abort => f() || abort());
|
|
8703
8436
|
if (result.aborted || !result.node) return undefined;
|
|
8704
8437
|
if (result.error) this.state = result.failState;
|
|
8705
8438
|
return result.node;
|
|
@@ -8724,7 +8457,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8724
8457
|
starttype = 74;
|
|
8725
8458
|
kind = "let";
|
|
8726
8459
|
}
|
|
8727
|
-
|
|
8728
8460
|
return this.tsInAmbientContext(() => {
|
|
8729
8461
|
if (starttype === 68) {
|
|
8730
8462
|
nany.declare = true;
|
|
@@ -8747,7 +8479,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8747
8479
|
nany.declare = true;
|
|
8748
8480
|
return this.parseVarStatement(nany, kind || this.state.value, true);
|
|
8749
8481
|
}
|
|
8750
|
-
|
|
8751
8482
|
this.expect(75);
|
|
8752
8483
|
return this.tsParseEnumDeclaration(nany, {
|
|
8753
8484
|
const: true,
|
|
@@ -8765,7 +8496,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8765
8496
|
}
|
|
8766
8497
|
});
|
|
8767
8498
|
}
|
|
8768
|
-
|
|
8769
8499
|
tsTryParseExportDeclaration() {
|
|
8770
8500
|
return this.tsParseDeclaration(this.startNode(), this.state.value, true, null);
|
|
8771
8501
|
}
|
|
@@ -8797,7 +8527,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8797
8527
|
return this.tsParseDeclaration(node, expr.name, false, decorators);
|
|
8798
8528
|
}
|
|
8799
8529
|
}
|
|
8800
|
-
|
|
8801
8530
|
tsParseDeclaration(node, value, next, decorators) {
|
|
8802
8531
|
switch (value) {
|
|
8803
8532
|
case "abstract":
|
|
@@ -8854,7 +8583,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8854
8583
|
}
|
|
8855
8584
|
return super.parseArrowExpression(res, null, true);
|
|
8856
8585
|
}
|
|
8857
|
-
|
|
8858
8586
|
tsParseTypeArgumentsInExpression() {
|
|
8859
8587
|
if (this.reScan_lt() !== 47) {
|
|
8860
8588
|
return undefined;
|
|
@@ -8863,8 +8591,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8863
8591
|
}
|
|
8864
8592
|
tsParseTypeArguments() {
|
|
8865
8593
|
const node = this.startNode();
|
|
8866
|
-
node.params = this.tsInType(() =>
|
|
8867
|
-
this.tsInNoContext(() => {
|
|
8594
|
+
node.params = this.tsInType(() => this.tsInNoContext(() => {
|
|
8868
8595
|
this.expect(47);
|
|
8869
8596
|
return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
|
|
8870
8597
|
}));
|
|
@@ -8879,7 +8606,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8879
8606
|
tsIsDeclarationStart() {
|
|
8880
8607
|
return tokenIsTSDeclarationStart(this.state.type);
|
|
8881
8608
|
}
|
|
8882
|
-
|
|
8883
8609
|
isExportDefaultSpecifier() {
|
|
8884
8610
|
if (this.tsIsDeclarationStart()) return false;
|
|
8885
8611
|
return super.isExportDefaultSpecifier();
|
|
@@ -8965,8 +8691,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8965
8691
|
}
|
|
8966
8692
|
});
|
|
8967
8693
|
}
|
|
8968
|
-
toReferencedList(exprList,
|
|
8969
|
-
isInParens) {
|
|
8694
|
+
toReferencedList(exprList, isInParens) {
|
|
8970
8695
|
this.tsCheckForInvalidTypeCasts(exprList);
|
|
8971
8696
|
return exprList;
|
|
8972
8697
|
}
|
|
@@ -8994,7 +8719,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8994
8719
|
state.optionalChainMember = isOptionalCall = true;
|
|
8995
8720
|
this.next();
|
|
8996
8721
|
}
|
|
8997
|
-
|
|
8998
8722
|
if (this.match(47) || this.match(51)) {
|
|
8999
8723
|
let missingParenErrorLoc;
|
|
9000
8724
|
const result = this.tsTryParseAndCatch(() => {
|
|
@@ -9019,7 +8743,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9019
8743
|
const node = this.startNodeAt(startLoc);
|
|
9020
8744
|
node.callee = base;
|
|
9021
8745
|
node.arguments = this.parseCallExpressionArguments(11, false);
|
|
9022
|
-
|
|
9023
8746
|
this.tsCheckForInvalidTypeCasts(node.arguments);
|
|
9024
8747
|
node.typeParameters = typeArguments;
|
|
9025
8748
|
if (state.optionalChainMember) {
|
|
@@ -9028,10 +8751,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9028
8751
|
return this.finishCallExpression(node, state.optionalChainMember);
|
|
9029
8752
|
}
|
|
9030
8753
|
const tokenType = this.state.type;
|
|
9031
|
-
if (
|
|
9032
|
-
tokenType === 48 ||
|
|
9033
|
-
tokenType === 52 ||
|
|
9034
|
-
tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
|
|
8754
|
+
if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
|
|
9035
8755
|
return;
|
|
9036
8756
|
}
|
|
9037
8757
|
const node = this.startNodeAt(startLoc);
|
|
@@ -9084,8 +8804,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9084
8804
|
});
|
|
9085
8805
|
this.finishNode(node, isSatisfies ? "TSSatisfiesExpression" : "TSAsExpression");
|
|
9086
8806
|
this.reScan_lt_gt();
|
|
9087
|
-
return this.parseExprOp(
|
|
9088
|
-
node, leftStartLoc, minPrec);
|
|
8807
|
+
return this.parseExprOp(node, leftStartLoc, minPrec);
|
|
9089
8808
|
}
|
|
9090
8809
|
return super.parseExprOp(left, leftStartLoc, minPrec);
|
|
9091
8810
|
}
|
|
@@ -9102,16 +8821,12 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9102
8821
|
});
|
|
9103
8822
|
}
|
|
9104
8823
|
}
|
|
9105
|
-
|
|
9106
8824
|
checkDuplicateExports() {}
|
|
9107
8825
|
parseImport(node) {
|
|
9108
8826
|
node.importKind = "value";
|
|
9109
8827
|
if (tokenIsIdentifier(this.state.type) || this.match(55) || this.match(5)) {
|
|
9110
8828
|
let ahead = this.lookahead();
|
|
9111
|
-
if (this.isContextual(128) &&
|
|
9112
|
-
ahead.type !== 12 &&
|
|
9113
|
-
ahead.type !== 97 &&
|
|
9114
|
-
ahead.type !== 29) {
|
|
8829
|
+
if (this.isContextual(128) && ahead.type !== 12 && ahead.type !== 97 && ahead.type !== 29) {
|
|
9115
8830
|
node.importKind = "type";
|
|
9116
8831
|
this.next();
|
|
9117
8832
|
ahead = this.lookahead();
|
|
@@ -9121,10 +8836,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9121
8836
|
}
|
|
9122
8837
|
}
|
|
9123
8838
|
const importNode = super.parseImport(node);
|
|
9124
|
-
|
|
9125
|
-
if (importNode.importKind === "type" &&
|
|
9126
|
-
importNode.specifiers.length > 1 &&
|
|
9127
|
-
importNode.specifiers[0].type === "ImportDefaultSpecifier") {
|
|
8839
|
+
if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
|
|
9128
8840
|
this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, {
|
|
9129
8841
|
at: importNode
|
|
9130
8842
|
});
|
|
@@ -9172,7 +8884,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9172
8884
|
cls.abstract = true;
|
|
9173
8885
|
return this.parseClass(cls, true, true);
|
|
9174
8886
|
}
|
|
9175
|
-
|
|
9176
8887
|
if (this.match(127)) {
|
|
9177
8888
|
const result = this.tsParseInterfaceDeclaration(this.startNode());
|
|
9178
8889
|
if (result) return result;
|
|
@@ -9190,12 +8901,11 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9190
8901
|
init
|
|
9191
8902
|
} of declaration.declarations) {
|
|
9192
8903
|
if (!init) continue;
|
|
9193
|
-
|
|
9194
8904
|
if (kind !== "const" || !!id.typeAnnotation) {
|
|
9195
8905
|
this.raise(TSErrors.InitializerNotAllowedInAmbientContext, {
|
|
9196
8906
|
at: init
|
|
9197
8907
|
});
|
|
9198
|
-
} else if (init
|
|
8908
|
+
} else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) {
|
|
9199
8909
|
this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, {
|
|
9200
8910
|
at: init
|
|
9201
8911
|
});
|
|
@@ -9302,7 +9012,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9302
9012
|
});
|
|
9303
9013
|
}
|
|
9304
9014
|
}
|
|
9305
|
-
|
|
9306
9015
|
super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
|
|
9307
9016
|
}
|
|
9308
9017
|
parsePostMemberNameModifiers(methodOrProp) {
|
|
@@ -9319,18 +9028,14 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9319
9028
|
});
|
|
9320
9029
|
}
|
|
9321
9030
|
}
|
|
9322
|
-
|
|
9323
9031
|
parseExpressionStatement(node, expr, decorators) {
|
|
9324
|
-
const decl = expr.type === "Identifier" ?
|
|
9325
|
-
this.tsParseExpressionStatement(node, expr, decorators) : undefined;
|
|
9032
|
+
const decl = expr.type === "Identifier" ? this.tsParseExpressionStatement(node, expr, decorators) : undefined;
|
|
9326
9033
|
return decl || super.parseExpressionStatement(node, expr, decorators);
|
|
9327
9034
|
}
|
|
9328
|
-
|
|
9329
9035
|
shouldParseExportDeclaration() {
|
|
9330
9036
|
if (this.tsIsDeclarationStart()) return true;
|
|
9331
9037
|
return super.shouldParseExportDeclaration();
|
|
9332
9038
|
}
|
|
9333
|
-
|
|
9334
9039
|
parseConditional(expr, startLoc, refExpressionErrors) {
|
|
9335
9040
|
if (!this.state.maybeInArrowParameters || !this.match(17)) {
|
|
9336
9041
|
return super.parseConditional(expr, startLoc, refExpressionErrors);
|
|
@@ -9345,7 +9050,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9345
9050
|
if (result.error) this.state = result.failState;
|
|
9346
9051
|
return result.node;
|
|
9347
9052
|
}
|
|
9348
|
-
|
|
9349
9053
|
parseParenItem(node, startLoc) {
|
|
9350
9054
|
node = super.parseParenItem(node, startLoc);
|
|
9351
9055
|
if (this.eat(17)) {
|
|
@@ -9364,7 +9068,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9364
9068
|
if (!this.state.isAmbientContext && this.isContextual(123)) {
|
|
9365
9069
|
return this.tsInAmbientContext(() => this.parseExportDeclaration(node));
|
|
9366
9070
|
}
|
|
9367
|
-
|
|
9368
9071
|
const startLoc = this.state.startLoc;
|
|
9369
9072
|
const isDeclare = this.eatContextual(123);
|
|
9370
9073
|
if (isDeclare && (this.isContextual(123) || !this.shouldParseExportDeclaration())) {
|
|
@@ -9384,8 +9087,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9384
9087
|
}
|
|
9385
9088
|
return declaration;
|
|
9386
9089
|
}
|
|
9387
|
-
parseClassId(node, isStatement, optionalId,
|
|
9388
|
-
bindingType) {
|
|
9090
|
+
parseClassId(node, isStatement, optionalId, bindingType) {
|
|
9389
9091
|
if ((!isStatement || optionalId) && this.isContextual(111)) {
|
|
9390
9092
|
return;
|
|
9391
9093
|
}
|
|
@@ -9428,7 +9130,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9428
9130
|
at: node
|
|
9429
9131
|
});
|
|
9430
9132
|
}
|
|
9431
|
-
|
|
9432
9133
|
if (node.accessibility) {
|
|
9433
9134
|
this.raise(TSErrors.PrivateElementHasAccessibility, {
|
|
9434
9135
|
at: node,
|
|
@@ -9454,7 +9155,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9454
9155
|
at: typeParameters
|
|
9455
9156
|
});
|
|
9456
9157
|
}
|
|
9457
|
-
|
|
9458
9158
|
const {
|
|
9459
9159
|
declare = false,
|
|
9460
9160
|
kind
|
|
@@ -9497,7 +9197,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9497
9197
|
if (typeParameters) node.typeParameters = typeParameters;
|
|
9498
9198
|
super.parseFunctionParams(node, allowModifiers);
|
|
9499
9199
|
}
|
|
9500
|
-
|
|
9501
9200
|
parseVarId(decl, kind) {
|
|
9502
9201
|
super.parseVarId(decl, kind);
|
|
9503
9202
|
if (decl.id.type === "Identifier" && !this.hasPrecedingLineBreak() && this.eat(35)) {
|
|
@@ -9509,7 +9208,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9509
9208
|
this.resetEndLocation(decl.id);
|
|
9510
9209
|
}
|
|
9511
9210
|
}
|
|
9512
|
-
|
|
9513
9211
|
parseAsyncArrowFromCallExpression(node, call) {
|
|
9514
9212
|
if (this.match(14)) {
|
|
9515
9213
|
node.returnType = this.tsParseTypeAnnotation();
|
|
@@ -9518,16 +9216,13 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9518
9216
|
}
|
|
9519
9217
|
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
|
|
9520
9218
|
var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2, _jsx4, _typeCast3;
|
|
9521
|
-
|
|
9522
9219
|
let state;
|
|
9523
9220
|
let jsx;
|
|
9524
9221
|
let typeCast;
|
|
9525
9222
|
if (this.hasPlugin("jsx") && (this.match(140) || this.match(47))) {
|
|
9526
9223
|
state = this.state.clone();
|
|
9527
9224
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
9528
|
-
|
|
9529
9225
|
if (!jsx.error) return jsx.node;
|
|
9530
|
-
|
|
9531
9226
|
const {
|
|
9532
9227
|
context
|
|
9533
9228
|
} = this.state;
|
|
@@ -9539,7 +9234,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9539
9234
|
if (!((_jsx = jsx) != null && _jsx.error) && !this.match(47)) {
|
|
9540
9235
|
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
9541
9236
|
}
|
|
9542
|
-
|
|
9543
9237
|
if (!state || state === this.state) state = this.state.clone();
|
|
9544
9238
|
let typeParameters;
|
|
9545
9239
|
const arrow = this.tryParse(abort => {
|
|
@@ -9549,21 +9243,18 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9549
9243
|
if (expr.type !== "ArrowFunctionExpression" || (_expr$extra = expr.extra) != null && _expr$extra.parenthesized) {
|
|
9550
9244
|
abort();
|
|
9551
9245
|
}
|
|
9552
|
-
|
|
9553
9246
|
if (((_typeParameters = typeParameters) == null ? void 0 : _typeParameters.params.length) !== 0) {
|
|
9554
9247
|
this.resetStartLocationFromNode(expr, typeParameters);
|
|
9555
9248
|
}
|
|
9556
9249
|
expr.typeParameters = typeParameters;
|
|
9557
9250
|
return expr;
|
|
9558
9251
|
}, state);
|
|
9559
|
-
|
|
9560
9252
|
if (!arrow.error && !arrow.aborted) {
|
|
9561
9253
|
if (typeParameters) this.reportReservedArrowTypeParam(typeParameters);
|
|
9562
9254
|
return arrow.node;
|
|
9563
9255
|
}
|
|
9564
9256
|
if (!jsx) {
|
|
9565
9257
|
assert(!this.hasPlugin("jsx"));
|
|
9566
|
-
|
|
9567
9258
|
typeCast = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
9568
9259
|
if (!typeCast.error) return typeCast.node;
|
|
9569
9260
|
}
|
|
@@ -9593,7 +9284,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9593
9284
|
});
|
|
9594
9285
|
}
|
|
9595
9286
|
}
|
|
9596
|
-
|
|
9597
9287
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
9598
9288
|
if (!this.hasPlugin("jsx") && this.match(47)) {
|
|
9599
9289
|
return this.tsParseTypeAssertion();
|
|
@@ -9603,7 +9293,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9603
9293
|
}
|
|
9604
9294
|
parseArrow(node) {
|
|
9605
9295
|
if (this.match(14)) {
|
|
9606
|
-
|
|
9607
9296
|
const result = this.tryParse(abort => {
|
|
9608
9297
|
const returnType = this.tsParseTypeOrTypePredicateAnnotation(14);
|
|
9609
9298
|
if (this.canInsertSemicolon() || !this.match(19)) abort();
|
|
@@ -9617,7 +9306,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9617
9306
|
}
|
|
9618
9307
|
return super.parseArrow(node);
|
|
9619
9308
|
}
|
|
9620
|
-
|
|
9621
9309
|
parseAssignableListItemTypes(param) {
|
|
9622
9310
|
if (this.eat(17)) {
|
|
9623
9311
|
if (param.type !== "Identifier" && !this.state.isAmbientContext && !this.state.inType) {
|
|
@@ -9695,7 +9383,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9695
9383
|
super.checkToRestConversion(node, allowPattern);
|
|
9696
9384
|
}
|
|
9697
9385
|
}
|
|
9698
|
-
|
|
9699
9386
|
isValidLVal(type, isUnparenthesizedInAssign, binding) {
|
|
9700
9387
|
return getOwn$1({
|
|
9701
9388
|
TSTypeCastExpression: true,
|
|
@@ -9734,7 +9421,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9734
9421
|
return super.checkCommaAfterRest(close);
|
|
9735
9422
|
}
|
|
9736
9423
|
}
|
|
9737
|
-
|
|
9738
9424
|
isClassMethod() {
|
|
9739
9425
|
return this.match(47) || super.isClassMethod();
|
|
9740
9426
|
}
|
|
@@ -9750,7 +9436,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9750
9436
|
}
|
|
9751
9437
|
return node;
|
|
9752
9438
|
}
|
|
9753
|
-
|
|
9754
9439
|
getTokenFromCode(code) {
|
|
9755
9440
|
if (this.state.inType) {
|
|
9756
9441
|
if (code === 62) {
|
|
@@ -9762,7 +9447,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9762
9447
|
}
|
|
9763
9448
|
return super.getTokenFromCode(code);
|
|
9764
9449
|
}
|
|
9765
|
-
|
|
9766
9450
|
reScan_lt_gt() {
|
|
9767
9451
|
const {
|
|
9768
9452
|
type
|
|
@@ -9814,8 +9498,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9814
9498
|
}
|
|
9815
9499
|
jsxParseOpeningElementAfterName(node) {
|
|
9816
9500
|
if (this.match(47) || this.match(51)) {
|
|
9817
|
-
const typeArguments = this.tsTryParseAndCatch(() =>
|
|
9818
|
-
this.tsParseTypeArgumentsInExpression());
|
|
9501
|
+
const typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArgumentsInExpression());
|
|
9819
9502
|
if (typeArguments) node.typeParameters = typeArguments;
|
|
9820
9503
|
}
|
|
9821
9504
|
return super.jsxParseOpeningElementAfterName(node);
|
|
@@ -9859,7 +9542,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9859
9542
|
node.abstract = true;
|
|
9860
9543
|
return this.maybeTakeDecorators(decorators, this.parseClass(node, true, false));
|
|
9861
9544
|
} else if (this.isContextual(127)) {
|
|
9862
|
-
|
|
9863
9545
|
if (!this.hasFollowingLineBreak()) {
|
|
9864
9546
|
node.abstract = true;
|
|
9865
9547
|
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, {
|
|
@@ -9874,8 +9556,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9874
9556
|
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope) {
|
|
9875
9557
|
const method = super.parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
|
|
9876
9558
|
if (method.abstract) {
|
|
9877
|
-
const hasBody = this.hasPlugin("estree") ?
|
|
9878
|
-
!!method.value.body : !!method.body;
|
|
9559
|
+
const hasBody = this.hasPlugin("estree") ? !!method.value.body : !!method.body;
|
|
9879
9560
|
if (hasBody) {
|
|
9880
9561
|
const {
|
|
9881
9562
|
key
|
|
@@ -9915,8 +9596,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9915
9596
|
node.exportKind = "value";
|
|
9916
9597
|
return super.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly);
|
|
9917
9598
|
}
|
|
9918
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly,
|
|
9919
|
-
bindingType) {
|
|
9599
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
9920
9600
|
if (!importedIsString && isMaybeTypeOnly) {
|
|
9921
9601
|
this.parseTypeOnlyImportExportSpecifier(specifier, true, isInTypeOnlyImport);
|
|
9922
9602
|
return this.finishNode(specifier, "ImportSpecifier");
|
|
@@ -9932,7 +9612,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9932
9612
|
let hasTypeSpecifier = false;
|
|
9933
9613
|
let canParseAsKeyword = true;
|
|
9934
9614
|
const loc = leftOfAs.loc.start;
|
|
9935
|
-
|
|
9936
9615
|
if (this.isContextual(93)) {
|
|
9937
9616
|
const firstAs = this.parseIdentifier();
|
|
9938
9617
|
if (this.isContextual(93)) {
|
|
@@ -9995,6 +9674,58 @@ function isPossiblyLiteralEnum(expression) {
|
|
|
9995
9674
|
}
|
|
9996
9675
|
return isUncomputedMemberExpressionChain(expression.object);
|
|
9997
9676
|
}
|
|
9677
|
+
function isValidAmbientConstInitializer(expression, estree) {
|
|
9678
|
+
var _expression$extra;
|
|
9679
|
+
const {
|
|
9680
|
+
type
|
|
9681
|
+
} = expression;
|
|
9682
|
+
if ((_expression$extra = expression.extra) != null && _expression$extra.parenthesized) {
|
|
9683
|
+
return false;
|
|
9684
|
+
}
|
|
9685
|
+
if (estree) {
|
|
9686
|
+
if (type === "Literal") {
|
|
9687
|
+
const {
|
|
9688
|
+
value
|
|
9689
|
+
} = expression;
|
|
9690
|
+
if (typeof value === "string" || typeof value === "boolean") {
|
|
9691
|
+
return true;
|
|
9692
|
+
}
|
|
9693
|
+
}
|
|
9694
|
+
} else {
|
|
9695
|
+
if (type === "StringLiteral" || type === "BooleanLiteral") {
|
|
9696
|
+
return true;
|
|
9697
|
+
}
|
|
9698
|
+
}
|
|
9699
|
+
if (isNumber(expression, estree) || isNegativeNumber(expression, estree)) {
|
|
9700
|
+
return true;
|
|
9701
|
+
}
|
|
9702
|
+
if (type === "TemplateLiteral" && expression.expressions.length === 0) {
|
|
9703
|
+
return true;
|
|
9704
|
+
}
|
|
9705
|
+
if (isPossiblyLiteralEnum(expression)) {
|
|
9706
|
+
return true;
|
|
9707
|
+
}
|
|
9708
|
+
return false;
|
|
9709
|
+
}
|
|
9710
|
+
function isNumber(expression, estree) {
|
|
9711
|
+
if (estree) {
|
|
9712
|
+
return expression.type === "Literal" && (typeof expression.value === "number" || "bigint" in expression);
|
|
9713
|
+
} else {
|
|
9714
|
+
return expression.type === "NumericLiteral" || expression.type === "BigIntLiteral";
|
|
9715
|
+
}
|
|
9716
|
+
}
|
|
9717
|
+
function isNegativeNumber(expression, estree) {
|
|
9718
|
+
if (expression.type === "UnaryExpression") {
|
|
9719
|
+
const {
|
|
9720
|
+
operator,
|
|
9721
|
+
argument
|
|
9722
|
+
} = expression;
|
|
9723
|
+
if (operator === "-" && isNumber(argument, estree)) {
|
|
9724
|
+
return true;
|
|
9725
|
+
}
|
|
9726
|
+
}
|
|
9727
|
+
return false;
|
|
9728
|
+
}
|
|
9998
9729
|
function isUncomputedMemberExpressionChain(expression) {
|
|
9999
9730
|
if (expression.type === "Identifier") return true;
|
|
10000
9731
|
if (expression.type !== "MemberExpression") return false;
|
|
@@ -10006,14 +9737,12 @@ const PlaceholderErrors = ParseErrorEnum`placeholders`({
|
|
|
10006
9737
|
ClassNameIsRequired: "A class name is required.",
|
|
10007
9738
|
UnexpectedSpace: "Unexpected space in placeholder."
|
|
10008
9739
|
});
|
|
10009
|
-
|
|
10010
9740
|
var placeholders = (superClass => class PlaceholdersParserMixin extends superClass {
|
|
10011
9741
|
parsePlaceholder(expectedNode) {
|
|
10012
9742
|
if (this.match(142)) {
|
|
10013
9743
|
const node = this.startNode();
|
|
10014
9744
|
this.next();
|
|
10015
9745
|
this.assertNoSpace();
|
|
10016
|
-
|
|
10017
9746
|
node.name = super.parseIdentifier(true);
|
|
10018
9747
|
this.assertNoSpace();
|
|
10019
9748
|
this.expect(142);
|
|
@@ -10023,17 +9752,14 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10023
9752
|
finishPlaceholder(node, expectedNode) {
|
|
10024
9753
|
const isFinished = !!(node.expectedNode && node.type === "Placeholder");
|
|
10025
9754
|
node.expectedNode = expectedNode;
|
|
10026
|
-
|
|
10027
9755
|
return isFinished ? node : this.finishNode(node, "Placeholder");
|
|
10028
9756
|
}
|
|
10029
|
-
|
|
10030
9757
|
getTokenFromCode(code) {
|
|
10031
9758
|
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
|
|
10032
9759
|
return this.finishOp(142, 2);
|
|
10033
9760
|
}
|
|
10034
9761
|
return super.getTokenFromCode(code);
|
|
10035
9762
|
}
|
|
10036
|
-
|
|
10037
9763
|
parseExprAtom(refExpressionErrors) {
|
|
10038
9764
|
return this.parsePlaceholder("Expression") || super.parseExprAtom(refExpressionErrors);
|
|
10039
9765
|
}
|
|
@@ -10045,7 +9771,6 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10045
9771
|
super.checkReservedWord(word, startLoc, checkKeywords, isBinding);
|
|
10046
9772
|
}
|
|
10047
9773
|
}
|
|
10048
|
-
|
|
10049
9774
|
parseBindingAtom() {
|
|
10050
9775
|
return this.parsePlaceholder("Pattern") || super.parseBindingAtom();
|
|
10051
9776
|
}
|
|
@@ -10059,12 +9784,10 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10059
9784
|
super.toAssignable(node, isLHS);
|
|
10060
9785
|
}
|
|
10061
9786
|
}
|
|
10062
|
-
|
|
10063
9787
|
chStartsBindingIdentifier(ch, pos) {
|
|
10064
9788
|
if (super.chStartsBindingIdentifier(ch, pos)) {
|
|
10065
9789
|
return true;
|
|
10066
9790
|
}
|
|
10067
|
-
|
|
10068
9791
|
const nextToken = this.lookahead();
|
|
10069
9792
|
if (nextToken.type === 142) {
|
|
10070
9793
|
return true;
|
|
@@ -10075,7 +9798,6 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10075
9798
|
if (node.label && node.label.type === "Placeholder") return;
|
|
10076
9799
|
super.verifyBreakContinue(node, isBreak);
|
|
10077
9800
|
}
|
|
10078
|
-
|
|
10079
9801
|
parseExpressionStatement(node, expr) {
|
|
10080
9802
|
if (expr.type !== "Placeholder" || expr.extra && expr.extra.parenthesized) {
|
|
10081
9803
|
return super.parseExpressionStatement(node, expr);
|
|
@@ -10130,7 +9852,6 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10130
9852
|
node.declaration = this.finishPlaceholder(placeholder, "Declaration");
|
|
10131
9853
|
return this.finishNode(node, "ExportNamedDeclaration");
|
|
10132
9854
|
}
|
|
10133
|
-
|
|
10134
9855
|
this.expectPlugin("exportDefaultFrom");
|
|
10135
9856
|
const specifier = this.startNode();
|
|
10136
9857
|
specifier.exported = placeholder;
|
|
@@ -10159,8 +9880,7 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10159
9880
|
specifiers
|
|
10160
9881
|
} = node;
|
|
10161
9882
|
if (specifiers != null && specifiers.length) {
|
|
10162
|
-
node.specifiers = specifiers.filter(
|
|
10163
|
-
node => node.exported.type === "Placeholder");
|
|
9883
|
+
node.specifiers = specifiers.filter(node => node.exported.type === "Placeholder");
|
|
10164
9884
|
}
|
|
10165
9885
|
super.checkExport(node);
|
|
10166
9886
|
node.specifiers = specifiers;
|
|
@@ -10174,13 +9894,11 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10174
9894
|
this.semicolon();
|
|
10175
9895
|
return this.finishNode(node, "ImportDeclaration");
|
|
10176
9896
|
}
|
|
10177
|
-
|
|
10178
9897
|
const specifier = this.startNodeAtNode(placeholder);
|
|
10179
9898
|
specifier.local = placeholder;
|
|
10180
9899
|
node.specifiers.push(this.finishNode(specifier, "ImportDefaultSpecifier"));
|
|
10181
9900
|
if (this.eat(12)) {
|
|
10182
9901
|
const hasStarImport = this.maybeParseStarImportSpecifier(node);
|
|
10183
|
-
|
|
10184
9902
|
if (!hasStarImport) this.parseNamedImportSpecifiers(node);
|
|
10185
9903
|
}
|
|
10186
9904
|
this.expectContextual(97);
|
|
@@ -10189,10 +9907,8 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10189
9907
|
return this.finishNode(node, "ImportDeclaration");
|
|
10190
9908
|
}
|
|
10191
9909
|
parseImportSource() {
|
|
10192
|
-
|
|
10193
9910
|
return this.parsePlaceholder("StringLiteral") || super.parseImportSource();
|
|
10194
9911
|
}
|
|
10195
|
-
|
|
10196
9912
|
assertNoSpace() {
|
|
10197
9913
|
if (this.state.start > this.state.lastTokEndLoc.index) {
|
|
10198
9914
|
this.raise(PlaceholderErrors.UnexpectedSpace, {
|
|
@@ -10219,7 +9935,6 @@ var v8intrinsic = (superClass => class V8IntrinsicMixin extends superClass {
|
|
|
10219
9935
|
this.unexpected(v8IntrinsicStartLoc);
|
|
10220
9936
|
}
|
|
10221
9937
|
}
|
|
10222
|
-
|
|
10223
9938
|
parseExprAtom(refExpressionErrors) {
|
|
10224
9939
|
return this.parseV8Intrinsic() || super.parseExprAtom(refExpressionErrors);
|
|
10225
9940
|
}
|
|
@@ -10330,7 +10045,6 @@ function validatePlugins(plugins) {
|
|
|
10330
10045
|
throw error;
|
|
10331
10046
|
}
|
|
10332
10047
|
}
|
|
10333
|
-
|
|
10334
10048
|
const mixinPlugins = {
|
|
10335
10049
|
estree,
|
|
10336
10050
|
jsx,
|
|
@@ -10359,7 +10073,6 @@ const defaultOptions = {
|
|
|
10359
10073
|
errorRecovery: false,
|
|
10360
10074
|
attachComment: true
|
|
10361
10075
|
};
|
|
10362
|
-
|
|
10363
10076
|
function getOptions(opts) {
|
|
10364
10077
|
const options = {};
|
|
10365
10078
|
for (const key of Object.keys(defaultOptions)) {
|
|
@@ -10373,7 +10086,6 @@ const unwrapParenthesizedExpression = node => {
|
|
|
10373
10086
|
return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
|
|
10374
10087
|
};
|
|
10375
10088
|
class LValParser extends NodeUtils {
|
|
10376
|
-
|
|
10377
10089
|
toAssignable(node, isLHS = false) {
|
|
10378
10090
|
var _node$extra, _node$extra3;
|
|
10379
10091
|
let parenthesized = undefined;
|
|
@@ -10451,7 +10163,6 @@ class LValParser extends NodeUtils {
|
|
|
10451
10163
|
break;
|
|
10452
10164
|
}
|
|
10453
10165
|
}
|
|
10454
|
-
|
|
10455
10166
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
10456
10167
|
if (prop.type === "ObjectMethod") {
|
|
10457
10168
|
this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, {
|
|
@@ -10471,7 +10182,6 @@ class LValParser extends NodeUtils {
|
|
|
10471
10182
|
this.toAssignable(prop, isLHS);
|
|
10472
10183
|
}
|
|
10473
10184
|
}
|
|
10474
|
-
|
|
10475
10185
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
10476
10186
|
const end = exprList.length - 1;
|
|
10477
10187
|
for (let i = 0; i <= end; i++) {
|
|
@@ -10530,9 +10240,7 @@ class LValParser extends NodeUtils {
|
|
|
10530
10240
|
return false;
|
|
10531
10241
|
}
|
|
10532
10242
|
}
|
|
10533
|
-
|
|
10534
|
-
toReferencedList(exprList,
|
|
10535
|
-
isParenthesizedExpr) {
|
|
10243
|
+
toReferencedList(exprList, isParenthesizedExpr) {
|
|
10536
10244
|
return exprList;
|
|
10537
10245
|
}
|
|
10538
10246
|
toReferencedListDeep(exprList, isParenthesizedExpr) {
|
|
@@ -10543,21 +10251,18 @@ class LValParser extends NodeUtils {
|
|
|
10543
10251
|
}
|
|
10544
10252
|
}
|
|
10545
10253
|
}
|
|
10546
|
-
|
|
10547
10254
|
parseSpread(refExpressionErrors) {
|
|
10548
10255
|
const node = this.startNode();
|
|
10549
10256
|
this.next();
|
|
10550
10257
|
node.argument = this.parseMaybeAssignAllowIn(refExpressionErrors, undefined);
|
|
10551
10258
|
return this.finishNode(node, "SpreadElement");
|
|
10552
10259
|
}
|
|
10553
|
-
|
|
10554
10260
|
parseRestBinding() {
|
|
10555
10261
|
const node = this.startNode();
|
|
10556
10262
|
this.next();
|
|
10557
10263
|
node.argument = this.parseBindingAtom();
|
|
10558
10264
|
return this.finishNode(node, "RestElement");
|
|
10559
10265
|
}
|
|
10560
|
-
|
|
10561
10266
|
parseBindingAtom() {
|
|
10562
10267
|
switch (this.state.type) {
|
|
10563
10268
|
case 0:
|
|
@@ -10570,10 +10275,8 @@ class LValParser extends NodeUtils {
|
|
|
10570
10275
|
case 5:
|
|
10571
10276
|
return this.parseObjectLike(8, true);
|
|
10572
10277
|
}
|
|
10573
|
-
|
|
10574
10278
|
return this.parseIdentifier();
|
|
10575
10279
|
}
|
|
10576
|
-
|
|
10577
10280
|
parseBindingList(close, closeCharCode, allowEmpty, allowModifiers) {
|
|
10578
10281
|
const elts = [];
|
|
10579
10282
|
let first = true;
|
|
@@ -10608,14 +10311,12 @@ class LValParser extends NodeUtils {
|
|
|
10608
10311
|
}
|
|
10609
10312
|
return elts;
|
|
10610
10313
|
}
|
|
10611
|
-
|
|
10612
10314
|
parseBindingRestProperty(prop) {
|
|
10613
10315
|
this.next();
|
|
10614
10316
|
prop.argument = this.parseIdentifier();
|
|
10615
10317
|
this.checkCommaAfterRest(125);
|
|
10616
10318
|
return this.finishNode(prop, "RestElement");
|
|
10617
10319
|
}
|
|
10618
|
-
|
|
10619
10320
|
parseBindingProperty() {
|
|
10620
10321
|
const prop = this.startNode();
|
|
10621
10322
|
const {
|
|
@@ -10634,7 +10335,6 @@ class LValParser extends NodeUtils {
|
|
|
10634
10335
|
prop.method = false;
|
|
10635
10336
|
return this.parseObjPropValue(prop, startLoc, false, false, true, false);
|
|
10636
10337
|
}
|
|
10637
|
-
|
|
10638
10338
|
parseAssignableListItem(allowModifiers, decorators) {
|
|
10639
10339
|
const left = this.parseMaybeDefault();
|
|
10640
10340
|
this.parseAssignableListItemTypes(left);
|
|
@@ -10644,11 +10344,9 @@ class LValParser extends NodeUtils {
|
|
|
10644
10344
|
}
|
|
10645
10345
|
return elt;
|
|
10646
10346
|
}
|
|
10647
|
-
|
|
10648
10347
|
parseAssignableListItemTypes(param) {
|
|
10649
10348
|
return param;
|
|
10650
10349
|
}
|
|
10651
|
-
|
|
10652
10350
|
parseMaybeDefault(startLoc, left) {
|
|
10653
10351
|
var _startLoc, _left;
|
|
10654
10352
|
(_startLoc = startLoc) != null ? _startLoc : startLoc = this.state.startLoc;
|
|
@@ -10659,9 +10357,7 @@ class LValParser extends NodeUtils {
|
|
|
10659
10357
|
node.right = this.parseMaybeAssignAllowIn();
|
|
10660
10358
|
return this.finishNode(node, "AssignmentPattern");
|
|
10661
10359
|
}
|
|
10662
|
-
isValidLVal(type,
|
|
10663
|
-
isUnparenthesizedInAssign,
|
|
10664
|
-
binding) {
|
|
10360
|
+
isValidLVal(type, isUnparenthesizedInAssign, binding) {
|
|
10665
10361
|
return getOwn({
|
|
10666
10362
|
AssignmentPattern: "left",
|
|
10667
10363
|
RestElement: "argument",
|
|
@@ -10669,10 +10365,8 @@ class LValParser extends NodeUtils {
|
|
|
10669
10365
|
ParenthesizedExpression: "expression",
|
|
10670
10366
|
ArrayPattern: "elements",
|
|
10671
10367
|
ObjectPattern: "properties"
|
|
10672
|
-
},
|
|
10673
|
-
type);
|
|
10368
|
+
}, type);
|
|
10674
10369
|
}
|
|
10675
|
-
|
|
10676
10370
|
checkLVal(expression, {
|
|
10677
10371
|
in: ancestor,
|
|
10678
10372
|
binding = BIND_NONE,
|
|
@@ -10683,7 +10377,6 @@ class LValParser extends NodeUtils {
|
|
|
10683
10377
|
}) {
|
|
10684
10378
|
var _expression$extra;
|
|
10685
10379
|
const type = expression.type;
|
|
10686
|
-
|
|
10687
10380
|
if (this.isObjectMethod(expression)) return;
|
|
10688
10381
|
if (type === "MemberExpression") {
|
|
10689
10382
|
if (binding !== BIND_NONE) {
|
|
@@ -10726,7 +10419,6 @@ class LValParser extends NodeUtils {
|
|
|
10726
10419
|
}
|
|
10727
10420
|
const [key, isParenthesizedExpression] = Array.isArray(validity) ? validity : [validity, type === "ParenthesizedExpression"];
|
|
10728
10421
|
const nextAncestor = expression.type === "ArrayPattern" || expression.type === "ObjectPattern" || expression.type === "ParenthesizedExpression" ? expression : ancestor;
|
|
10729
|
-
|
|
10730
10422
|
for (const child of [].concat(expression[key])) {
|
|
10731
10423
|
if (child) {
|
|
10732
10424
|
this.checkLVal(child, {
|
|
@@ -10795,10 +10487,8 @@ class LValParser extends NodeUtils {
|
|
|
10795
10487
|
}
|
|
10796
10488
|
|
|
10797
10489
|
class ExpressionParser extends LValParser {
|
|
10798
|
-
|
|
10799
10490
|
checkProto(prop, isRecord, protoRef, refExpressionErrors) {
|
|
10800
|
-
if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed ||
|
|
10801
|
-
prop.shorthand) {
|
|
10491
|
+
if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) {
|
|
10802
10492
|
return;
|
|
10803
10493
|
}
|
|
10804
10494
|
const key = prop.key;
|
|
@@ -10827,7 +10517,6 @@ class ExpressionParser extends LValParser {
|
|
|
10827
10517
|
shouldExitDescending(expr, potentialArrowAt) {
|
|
10828
10518
|
return expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt;
|
|
10829
10519
|
}
|
|
10830
|
-
|
|
10831
10520
|
getExpression() {
|
|
10832
10521
|
this.enterInitialScopes();
|
|
10833
10522
|
this.nextToken();
|
|
@@ -10843,14 +10532,12 @@ class ExpressionParser extends LValParser {
|
|
|
10843
10532
|
}
|
|
10844
10533
|
return expr;
|
|
10845
10534
|
}
|
|
10846
|
-
|
|
10847
10535
|
parseExpression(disallowIn, refExpressionErrors) {
|
|
10848
10536
|
if (disallowIn) {
|
|
10849
10537
|
return this.disallowInAnd(() => this.parseExpressionBase(refExpressionErrors));
|
|
10850
10538
|
}
|
|
10851
10539
|
return this.allowInAnd(() => this.parseExpressionBase(refExpressionErrors));
|
|
10852
10540
|
}
|
|
10853
|
-
|
|
10854
10541
|
parseExpressionBase(refExpressionErrors) {
|
|
10855
10542
|
const startLoc = this.state.startLoc;
|
|
10856
10543
|
const expr = this.parseMaybeAssign(refExpressionErrors);
|
|
@@ -10865,20 +10552,16 @@ class ExpressionParser extends LValParser {
|
|
|
10865
10552
|
}
|
|
10866
10553
|
return expr;
|
|
10867
10554
|
}
|
|
10868
|
-
|
|
10869
10555
|
parseMaybeAssignDisallowIn(refExpressionErrors, afterLeftParse) {
|
|
10870
10556
|
return this.disallowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
|
|
10871
10557
|
}
|
|
10872
|
-
|
|
10873
10558
|
parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse) {
|
|
10874
10559
|
return this.allowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
|
|
10875
10560
|
}
|
|
10876
|
-
|
|
10877
10561
|
setOptionalParametersError(refExpressionErrors, resultError) {
|
|
10878
10562
|
var _resultError$loc;
|
|
10879
10563
|
refExpressionErrors.optionalParametersLoc = (_resultError$loc = resultError == null ? void 0 : resultError.loc) != null ? _resultError$loc : this.state.startLoc;
|
|
10880
10564
|
}
|
|
10881
|
-
|
|
10882
10565
|
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
|
|
10883
10566
|
const startLoc = this.state.startLoc;
|
|
10884
10567
|
if (this.isContextual(106)) {
|
|
@@ -10918,11 +10601,9 @@ class ExpressionParser extends LValParser {
|
|
|
10918
10601
|
if (refExpressionErrors.doubleProtoLoc != null && refExpressionErrors.doubleProtoLoc.index >= startIndex) {
|
|
10919
10602
|
refExpressionErrors.doubleProtoLoc = null;
|
|
10920
10603
|
}
|
|
10921
|
-
|
|
10922
10604
|
if (refExpressionErrors.shorthandAssignLoc != null && refExpressionErrors.shorthandAssignLoc.index >= startIndex) {
|
|
10923
10605
|
refExpressionErrors.shorthandAssignLoc = null;
|
|
10924
10606
|
}
|
|
10925
|
-
|
|
10926
10607
|
if (refExpressionErrors.privateKeyLoc != null && refExpressionErrors.privateKeyLoc.index >= startIndex) {
|
|
10927
10608
|
this.checkDestructuringPrivate(refExpressionErrors);
|
|
10928
10609
|
refExpressionErrors.privateKeyLoc = null;
|
|
@@ -10941,7 +10622,6 @@ class ExpressionParser extends LValParser {
|
|
|
10941
10622
|
}
|
|
10942
10623
|
return left;
|
|
10943
10624
|
}
|
|
10944
|
-
|
|
10945
10625
|
parseMaybeConditional(refExpressionErrors) {
|
|
10946
10626
|
const startLoc = this.state.startLoc;
|
|
10947
10627
|
const potentialArrowAt = this.state.potentialArrowAt;
|
|
@@ -10951,8 +10631,7 @@ class ExpressionParser extends LValParser {
|
|
|
10951
10631
|
}
|
|
10952
10632
|
return this.parseConditional(expr, startLoc, refExpressionErrors);
|
|
10953
10633
|
}
|
|
10954
|
-
parseConditional(expr, startLoc,
|
|
10955
|
-
refExpressionErrors) {
|
|
10634
|
+
parseConditional(expr, startLoc, refExpressionErrors) {
|
|
10956
10635
|
if (this.eat(17)) {
|
|
10957
10636
|
const node = this.startNodeAt(startLoc);
|
|
10958
10637
|
node.test = expr;
|
|
@@ -10966,7 +10645,6 @@ class ExpressionParser extends LValParser {
|
|
|
10966
10645
|
parseMaybeUnaryOrPrivate(refExpressionErrors) {
|
|
10967
10646
|
return this.match(136) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
|
|
10968
10647
|
}
|
|
10969
|
-
|
|
10970
10648
|
parseExprOps(refExpressionErrors) {
|
|
10971
10649
|
const startLoc = this.state.startLoc;
|
|
10972
10650
|
const potentialArrowAt = this.state.potentialArrowAt;
|
|
@@ -10976,10 +10654,8 @@ class ExpressionParser extends LValParser {
|
|
|
10976
10654
|
}
|
|
10977
10655
|
return this.parseExprOp(expr, startLoc, -1);
|
|
10978
10656
|
}
|
|
10979
|
-
|
|
10980
10657
|
parseExprOp(left, leftStartLoc, minPrec) {
|
|
10981
10658
|
if (this.isPrivateName(left)) {
|
|
10982
|
-
|
|
10983
10659
|
const value = this.getPrivateNameSV(left);
|
|
10984
10660
|
if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) {
|
|
10985
10661
|
this.raise(Errors.PrivateInExpectedIn, {
|
|
@@ -11031,7 +10707,6 @@ class ExpressionParser extends LValParser {
|
|
|
11031
10707
|
}
|
|
11032
10708
|
return left;
|
|
11033
10709
|
}
|
|
11034
|
-
|
|
11035
10710
|
parseExprOpRightExpr(op, prec) {
|
|
11036
10711
|
const startLoc = this.state.startLoc;
|
|
11037
10712
|
switch (op) {
|
|
@@ -11055,12 +10730,10 @@ class ExpressionParser extends LValParser {
|
|
|
11055
10730
|
return this.parseFSharpPipelineBody(prec);
|
|
11056
10731
|
});
|
|
11057
10732
|
}
|
|
11058
|
-
|
|
11059
10733
|
default:
|
|
11060
10734
|
return this.parseExprOpBaseRightExpr(op, prec);
|
|
11061
10735
|
}
|
|
11062
10736
|
}
|
|
11063
|
-
|
|
11064
10737
|
parseExprOpBaseRightExpr(op, prec) {
|
|
11065
10738
|
const startLoc = this.state.startLoc;
|
|
11066
10739
|
return this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startLoc, tokenIsRightAssociative(op) ? prec - 1 : prec);
|
|
@@ -11071,9 +10744,7 @@ class ExpressionParser extends LValParser {
|
|
|
11071
10744
|
startLoc
|
|
11072
10745
|
} = this.state;
|
|
11073
10746
|
const body = this.parseMaybeAssign();
|
|
11074
|
-
const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(
|
|
11075
|
-
body.type);
|
|
11076
|
-
|
|
10747
|
+
const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);
|
|
11077
10748
|
if (requiredParentheses && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) {
|
|
11078
10749
|
this.raise(Errors.PipeUnparenthesizedBody, {
|
|
11079
10750
|
at: startLoc,
|
|
@@ -11094,7 +10765,6 @@ class ExpressionParser extends LValParser {
|
|
|
11094
10765
|
});
|
|
11095
10766
|
}
|
|
11096
10767
|
}
|
|
11097
|
-
|
|
11098
10768
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
11099
10769
|
const startLoc = this.state.startLoc;
|
|
11100
10770
|
const isAwait = this.isContextual(96);
|
|
@@ -11135,8 +10805,7 @@ class ExpressionParser extends LValParser {
|
|
|
11135
10805
|
return this.finishNode(node, "UnaryExpression");
|
|
11136
10806
|
}
|
|
11137
10807
|
}
|
|
11138
|
-
const expr = this.parseUpdate(
|
|
11139
|
-
node, update, refExpressionErrors);
|
|
10808
|
+
const expr = this.parseUpdate(node, update, refExpressionErrors);
|
|
11140
10809
|
if (isAwait) {
|
|
11141
10810
|
const {
|
|
11142
10811
|
type
|
|
@@ -11151,7 +10820,6 @@ class ExpressionParser extends LValParser {
|
|
|
11151
10820
|
}
|
|
11152
10821
|
return expr;
|
|
11153
10822
|
}
|
|
11154
|
-
|
|
11155
10823
|
parseUpdate(node, update, refExpressionErrors) {
|
|
11156
10824
|
if (update) {
|
|
11157
10825
|
const updateExpressionNode = node;
|
|
@@ -11175,7 +10843,6 @@ class ExpressionParser extends LValParser {
|
|
|
11175
10843
|
}
|
|
11176
10844
|
return expr;
|
|
11177
10845
|
}
|
|
11178
|
-
|
|
11179
10846
|
parseExprSubscripts(refExpressionErrors) {
|
|
11180
10847
|
const startLoc = this.state.startLoc;
|
|
11181
10848
|
const potentialArrowAt = this.state.potentialArrowAt;
|
|
@@ -11193,12 +10860,10 @@ class ExpressionParser extends LValParser {
|
|
|
11193
10860
|
};
|
|
11194
10861
|
do {
|
|
11195
10862
|
base = this.parseSubscript(base, startLoc, noCalls, state);
|
|
11196
|
-
|
|
11197
10863
|
state.maybeAsyncArrow = false;
|
|
11198
10864
|
} while (!state.stop);
|
|
11199
10865
|
return base;
|
|
11200
10866
|
}
|
|
11201
|
-
|
|
11202
10867
|
parseSubscript(base, startLoc, noCalls, state) {
|
|
11203
10868
|
const {
|
|
11204
10869
|
type
|
|
@@ -11229,7 +10894,6 @@ class ExpressionParser extends LValParser {
|
|
|
11229
10894
|
}
|
|
11230
10895
|
}
|
|
11231
10896
|
}
|
|
11232
|
-
|
|
11233
10897
|
parseMember(base, startLoc, state, computed, optional) {
|
|
11234
10898
|
const node = this.startNodeAt(startLoc);
|
|
11235
10899
|
node.object = base;
|
|
@@ -11255,7 +10919,6 @@ class ExpressionParser extends LValParser {
|
|
|
11255
10919
|
return this.finishNode(node, "MemberExpression");
|
|
11256
10920
|
}
|
|
11257
10921
|
}
|
|
11258
|
-
|
|
11259
10922
|
parseBind(base, startLoc, noCalls, state) {
|
|
11260
10923
|
const node = this.startNodeAt(startLoc);
|
|
11261
10924
|
node.object = base;
|
|
@@ -11264,13 +10927,11 @@ class ExpressionParser extends LValParser {
|
|
|
11264
10927
|
state.stop = true;
|
|
11265
10928
|
return this.parseSubscripts(this.finishNode(node, "BindExpression"), startLoc, noCalls);
|
|
11266
10929
|
}
|
|
11267
|
-
|
|
11268
10930
|
parseCoverCallAndAsyncArrowHead(base, startLoc, state, optional) {
|
|
11269
10931
|
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
|
11270
10932
|
let refExpressionErrors = null;
|
|
11271
10933
|
this.state.maybeInArrowParameters = true;
|
|
11272
10934
|
this.next();
|
|
11273
|
-
|
|
11274
10935
|
const node = this.startNodeAt(startLoc);
|
|
11275
10936
|
node.callee = base;
|
|
11276
10937
|
const {
|
|
@@ -11287,8 +10948,7 @@ class ExpressionParser extends LValParser {
|
|
|
11287
10948
|
if (optional) {
|
|
11288
10949
|
node.arguments = this.parseCallExpressionArguments(11);
|
|
11289
10950
|
} else {
|
|
11290
|
-
node.arguments = this.parseCallExpressionArguments(11, base.type === "Import", base.type !== "Super",
|
|
11291
|
-
node, refExpressionErrors);
|
|
10951
|
+
node.arguments = this.parseCallExpressionArguments(11, base.type === "Import", base.type !== "Super", node, refExpressionErrors);
|
|
11292
10952
|
}
|
|
11293
10953
|
let finishedNode = this.finishCallExpression(node, optionalChainMember);
|
|
11294
10954
|
if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
|
|
@@ -11310,7 +10970,6 @@ class ExpressionParser extends LValParser {
|
|
|
11310
10970
|
toReferencedArguments(node, isParenthesizedExpr) {
|
|
11311
10971
|
this.toReferencedListDeep(node.arguments, isParenthesizedExpr);
|
|
11312
10972
|
}
|
|
11313
|
-
|
|
11314
10973
|
parseTaggedTemplateExpression(base, startLoc, state) {
|
|
11315
10974
|
const node = this.startNodeAt(startLoc);
|
|
11316
10975
|
node.tag = base;
|
|
@@ -11323,8 +10982,7 @@ class ExpressionParser extends LValParser {
|
|
|
11323
10982
|
return this.finishNode(node, "TaggedTemplateExpression");
|
|
11324
10983
|
}
|
|
11325
10984
|
atPossibleAsyncArrow(base) {
|
|
11326
|
-
return base.type === "Identifier" && base.name === "async" && this.state.lastTokEndLoc.index === base.end && !this.canInsertSemicolon() &&
|
|
11327
|
-
base.end - base.start === 5 && base.start === this.state.potentialArrowAt;
|
|
10985
|
+
return base.type === "Identifier" && base.name === "async" && this.state.lastTokEndLoc.index === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && base.start === this.state.potentialArrowAt;
|
|
11328
10986
|
}
|
|
11329
10987
|
finishCallExpression(node, optional) {
|
|
11330
10988
|
if (node.callee.type === "Import") {
|
|
@@ -11396,12 +11054,10 @@ class ExpressionParser extends LValParser {
|
|
|
11396
11054
|
}
|
|
11397
11055
|
return node;
|
|
11398
11056
|
}
|
|
11399
|
-
|
|
11400
11057
|
parseNoCallExpr() {
|
|
11401
11058
|
const startLoc = this.state.startLoc;
|
|
11402
11059
|
return this.parseSubscripts(this.parseExprAtom(), startLoc, true);
|
|
11403
11060
|
}
|
|
11404
|
-
|
|
11405
11061
|
parseExprAtom(refExpressionErrors) {
|
|
11406
11062
|
let node;
|
|
11407
11063
|
let decorators = null;
|
|
@@ -11485,7 +11141,6 @@ class ExpressionParser extends LValParser {
|
|
|
11485
11141
|
case 25:
|
|
11486
11142
|
case 24:
|
|
11487
11143
|
return this.parseTemplate(false);
|
|
11488
|
-
|
|
11489
11144
|
case 15:
|
|
11490
11145
|
{
|
|
11491
11146
|
node = this.startNode();
|
|
@@ -11535,8 +11190,7 @@ class ExpressionParser extends LValParser {
|
|
|
11535
11190
|
case 47:
|
|
11536
11191
|
{
|
|
11537
11192
|
const lookaheadCh = this.input.codePointAt(this.nextTokenStart());
|
|
11538
|
-
if (isIdentifierStart(lookaheadCh) ||
|
|
11539
|
-
lookaheadCh === 62) {
|
|
11193
|
+
if (isIdentifierStart(lookaheadCh) || lookaheadCh === 62) {
|
|
11540
11194
|
this.expectOnePlugin(["jsx", "flow", "typescript"]);
|
|
11541
11195
|
break;
|
|
11542
11196
|
} else {
|
|
@@ -11580,7 +11234,6 @@ class ExpressionParser extends LValParser {
|
|
|
11580
11234
|
}
|
|
11581
11235
|
}
|
|
11582
11236
|
}
|
|
11583
|
-
|
|
11584
11237
|
parseTopicReferenceThenEqualsSign(topicTokenType, topicTokenValue) {
|
|
11585
11238
|
const pipeProposal = this.getPluginOption("pipelineOperator", "proposal");
|
|
11586
11239
|
if (pipeProposal) {
|
|
@@ -11594,30 +11247,21 @@ class ExpressionParser extends LValParser {
|
|
|
11594
11247
|
throw this.unexpected();
|
|
11595
11248
|
}
|
|
11596
11249
|
}
|
|
11597
|
-
|
|
11598
11250
|
parseTopicReference(pipeProposal) {
|
|
11599
11251
|
const node = this.startNode();
|
|
11600
11252
|
const startLoc = this.state.startLoc;
|
|
11601
11253
|
const tokenType = this.state.type;
|
|
11602
|
-
|
|
11603
11254
|
this.next();
|
|
11604
|
-
|
|
11605
11255
|
return this.finishTopicReference(node, startLoc, pipeProposal, tokenType);
|
|
11606
11256
|
}
|
|
11607
|
-
|
|
11608
11257
|
finishTopicReference(node, startLoc, pipeProposal, tokenType) {
|
|
11609
11258
|
if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
|
|
11610
|
-
|
|
11611
|
-
const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" :
|
|
11612
|
-
"TopicReference";
|
|
11259
|
+
const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" : "TopicReference";
|
|
11613
11260
|
if (!this.topicReferenceIsAllowedInCurrentContext()) {
|
|
11614
|
-
this.raise(
|
|
11615
|
-
pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed :
|
|
11616
|
-
Errors.PipeTopicUnbound, {
|
|
11261
|
+
this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, {
|
|
11617
11262
|
at: startLoc
|
|
11618
11263
|
});
|
|
11619
11264
|
}
|
|
11620
|
-
|
|
11621
11265
|
this.registerTopicReference();
|
|
11622
11266
|
return this.finishNode(node, nodeType);
|
|
11623
11267
|
} else {
|
|
@@ -11627,7 +11271,6 @@ class ExpressionParser extends LValParser {
|
|
|
11627
11271
|
});
|
|
11628
11272
|
}
|
|
11629
11273
|
}
|
|
11630
|
-
|
|
11631
11274
|
testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType) {
|
|
11632
11275
|
switch (pipeProposal) {
|
|
11633
11276
|
case "hack":
|
|
@@ -11644,7 +11287,6 @@ class ExpressionParser extends LValParser {
|
|
|
11644
11287
|
});
|
|
11645
11288
|
}
|
|
11646
11289
|
}
|
|
11647
|
-
|
|
11648
11290
|
parseAsyncArrowUnaryFunction(node) {
|
|
11649
11291
|
this.prodParam.enter(functionFlags(true, this.prodParam.hasYield));
|
|
11650
11292
|
const params = [this.parseIdentifier()];
|
|
@@ -11657,7 +11299,6 @@ class ExpressionParser extends LValParser {
|
|
|
11657
11299
|
this.expect(19);
|
|
11658
11300
|
return this.parseArrowExpression(node, params, true);
|
|
11659
11301
|
}
|
|
11660
|
-
|
|
11661
11302
|
parseDo(node, isAsync) {
|
|
11662
11303
|
this.expectPlugin("doExpressions");
|
|
11663
11304
|
if (isAsync) {
|
|
@@ -11677,7 +11318,6 @@ class ExpressionParser extends LValParser {
|
|
|
11677
11318
|
this.state.labels = oldLabels;
|
|
11678
11319
|
return this.finishNode(node, "DoExpression");
|
|
11679
11320
|
}
|
|
11680
|
-
|
|
11681
11321
|
parseSuper() {
|
|
11682
11322
|
const node = this.startNode();
|
|
11683
11323
|
this.next();
|
|
@@ -11699,8 +11339,7 @@ class ExpressionParser extends LValParser {
|
|
|
11699
11339
|
}
|
|
11700
11340
|
parsePrivateName() {
|
|
11701
11341
|
const node = this.startNode();
|
|
11702
|
-
const id = this.startNodeAt(
|
|
11703
|
-
createPositionWithColumnOffset(this.state.startLoc, 1));
|
|
11342
|
+
const id = this.startNodeAt(createPositionWithColumnOffset(this.state.startLoc, 1));
|
|
11704
11343
|
const name = this.state.value;
|
|
11705
11344
|
this.next();
|
|
11706
11345
|
node.id = this.createIdentifier(id, name);
|
|
@@ -11708,9 +11347,7 @@ class ExpressionParser extends LValParser {
|
|
|
11708
11347
|
}
|
|
11709
11348
|
parseFunctionOrFunctionSent() {
|
|
11710
11349
|
const node = this.startNode();
|
|
11711
|
-
|
|
11712
11350
|
this.next();
|
|
11713
|
-
|
|
11714
11351
|
if (this.prodParam.hasYield && this.match(16)) {
|
|
11715
11352
|
const meta = this.createIdentifier(this.startNodeAtNode(node), "function");
|
|
11716
11353
|
this.next();
|
|
@@ -11736,11 +11373,9 @@ class ExpressionParser extends LValParser {
|
|
|
11736
11373
|
}
|
|
11737
11374
|
return this.finishNode(node, "MetaProperty");
|
|
11738
11375
|
}
|
|
11739
|
-
|
|
11740
11376
|
parseImportMetaProperty(node) {
|
|
11741
11377
|
const id = this.createIdentifier(this.startNodeAtNode(node), "import");
|
|
11742
11378
|
this.next();
|
|
11743
|
-
|
|
11744
11379
|
if (this.isContextual(100)) {
|
|
11745
11380
|
if (!this.inModule) {
|
|
11746
11381
|
this.raise(Errors.ImportMetaOutsideModule, {
|
|
@@ -11791,7 +11426,6 @@ class ExpressionParser extends LValParser {
|
|
|
11791
11426
|
this.next();
|
|
11792
11427
|
return this.finishNode(node, "NullLiteral");
|
|
11793
11428
|
}
|
|
11794
|
-
|
|
11795
11429
|
parseParenAndDistinguishExpression(canBeArrow) {
|
|
11796
11430
|
const startLoc = this.state.startLoc;
|
|
11797
11431
|
let val;
|
|
@@ -11856,8 +11490,7 @@ class ExpressionParser extends LValParser {
|
|
|
11856
11490
|
} else {
|
|
11857
11491
|
val = exprList[0];
|
|
11858
11492
|
}
|
|
11859
|
-
return this.wrapParenthesis(startLoc,
|
|
11860
|
-
val);
|
|
11493
|
+
return this.wrapParenthesis(startLoc, val);
|
|
11861
11494
|
}
|
|
11862
11495
|
wrapParenthesis(startLoc, expression) {
|
|
11863
11496
|
if (!this.options.createParenthesizedExpressions) {
|
|
@@ -11870,7 +11503,6 @@ class ExpressionParser extends LValParser {
|
|
|
11870
11503
|
parenExpression.expression = expression;
|
|
11871
11504
|
return this.finishNode(parenExpression, "ParenthesizedExpression");
|
|
11872
11505
|
}
|
|
11873
|
-
|
|
11874
11506
|
shouldParseArrow(params) {
|
|
11875
11507
|
return !this.canInsertSemicolon();
|
|
11876
11508
|
}
|
|
@@ -11879,8 +11511,7 @@ class ExpressionParser extends LValParser {
|
|
|
11879
11511
|
return node;
|
|
11880
11512
|
}
|
|
11881
11513
|
}
|
|
11882
|
-
parseParenItem(node,
|
|
11883
|
-
startLoc) {
|
|
11514
|
+
parseParenItem(node, startLoc) {
|
|
11884
11515
|
return node;
|
|
11885
11516
|
}
|
|
11886
11517
|
parseNewOrNewTarget() {
|
|
@@ -11899,7 +11530,6 @@ class ExpressionParser extends LValParser {
|
|
|
11899
11530
|
}
|
|
11900
11531
|
return this.parseNew(node);
|
|
11901
11532
|
}
|
|
11902
|
-
|
|
11903
11533
|
parseNew(node) {
|
|
11904
11534
|
this.parseNewCallee(node);
|
|
11905
11535
|
if (this.eat(10)) {
|
|
@@ -11927,7 +11557,6 @@ class ExpressionParser extends LValParser {
|
|
|
11927
11557
|
});
|
|
11928
11558
|
}
|
|
11929
11559
|
}
|
|
11930
|
-
|
|
11931
11560
|
parseTemplateElement(isTagged) {
|
|
11932
11561
|
const {
|
|
11933
11562
|
start,
|
|
@@ -11957,7 +11586,6 @@ class ExpressionParser extends LValParser {
|
|
|
11957
11586
|
this.resetEndLocation(finishedNode, createPositionWithColumnOffset(this.state.lastTokEndLoc, endOffset));
|
|
11958
11587
|
return finishedNode;
|
|
11959
11588
|
}
|
|
11960
|
-
|
|
11961
11589
|
parseTemplate(isTagged) {
|
|
11962
11590
|
const node = this.startNode();
|
|
11963
11591
|
node.expressions = [];
|
|
@@ -11970,11 +11598,9 @@ class ExpressionParser extends LValParser {
|
|
|
11970
11598
|
}
|
|
11971
11599
|
return this.finishNode(node, "TemplateLiteral");
|
|
11972
11600
|
}
|
|
11973
|
-
|
|
11974
11601
|
parseTemplateSubstitution() {
|
|
11975
11602
|
return this.parseExpression();
|
|
11976
11603
|
}
|
|
11977
|
-
|
|
11978
11604
|
parseObjectLike(close, isPattern, isRecord, refExpressionErrors) {
|
|
11979
11605
|
if (isRecord) {
|
|
11980
11606
|
this.expectPlugin("recordAndTuple");
|
|
@@ -11992,8 +11618,7 @@ class ExpressionParser extends LValParser {
|
|
|
11992
11618
|
} else {
|
|
11993
11619
|
this.expect(12);
|
|
11994
11620
|
if (this.match(close)) {
|
|
11995
|
-
this.addTrailingCommaExtraToNode(
|
|
11996
|
-
node);
|
|
11621
|
+
this.addTrailingCommaExtraToNode(node);
|
|
11997
11622
|
break;
|
|
11998
11623
|
}
|
|
11999
11624
|
}
|
|
@@ -12009,11 +11634,9 @@ class ExpressionParser extends LValParser {
|
|
|
12009
11634
|
at: prop
|
|
12010
11635
|
});
|
|
12011
11636
|
}
|
|
12012
|
-
|
|
12013
11637
|
if (prop.shorthand) {
|
|
12014
11638
|
this.addExtra(prop, "shorthand", true);
|
|
12015
11639
|
}
|
|
12016
|
-
|
|
12017
11640
|
node.properties.push(prop);
|
|
12018
11641
|
}
|
|
12019
11642
|
this.next();
|
|
@@ -12030,11 +11653,9 @@ class ExpressionParser extends LValParser {
|
|
|
12030
11653
|
this.addExtra(node, "trailingComma", this.state.lastTokStart);
|
|
12031
11654
|
this.addExtra(node, "trailingCommaLoc", this.state.lastTokStartLoc, false);
|
|
12032
11655
|
}
|
|
12033
|
-
|
|
12034
11656
|
maybeAsyncOrAccessorProp(prop) {
|
|
12035
11657
|
return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(55));
|
|
12036
11658
|
}
|
|
12037
|
-
|
|
12038
11659
|
parsePropertyDefinition(refExpressionErrors) {
|
|
12039
11660
|
let decorators = [];
|
|
12040
11661
|
if (this.match(26)) {
|
|
@@ -12043,7 +11664,6 @@ class ExpressionParser extends LValParser {
|
|
|
12043
11664
|
at: this.state.startLoc
|
|
12044
11665
|
});
|
|
12045
11666
|
}
|
|
12046
|
-
|
|
12047
11667
|
while (this.match(26)) {
|
|
12048
11668
|
decorators.push(this.parseDecorator());
|
|
12049
11669
|
}
|
|
@@ -12096,11 +11716,9 @@ class ExpressionParser extends LValParser {
|
|
|
12096
11716
|
getGetterSetterExpectedParamCount(method) {
|
|
12097
11717
|
return method.kind === "get" ? 0 : 1;
|
|
12098
11718
|
}
|
|
12099
|
-
|
|
12100
11719
|
getObjectOrClassMethodParams(method) {
|
|
12101
11720
|
return method.params;
|
|
12102
11721
|
}
|
|
12103
|
-
|
|
12104
11722
|
checkGetterSetterParams(method) {
|
|
12105
11723
|
var _params;
|
|
12106
11724
|
const paramCount = this.getGetterSetterExpectedParamCount(method);
|
|
@@ -12116,11 +11734,9 @@ class ExpressionParser extends LValParser {
|
|
|
12116
11734
|
});
|
|
12117
11735
|
}
|
|
12118
11736
|
}
|
|
12119
|
-
|
|
12120
11737
|
parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
|
|
12121
11738
|
if (isAccessor) {
|
|
12122
|
-
const finishedProp = this.parseMethod(prop,
|
|
12123
|
-
isGenerator, false, false, false, "ObjectMethod");
|
|
11739
|
+
const finishedProp = this.parseMethod(prop, isGenerator, false, false, false, "ObjectMethod");
|
|
12124
11740
|
this.checkGetterSetterParams(finishedProp);
|
|
12125
11741
|
return finishedProp;
|
|
12126
11742
|
}
|
|
@@ -12131,7 +11747,6 @@ class ExpressionParser extends LValParser {
|
|
|
12131
11747
|
return this.parseMethod(prop, isGenerator, isAsync, false, false, "ObjectMethod");
|
|
12132
11748
|
}
|
|
12133
11749
|
}
|
|
12134
|
-
|
|
12135
11750
|
parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) {
|
|
12136
11751
|
prop.shorthand = false;
|
|
12137
11752
|
if (this.eat(14)) {
|
|
@@ -12166,7 +11781,6 @@ class ExpressionParser extends LValParser {
|
|
|
12166
11781
|
if (!node) this.unexpected();
|
|
12167
11782
|
return node;
|
|
12168
11783
|
}
|
|
12169
|
-
|
|
12170
11784
|
parsePropertyName(prop, refExpressionErrors) {
|
|
12171
11785
|
if (this.eat(0)) {
|
|
12172
11786
|
prop.computed = true;
|
|
@@ -12220,13 +11834,11 @@ class ExpressionParser extends LValParser {
|
|
|
12220
11834
|
}
|
|
12221
11835
|
return prop.key;
|
|
12222
11836
|
}
|
|
12223
|
-
|
|
12224
11837
|
initFunction(node, isAsync) {
|
|
12225
11838
|
node.id = null;
|
|
12226
11839
|
node.generator = false;
|
|
12227
11840
|
node.async = isAsync;
|
|
12228
11841
|
}
|
|
12229
|
-
|
|
12230
11842
|
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
|
|
12231
11843
|
this.initFunction(node, isAsync);
|
|
12232
11844
|
node.generator = isGenerator;
|
|
@@ -12239,7 +11851,6 @@ class ExpressionParser extends LValParser {
|
|
|
12239
11851
|
this.scope.exit();
|
|
12240
11852
|
return finishedNode;
|
|
12241
11853
|
}
|
|
12242
|
-
|
|
12243
11854
|
parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
|
|
12244
11855
|
if (isTuple) {
|
|
12245
11856
|
this.expectPlugin("recordAndTuple");
|
|
@@ -12248,12 +11859,10 @@ class ExpressionParser extends LValParser {
|
|
|
12248
11859
|
this.state.inFSharpPipelineDirectBody = false;
|
|
12249
11860
|
const node = this.startNode();
|
|
12250
11861
|
this.next();
|
|
12251
|
-
node.elements = this.parseExprList(close, !isTuple, refExpressionErrors,
|
|
12252
|
-
node);
|
|
11862
|
+
node.elements = this.parseExprList(close, !isTuple, refExpressionErrors, node);
|
|
12253
11863
|
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
|
|
12254
11864
|
return this.finishNode(node, isTuple ? "TupleExpression" : "ArrayExpression");
|
|
12255
11865
|
}
|
|
12256
|
-
|
|
12257
11866
|
parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
|
|
12258
11867
|
this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW);
|
|
12259
11868
|
let flags = functionFlags(isAsync, false);
|
|
@@ -12282,7 +11891,6 @@ class ExpressionParser extends LValParser {
|
|
|
12282
11891
|
this.parseFunctionBody(node, false, isMethod);
|
|
12283
11892
|
return this.finishNode(node, type);
|
|
12284
11893
|
}
|
|
12285
|
-
|
|
12286
11894
|
parseFunctionBody(node, allowExpression, isMethod = false) {
|
|
12287
11895
|
const isExpression = allowExpression && !this.match(5);
|
|
12288
11896
|
this.expressionScope.enter(newExpressionScope());
|
|
@@ -12293,23 +11901,16 @@ class ExpressionParser extends LValParser {
|
|
|
12293
11901
|
const oldStrict = this.state.strict;
|
|
12294
11902
|
const oldLabels = this.state.labels;
|
|
12295
11903
|
this.state.labels = [];
|
|
12296
|
-
|
|
12297
11904
|
this.prodParam.enter(this.prodParam.currentFlags() | PARAM_RETURN);
|
|
12298
|
-
node.body = this.parseBlock(true, false,
|
|
12299
|
-
hasStrictModeDirective => {
|
|
11905
|
+
node.body = this.parseBlock(true, false, hasStrictModeDirective => {
|
|
12300
11906
|
const nonSimple = !this.isSimpleParamList(node.params);
|
|
12301
11907
|
if (hasStrictModeDirective && nonSimple) {
|
|
12302
11908
|
this.raise(Errors.IllegalLanguageModeDirective, {
|
|
12303
|
-
at:
|
|
12304
|
-
(node.kind === "method" || node.kind === "constructor") &&
|
|
12305
|
-
!!node.key ?
|
|
12306
|
-
node.key.loc.end : node
|
|
11909
|
+
at: (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node
|
|
12307
11910
|
});
|
|
12308
11911
|
}
|
|
12309
11912
|
const strictModeChanged = !oldStrict && this.state.strict;
|
|
12310
|
-
|
|
12311
11913
|
this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
|
|
12312
|
-
|
|
12313
11914
|
if (this.state.strict && node.id) {
|
|
12314
11915
|
this.checkIdentifier(node.id, BIND_OUTSIDE, strictModeChanged);
|
|
12315
11916
|
}
|
|
@@ -12328,8 +11929,7 @@ class ExpressionParser extends LValParser {
|
|
|
12328
11929
|
}
|
|
12329
11930
|
return true;
|
|
12330
11931
|
}
|
|
12331
|
-
checkParams(node, allowDuplicates,
|
|
12332
|
-
isArrowFunction, strictModeChanged = true) {
|
|
11932
|
+
checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) {
|
|
12333
11933
|
const checkClashes = !allowDuplicates && new Set();
|
|
12334
11934
|
const formalParameters = {
|
|
12335
11935
|
type: "FormalParameters"
|
|
@@ -12343,7 +11943,6 @@ class ExpressionParser extends LValParser {
|
|
|
12343
11943
|
});
|
|
12344
11944
|
}
|
|
12345
11945
|
}
|
|
12346
|
-
|
|
12347
11946
|
parseExprList(close, allowEmpty, refExpressionErrors, nodeForExtra) {
|
|
12348
11947
|
const elts = [];
|
|
12349
11948
|
let first = true;
|
|
@@ -12392,7 +11991,6 @@ class ExpressionParser extends LValParser {
|
|
|
12392
11991
|
}
|
|
12393
11992
|
return elt;
|
|
12394
11993
|
}
|
|
12395
|
-
|
|
12396
11994
|
parseIdentifier(liberal) {
|
|
12397
11995
|
const node = this.startNode();
|
|
12398
11996
|
const name = this.parseIdentifierName(liberal);
|
|
@@ -12485,7 +12083,6 @@ class ExpressionParser extends LValParser {
|
|
|
12485
12083
|
}
|
|
12486
12084
|
return false;
|
|
12487
12085
|
}
|
|
12488
|
-
|
|
12489
12086
|
parseAwait(startLoc) {
|
|
12490
12087
|
const node = this.startNodeAt(startLoc);
|
|
12491
12088
|
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, {
|
|
@@ -12513,13 +12110,8 @@ class ExpressionParser extends LValParser {
|
|
|
12513
12110
|
const {
|
|
12514
12111
|
type
|
|
12515
12112
|
} = this.state;
|
|
12516
|
-
return (
|
|
12517
|
-
type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 101 && !this.state.containsEsc ||
|
|
12518
|
-
type === 135 || type === 56 ||
|
|
12519
|
-
this.hasPlugin("v8intrinsic") && type === 54
|
|
12520
|
-
);
|
|
12113
|
+
return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 101 && !this.state.containsEsc || type === 135 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54;
|
|
12521
12114
|
}
|
|
12522
|
-
|
|
12523
12115
|
parseYield() {
|
|
12524
12116
|
const node = this.startNode();
|
|
12525
12117
|
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, {
|
|
@@ -12548,7 +12140,6 @@ class ExpressionParser extends LValParser {
|
|
|
12548
12140
|
node.argument = argument;
|
|
12549
12141
|
return this.finishNode(node, "YieldExpression");
|
|
12550
12142
|
}
|
|
12551
|
-
|
|
12552
12143
|
checkPipelineAtInfixOperator(left, leftStartLoc) {
|
|
12553
12144
|
if (this.hasPlugin(["pipelineOperator", {
|
|
12554
12145
|
proposal: "smart"
|
|
@@ -12582,21 +12173,18 @@ class ExpressionParser extends LValParser {
|
|
|
12582
12173
|
return false;
|
|
12583
12174
|
}
|
|
12584
12175
|
}
|
|
12585
|
-
|
|
12586
12176
|
checkSmartPipeTopicBodyEarlyErrors(startLoc) {
|
|
12587
12177
|
if (this.match(19)) {
|
|
12588
12178
|
throw this.raise(Errors.PipelineBodyNoArrow, {
|
|
12589
12179
|
at: this.state.startLoc
|
|
12590
12180
|
});
|
|
12591
12181
|
}
|
|
12592
|
-
|
|
12593
12182
|
if (!this.topicReferenceWasUsedInCurrentContext()) {
|
|
12594
12183
|
this.raise(Errors.PipelineTopicUnused, {
|
|
12595
12184
|
at: startLoc
|
|
12596
12185
|
});
|
|
12597
12186
|
}
|
|
12598
12187
|
}
|
|
12599
|
-
|
|
12600
12188
|
withTopicBindingContext(callback) {
|
|
12601
12189
|
const outerContextTopicState = this.state.topicContext;
|
|
12602
12190
|
this.state.topicContext = {
|
|
@@ -12609,7 +12197,6 @@ class ExpressionParser extends LValParser {
|
|
|
12609
12197
|
this.state.topicContext = outerContextTopicState;
|
|
12610
12198
|
}
|
|
12611
12199
|
}
|
|
12612
|
-
|
|
12613
12200
|
withSmartMixTopicForbiddingContext(callback) {
|
|
12614
12201
|
if (this.hasPlugin(["pipelineOperator", {
|
|
12615
12202
|
proposal: "smart"
|
|
@@ -12663,7 +12250,6 @@ class ExpressionParser extends LValParser {
|
|
|
12663
12250
|
}
|
|
12664
12251
|
return callback();
|
|
12665
12252
|
}
|
|
12666
|
-
|
|
12667
12253
|
registerTopicReference() {
|
|
12668
12254
|
this.state.topicContext.maxTopicIndex = 0;
|
|
12669
12255
|
}
|
|
@@ -12682,7 +12268,6 @@ class ExpressionParser extends LValParser {
|
|
|
12682
12268
|
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
|
|
12683
12269
|
return ret;
|
|
12684
12270
|
}
|
|
12685
|
-
|
|
12686
12271
|
parseModuleExpression() {
|
|
12687
12272
|
this.expectPlugin("moduleBlocks");
|
|
12688
12273
|
const node = this.startNode();
|
|
@@ -12692,7 +12277,6 @@ class ExpressionParser extends LValParser {
|
|
|
12692
12277
|
}
|
|
12693
12278
|
const program = this.startNodeAt(this.state.endLoc);
|
|
12694
12279
|
this.next();
|
|
12695
|
-
|
|
12696
12280
|
const revertScopes = this.initializeScopes(true);
|
|
12697
12281
|
this.enterInitialScopes();
|
|
12698
12282
|
try {
|
|
@@ -12702,9 +12286,7 @@ class ExpressionParser extends LValParser {
|
|
|
12702
12286
|
}
|
|
12703
12287
|
return this.finishNode(node, "ModuleExpression");
|
|
12704
12288
|
}
|
|
12705
|
-
|
|
12706
|
-
parsePropertyNamePrefixOperator(
|
|
12707
|
-
prop) {}
|
|
12289
|
+
parsePropertyNamePrefixOperator(prop) {}
|
|
12708
12290
|
}
|
|
12709
12291
|
|
|
12710
12292
|
const loopLabel = {
|
|
@@ -12729,7 +12311,6 @@ var ParseStatementFlag = {
|
|
|
12729
12311
|
};
|
|
12730
12312
|
const loneSurrogate = /[\uD800-\uDFFF]/u;
|
|
12731
12313
|
const keywordRelationalOperator = /in(?:stanceof)?/y;
|
|
12732
|
-
|
|
12733
12314
|
function babel7CompatTokens(tokens, input) {
|
|
12734
12315
|
for (let i = 0; i < tokens.length; i++) {
|
|
12735
12316
|
const token = tokens[i];
|
|
@@ -12838,7 +12419,6 @@ function babel7CompatTokens(tokens, input) {
|
|
|
12838
12419
|
return tokens;
|
|
12839
12420
|
}
|
|
12840
12421
|
class StatementParser extends ExpressionParser {
|
|
12841
|
-
|
|
12842
12422
|
parseTopLevel(file, program) {
|
|
12843
12423
|
file.program = this.parseProgram(program);
|
|
12844
12424
|
file.comments = this.state.comments;
|
|
@@ -12867,7 +12447,6 @@ class StatementParser extends ExpressionParser {
|
|
|
12867
12447
|
}
|
|
12868
12448
|
return finishedProgram;
|
|
12869
12449
|
}
|
|
12870
|
-
|
|
12871
12450
|
stmtToDirective(stmt) {
|
|
12872
12451
|
const directive = stmt;
|
|
12873
12452
|
directive.type = "Directive";
|
|
@@ -12877,7 +12456,6 @@ class StatementParser extends ExpressionParser {
|
|
|
12877
12456
|
const expressionValue = directiveLiteral.value;
|
|
12878
12457
|
const raw = this.input.slice(directiveLiteral.start, directiveLiteral.end);
|
|
12879
12458
|
const val = directiveLiteral.value = raw.slice(1, -1);
|
|
12880
|
-
|
|
12881
12459
|
this.addExtra(directiveLiteral, "raw", raw);
|
|
12882
12460
|
this.addExtra(directiveLiteral, "rawValue", val);
|
|
12883
12461
|
this.addExtra(directiveLiteral, "expressionValue", expressionValue);
|
|
@@ -12918,13 +12496,11 @@ class StatementParser extends ExpressionParser {
|
|
|
12918
12496
|
chStartsBindingPattern(ch) {
|
|
12919
12497
|
return ch === 91 || ch === 123;
|
|
12920
12498
|
}
|
|
12921
|
-
|
|
12922
12499
|
hasFollowingBindingAtom() {
|
|
12923
12500
|
const next = this.nextTokenStart();
|
|
12924
12501
|
const nextCh = this.codePointAtPos(next);
|
|
12925
12502
|
return this.chStartsBindingPattern(nextCh) || this.chStartsBindingIdentifier(nextCh, next);
|
|
12926
12503
|
}
|
|
12927
|
-
|
|
12928
12504
|
hasFollowingBindingIdentifier() {
|
|
12929
12505
|
const next = this.nextTokenStart();
|
|
12930
12506
|
const nextCh = this.codePointAtPos(next);
|
|
@@ -12939,22 +12515,18 @@ class StatementParser extends ExpressionParser {
|
|
|
12939
12515
|
return true;
|
|
12940
12516
|
}
|
|
12941
12517
|
}
|
|
12942
|
-
|
|
12943
12518
|
parseModuleItem() {
|
|
12944
12519
|
return this.parseStatementLike(ParseStatementFlag.AllowImportExport | ParseStatementFlag.AllowDeclaration | ParseStatementFlag.AllowFunctionDeclaration | ParseStatementFlag.AllowLabeledFunction);
|
|
12945
12520
|
}
|
|
12946
|
-
|
|
12947
12521
|
parseStatementListItem() {
|
|
12948
12522
|
return this.parseStatementLike(ParseStatementFlag.AllowDeclaration | ParseStatementFlag.AllowFunctionDeclaration | ParseStatementFlag.AllowLabeledFunction);
|
|
12949
12523
|
}
|
|
12950
12524
|
parseStatementOrFunctionDeclaration(disallowLabeledFunction) {
|
|
12951
12525
|
return this.parseStatementLike(ParseStatementFlag.AllowFunctionDeclaration | (disallowLabeledFunction ? 0 : ParseStatementFlag.AllowLabeledFunction));
|
|
12952
12526
|
}
|
|
12953
|
-
|
|
12954
12527
|
parseStatement() {
|
|
12955
12528
|
return this.parseStatementLike(ParseStatementFlag.StatementOnly);
|
|
12956
12529
|
}
|
|
12957
|
-
|
|
12958
12530
|
parseStatementLike(flags) {
|
|
12959
12531
|
let decorators = null;
|
|
12960
12532
|
if (this.match(26)) {
|
|
@@ -12968,7 +12540,6 @@ class StatementParser extends ExpressionParser {
|
|
|
12968
12540
|
const allowDeclaration = !!(flags & ParseStatementFlag.AllowDeclaration);
|
|
12969
12541
|
const allowFunctionDeclaration = !!(flags & ParseStatementFlag.AllowFunctionDeclaration);
|
|
12970
12542
|
const topLevel = flags & ParseStatementFlag.AllowImportExport;
|
|
12971
|
-
|
|
12972
12543
|
switch (starttype) {
|
|
12973
12544
|
case 60:
|
|
12974
12545
|
return this.parseBreakContinueStatement(node, true);
|
|
@@ -13060,8 +12631,7 @@ class StatementParser extends ExpressionParser {
|
|
|
13060
12631
|
case 83:
|
|
13061
12632
|
{
|
|
13062
12633
|
const nextTokenCharCode = this.lookaheadCharCode();
|
|
13063
|
-
if (nextTokenCharCode === 40 ||
|
|
13064
|
-
nextTokenCharCode === 46) {
|
|
12634
|
+
if (nextTokenCharCode === 40 || nextTokenCharCode === 46) {
|
|
13065
12635
|
break;
|
|
13066
12636
|
}
|
|
13067
12637
|
}
|
|
@@ -13073,7 +12643,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13073
12643
|
});
|
|
13074
12644
|
}
|
|
13075
12645
|
this.next();
|
|
13076
|
-
|
|
13077
12646
|
let result;
|
|
13078
12647
|
if (starttype === 83) {
|
|
13079
12648
|
result = this.parseImport(node);
|
|
@@ -13102,12 +12671,10 @@ class StatementParser extends ExpressionParser {
|
|
|
13102
12671
|
}
|
|
13103
12672
|
}
|
|
13104
12673
|
}
|
|
13105
|
-
|
|
13106
12674
|
const maybeName = this.state.value;
|
|
13107
12675
|
const expr = this.parseExpression();
|
|
13108
12676
|
if (tokenIsIdentifier(starttype) && expr.type === "Identifier" && this.eat(14)) {
|
|
13109
|
-
return this.parseLabeledStatement(node, maybeName,
|
|
13110
|
-
expr, flags);
|
|
12677
|
+
return this.parseLabeledStatement(node, maybeName, expr, flags);
|
|
13111
12678
|
} else {
|
|
13112
12679
|
return this.parseExpressionStatement(node, expr, decorators);
|
|
13113
12680
|
}
|
|
@@ -13123,7 +12690,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13123
12690
|
if (this.hasPlugin("decorators-legacy")) return true;
|
|
13124
12691
|
return this.hasPlugin("decorators") && !!this.getPluginOption("decorators", "decoratorsBeforeExport");
|
|
13125
12692
|
}
|
|
13126
|
-
|
|
13127
12693
|
maybeTakeDecorators(maybeDecorators, classNode, exportNode) {
|
|
13128
12694
|
if (maybeDecorators) {
|
|
13129
12695
|
classNode.decorators = maybeDecorators;
|
|
@@ -13246,21 +12812,16 @@ class StatementParser extends ExpressionParser {
|
|
|
13246
12812
|
this.expect(11);
|
|
13247
12813
|
return val;
|
|
13248
12814
|
}
|
|
13249
|
-
|
|
13250
12815
|
parseDoWhileStatement(node) {
|
|
13251
12816
|
this.next();
|
|
13252
12817
|
this.state.labels.push(loopLabel);
|
|
13253
|
-
|
|
13254
|
-
node.body =
|
|
13255
|
-
this.withSmartMixTopicForbiddingContext(() =>
|
|
13256
|
-
this.parseStatement());
|
|
12818
|
+
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
13257
12819
|
this.state.labels.pop();
|
|
13258
12820
|
this.expect(92);
|
|
13259
12821
|
node.test = this.parseHeaderExpression();
|
|
13260
12822
|
this.eat(13);
|
|
13261
12823
|
return this.finishNode(node, "DoWhileStatement");
|
|
13262
12824
|
}
|
|
13263
|
-
|
|
13264
12825
|
parseForStatement(node) {
|
|
13265
12826
|
this.next();
|
|
13266
12827
|
this.state.labels.push(loopLabel);
|
|
@@ -13299,7 +12860,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13299
12860
|
}
|
|
13300
12861
|
return this.parseFor(node, init);
|
|
13301
12862
|
}
|
|
13302
|
-
|
|
13303
12863
|
const startsWithAsync = this.isContextual(95);
|
|
13304
12864
|
const refExpressionErrors = new ExpressionErrors();
|
|
13305
12865
|
const init = this.parseExpression(true, refExpressionErrors);
|
|
@@ -13310,8 +12870,7 @@ class StatementParser extends ExpressionParser {
|
|
|
13310
12870
|
at: init
|
|
13311
12871
|
});
|
|
13312
12872
|
}
|
|
13313
|
-
if (
|
|
13314
|
-
awaitAt === null && startsWithAsync && init.type === "Identifier") {
|
|
12873
|
+
if (awaitAt === null && startsWithAsync && init.type === "Identifier") {
|
|
13315
12874
|
this.raise(Errors.ForOfAsync, {
|
|
13316
12875
|
at: init
|
|
13317
12876
|
});
|
|
@@ -13326,8 +12885,7 @@ class StatementParser extends ExpressionParser {
|
|
|
13326
12885
|
type
|
|
13327
12886
|
}
|
|
13328
12887
|
});
|
|
13329
|
-
return this.parseForIn(node,
|
|
13330
|
-
init, awaitAt);
|
|
12888
|
+
return this.parseForIn(node, init, awaitAt);
|
|
13331
12889
|
} else {
|
|
13332
12890
|
this.checkExpressionErrors(refExpressionErrors, true);
|
|
13333
12891
|
}
|
|
@@ -13336,17 +12894,14 @@ class StatementParser extends ExpressionParser {
|
|
|
13336
12894
|
}
|
|
13337
12895
|
return this.parseFor(node, init);
|
|
13338
12896
|
}
|
|
13339
|
-
|
|
13340
12897
|
parseFunctionStatement(node, isAsync, isHangingDeclaration) {
|
|
13341
12898
|
this.next();
|
|
13342
12899
|
return this.parseFunction(node, ParseFunctionFlag.Declaration | (isHangingDeclaration ? ParseFunctionFlag.HangingDeclaration : 0) | (isAsync ? ParseFunctionFlag.Async : 0));
|
|
13343
12900
|
}
|
|
13344
|
-
|
|
13345
12901
|
parseIfStatement(node) {
|
|
13346
12902
|
this.next();
|
|
13347
12903
|
node.test = this.parseHeaderExpression();
|
|
13348
|
-
node.consequent = this.parseStatementOrFunctionDeclaration(
|
|
13349
|
-
true);
|
|
12904
|
+
node.consequent = this.parseStatementOrFunctionDeclaration(true);
|
|
13350
12905
|
node.alternate = this.eat(66) ? this.parseStatementOrFunctionDeclaration(true) : null;
|
|
13351
12906
|
return this.finishNode(node, "IfStatement");
|
|
13352
12907
|
}
|
|
@@ -13357,7 +12912,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13357
12912
|
});
|
|
13358
12913
|
}
|
|
13359
12914
|
this.next();
|
|
13360
|
-
|
|
13361
12915
|
if (this.isLineTerminator()) {
|
|
13362
12916
|
node.argument = null;
|
|
13363
12917
|
} else {
|
|
@@ -13366,7 +12920,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13366
12920
|
}
|
|
13367
12921
|
return this.finishNode(node, "ReturnStatement");
|
|
13368
12922
|
}
|
|
13369
|
-
|
|
13370
12923
|
parseSwitchStatement(node) {
|
|
13371
12924
|
this.next();
|
|
13372
12925
|
node.discriminant = this.parseHeaderExpression();
|
|
@@ -13374,7 +12927,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13374
12927
|
this.expect(5);
|
|
13375
12928
|
this.state.labels.push(switchLabel);
|
|
13376
12929
|
this.scope.enter(SCOPE_OTHER);
|
|
13377
|
-
|
|
13378
12930
|
let cur;
|
|
13379
12931
|
for (let sawDefault; !this.match(8);) {
|
|
13380
12932
|
if (this.match(61) || this.match(65)) {
|
|
@@ -13448,10 +13000,7 @@ class StatementParser extends ExpressionParser {
|
|
|
13448
13000
|
clause.param = null;
|
|
13449
13001
|
this.scope.enter(SCOPE_OTHER);
|
|
13450
13002
|
}
|
|
13451
|
-
|
|
13452
|
-
clause.body =
|
|
13453
|
-
this.withSmartMixTopicForbiddingContext(() =>
|
|
13454
|
-
this.parseBlock(false, false));
|
|
13003
|
+
clause.body = this.withSmartMixTopicForbiddingContext(() => this.parseBlock(false, false));
|
|
13455
13004
|
this.scope.exit();
|
|
13456
13005
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
13457
13006
|
}
|
|
@@ -13463,22 +13012,17 @@ class StatementParser extends ExpressionParser {
|
|
|
13463
13012
|
}
|
|
13464
13013
|
return this.finishNode(node, "TryStatement");
|
|
13465
13014
|
}
|
|
13466
|
-
|
|
13467
13015
|
parseVarStatement(node, kind, allowMissingInitializer = false) {
|
|
13468
13016
|
this.next();
|
|
13469
13017
|
this.parseVar(node, false, kind, allowMissingInitializer);
|
|
13470
13018
|
this.semicolon();
|
|
13471
13019
|
return this.finishNode(node, "VariableDeclaration");
|
|
13472
13020
|
}
|
|
13473
|
-
|
|
13474
13021
|
parseWhileStatement(node) {
|
|
13475
13022
|
this.next();
|
|
13476
13023
|
node.test = this.parseHeaderExpression();
|
|
13477
13024
|
this.state.labels.push(loopLabel);
|
|
13478
|
-
|
|
13479
|
-
node.body =
|
|
13480
|
-
this.withSmartMixTopicForbiddingContext(() =>
|
|
13481
|
-
this.parseStatement());
|
|
13025
|
+
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
13482
13026
|
this.state.labels.pop();
|
|
13483
13027
|
return this.finishNode(node, "WhileStatement");
|
|
13484
13028
|
}
|
|
@@ -13490,17 +13034,13 @@ class StatementParser extends ExpressionParser {
|
|
|
13490
13034
|
}
|
|
13491
13035
|
this.next();
|
|
13492
13036
|
node.object = this.parseHeaderExpression();
|
|
13493
|
-
|
|
13494
|
-
node.body =
|
|
13495
|
-
this.withSmartMixTopicForbiddingContext(() =>
|
|
13496
|
-
this.parseStatement());
|
|
13037
|
+
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
13497
13038
|
return this.finishNode(node, "WithStatement");
|
|
13498
13039
|
}
|
|
13499
13040
|
parseEmptyStatement(node) {
|
|
13500
13041
|
this.next();
|
|
13501
13042
|
return this.finishNode(node, "EmptyStatement");
|
|
13502
13043
|
}
|
|
13503
|
-
|
|
13504
13044
|
parseLabeledStatement(node, maybeName, expr, flags) {
|
|
13505
13045
|
for (const label of this.state.labels) {
|
|
13506
13046
|
if (label.name === maybeName) {
|
|
@@ -13530,13 +13070,11 @@ class StatementParser extends ExpressionParser {
|
|
|
13530
13070
|
node.label = expr;
|
|
13531
13071
|
return this.finishNode(node, "LabeledStatement");
|
|
13532
13072
|
}
|
|
13533
|
-
parseExpressionStatement(node, expr,
|
|
13534
|
-
decorators) {
|
|
13073
|
+
parseExpressionStatement(node, expr, decorators) {
|
|
13535
13074
|
node.expression = expr;
|
|
13536
13075
|
this.semicolon();
|
|
13537
13076
|
return this.finishNode(node, "ExpressionStatement");
|
|
13538
13077
|
}
|
|
13539
|
-
|
|
13540
13078
|
parseBlock(allowDirectives = false, createNewLexicalScope = true, afterBlockParse) {
|
|
13541
13079
|
const node = this.startNode();
|
|
13542
13080
|
if (allowDirectives) {
|
|
@@ -13560,7 +13098,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13560
13098
|
const directives = node.directives = [];
|
|
13561
13099
|
this.parseBlockOrModuleBlockBody(body, allowDirectives ? directives : undefined, topLevel, end, afterBlockParse);
|
|
13562
13100
|
}
|
|
13563
|
-
|
|
13564
13101
|
parseBlockOrModuleBlockBody(body, directives, topLevel, end, afterBlockParse) {
|
|
13565
13102
|
const oldStrict = this.state.strict;
|
|
13566
13103
|
let hasStrictModeDirective = false;
|
|
@@ -13590,7 +13127,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13590
13127
|
}
|
|
13591
13128
|
this.next();
|
|
13592
13129
|
}
|
|
13593
|
-
|
|
13594
13130
|
parseFor(node, init) {
|
|
13595
13131
|
node.init = init;
|
|
13596
13132
|
this.semicolon(false);
|
|
@@ -13598,15 +13134,11 @@ class StatementParser extends ExpressionParser {
|
|
|
13598
13134
|
this.semicolon(false);
|
|
13599
13135
|
node.update = this.match(11) ? null : this.parseExpression();
|
|
13600
13136
|
this.expect(11);
|
|
13601
|
-
|
|
13602
|
-
node.body =
|
|
13603
|
-
this.withSmartMixTopicForbiddingContext(() =>
|
|
13604
|
-
this.parseStatement());
|
|
13137
|
+
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
13605
13138
|
this.scope.exit();
|
|
13606
13139
|
this.state.labels.pop();
|
|
13607
13140
|
return this.finishNode(node, "ForStatement");
|
|
13608
13141
|
}
|
|
13609
|
-
|
|
13610
13142
|
parseForIn(node, init, awaitAt) {
|
|
13611
13143
|
const isForIn = this.match(58);
|
|
13612
13144
|
this.next();
|
|
@@ -13632,15 +13164,11 @@ class StatementParser extends ExpressionParser {
|
|
|
13632
13164
|
node.left = init;
|
|
13633
13165
|
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssignAllowIn();
|
|
13634
13166
|
this.expect(11);
|
|
13635
|
-
|
|
13636
|
-
node.body =
|
|
13637
|
-
this.withSmartMixTopicForbiddingContext(() =>
|
|
13638
|
-
this.parseStatement());
|
|
13167
|
+
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
13639
13168
|
this.scope.exit();
|
|
13640
13169
|
this.state.labels.pop();
|
|
13641
13170
|
return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
|
|
13642
13171
|
}
|
|
13643
|
-
|
|
13644
13172
|
parseVar(node, isFor, kind, allowMissingInitializer = false) {
|
|
13645
13173
|
const declarations = node.declarations = [];
|
|
13646
13174
|
node.kind = kind;
|
|
@@ -13676,11 +13204,9 @@ class StatementParser extends ExpressionParser {
|
|
|
13676
13204
|
});
|
|
13677
13205
|
decl.id = id;
|
|
13678
13206
|
}
|
|
13679
|
-
|
|
13680
13207
|
parseAsyncFunctionExpression(node) {
|
|
13681
13208
|
return this.parseFunction(node, ParseFunctionFlag.Async);
|
|
13682
13209
|
}
|
|
13683
|
-
|
|
13684
13210
|
parseFunction(node, flags = ParseFunctionFlag.Expression) {
|
|
13685
13211
|
const hangingDeclaration = flags & ParseFunctionFlag.HangingDeclaration;
|
|
13686
13212
|
const isDeclaration = !!(flags & ParseFunctionFlag.Declaration);
|
|
@@ -13707,7 +13233,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13707
13233
|
node.id = this.parseFunctionId();
|
|
13708
13234
|
}
|
|
13709
13235
|
this.parseFunctionParams(node, false);
|
|
13710
|
-
|
|
13711
13236
|
this.withSmartMixTopicForbiddingContext(() => {
|
|
13712
13237
|
this.parseFunctionBodyAndFinish(node, isDeclaration ? "FunctionDeclaration" : "FunctionExpression");
|
|
13713
13238
|
});
|
|
@@ -13730,13 +13255,10 @@ class StatementParser extends ExpressionParser {
|
|
|
13730
13255
|
}
|
|
13731
13256
|
registerFunctionStatementId(node) {
|
|
13732
13257
|
if (!node.id) return;
|
|
13733
|
-
|
|
13734
13258
|
this.scope.declareName(node.id.name, this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION, node.id.loc.start);
|
|
13735
13259
|
}
|
|
13736
|
-
|
|
13737
13260
|
parseClass(node, isStatement, optionalId) {
|
|
13738
13261
|
this.next();
|
|
13739
|
-
|
|
13740
13262
|
const oldStrict = this.state.strict;
|
|
13741
13263
|
this.state.strict = true;
|
|
13742
13264
|
this.parseClassId(node, isStatement, optionalId);
|
|
@@ -13751,10 +13273,8 @@ class StatementParser extends ExpressionParser {
|
|
|
13751
13273
|
return this.match(10);
|
|
13752
13274
|
}
|
|
13753
13275
|
isNonstaticConstructor(method) {
|
|
13754
|
-
return !method.computed && !method.static && (method.key.name === "constructor" ||
|
|
13755
|
-
method.key.value === "constructor");
|
|
13276
|
+
return !method.computed && !method.static && (method.key.name === "constructor" || method.key.value === "constructor");
|
|
13756
13277
|
}
|
|
13757
|
-
|
|
13758
13278
|
parseClassBody(hadSuperClass, oldStrict) {
|
|
13759
13279
|
this.classScope.enter();
|
|
13760
13280
|
const state = {
|
|
@@ -13765,7 +13285,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13765
13285
|
const classBody = this.startNode();
|
|
13766
13286
|
classBody.body = [];
|
|
13767
13287
|
this.expect(5);
|
|
13768
|
-
|
|
13769
13288
|
this.withSmartMixTopicForbiddingContext(() => {
|
|
13770
13289
|
while (!this.match(8)) {
|
|
13771
13290
|
if (this.eat(13)) {
|
|
@@ -13781,17 +13300,13 @@ class StatementParser extends ExpressionParser {
|
|
|
13781
13300
|
continue;
|
|
13782
13301
|
}
|
|
13783
13302
|
const member = this.startNode();
|
|
13784
|
-
|
|
13785
13303
|
if (decorators.length) {
|
|
13786
13304
|
member.decorators = decorators;
|
|
13787
13305
|
this.resetStartLocationFromNode(member, decorators[0]);
|
|
13788
13306
|
decorators = [];
|
|
13789
13307
|
}
|
|
13790
13308
|
this.parseClassMember(classBody, member, state);
|
|
13791
|
-
if (
|
|
13792
|
-
member.kind === "constructor" &&
|
|
13793
|
-
member.decorators &&
|
|
13794
|
-
member.decorators.length > 0) {
|
|
13309
|
+
if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
|
|
13795
13310
|
this.raise(Errors.DecoratorConstructor, {
|
|
13796
13311
|
at: member
|
|
13797
13312
|
});
|
|
@@ -13800,7 +13315,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13800
13315
|
});
|
|
13801
13316
|
this.state.strict = oldStrict;
|
|
13802
13317
|
this.next();
|
|
13803
|
-
|
|
13804
13318
|
if (decorators.length) {
|
|
13805
13319
|
throw this.raise(Errors.TrailingDecorator, {
|
|
13806
13320
|
at: this.state.startLoc
|
|
@@ -13809,13 +13323,10 @@ class StatementParser extends ExpressionParser {
|
|
|
13809
13323
|
this.classScope.exit();
|
|
13810
13324
|
return this.finishNode(classBody, "ClassBody");
|
|
13811
13325
|
}
|
|
13812
|
-
|
|
13813
13326
|
parseClassMemberFromModifier(classBody, member) {
|
|
13814
13327
|
const key = this.parseIdentifier(true);
|
|
13815
|
-
|
|
13816
13328
|
if (this.isClassMethod()) {
|
|
13817
13329
|
const method = member;
|
|
13818
|
-
|
|
13819
13330
|
method.kind = "method";
|
|
13820
13331
|
method.computed = false;
|
|
13821
13332
|
method.key = key;
|
|
@@ -13824,7 +13335,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13824
13335
|
return true;
|
|
13825
13336
|
} else if (this.isClassProperty()) {
|
|
13826
13337
|
const prop = member;
|
|
13827
|
-
|
|
13828
13338
|
prop.computed = false;
|
|
13829
13339
|
prop.key = key;
|
|
13830
13340
|
prop.static = false;
|
|
@@ -13884,12 +13394,10 @@ class StatementParser extends ExpressionParser {
|
|
|
13884
13394
|
this.pushClassPrivateMethod(classBody, privateMethod, false, false);
|
|
13885
13395
|
return;
|
|
13886
13396
|
}
|
|
13887
|
-
|
|
13888
13397
|
const isConstructor = this.isNonstaticConstructor(publicMethod);
|
|
13889
13398
|
let allowsDirectSuper = false;
|
|
13890
13399
|
if (isConstructor) {
|
|
13891
13400
|
publicMethod.kind = "constructor";
|
|
13892
|
-
|
|
13893
13401
|
if (state.hadConstructor && !this.hasPlugin("typescript")) {
|
|
13894
13402
|
this.raise(Errors.DuplicateConstructor, {
|
|
13895
13403
|
at: key
|
|
@@ -13949,7 +13457,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13949
13457
|
} else if (isContextual && key.name === "accessor" && !this.isLineTerminator()) {
|
|
13950
13458
|
this.expectPlugin("decoratorAutoAccessors");
|
|
13951
13459
|
this.resetPreviousNodeTrailingComments(key);
|
|
13952
|
-
|
|
13953
13460
|
const isPrivate = this.match(136);
|
|
13954
13461
|
this.parseClassElementName(publicProp);
|
|
13955
13462
|
this.pushClassAccessorProperty(classBody, accessorProp, isPrivate);
|
|
@@ -13963,7 +13470,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13963
13470
|
this.unexpected();
|
|
13964
13471
|
}
|
|
13965
13472
|
}
|
|
13966
|
-
|
|
13967
13473
|
parseClassElementName(member) {
|
|
13968
13474
|
const {
|
|
13969
13475
|
type,
|
|
@@ -14044,16 +13550,12 @@ class StatementParser extends ExpressionParser {
|
|
|
14044
13550
|
declareClassPrivateMethodInScope(node, kind) {
|
|
14045
13551
|
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), kind, node.key.loc.start);
|
|
14046
13552
|
}
|
|
14047
|
-
|
|
14048
|
-
parsePostMemberNameModifiers(
|
|
14049
|
-
methodOrProp) {}
|
|
14050
|
-
|
|
13553
|
+
parsePostMemberNameModifiers(methodOrProp) {}
|
|
14051
13554
|
parseClassPrivateProperty(node) {
|
|
14052
13555
|
this.parseInitializer(node);
|
|
14053
13556
|
this.semicolon();
|
|
14054
13557
|
return this.finishNode(node, "ClassPrivateProperty");
|
|
14055
13558
|
}
|
|
14056
|
-
|
|
14057
13559
|
parseClassProperty(node) {
|
|
14058
13560
|
this.parseInitializer(node);
|
|
14059
13561
|
this.semicolon();
|
|
@@ -14064,7 +13566,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14064
13566
|
this.semicolon();
|
|
14065
13567
|
return this.finishNode(node, "ClassAccessorProperty");
|
|
14066
13568
|
}
|
|
14067
|
-
|
|
14068
13569
|
parseInitializer(node) {
|
|
14069
13570
|
this.scope.enter(SCOPE_CLASS | SCOPE_SUPER);
|
|
14070
13571
|
this.expressionScope.enter(newExpressionScope());
|
|
@@ -14090,19 +13591,14 @@ class StatementParser extends ExpressionParser {
|
|
|
14090
13591
|
}
|
|
14091
13592
|
}
|
|
14092
13593
|
}
|
|
14093
|
-
|
|
14094
13594
|
parseClassSuper(node) {
|
|
14095
13595
|
node.superClass = this.eat(81) ? this.parseExprSubscripts() : null;
|
|
14096
13596
|
}
|
|
14097
|
-
|
|
14098
13597
|
parseExport(node, decorators) {
|
|
14099
|
-
const hasDefault = this.maybeParseExportDefaultSpecifier(
|
|
14100
|
-
node);
|
|
13598
|
+
const hasDefault = this.maybeParseExportDefaultSpecifier(node);
|
|
14101
13599
|
const parseAfterDefault = !hasDefault || this.eat(12);
|
|
14102
|
-
const hasStar = parseAfterDefault && this.eatExportStar(
|
|
14103
|
-
node);
|
|
14104
|
-
const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(
|
|
14105
|
-
node);
|
|
13600
|
+
const hasStar = parseAfterDefault && this.eatExportStar(node);
|
|
13601
|
+
const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(node);
|
|
14106
13602
|
const parseAfterNamespace = parseAfterDefault && (!hasNamespace || this.eat(12));
|
|
14107
13603
|
const isFromRequired = hasDefault || hasStar;
|
|
14108
13604
|
if (hasStar && !hasNamespace) {
|
|
@@ -14115,8 +13611,7 @@ class StatementParser extends ExpressionParser {
|
|
|
14115
13611
|
this.parseExportFrom(node, true);
|
|
14116
13612
|
return this.finishNode(node, "ExportAllDeclaration");
|
|
14117
13613
|
}
|
|
14118
|
-
const hasSpecifiers = this.maybeParseExportNamedSpecifiers(
|
|
14119
|
-
node);
|
|
13614
|
+
const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node);
|
|
14120
13615
|
if (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers || hasNamespace && parseAfterNamespace && !hasSpecifiers) {
|
|
14121
13616
|
throw this.unexpected(null, 5);
|
|
14122
13617
|
}
|
|
@@ -14161,7 +13656,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14161
13656
|
}
|
|
14162
13657
|
throw this.unexpected(null, 5);
|
|
14163
13658
|
}
|
|
14164
|
-
|
|
14165
13659
|
eatExportStar(node) {
|
|
14166
13660
|
return this.eat(55);
|
|
14167
13661
|
}
|
|
@@ -14247,9 +13741,7 @@ class StatementParser extends ExpressionParser {
|
|
|
14247
13741
|
this.semicolon();
|
|
14248
13742
|
return res;
|
|
14249
13743
|
}
|
|
14250
|
-
|
|
14251
|
-
parseExportDeclaration(
|
|
14252
|
-
node) {
|
|
13744
|
+
parseExportDeclaration(node) {
|
|
14253
13745
|
if (this.match(80)) {
|
|
14254
13746
|
const node = this.parseClass(this.startNode(), true, false);
|
|
14255
13747
|
return node;
|
|
@@ -14325,8 +13817,7 @@ class StatementParser extends ExpressionParser {
|
|
|
14325
13817
|
if (this.hasPlugin("exportDefaultFrom")) {
|
|
14326
13818
|
var _declaration$extra;
|
|
14327
13819
|
const declaration = node.declaration;
|
|
14328
|
-
if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 &&
|
|
14329
|
-
!((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) {
|
|
13820
|
+
if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) {
|
|
14330
13821
|
this.raise(Errors.ExportDefaultFromAsIdentifier, {
|
|
14331
13822
|
at: declaration
|
|
14332
13823
|
});
|
|
@@ -14404,11 +13895,9 @@ class StatementParser extends ExpressionParser {
|
|
|
14404
13895
|
}
|
|
14405
13896
|
this.exportedIdentifiers.add(exportName);
|
|
14406
13897
|
}
|
|
14407
|
-
|
|
14408
13898
|
parseExportSpecifiers(isInTypeExport) {
|
|
14409
13899
|
const nodes = [];
|
|
14410
13900
|
let first = true;
|
|
14411
|
-
|
|
14412
13901
|
this.expect(5);
|
|
14413
13902
|
while (!this.eat(8)) {
|
|
14414
13903
|
if (first) {
|
|
@@ -14425,9 +13914,7 @@ class StatementParser extends ExpressionParser {
|
|
|
14425
13914
|
}
|
|
14426
13915
|
return nodes;
|
|
14427
13916
|
}
|
|
14428
|
-
parseExportSpecifier(node, isString,
|
|
14429
|
-
isInTypeExport, isMaybeTypeOnly
|
|
14430
|
-
) {
|
|
13917
|
+
parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
|
|
14431
13918
|
if (this.eatContextual(93)) {
|
|
14432
13919
|
node.exported = this.parseModuleExportName();
|
|
14433
13920
|
} else if (isString) {
|
|
@@ -14437,7 +13924,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14437
13924
|
}
|
|
14438
13925
|
return this.finishNode(node, "ExportSpecifier");
|
|
14439
13926
|
}
|
|
14440
|
-
|
|
14441
13927
|
parseModuleExportName() {
|
|
14442
13928
|
if (this.match(131)) {
|
|
14443
13929
|
const result = this.parseStringLiteral(this.state.value);
|
|
@@ -14529,7 +14015,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14529
14015
|
node.module = false;
|
|
14530
14016
|
}
|
|
14531
14017
|
}
|
|
14532
|
-
|
|
14533
14018
|
parseImport(node) {
|
|
14534
14019
|
node.specifiers = [];
|
|
14535
14020
|
if (!this.match(131)) {
|
|
@@ -14559,7 +14044,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14559
14044
|
if (!this.match(131)) this.unexpected();
|
|
14560
14045
|
return this.parseExprAtom();
|
|
14561
14046
|
}
|
|
14562
|
-
|
|
14563
14047
|
shouldParseDefaultImport(node) {
|
|
14564
14048
|
return tokenIsIdentifier(this.state.type);
|
|
14565
14049
|
}
|
|
@@ -14574,7 +14058,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14574
14058
|
});
|
|
14575
14059
|
return this.finishNode(specifier, type);
|
|
14576
14060
|
}
|
|
14577
|
-
|
|
14578
14061
|
parseAssertEntries() {
|
|
14579
14062
|
const attrs = [];
|
|
14580
14063
|
const attrNames = new Set();
|
|
@@ -14583,7 +14066,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14583
14066
|
break;
|
|
14584
14067
|
}
|
|
14585
14068
|
const node = this.startNode();
|
|
14586
|
-
|
|
14587
14069
|
const keyName = this.state.value;
|
|
14588
14070
|
if (attrNames.has(keyName)) {
|
|
14589
14071
|
this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
|
|
@@ -14608,7 +14090,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14608
14090
|
} while (this.eat(12));
|
|
14609
14091
|
return attrs;
|
|
14610
14092
|
}
|
|
14611
|
-
|
|
14612
14093
|
maybeParseModuleAttributes() {
|
|
14613
14094
|
if (this.match(76) && !this.hasPrecedingLineBreak()) {
|
|
14614
14095
|
this.expectPlugin("moduleAttributes");
|
|
@@ -14699,10 +14180,7 @@ class StatementParser extends ExpressionParser {
|
|
|
14699
14180
|
node.specifiers.push(importSpecifier);
|
|
14700
14181
|
}
|
|
14701
14182
|
}
|
|
14702
|
-
|
|
14703
|
-
parseImportSpecifier(specifier, importedIsString,
|
|
14704
|
-
isInTypeOnlyImport, isMaybeTypeOnly, bindingType
|
|
14705
|
-
) {
|
|
14183
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
14706
14184
|
if (this.eatContextual(93)) {
|
|
14707
14185
|
specifier.local = this.parseIdentifier();
|
|
14708
14186
|
} else {
|
|
@@ -14722,14 +14200,12 @@ class StatementParser extends ExpressionParser {
|
|
|
14722
14200
|
}
|
|
14723
14201
|
return this.finishImportSpecifier(specifier, "ImportSpecifier", bindingType);
|
|
14724
14202
|
}
|
|
14725
|
-
|
|
14726
14203
|
isThisParam(param) {
|
|
14727
14204
|
return param.type === "Identifier" && param.name === "this";
|
|
14728
14205
|
}
|
|
14729
14206
|
}
|
|
14730
14207
|
|
|
14731
14208
|
class Parser extends StatementParser {
|
|
14732
|
-
|
|
14733
14209
|
constructor(options, input) {
|
|
14734
14210
|
options = getOptions(options);
|
|
14735
14211
|
super(options, input);
|
|
@@ -14738,7 +14214,6 @@ class Parser extends StatementParser {
|
|
|
14738
14214
|
this.plugins = pluginsMap(this.options.plugins);
|
|
14739
14215
|
this.filename = options.sourceFilename;
|
|
14740
14216
|
}
|
|
14741
|
-
|
|
14742
14217
|
getScopeHandler() {
|
|
14743
14218
|
return ScopeHandler;
|
|
14744
14219
|
}
|
|
@@ -14817,7 +14292,6 @@ function getParser(options, input) {
|
|
|
14817
14292
|
return new cls(options, input);
|
|
14818
14293
|
}
|
|
14819
14294
|
const parserClassCache = {};
|
|
14820
|
-
|
|
14821
14295
|
function getParserClass(pluginsFromOptions) {
|
|
14822
14296
|
const pluginList = mixinPluginNames.filter(name => hasPlugin(pluginsFromOptions, name));
|
|
14823
14297
|
const key = pluginList.join("/");
|