@tinacms/app 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +189 -707
- 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 +8 -2
- 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" ? {
|
|
@@ -116,6 +113,7 @@ var StandardErrors = {
|
|
|
116
113
|
AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function.",
|
|
117
114
|
AwaitBindingIdentifierInStaticBlock: "Can not use 'await' as identifier inside a static block.",
|
|
118
115
|
AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.",
|
|
116
|
+
AwaitInUsingBinding: "'await' is not allowed to be used as a name in 'using' declarations.",
|
|
119
117
|
AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.",
|
|
120
118
|
AwaitNotInAsyncFunction: "'await' is only allowed within async functions.",
|
|
121
119
|
BadGetterArity: "A 'get' accessor must not have any formal parameters.",
|
|
@@ -445,7 +443,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
445
443
|
}
|
|
446
444
|
return file;
|
|
447
445
|
}
|
|
448
|
-
|
|
449
446
|
parseRegExpLiteral({
|
|
450
447
|
pattern,
|
|
451
448
|
flags
|
|
@@ -453,9 +450,7 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
453
450
|
let regex = null;
|
|
454
451
|
try {
|
|
455
452
|
regex = new RegExp(pattern, flags);
|
|
456
|
-
} catch (e) {
|
|
457
|
-
}
|
|
458
|
-
|
|
453
|
+
} catch (e) {}
|
|
459
454
|
const node = this.estreeParseLiteral(regex);
|
|
460
455
|
node.regex = {
|
|
461
456
|
pattern,
|
|
@@ -463,7 +458,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
463
458
|
};
|
|
464
459
|
return node;
|
|
465
460
|
}
|
|
466
|
-
|
|
467
461
|
parseBigIntLiteral(value) {
|
|
468
462
|
let bigInt;
|
|
469
463
|
try {
|
|
@@ -475,7 +469,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
475
469
|
node.bigint = String(node.value || value);
|
|
476
470
|
return node;
|
|
477
471
|
}
|
|
478
|
-
|
|
479
472
|
parseDecimalLiteral(value) {
|
|
480
473
|
const decimal = null;
|
|
481
474
|
const node = this.estreeParseLiteral(decimal);
|
|
@@ -485,21 +478,18 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
485
478
|
estreeParseLiteral(value) {
|
|
486
479
|
return this.parseLiteral(value, "Literal");
|
|
487
480
|
}
|
|
488
|
-
|
|
489
481
|
parseStringLiteral(value) {
|
|
490
482
|
return this.estreeParseLiteral(value);
|
|
491
483
|
}
|
|
492
484
|
parseNumericLiteral(value) {
|
|
493
485
|
return this.estreeParseLiteral(value);
|
|
494
486
|
}
|
|
495
|
-
|
|
496
487
|
parseNullLiteral() {
|
|
497
488
|
return this.estreeParseLiteral(null);
|
|
498
489
|
}
|
|
499
490
|
parseBooleanLiteral(value) {
|
|
500
491
|
return this.estreeParseLiteral(value);
|
|
501
492
|
}
|
|
502
|
-
|
|
503
493
|
directiveToStmt(directive) {
|
|
504
494
|
const expression = directive.value;
|
|
505
495
|
delete directive.value;
|
|
@@ -513,7 +503,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
513
503
|
delete expression.extra;
|
|
514
504
|
return stmt;
|
|
515
505
|
}
|
|
516
|
-
|
|
517
506
|
initFunction(node, isAsync) {
|
|
518
507
|
super.initFunction(node, isAsync);
|
|
519
508
|
node.expression = false;
|
|
@@ -579,7 +568,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
579
568
|
}
|
|
580
569
|
return node.name;
|
|
581
570
|
}
|
|
582
|
-
|
|
583
571
|
parseLiteral(value, type) {
|
|
584
572
|
const node = super.parseLiteral(value, type);
|
|
585
573
|
node.raw = node.extra.raw;
|
|
@@ -590,20 +578,17 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
590
578
|
super.parseFunctionBody(node, allowExpression, isMethod);
|
|
591
579
|
node.expression = node.body.type !== "BlockStatement";
|
|
592
580
|
}
|
|
593
|
-
|
|
594
581
|
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
|
|
595
582
|
let funcNode = this.startNode();
|
|
596
583
|
funcNode.kind = node.kind;
|
|
597
|
-
funcNode = super.parseMethod(
|
|
598
|
-
funcNode, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
|
|
584
|
+
funcNode = super.parseMethod(funcNode, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
|
|
599
585
|
funcNode.type = "FunctionExpression";
|
|
600
586
|
delete funcNode.kind;
|
|
601
587
|
node.value = funcNode;
|
|
602
588
|
if (type === "ClassPrivateMethod") {
|
|
603
589
|
node.computed = false;
|
|
604
590
|
}
|
|
605
|
-
return this.finishNode(
|
|
606
|
-
node, "MethodDefinition");
|
|
591
|
+
return this.finishNode(node, "MethodDefinition");
|
|
607
592
|
}
|
|
608
593
|
parseClassProperty(...args) {
|
|
609
594
|
const propertyNode = super.parseClassProperty(...args);
|
|
@@ -695,8 +680,7 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
695
680
|
}
|
|
696
681
|
return node;
|
|
697
682
|
}
|
|
698
|
-
toReferencedArguments(node
|
|
699
|
-
) {
|
|
683
|
+
toReferencedArguments(node) {
|
|
700
684
|
if (node.type === "ImportExpression") {
|
|
701
685
|
return;
|
|
702
686
|
}
|
|
@@ -710,23 +694,19 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
710
694
|
node.exported = null;
|
|
711
695
|
break;
|
|
712
696
|
case "ExportNamedDeclaration":
|
|
713
|
-
if (node.specifiers.length === 1 &&
|
|
714
|
-
node.specifiers[0].type === "ExportNamespaceSpecifier") {
|
|
697
|
+
if (node.specifiers.length === 1 && node.specifiers[0].type === "ExportNamespaceSpecifier") {
|
|
715
698
|
node.type = "ExportAllDeclaration";
|
|
716
699
|
node.exported = node.specifiers[0].exported;
|
|
717
700
|
delete node.specifiers;
|
|
718
701
|
}
|
|
719
|
-
|
|
720
702
|
case "ExportDefaultDeclaration":
|
|
721
703
|
{
|
|
722
704
|
var _declaration$decorato;
|
|
723
705
|
const {
|
|
724
706
|
declaration
|
|
725
707
|
} = 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);
|
|
708
|
+
if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && ((_declaration$decorato = declaration.decorators) == null ? void 0 : _declaration$decorato.length) > 0 && declaration.start === node.start) {
|
|
709
|
+
this.resetStartLocation(node, exportStartLoc);
|
|
730
710
|
}
|
|
731
711
|
}
|
|
732
712
|
break;
|
|
@@ -739,7 +719,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
739
719
|
if (node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression") {
|
|
740
720
|
node.type = node.type.substring(8);
|
|
741
721
|
}
|
|
742
|
-
|
|
743
722
|
if (state.stop) {
|
|
744
723
|
const chain = this.startNodeAtNode(node);
|
|
745
724
|
chain.expression = node;
|
|
@@ -759,7 +738,6 @@ var estree = (superClass => class ESTreeParserMixin extends superClass {
|
|
|
759
738
|
isOptionalChain(node) {
|
|
760
739
|
return node.type === "ChainExpression";
|
|
761
740
|
}
|
|
762
|
-
|
|
763
741
|
isObjectProperty(node) {
|
|
764
742
|
return node.type === "Property" && node.kind === "init" && !node.method;
|
|
765
743
|
}
|
|
@@ -793,7 +771,6 @@ const types = {
|
|
|
793
771
|
j_cTag: new TokContext("</tag"),
|
|
794
772
|
j_expr: new TokContext("<tag>...</tag>", true)
|
|
795
773
|
};
|
|
796
|
-
|
|
797
774
|
{
|
|
798
775
|
types.template = new TokContext("`", true);
|
|
799
776
|
}
|
|
@@ -831,7 +808,6 @@ class ExportedTokenType {
|
|
|
831
808
|
}
|
|
832
809
|
}
|
|
833
810
|
}
|
|
834
|
-
|
|
835
811
|
const keywords$1 = new Map();
|
|
836
812
|
function createKeyword(name, options = {}) {
|
|
837
813
|
options.keyword = name;
|
|
@@ -875,7 +851,6 @@ function createKeywordLike(name, options = {}) {
|
|
|
875
851
|
tokenTypes.push(new ExportedTokenType("name", options));
|
|
876
852
|
return tokenTypeCounter;
|
|
877
853
|
}
|
|
878
|
-
|
|
879
854
|
const tt = {
|
|
880
855
|
bracketL: createToken("[", {
|
|
881
856
|
beforeExpr,
|
|
@@ -953,7 +928,6 @@ const tt = {
|
|
|
953
928
|
startsExpr
|
|
954
929
|
}),
|
|
955
930
|
interpreterDirective: createToken("#!..."),
|
|
956
|
-
|
|
957
931
|
eq: createToken("=", {
|
|
958
932
|
beforeExpr,
|
|
959
933
|
isAssign
|
|
@@ -974,7 +948,6 @@ const tt = {
|
|
|
974
948
|
beforeExpr,
|
|
975
949
|
isAssign
|
|
976
950
|
}),
|
|
977
|
-
|
|
978
951
|
incDec: createToken("++/--", {
|
|
979
952
|
prefix,
|
|
980
953
|
postfix,
|
|
@@ -1122,7 +1095,6 @@ const tt = {
|
|
|
1122
1095
|
_while: createKeyword("while", {
|
|
1123
1096
|
isLoop
|
|
1124
1097
|
}),
|
|
1125
|
-
|
|
1126
1098
|
_as: createKeywordLike("as", {
|
|
1127
1099
|
startsExpr
|
|
1128
1100
|
}),
|
|
@@ -1237,7 +1209,6 @@ const tt = {
|
|
|
1237
1209
|
name: createToken("name", {
|
|
1238
1210
|
startsExpr
|
|
1239
1211
|
}),
|
|
1240
|
-
|
|
1241
1212
|
string: createToken("string", {
|
|
1242
1213
|
startsExpr
|
|
1243
1214
|
}),
|
|
@@ -1353,10 +1324,8 @@ let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\
|
|
|
1353
1324
|
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
1354
1325
|
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
1355
1326
|
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
1356
|
-
|
|
1357
1327
|
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
1328
|
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
1329
|
function isInAstralSet(code, set) {
|
|
1361
1330
|
let pos = 0x10000;
|
|
1362
1331
|
for (let i = 0, length = set.length; i < length; i += 2) {
|
|
@@ -1367,7 +1336,6 @@ function isInAstralSet(code, set) {
|
|
|
1367
1336
|
}
|
|
1368
1337
|
return false;
|
|
1369
1338
|
}
|
|
1370
|
-
|
|
1371
1339
|
function isIdentifierStart(code) {
|
|
1372
1340
|
if (code < 65) return code === 36;
|
|
1373
1341
|
if (code <= 90) return true;
|
|
@@ -1378,7 +1346,6 @@ function isIdentifierStart(code) {
|
|
|
1378
1346
|
}
|
|
1379
1347
|
return isInAstralSet(code, astralIdentifierStartCodes);
|
|
1380
1348
|
}
|
|
1381
|
-
|
|
1382
1349
|
function isIdentifierChar(code) {
|
|
1383
1350
|
if (code < 48) return code === 36;
|
|
1384
1351
|
if (code < 58) return true;
|
|
@@ -1400,19 +1367,15 @@ const reservedWords = {
|
|
|
1400
1367
|
const keywords = new Set(reservedWords.keyword);
|
|
1401
1368
|
const reservedWordsStrictSet = new Set(reservedWords.strict);
|
|
1402
1369
|
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
|
1403
|
-
|
|
1404
1370
|
function isReservedWord(word, inModule) {
|
|
1405
1371
|
return inModule && word === "await" || word === "enum";
|
|
1406
1372
|
}
|
|
1407
|
-
|
|
1408
1373
|
function isStrictReservedWord(word, inModule) {
|
|
1409
1374
|
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
|
1410
1375
|
}
|
|
1411
|
-
|
|
1412
1376
|
function isStrictBindOnlyReservedWord(word) {
|
|
1413
1377
|
return reservedWordsStrictBindSet.has(word);
|
|
1414
1378
|
}
|
|
1415
|
-
|
|
1416
1379
|
function isStrictBindReservedWord(word, inModule) {
|
|
1417
1380
|
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
|
1418
1381
|
}
|
|
@@ -1423,11 +1386,7 @@ function isKeyword(word) {
|
|
|
1423
1386
|
function isIteratorStart(current, next, next2) {
|
|
1424
1387
|
return current === 64 && next === 64 && isIdentifierStart(next2);
|
|
1425
1388
|
}
|
|
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"]);
|
|
1389
|
+
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
1390
|
function canBeReservedWord(word) {
|
|
1432
1391
|
return reservedWordLikeSet.has(word);
|
|
1433
1392
|
}
|
|
@@ -1443,26 +1402,27 @@ const SCOPE_OTHER = 0b000000000,
|
|
|
1443
1402
|
SCOPE_STATIC_BLOCK = 0b010000000,
|
|
1444
1403
|
SCOPE_TS_MODULE = 0b100000000,
|
|
1445
1404
|
SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION | SCOPE_STATIC_BLOCK | SCOPE_TS_MODULE;
|
|
1446
|
-
const BIND_KIND_VALUE =
|
|
1447
|
-
BIND_KIND_TYPE =
|
|
1448
|
-
BIND_SCOPE_VAR =
|
|
1449
|
-
BIND_SCOPE_LEXICAL =
|
|
1450
|
-
BIND_SCOPE_FUNCTION =
|
|
1451
|
-
BIND_FLAGS_NONE =
|
|
1452
|
-
BIND_FLAGS_CLASS =
|
|
1453
|
-
BIND_FLAGS_TS_ENUM =
|
|
1454
|
-
BIND_FLAGS_TS_CONST_ENUM =
|
|
1455
|
-
BIND_FLAGS_TS_EXPORT_ONLY =
|
|
1456
|
-
BIND_FLAGS_FLOW_DECLARE_FN =
|
|
1457
|
-
BIND_FLAGS_TS_IMPORT =
|
|
1458
|
-
|
|
1459
|
-
const BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_CLASS,
|
|
1460
|
-
BIND_LEXICAL = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL |
|
|
1405
|
+
const BIND_KIND_VALUE = 0b0000000000001,
|
|
1406
|
+
BIND_KIND_TYPE = 0b0000000000010,
|
|
1407
|
+
BIND_SCOPE_VAR = 0b0000000000100,
|
|
1408
|
+
BIND_SCOPE_LEXICAL = 0b0000000001000,
|
|
1409
|
+
BIND_SCOPE_FUNCTION = 0b0000000010000,
|
|
1410
|
+
BIND_FLAGS_NONE = 0b00000001000000,
|
|
1411
|
+
BIND_FLAGS_CLASS = 0b00000010000000,
|
|
1412
|
+
BIND_FLAGS_TS_ENUM = 0b00000100000000,
|
|
1413
|
+
BIND_FLAGS_TS_CONST_ENUM = 0b00001000000000,
|
|
1414
|
+
BIND_FLAGS_TS_EXPORT_ONLY = 0b00010000000000,
|
|
1415
|
+
BIND_FLAGS_FLOW_DECLARE_FN = 0b00100000000000,
|
|
1416
|
+
BIND_FLAGS_TS_IMPORT = 0b01000000000000,
|
|
1417
|
+
BIND_FLAGS_NO_LET_IN_LEXICAL = 0b10000000000000;
|
|
1418
|
+
const BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_CLASS | BIND_FLAGS_NO_LET_IN_LEXICAL,
|
|
1419
|
+
BIND_LEXICAL = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL | BIND_FLAGS_NO_LET_IN_LEXICAL,
|
|
1420
|
+
BIND_CATCH_PARAM = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL | 0,
|
|
1461
1421
|
BIND_VAR = BIND_KIND_VALUE | 0 | BIND_SCOPE_VAR | 0,
|
|
1462
1422
|
BIND_FUNCTION = BIND_KIND_VALUE | 0 | BIND_SCOPE_FUNCTION | 0,
|
|
1463
1423
|
BIND_TS_INTERFACE = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_CLASS,
|
|
1464
1424
|
BIND_TS_TYPE = 0 | BIND_KIND_TYPE | 0 | 0,
|
|
1465
|
-
BIND_TS_ENUM = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_TS_ENUM,
|
|
1425
|
+
BIND_TS_ENUM = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_TS_ENUM | BIND_FLAGS_NO_LET_IN_LEXICAL,
|
|
1466
1426
|
BIND_TS_AMBIENT = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY,
|
|
1467
1427
|
BIND_NONE = 0 | 0 | 0 | BIND_FLAGS_NONE,
|
|
1468
1428
|
BIND_OUTSIDE = BIND_KIND_VALUE | 0 | 0 | BIND_FLAGS_NONE,
|
|
@@ -1474,7 +1434,6 @@ const CLASS_ELEMENT_FLAG_STATIC = 0b100,
|
|
|
1474
1434
|
CLASS_ELEMENT_KIND_GETTER = 0b010,
|
|
1475
1435
|
CLASS_ELEMENT_KIND_SETTER = 0b001,
|
|
1476
1436
|
CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_KIND_SETTER;
|
|
1477
|
-
|
|
1478
1437
|
const CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FLAG_STATIC,
|
|
1479
1438
|
CLASS_ELEMENT_STATIC_SETTER = CLASS_ELEMENT_KIND_SETTER | CLASS_ELEMENT_FLAG_STATIC,
|
|
1480
1439
|
CLASS_ELEMENT_INSTANCE_GETTER = CLASS_ELEMENT_KIND_GETTER,
|
|
@@ -1482,7 +1441,6 @@ const CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FL
|
|
|
1482
1441
|
CLASS_ELEMENT_OTHER = 0;
|
|
1483
1442
|
|
|
1484
1443
|
class Scope {
|
|
1485
|
-
|
|
1486
1444
|
constructor(flags) {
|
|
1487
1445
|
this.var = new Set();
|
|
1488
1446
|
this.lexical = new Set();
|
|
@@ -1490,7 +1448,6 @@ class Scope {
|
|
|
1490
1448
|
this.flags = flags;
|
|
1491
1449
|
}
|
|
1492
1450
|
}
|
|
1493
|
-
|
|
1494
1451
|
class ScopeHandler {
|
|
1495
1452
|
constructor(parser, inModule) {
|
|
1496
1453
|
this.parser = void 0;
|
|
@@ -1548,7 +1505,6 @@ class ScopeHandler {
|
|
|
1548
1505
|
const scope = this.scopeStack.pop();
|
|
1549
1506
|
return scope.flags;
|
|
1550
1507
|
}
|
|
1551
|
-
|
|
1552
1508
|
treatFunctionsAsVarInScope(scope) {
|
|
1553
1509
|
return !!(scope.flags & (SCOPE_FUNCTION | SCOPE_STATIC_BLOCK) || !this.parser.inModule && scope.flags & SCOPE_PROGRAM);
|
|
1554
1510
|
}
|
|
@@ -1605,8 +1561,7 @@ class ScopeHandler {
|
|
|
1605
1561
|
name
|
|
1606
1562
|
} = id;
|
|
1607
1563
|
const topLevelScope = this.scopeStack[0];
|
|
1608
|
-
if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) &&
|
|
1609
|
-
!topLevelScope.functions.has(name)) {
|
|
1564
|
+
if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) && !topLevelScope.functions.has(name)) {
|
|
1610
1565
|
this.undefinedExports.set(name, id.loc.start);
|
|
1611
1566
|
}
|
|
1612
1567
|
}
|
|
@@ -1623,7 +1578,6 @@ class ScopeHandler {
|
|
|
1623
1578
|
}
|
|
1624
1579
|
}
|
|
1625
1580
|
}
|
|
1626
|
-
|
|
1627
1581
|
currentThisScopeFlags() {
|
|
1628
1582
|
for (let i = this.scopeStack.length - 1;; i--) {
|
|
1629
1583
|
const {
|
|
@@ -1705,7 +1659,6 @@ function setTrailingComments(node, comments) {
|
|
|
1705
1659
|
node.trailingComments.unshift(...comments);
|
|
1706
1660
|
}
|
|
1707
1661
|
}
|
|
1708
|
-
|
|
1709
1662
|
function setLeadingComments(node, comments) {
|
|
1710
1663
|
if (node.leadingComments === undefined) {
|
|
1711
1664
|
node.leadingComments = comments;
|
|
@@ -1713,7 +1666,6 @@ function setLeadingComments(node, comments) {
|
|
|
1713
1666
|
node.leadingComments.unshift(...comments);
|
|
1714
1667
|
}
|
|
1715
1668
|
}
|
|
1716
|
-
|
|
1717
1669
|
function setInnerComments(node, comments) {
|
|
1718
1670
|
if (node.innerComments === undefined) {
|
|
1719
1671
|
node.innerComments = comments;
|
|
@@ -1721,7 +1673,6 @@ function setInnerComments(node, comments) {
|
|
|
1721
1673
|
node.innerComments.unshift(...comments);
|
|
1722
1674
|
}
|
|
1723
1675
|
}
|
|
1724
|
-
|
|
1725
1676
|
function adjustInnerComments(node, elements, commentWS) {
|
|
1726
1677
|
let lastElement = null;
|
|
1727
1678
|
let i = elements.length;
|
|
@@ -1739,7 +1690,6 @@ class CommentsParser extends BaseParser {
|
|
|
1739
1690
|
if (this.filename) comment.loc.filename = this.filename;
|
|
1740
1691
|
this.state.comments.push(comment);
|
|
1741
1692
|
}
|
|
1742
|
-
|
|
1743
1693
|
processComment(node) {
|
|
1744
1694
|
const {
|
|
1745
1695
|
commentStack
|
|
@@ -1770,7 +1720,6 @@ class CommentsParser extends BaseParser {
|
|
|
1770
1720
|
}
|
|
1771
1721
|
}
|
|
1772
1722
|
}
|
|
1773
|
-
|
|
1774
1723
|
finalizeComment(commentWS) {
|
|
1775
1724
|
const {
|
|
1776
1725
|
comments
|
|
@@ -1825,7 +1774,6 @@ class CommentsParser extends BaseParser {
|
|
|
1825
1774
|
}
|
|
1826
1775
|
}
|
|
1827
1776
|
}
|
|
1828
|
-
|
|
1829
1777
|
finalizeRemainingComments() {
|
|
1830
1778
|
const {
|
|
1831
1779
|
commentStack
|
|
@@ -1835,7 +1783,6 @@ class CommentsParser extends BaseParser {
|
|
|
1835
1783
|
}
|
|
1836
1784
|
this.state.commentStack = [];
|
|
1837
1785
|
}
|
|
1838
|
-
|
|
1839
1786
|
resetPreviousNodeTrailingComments(node) {
|
|
1840
1787
|
const {
|
|
1841
1788
|
commentStack
|
|
@@ -1849,7 +1796,6 @@ class CommentsParser extends BaseParser {
|
|
|
1849
1796
|
commentWS.leadingNode = null;
|
|
1850
1797
|
}
|
|
1851
1798
|
}
|
|
1852
|
-
|
|
1853
1799
|
takeSurroundingComments(node, start, end) {
|
|
1854
1800
|
const {
|
|
1855
1801
|
commentStack
|
|
@@ -1874,7 +1820,6 @@ class CommentsParser extends BaseParser {
|
|
|
1874
1820
|
|
|
1875
1821
|
const lineBreak = /\r\n?|[\n\u2028\u2029]/;
|
|
1876
1822
|
const lineBreakG = new RegExp(lineBreak.source, "g");
|
|
1877
|
-
|
|
1878
1823
|
function isNewLine(code) {
|
|
1879
1824
|
switch (code) {
|
|
1880
1825
|
case 10:
|
|
@@ -1888,12 +1833,7 @@ function isNewLine(code) {
|
|
|
1888
1833
|
}
|
|
1889
1834
|
const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
1890
1835
|
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
|
-
|
|
1836
|
+
const skipWhiteSpaceToLineBreak = new RegExp("(?=(" + skipWhiteSpaceInLine.source + "))\\1" + /(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source, "y");
|
|
1897
1837
|
function isWhitespace(code) {
|
|
1898
1838
|
switch (code) {
|
|
1899
1839
|
case 0x0009:
|
|
@@ -1988,7 +1928,6 @@ class State {
|
|
|
1988
1928
|
if (!skipArrays && Array.isArray(val)) {
|
|
1989
1929
|
val = val.slice();
|
|
1990
1930
|
}
|
|
1991
|
-
|
|
1992
1931
|
state[key] = val;
|
|
1993
1932
|
}
|
|
1994
1933
|
return state;
|
|
@@ -2085,7 +2024,6 @@ function isStringEnd(type, ch, input, pos) {
|
|
|
2085
2024
|
function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
2086
2025
|
const throwOnInvalid = !inTemplate;
|
|
2087
2026
|
pos++;
|
|
2088
|
-
|
|
2089
2027
|
const res = ch => ({
|
|
2090
2028
|
pos,
|
|
2091
2029
|
ch,
|
|
@@ -2209,7 +2147,6 @@ function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumS
|
|
|
2209
2147
|
};
|
|
2210
2148
|
errors.unexpectedNumericSeparator(pos, lineStart, curLine);
|
|
2211
2149
|
}
|
|
2212
|
-
|
|
2213
2150
|
++pos;
|
|
2214
2151
|
continue;
|
|
2215
2152
|
}
|
|
@@ -2289,7 +2226,6 @@ function buildPosition(pos, lineStart, curLine) {
|
|
|
2289
2226
|
return new Position(curLine, pos - lineStart, pos);
|
|
2290
2227
|
}
|
|
2291
2228
|
const VALID_REGEX_FLAGS = new Set([103, 109, 115, 105, 121, 117, 100, 118]);
|
|
2292
|
-
|
|
2293
2229
|
class Token {
|
|
2294
2230
|
constructor(state) {
|
|
2295
2231
|
this.type = state.type;
|
|
@@ -2299,9 +2235,7 @@ class Token {
|
|
|
2299
2235
|
this.loc = new SourceLocation(state.startLoc, state.endLoc);
|
|
2300
2236
|
}
|
|
2301
2237
|
}
|
|
2302
|
-
|
|
2303
2238
|
class Tokenizer extends CommentsParser {
|
|
2304
|
-
|
|
2305
2239
|
constructor(options, input) {
|
|
2306
2240
|
super();
|
|
2307
2241
|
this.isLookahead = void 0;
|
|
@@ -2353,7 +2287,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2353
2287
|
this.tokens.push(token);
|
|
2354
2288
|
++this.state.tokensLength;
|
|
2355
2289
|
}
|
|
2356
|
-
|
|
2357
2290
|
next() {
|
|
2358
2291
|
this.checkKeywordEscapes();
|
|
2359
2292
|
if (this.options.tokens) {
|
|
@@ -2372,11 +2305,9 @@ class Tokenizer extends CommentsParser {
|
|
|
2372
2305
|
return false;
|
|
2373
2306
|
}
|
|
2374
2307
|
}
|
|
2375
|
-
|
|
2376
2308
|
match(type) {
|
|
2377
2309
|
return this.state.type === type;
|
|
2378
2310
|
}
|
|
2379
|
-
|
|
2380
2311
|
createLookaheadState(state) {
|
|
2381
2312
|
return {
|
|
2382
2313
|
pos: state.pos,
|
|
@@ -2393,7 +2324,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2393
2324
|
curPosition: state.curPosition
|
|
2394
2325
|
};
|
|
2395
2326
|
}
|
|
2396
|
-
|
|
2397
2327
|
lookahead() {
|
|
2398
2328
|
const old = this.state;
|
|
2399
2329
|
this.state = this.createLookaheadState(old);
|
|
@@ -2424,7 +2354,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2424
2354
|
}
|
|
2425
2355
|
return cp;
|
|
2426
2356
|
}
|
|
2427
|
-
|
|
2428
2357
|
setStrict(strict) {
|
|
2429
2358
|
this.state.strict = strict;
|
|
2430
2359
|
if (strict) {
|
|
@@ -2437,7 +2366,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2437
2366
|
curContext() {
|
|
2438
2367
|
return this.state.context[this.state.context.length - 1];
|
|
2439
2368
|
}
|
|
2440
|
-
|
|
2441
2369
|
nextToken() {
|
|
2442
2370
|
this.skipSpace();
|
|
2443
2371
|
this.state.start = this.state.pos;
|
|
@@ -2448,7 +2376,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2448
2376
|
}
|
|
2449
2377
|
this.getTokenFromCode(this.codePointAtPos(this.state.pos));
|
|
2450
2378
|
}
|
|
2451
|
-
|
|
2452
2379
|
skipBlockComment(commentEnd) {
|
|
2453
2380
|
let startLoc;
|
|
2454
2381
|
if (!this.isLookahead) startLoc = this.state.curPosition();
|
|
@@ -2465,9 +2392,7 @@ class Tokenizer extends CommentsParser {
|
|
|
2465
2392
|
++this.state.curLine;
|
|
2466
2393
|
this.state.lineStart = lineBreakG.lastIndex;
|
|
2467
2394
|
}
|
|
2468
|
-
|
|
2469
2395
|
if (this.isLookahead) return;
|
|
2470
|
-
|
|
2471
2396
|
const comment = {
|
|
2472
2397
|
type: "CommentBlock",
|
|
2473
2398
|
value: this.input.slice(start + 2, end),
|
|
@@ -2488,9 +2413,7 @@ class Tokenizer extends CommentsParser {
|
|
|
2488
2413
|
ch = this.input.charCodeAt(this.state.pos);
|
|
2489
2414
|
}
|
|
2490
2415
|
}
|
|
2491
|
-
|
|
2492
2416
|
if (this.isLookahead) return;
|
|
2493
|
-
|
|
2494
2417
|
const end = this.state.pos;
|
|
2495
2418
|
const value = this.input.slice(start + startSkip, end);
|
|
2496
2419
|
const comment = {
|
|
@@ -2503,7 +2426,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2503
2426
|
if (this.options.tokens) this.pushToken(comment);
|
|
2504
2427
|
return comment;
|
|
2505
2428
|
}
|
|
2506
|
-
|
|
2507
2429
|
skipSpace() {
|
|
2508
2430
|
const spaceStart = this.state.pos;
|
|
2509
2431
|
const comments = [];
|
|
@@ -2593,7 +2515,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2593
2515
|
this.state.commentStack.push(commentWhitespace);
|
|
2594
2516
|
}
|
|
2595
2517
|
}
|
|
2596
|
-
|
|
2597
2518
|
finishToken(type, val) {
|
|
2598
2519
|
this.state.end = this.state.pos;
|
|
2599
2520
|
this.state.endLoc = this.state.curPosition();
|
|
@@ -2608,7 +2529,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2608
2529
|
this.state.type = type;
|
|
2609
2530
|
this.updateContext();
|
|
2610
2531
|
}
|
|
2611
|
-
|
|
2612
2532
|
readToken_numberSign() {
|
|
2613
2533
|
if (this.state.pos === 0 && this.readToken_interpreter()) {
|
|
2614
2534
|
return;
|
|
@@ -2682,13 +2602,11 @@ class Tokenizer extends CommentsParser {
|
|
|
2682
2602
|
let type = code === 42 ? 55 : 54;
|
|
2683
2603
|
let width = 1;
|
|
2684
2604
|
let next = this.input.charCodeAt(this.state.pos + 1);
|
|
2685
|
-
|
|
2686
2605
|
if (code === 42 && next === 42) {
|
|
2687
2606
|
width++;
|
|
2688
2607
|
next = this.input.charCodeAt(this.state.pos + 2);
|
|
2689
2608
|
type = 57;
|
|
2690
2609
|
}
|
|
2691
|
-
|
|
2692
2610
|
if (next === 61 && !this.state.inType) {
|
|
2693
2611
|
width++;
|
|
2694
2612
|
type = code === 37 ? 33 : 30;
|
|
@@ -2720,7 +2638,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2720
2638
|
this.finishToken(9);
|
|
2721
2639
|
return;
|
|
2722
2640
|
}
|
|
2723
|
-
|
|
2724
2641
|
if (this.hasPlugin("recordAndTuple") && next === 93) {
|
|
2725
2642
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
2726
2643
|
throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, {
|
|
@@ -2740,36 +2657,29 @@ class Tokenizer extends CommentsParser {
|
|
|
2740
2657
|
}
|
|
2741
2658
|
readToken_caret() {
|
|
2742
2659
|
const next = this.input.charCodeAt(this.state.pos + 1);
|
|
2743
|
-
|
|
2744
2660
|
if (next === 61 && !this.state.inType) {
|
|
2745
2661
|
this.finishOp(32, 2);
|
|
2746
|
-
}
|
|
2747
|
-
else if (next === 94 &&
|
|
2748
|
-
this.hasPlugin(["pipelineOperator", {
|
|
2662
|
+
} else if (next === 94 && this.hasPlugin(["pipelineOperator", {
|
|
2749
2663
|
proposal: "hack",
|
|
2750
2664
|
topicToken: "^^"
|
|
2751
2665
|
}])) {
|
|
2752
2666
|
this.finishOp(37, 2);
|
|
2753
|
-
|
|
2754
2667
|
const lookaheadCh = this.input.codePointAt(this.state.pos);
|
|
2755
2668
|
if (lookaheadCh === 94) {
|
|
2756
2669
|
throw this.unexpected();
|
|
2757
2670
|
}
|
|
2758
|
-
}
|
|
2759
|
-
else {
|
|
2671
|
+
} else {
|
|
2760
2672
|
this.finishOp(44, 1);
|
|
2761
2673
|
}
|
|
2762
2674
|
}
|
|
2763
2675
|
readToken_atSign() {
|
|
2764
2676
|
const next = this.input.charCodeAt(this.state.pos + 1);
|
|
2765
|
-
|
|
2766
2677
|
if (next === 64 && this.hasPlugin(["pipelineOperator", {
|
|
2767
2678
|
proposal: "hack",
|
|
2768
2679
|
topicToken: "@@"
|
|
2769
2680
|
}])) {
|
|
2770
2681
|
this.finishOp(38, 2);
|
|
2771
|
-
}
|
|
2772
|
-
else {
|
|
2682
|
+
} else {
|
|
2773
2683
|
this.finishOp(26, 1);
|
|
2774
2684
|
}
|
|
2775
2685
|
}
|
|
@@ -2856,11 +2766,9 @@ class Tokenizer extends CommentsParser {
|
|
|
2856
2766
|
}
|
|
2857
2767
|
getTokenFromCode(code) {
|
|
2858
2768
|
switch (code) {
|
|
2859
|
-
|
|
2860
2769
|
case 46:
|
|
2861
2770
|
this.readToken_dot();
|
|
2862
2771
|
return;
|
|
2863
|
-
|
|
2864
2772
|
case 40:
|
|
2865
2773
|
++this.state.pos;
|
|
2866
2774
|
this.finishToken(10);
|
|
@@ -2884,7 +2792,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2884
2792
|
at: this.state.curPosition()
|
|
2885
2793
|
});
|
|
2886
2794
|
}
|
|
2887
|
-
|
|
2888
2795
|
this.state.pos += 2;
|
|
2889
2796
|
this.finishToken(2);
|
|
2890
2797
|
} else {
|
|
@@ -2903,7 +2810,6 @@ class Tokenizer extends CommentsParser {
|
|
|
2903
2810
|
at: this.state.curPosition()
|
|
2904
2811
|
});
|
|
2905
2812
|
}
|
|
2906
|
-
|
|
2907
2813
|
this.state.pos += 2;
|
|
2908
2814
|
this.finishToken(6);
|
|
2909
2815
|
} else {
|
|
@@ -2956,12 +2862,10 @@ class Tokenizer extends CommentsParser {
|
|
|
2956
2862
|
case 57:
|
|
2957
2863
|
this.readNumber(false);
|
|
2958
2864
|
return;
|
|
2959
|
-
|
|
2960
2865
|
case 34:
|
|
2961
2866
|
case 39:
|
|
2962
2867
|
this.readString(code);
|
|
2963
2868
|
return;
|
|
2964
|
-
|
|
2965
2869
|
case 47:
|
|
2966
2870
|
this.readToken_slash();
|
|
2967
2871
|
return;
|
|
@@ -3053,12 +2957,10 @@ class Tokenizer extends CommentsParser {
|
|
|
3053
2957
|
const content = this.input.slice(start, pos);
|
|
3054
2958
|
++pos;
|
|
3055
2959
|
let mods = "";
|
|
3056
|
-
const nextPos = () =>
|
|
3057
|
-
createPositionWithColumnOffset(startLoc, pos + 2 - start);
|
|
2960
|
+
const nextPos = () => createPositionWithColumnOffset(startLoc, pos + 2 - start);
|
|
3058
2961
|
while (pos < this.length) {
|
|
3059
2962
|
const cp = this.codePointAtPos(pos);
|
|
3060
2963
|
const char = String.fromCharCode(cp);
|
|
3061
|
-
|
|
3062
2964
|
if (VALID_REGEX_FLAGS.has(cp)) {
|
|
3063
2965
|
if (cp === 118) {
|
|
3064
2966
|
this.expectPlugin("regexpUnicodeSets", nextPos());
|
|
@@ -3095,7 +2997,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3095
2997
|
flags: mods
|
|
3096
2998
|
});
|
|
3097
2999
|
}
|
|
3098
|
-
|
|
3099
3000
|
readInt(radix, len, forceLen = false, allowNumSeparator = true) {
|
|
3100
3001
|
const {
|
|
3101
3002
|
n,
|
|
@@ -3136,7 +3037,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3136
3037
|
}
|
|
3137
3038
|
this.finishToken(132, val);
|
|
3138
3039
|
}
|
|
3139
|
-
|
|
3140
3040
|
readNumber(startsWithDot) {
|
|
3141
3041
|
const start = this.state.pos;
|
|
3142
3042
|
const startLoc = this.state.curPosition();
|
|
@@ -3211,7 +3111,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3211
3111
|
at: this.state.curPosition()
|
|
3212
3112
|
});
|
|
3213
3113
|
}
|
|
3214
|
-
|
|
3215
3114
|
const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
|
|
3216
3115
|
if (isBigInt) {
|
|
3217
3116
|
this.finishToken(133, str);
|
|
@@ -3224,7 +3123,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3224
3123
|
const val = isOctal ? parseInt(str, 8) : parseFloat(str);
|
|
3225
3124
|
this.finishToken(132, val);
|
|
3226
3125
|
}
|
|
3227
|
-
|
|
3228
3126
|
readCodePoint(throwOnInvalid) {
|
|
3229
3127
|
const {
|
|
3230
3128
|
code,
|
|
@@ -3239,14 +3137,12 @@ class Tokenizer extends CommentsParser {
|
|
|
3239
3137
|
pos,
|
|
3240
3138
|
curLine,
|
|
3241
3139
|
lineStart
|
|
3242
|
-
} = readStringContents(quote === 34 ? "double" : "single", this.input, this.state.pos + 1,
|
|
3243
|
-
this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
|
|
3140
|
+
} = readStringContents(quote === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
|
|
3244
3141
|
this.state.pos = pos + 1;
|
|
3245
3142
|
this.state.lineStart = lineStart;
|
|
3246
3143
|
this.state.curLine = curLine;
|
|
3247
3144
|
this.finishToken(131, str);
|
|
3248
3145
|
}
|
|
3249
|
-
|
|
3250
3146
|
readTemplateContinuation() {
|
|
3251
3147
|
if (!this.match(8)) {
|
|
3252
3148
|
this.unexpected(null, 8);
|
|
@@ -3254,7 +3150,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3254
3150
|
this.state.pos--;
|
|
3255
3151
|
this.readTemplateToken();
|
|
3256
3152
|
}
|
|
3257
|
-
|
|
3258
3153
|
readTemplateToken() {
|
|
3259
3154
|
const opening = this.input[this.state.pos];
|
|
3260
3155
|
const {
|
|
@@ -3263,8 +3158,7 @@ class Tokenizer extends CommentsParser {
|
|
|
3263
3158
|
pos,
|
|
3264
3159
|
curLine,
|
|
3265
3160
|
lineStart
|
|
3266
|
-
} = readStringContents("template", this.input, this.state.pos + 1,
|
|
3267
|
-
this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
|
|
3161
|
+
} = readStringContents("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
|
|
3268
3162
|
this.state.pos = pos + 1;
|
|
3269
3163
|
this.state.lineStart = lineStart;
|
|
3270
3164
|
this.state.curLine = curLine;
|
|
@@ -3290,7 +3184,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3290
3184
|
this.state.strictErrors.set(index, [toParseError, at]);
|
|
3291
3185
|
}
|
|
3292
3186
|
}
|
|
3293
|
-
|
|
3294
3187
|
readWord1(firstCode) {
|
|
3295
3188
|
this.state.containsEsc = false;
|
|
3296
3189
|
let word = "";
|
|
@@ -3332,7 +3225,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3332
3225
|
}
|
|
3333
3226
|
return word + this.input.slice(chunkStart, this.state.pos);
|
|
3334
3227
|
}
|
|
3335
|
-
|
|
3336
3228
|
readWord(firstCode) {
|
|
3337
3229
|
const word = this.readWord1(firstCode);
|
|
3338
3230
|
const type = keywords$1.get(word);
|
|
@@ -3353,7 +3245,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3353
3245
|
});
|
|
3354
3246
|
}
|
|
3355
3247
|
}
|
|
3356
|
-
|
|
3357
3248
|
raise(toParseError, raiseProperties) {
|
|
3358
3249
|
const {
|
|
3359
3250
|
at
|
|
@@ -3368,7 +3259,6 @@ class Tokenizer extends CommentsParser {
|
|
|
3368
3259
|
if (!this.isLookahead) this.state.errors.push(error);
|
|
3369
3260
|
return error;
|
|
3370
3261
|
}
|
|
3371
|
-
|
|
3372
3262
|
raiseOverwrite(toParseError, raiseProperties) {
|
|
3373
3263
|
const {
|
|
3374
3264
|
at
|
|
@@ -3389,9 +3279,7 @@ class Tokenizer extends CommentsParser {
|
|
|
3389
3279
|
}
|
|
3390
3280
|
return this.raise(toParseError, raiseProperties);
|
|
3391
3281
|
}
|
|
3392
|
-
|
|
3393
3282
|
updateContext(prevType) {}
|
|
3394
|
-
|
|
3395
3283
|
unexpected(loc, type) {
|
|
3396
3284
|
throw this.raise(Errors.UnexpectedToken, {
|
|
3397
3285
|
expected: type ? tokenLabelName(type) : null,
|
|
@@ -3446,9 +3334,7 @@ class ClassScopeHandler {
|
|
|
3446
3334
|
}
|
|
3447
3335
|
exit() {
|
|
3448
3336
|
const oldClassScope = this.stack.pop();
|
|
3449
|
-
|
|
3450
3337
|
const current = this.current();
|
|
3451
|
-
|
|
3452
3338
|
for (const [name, loc] of Array.from(oldClassScope.undefinedPrivateNames)) {
|
|
3453
3339
|
if (current) {
|
|
3454
3340
|
if (!current.undefinedPrivateNames.has(name)) {
|
|
@@ -3476,7 +3362,6 @@ class ClassScopeHandler {
|
|
|
3476
3362
|
const newStatic = elementType & CLASS_ELEMENT_FLAG_STATIC;
|
|
3477
3363
|
const oldKind = accessor & CLASS_ELEMENT_KIND_ACCESSOR;
|
|
3478
3364
|
const newKind = elementType & CLASS_ELEMENT_KIND_ACCESSOR;
|
|
3479
|
-
|
|
3480
3365
|
redefined = oldKind === newKind || oldStatic !== newStatic;
|
|
3481
3366
|
if (!redefined) loneAccessors.delete(name);
|
|
3482
3367
|
} else if (!redefined) {
|
|
@@ -3554,7 +3439,6 @@ class ExpressionScopeHandler {
|
|
|
3554
3439
|
exit() {
|
|
3555
3440
|
this.stack.pop();
|
|
3556
3441
|
}
|
|
3557
|
-
|
|
3558
3442
|
recordParameterInitializerError(toParseError, {
|
|
3559
3443
|
at: node
|
|
3560
3444
|
}) {
|
|
@@ -3576,7 +3460,6 @@ class ExpressionScopeHandler {
|
|
|
3576
3460
|
}
|
|
3577
3461
|
this.parser.raise(toParseError, origin);
|
|
3578
3462
|
}
|
|
3579
|
-
|
|
3580
3463
|
recordArrowParameterBindingError(error, {
|
|
3581
3464
|
at: node
|
|
3582
3465
|
}) {
|
|
@@ -3595,7 +3478,6 @@ class ExpressionScopeHandler {
|
|
|
3595
3478
|
return;
|
|
3596
3479
|
}
|
|
3597
3480
|
}
|
|
3598
|
-
|
|
3599
3481
|
recordAsyncArrowParametersError({
|
|
3600
3482
|
at
|
|
3601
3483
|
}) {
|
|
@@ -3645,13 +3527,11 @@ function newExpressionScope() {
|
|
|
3645
3527
|
return new ExpressionScope();
|
|
3646
3528
|
}
|
|
3647
3529
|
|
|
3648
|
-
const
|
|
3649
|
-
PARAM = 0b0000,
|
|
3530
|
+
const PARAM = 0b0000,
|
|
3650
3531
|
PARAM_YIELD = 0b0001,
|
|
3651
3532
|
PARAM_AWAIT = 0b0010,
|
|
3652
3533
|
PARAM_RETURN = 0b0100,
|
|
3653
3534
|
PARAM_IN = 0b1000;
|
|
3654
|
-
|
|
3655
3535
|
class ProductionParameterHandler {
|
|
3656
3536
|
constructor() {
|
|
3657
3537
|
this.stacks = [];
|
|
@@ -3683,7 +3563,6 @@ function functionFlags(isAsync, isGenerator) {
|
|
|
3683
3563
|
}
|
|
3684
3564
|
|
|
3685
3565
|
class UtilParser extends Tokenizer {
|
|
3686
|
-
|
|
3687
3566
|
addExtra(node, key, value, enumerable = true) {
|
|
3688
3567
|
if (!node) return;
|
|
3689
3568
|
const extra = node.extra = node.extra || {};
|
|
@@ -3696,7 +3575,6 @@ class UtilParser extends Tokenizer {
|
|
|
3696
3575
|
});
|
|
3697
3576
|
}
|
|
3698
3577
|
}
|
|
3699
|
-
|
|
3700
3578
|
isContextual(token) {
|
|
3701
3579
|
return this.state.type === token && !this.state.containsEsc;
|
|
3702
3580
|
}
|
|
@@ -3704,8 +3582,7 @@ class UtilParser extends Tokenizer {
|
|
|
3704
3582
|
const nameEnd = nameStart + name.length;
|
|
3705
3583
|
if (this.input.slice(nameStart, nameEnd) === name) {
|
|
3706
3584
|
const nextCh = this.input.charCodeAt(nameEnd);
|
|
3707
|
-
return !(isIdentifierChar(nextCh) ||
|
|
3708
|
-
(nextCh & 0xfc00) === 0xd800);
|
|
3585
|
+
return !(isIdentifierChar(nextCh) || (nextCh & 0xfc00) === 0xd800);
|
|
3709
3586
|
}
|
|
3710
3587
|
return false;
|
|
3711
3588
|
}
|
|
@@ -3713,7 +3590,6 @@ class UtilParser extends Tokenizer {
|
|
|
3713
3590
|
const next = this.nextTokenStart();
|
|
3714
3591
|
return this.isUnparsedContextual(next, name);
|
|
3715
3592
|
}
|
|
3716
|
-
|
|
3717
3593
|
eatContextual(token) {
|
|
3718
3594
|
if (this.isContextual(token)) {
|
|
3719
3595
|
this.next();
|
|
@@ -3721,7 +3597,6 @@ class UtilParser extends Tokenizer {
|
|
|
3721
3597
|
}
|
|
3722
3598
|
return false;
|
|
3723
3599
|
}
|
|
3724
|
-
|
|
3725
3600
|
expectContextual(token, toParseError) {
|
|
3726
3601
|
if (!this.eatContextual(token)) {
|
|
3727
3602
|
if (toParseError != null) {
|
|
@@ -3732,7 +3607,6 @@ class UtilParser extends Tokenizer {
|
|
|
3732
3607
|
throw this.unexpected(null, token);
|
|
3733
3608
|
}
|
|
3734
3609
|
}
|
|
3735
|
-
|
|
3736
3610
|
canInsertSemicolon() {
|
|
3737
3611
|
return this.match(137) || this.match(8) || this.hasPrecedingLineBreak();
|
|
3738
3612
|
}
|
|
@@ -3746,18 +3620,15 @@ class UtilParser extends Tokenizer {
|
|
|
3746
3620
|
isLineTerminator() {
|
|
3747
3621
|
return this.eat(13) || this.canInsertSemicolon();
|
|
3748
3622
|
}
|
|
3749
|
-
|
|
3750
3623
|
semicolon(allowAsi = true) {
|
|
3751
3624
|
if (allowAsi ? this.isLineTerminator() : this.eat(13)) return;
|
|
3752
3625
|
this.raise(Errors.MissingSemicolon, {
|
|
3753
3626
|
at: this.state.lastTokEndLoc
|
|
3754
3627
|
});
|
|
3755
3628
|
}
|
|
3756
|
-
|
|
3757
3629
|
expect(type, loc) {
|
|
3758
3630
|
this.eat(type) || this.unexpected(loc, type);
|
|
3759
3631
|
}
|
|
3760
|
-
|
|
3761
3632
|
tryParse(fn, oldState = this.state.clone()) {
|
|
3762
3633
|
const abortSignal = {
|
|
3763
3634
|
node: null
|
|
@@ -3841,19 +3712,15 @@ class UtilParser extends Tokenizer {
|
|
|
3841
3712
|
this.unexpected(optionalParametersLoc);
|
|
3842
3713
|
}
|
|
3843
3714
|
}
|
|
3844
|
-
|
|
3845
3715
|
isLiteralPropertyName() {
|
|
3846
3716
|
return tokenIsLiteralPropertyName(this.state.type);
|
|
3847
3717
|
}
|
|
3848
|
-
|
|
3849
3718
|
isPrivateName(node) {
|
|
3850
3719
|
return node.type === "PrivateName";
|
|
3851
3720
|
}
|
|
3852
|
-
|
|
3853
3721
|
getPrivateNameSV(node) {
|
|
3854
3722
|
return node.id.name;
|
|
3855
3723
|
}
|
|
3856
|
-
|
|
3857
3724
|
hasPropertyAsPrivateName(node) {
|
|
3858
3725
|
return (node.type === "MemberExpression" || node.type === "OptionalMemberExpression") && this.isPrivateName(node.property);
|
|
3859
3726
|
}
|
|
@@ -3871,7 +3738,6 @@ class UtilParser extends Tokenizer {
|
|
|
3871
3738
|
this.state.labels = [];
|
|
3872
3739
|
const oldExportedIdentifiers = this.exportedIdentifiers;
|
|
3873
3740
|
this.exportedIdentifiers = new Set();
|
|
3874
|
-
|
|
3875
3741
|
const oldInModule = this.inModule;
|
|
3876
3742
|
this.inModule = inModule;
|
|
3877
3743
|
const oldScope = this.scope;
|
|
@@ -3886,7 +3752,6 @@ class UtilParser extends Tokenizer {
|
|
|
3886
3752
|
return () => {
|
|
3887
3753
|
this.state.labels = oldLabels;
|
|
3888
3754
|
this.exportedIdentifiers = oldExportedIdentifiers;
|
|
3889
|
-
|
|
3890
3755
|
this.inModule = oldInModule;
|
|
3891
3756
|
this.scope = oldScope;
|
|
3892
3757
|
this.prodParam = oldProdParam;
|
|
@@ -3911,7 +3776,6 @@ class UtilParser extends Tokenizer {
|
|
|
3911
3776
|
}
|
|
3912
3777
|
}
|
|
3913
3778
|
}
|
|
3914
|
-
|
|
3915
3779
|
class ExpressionErrors {
|
|
3916
3780
|
constructor() {
|
|
3917
3781
|
this.shorthandAssignLoc = null;
|
|
@@ -4004,15 +3868,12 @@ class NodeUtils extends UtilParser {
|
|
|
4004
3868
|
startNodeAt(loc) {
|
|
4005
3869
|
return new Node(this, loc.index, loc);
|
|
4006
3870
|
}
|
|
4007
|
-
|
|
4008
3871
|
startNodeAtNode(type) {
|
|
4009
3872
|
return this.startNodeAt(type.loc.start);
|
|
4010
3873
|
}
|
|
4011
|
-
|
|
4012
3874
|
finishNode(node, type) {
|
|
4013
3875
|
return this.finishNodeAt(node, type, this.state.lastTokEndLoc);
|
|
4014
3876
|
}
|
|
4015
|
-
|
|
4016
3877
|
finishNodeAt(node, type, endLoc) {
|
|
4017
3878
|
node.type = type;
|
|
4018
3879
|
node.end = endLoc.index;
|
|
@@ -4031,14 +3892,12 @@ class NodeUtils extends UtilParser {
|
|
|
4031
3892
|
node.loc.end = endLoc;
|
|
4032
3893
|
if (this.options.ranges) node.range[1] = endLoc.index;
|
|
4033
3894
|
}
|
|
4034
|
-
|
|
4035
3895
|
resetStartLocationFromNode(node, locationNode) {
|
|
4036
3896
|
this.resetStartLocation(node, locationNode.loc.start);
|
|
4037
3897
|
}
|
|
4038
3898
|
}
|
|
4039
3899
|
|
|
4040
3900
|
const reservedTypes = new Set(["_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void"]);
|
|
4041
|
-
|
|
4042
3901
|
const FlowErrors = ParseErrorEnum`flow`({
|
|
4043
3902
|
AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
|
|
4044
3903
|
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 +3991,6 @@ const FlowErrors = ParseErrorEnum`flow`({
|
|
|
4132
3991
|
UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.",
|
|
4133
3992
|
UnterminatedFlowComment: "Unterminated flow-comment."
|
|
4134
3993
|
});
|
|
4135
|
-
|
|
4136
3994
|
function isEsModuleType(bodyElement) {
|
|
4137
3995
|
return bodyElement.type === "DeclareExportAllDeclaration" || bodyElement.type === "DeclareExportDeclaration" && (!bodyElement.declaration || bodyElement.declaration.type !== "TypeAlias" && bodyElement.declaration.type !== "InterfaceDeclaration");
|
|
4138
3996
|
}
|
|
@@ -4148,7 +4006,6 @@ const exportSuggestions = {
|
|
|
4148
4006
|
type: "export type",
|
|
4149
4007
|
interface: "export interface"
|
|
4150
4008
|
};
|
|
4151
|
-
|
|
4152
4009
|
function partition(list, test) {
|
|
4153
4010
|
const list1 = [];
|
|
4154
4011
|
const list2 = [];
|
|
@@ -4158,7 +4015,6 @@ function partition(list, test) {
|
|
|
4158
4015
|
return [list1, list2];
|
|
4159
4016
|
}
|
|
4160
4017
|
const FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/;
|
|
4161
|
-
|
|
4162
4018
|
var flow = (superClass => class FlowParserMixin extends superClass {
|
|
4163
4019
|
constructor(...args) {
|
|
4164
4020
|
super(...args);
|
|
@@ -4381,18 +4237,11 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4381
4237
|
suggestion: exportSuggestions[label]
|
|
4382
4238
|
});
|
|
4383
4239
|
}
|
|
4384
|
-
if (this.match(74) ||
|
|
4385
|
-
this.match(68) ||
|
|
4386
|
-
this.match(80) ||
|
|
4387
|
-
this.isContextual(129)) {
|
|
4240
|
+
if (this.match(74) || this.match(68) || this.match(80) || this.isContextual(129)) {
|
|
4388
4241
|
node.declaration = this.flowParseDeclare(this.startNode());
|
|
4389
4242
|
node.default = false;
|
|
4390
4243
|
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)) {
|
|
4244
|
+
} else if (this.match(55) || this.match(5) || this.isContextual(127) || this.isContextual(128) || this.isContextual(129)) {
|
|
4396
4245
|
node = this.parseExport(node, null);
|
|
4397
4246
|
if (node.type === "ExportNamedDeclaration") {
|
|
4398
4247
|
node.type = "ExportDeclaration";
|
|
@@ -4429,7 +4278,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4429
4278
|
this.flowParseInterfaceish(node);
|
|
4430
4279
|
return this.finishNode(node, "DeclareInterface");
|
|
4431
4280
|
}
|
|
4432
|
-
|
|
4433
4281
|
flowParseInterfaceish(node, isClass = false) {
|
|
4434
4282
|
node.id = this.flowParseRestrictedIdentifier(!isClass, true);
|
|
4435
4283
|
this.scope.declareName(node.id.name, isClass ? BIND_FUNCTION : BIND_LEXICAL, node.id.loc.start);
|
|
@@ -4498,7 +4346,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4498
4346
|
this.checkReservedType(this.state.value, this.state.startLoc, declaration);
|
|
4499
4347
|
return this.parseIdentifier(liberal);
|
|
4500
4348
|
}
|
|
4501
|
-
|
|
4502
4349
|
flowParseTypeAlias(node) {
|
|
4503
4350
|
node.id = this.flowParseRestrictedIdentifier(false, true);
|
|
4504
4351
|
this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.loc.start);
|
|
@@ -4520,7 +4367,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4520
4367
|
} else {
|
|
4521
4368
|
node.typeParameters = null;
|
|
4522
4369
|
}
|
|
4523
|
-
|
|
4524
4370
|
node.supertype = null;
|
|
4525
4371
|
if (this.match(14)) {
|
|
4526
4372
|
node.supertype = this.flowParseTypeInitialiser(14);
|
|
@@ -4532,7 +4378,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4532
4378
|
this.semicolon();
|
|
4533
4379
|
return this.finishNode(node, "OpaqueType");
|
|
4534
4380
|
}
|
|
4535
|
-
|
|
4536
4381
|
flowParseTypeParameter(requireDefault = false) {
|
|
4537
4382
|
const nodeStartLoc = this.state.startLoc;
|
|
4538
4383
|
const node = this.startNode();
|
|
@@ -4558,7 +4403,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4558
4403
|
const node = this.startNode();
|
|
4559
4404
|
node.params = [];
|
|
4560
4405
|
this.state.inType = true;
|
|
4561
|
-
|
|
4562
4406
|
if (this.match(47) || this.match(140)) {
|
|
4563
4407
|
this.next();
|
|
4564
4408
|
} else {
|
|
@@ -4637,7 +4481,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4637
4481
|
}
|
|
4638
4482
|
flowParseObjectTypeIndexer(node, isStatic, variance) {
|
|
4639
4483
|
node.static = isStatic;
|
|
4640
|
-
|
|
4641
4484
|
if (this.lookahead().type === 14) {
|
|
4642
4485
|
node.id = this.flowParseObjectPropertyKey();
|
|
4643
4486
|
node.key = this.flowParseTypeInitialiser();
|
|
@@ -4745,7 +4588,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4745
4588
|
}
|
|
4746
4589
|
if (allowStatic && this.isContextual(104)) {
|
|
4747
4590
|
const lookahead = this.lookahead();
|
|
4748
|
-
|
|
4749
4591
|
if (lookahead.type !== 14 && lookahead.type !== 17) {
|
|
4750
4592
|
this.next();
|
|
4751
4593
|
isStatic = true;
|
|
@@ -4797,7 +4639,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4797
4639
|
}
|
|
4798
4640
|
}
|
|
4799
4641
|
this.expect(endDelim);
|
|
4800
|
-
|
|
4801
4642
|
if (allowSpread) {
|
|
4802
4643
|
nodeStart.inexact = inexact;
|
|
4803
4644
|
}
|
|
@@ -4876,7 +4717,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
4876
4717
|
return this.finishNode(node, "ObjectTypeProperty");
|
|
4877
4718
|
}
|
|
4878
4719
|
}
|
|
4879
|
-
|
|
4880
4720
|
flowCheckGetterSetterParams(property) {
|
|
4881
4721
|
const paramCount = property.kind === "get" ? 0 : 1;
|
|
4882
4722
|
const length = property.value.params.length + (property.value.rest ? 1 : 0);
|
|
@@ -5025,7 +4865,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5025
4865
|
return this.flowParseGenericType(startLoc, id);
|
|
5026
4866
|
}
|
|
5027
4867
|
}
|
|
5028
|
-
|
|
5029
4868
|
flowParsePrimaryType() {
|
|
5030
4869
|
const startLoc = this.state.startLoc;
|
|
5031
4870
|
const node = this.startNode();
|
|
@@ -5068,7 +4907,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5068
4907
|
return this.finishNode(node, "FunctionTypeAnnotation");
|
|
5069
4908
|
case 10:
|
|
5070
4909
|
this.next();
|
|
5071
|
-
|
|
5072
4910
|
if (!this.match(11) && !this.match(21)) {
|
|
5073
4911
|
if (tokenIsIdentifier(this.state.type) || this.match(78)) {
|
|
5074
4912
|
const token = this.lookahead().type;
|
|
@@ -5081,7 +4919,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5081
4919
|
this.state.noAnonFunctionType = false;
|
|
5082
4920
|
type = this.flowParseType();
|
|
5083
4921
|
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
5084
|
-
|
|
5085
4922
|
if (this.state.noAnonFunctionType || !(this.match(12) || this.match(11) && this.lookahead().type === 19)) {
|
|
5086
4923
|
this.expect(11);
|
|
5087
4924
|
return type;
|
|
@@ -5174,11 +5011,9 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5174
5011
|
this.expect(3);
|
|
5175
5012
|
if (seenOptionalIndexedAccess) {
|
|
5176
5013
|
node.optional = optional;
|
|
5177
|
-
type = this.finishNode(
|
|
5178
|
-
node, "OptionalIndexedAccessType");
|
|
5014
|
+
type = this.finishNode(node, "OptionalIndexedAccessType");
|
|
5179
5015
|
} else {
|
|
5180
|
-
type = this.finishNode(
|
|
5181
|
-
node, "IndexedAccessType");
|
|
5016
|
+
type = this.finishNode(node, "IndexedAccessType");
|
|
5182
5017
|
}
|
|
5183
5018
|
}
|
|
5184
5019
|
}
|
|
@@ -5274,7 +5109,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5274
5109
|
}
|
|
5275
5110
|
return variance;
|
|
5276
5111
|
}
|
|
5277
|
-
|
|
5278
5112
|
parseFunctionBody(node, allowExpressionBody, isMethod = false) {
|
|
5279
5113
|
if (allowExpressionBody) {
|
|
5280
5114
|
return this.forwardNoArrowParamsConversionAt(node, () => super.parseFunctionBody(node, true, isMethod));
|
|
@@ -5284,13 +5118,11 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5284
5118
|
parseFunctionBodyAndFinish(node, type, isMethod = false) {
|
|
5285
5119
|
if (this.match(14)) {
|
|
5286
5120
|
const typeNode = this.startNode();
|
|
5287
|
-
[typeNode.typeAnnotation,
|
|
5288
|
-
node.predicate] = this.flowParseTypeAndPredicateInitialiser();
|
|
5121
|
+
[typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
|
|
5289
5122
|
node.returnType = typeNode.typeAnnotation ? this.finishNode(typeNode, "TypeAnnotation") : null;
|
|
5290
5123
|
}
|
|
5291
5124
|
return super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
5292
5125
|
}
|
|
5293
|
-
|
|
5294
5126
|
parseStatementLike(flags) {
|
|
5295
5127
|
if (this.state.strict && this.isContextual(127)) {
|
|
5296
5128
|
const lookahead = this.lookahead();
|
|
@@ -5310,7 +5142,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5310
5142
|
}
|
|
5311
5143
|
return stmt;
|
|
5312
5144
|
}
|
|
5313
|
-
|
|
5314
5145
|
parseExpressionStatement(node, expr, decorators) {
|
|
5315
5146
|
if (expr.type === "Identifier") {
|
|
5316
5147
|
if (expr.name === "declare") {
|
|
@@ -5329,7 +5160,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5329
5160
|
}
|
|
5330
5161
|
return super.parseExpressionStatement(node, expr, decorators);
|
|
5331
5162
|
}
|
|
5332
|
-
|
|
5333
5163
|
shouldParseExportDeclaration() {
|
|
5334
5164
|
const {
|
|
5335
5165
|
type
|
|
@@ -5360,10 +5190,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5360
5190
|
if (!this.match(17)) return expr;
|
|
5361
5191
|
if (this.state.maybeInArrowParameters) {
|
|
5362
5192
|
const nextCh = this.lookaheadCharCode();
|
|
5363
|
-
if (nextCh === 44 ||
|
|
5364
|
-
nextCh === 61 ||
|
|
5365
|
-
nextCh === 58 ||
|
|
5366
|
-
nextCh === 41) {
|
|
5193
|
+
if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41) {
|
|
5367
5194
|
this.setOptionalParametersError(refExpressionErrors);
|
|
5368
5195
|
return expr;
|
|
5369
5196
|
}
|
|
@@ -5424,7 +5251,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5424
5251
|
failed
|
|
5425
5252
|
};
|
|
5426
5253
|
}
|
|
5427
|
-
|
|
5428
5254
|
getArrowLikeExpressions(node, disallowInvalid) {
|
|
5429
5255
|
const stack = [node];
|
|
5430
5256
|
const arrows = [];
|
|
@@ -5450,8 +5276,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5450
5276
|
}
|
|
5451
5277
|
finishArrowValidation(node) {
|
|
5452
5278
|
var _node$extra;
|
|
5453
|
-
this.toAssignableList(
|
|
5454
|
-
node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, false);
|
|
5279
|
+
this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, false);
|
|
5455
5280
|
this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW);
|
|
5456
5281
|
super.checkParams(node, false, true);
|
|
5457
5282
|
this.scope.exit();
|
|
@@ -5580,7 +5405,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5580
5405
|
readIterator() {
|
|
5581
5406
|
const word = super.readWord1();
|
|
5582
5407
|
const fullWord = "@@" + word;
|
|
5583
|
-
|
|
5584
5408
|
if (!this.isIterator(word) || !this.state.inType) {
|
|
5585
5409
|
this.raise(Errors.InvalidIdentifier, {
|
|
5586
5410
|
at: this.state.curPosition(),
|
|
@@ -5589,7 +5413,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5589
5413
|
}
|
|
5590
5414
|
this.finishToken(130, fullWord);
|
|
5591
5415
|
}
|
|
5592
|
-
|
|
5593
5416
|
getTokenFromCode(code) {
|
|
5594
5417
|
const next = this.input.charCodeAt(this.state.pos + 1);
|
|
5595
5418
|
if (code === 123 && next === 124) {
|
|
@@ -5621,7 +5444,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5621
5444
|
}
|
|
5622
5445
|
super.toAssignable(node, isLHS);
|
|
5623
5446
|
}
|
|
5624
|
-
|
|
5625
5447
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
5626
5448
|
for (let i = 0; i < exprList.length; i++) {
|
|
5627
5449
|
const expr = exprList[i];
|
|
@@ -5631,7 +5453,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5631
5453
|
}
|
|
5632
5454
|
super.toAssignableList(exprList, trailingCommaLoc, isLHS);
|
|
5633
5455
|
}
|
|
5634
|
-
|
|
5635
5456
|
toReferencedList(exprList, isParenthesizedExpr) {
|
|
5636
5457
|
for (let i = 0; i < exprList.length; i++) {
|
|
5637
5458
|
var _expr$extra;
|
|
@@ -5646,7 +5467,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5646
5467
|
}
|
|
5647
5468
|
parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
|
|
5648
5469
|
const node = super.parseArrayLike(close, canBePattern, isTuple, refExpressionErrors);
|
|
5649
|
-
|
|
5650
5470
|
if (canBePattern && !this.state.maybeInArrowParameters) {
|
|
5651
5471
|
this.toReferencedList(node.elements);
|
|
5652
5472
|
}
|
|
@@ -5655,7 +5475,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5655
5475
|
isValidLVal(type, isParenthesized, binding) {
|
|
5656
5476
|
return type === "TypeCastExpression" || super.isValidLVal(type, isParenthesized, binding);
|
|
5657
5477
|
}
|
|
5658
|
-
|
|
5659
5478
|
parseClassProperty(node) {
|
|
5660
5479
|
if (this.match(14)) {
|
|
5661
5480
|
node.typeAnnotation = this.flowParseTypeAnnotation();
|
|
@@ -5668,18 +5487,15 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5668
5487
|
}
|
|
5669
5488
|
return super.parseClassPrivateProperty(node);
|
|
5670
5489
|
}
|
|
5671
|
-
|
|
5672
5490
|
isClassMethod() {
|
|
5673
5491
|
return this.match(47) || super.isClassMethod();
|
|
5674
5492
|
}
|
|
5675
|
-
|
|
5676
5493
|
isClassProperty() {
|
|
5677
5494
|
return this.match(14) || super.isClassProperty();
|
|
5678
5495
|
}
|
|
5679
5496
|
isNonstaticConstructor(method) {
|
|
5680
5497
|
return !this.match(14) && super.isNonstaticConstructor(method);
|
|
5681
5498
|
}
|
|
5682
|
-
|
|
5683
5499
|
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
|
5684
5500
|
if (method.variance) {
|
|
5685
5501
|
this.unexpected(method.variance.loc.start);
|
|
@@ -5696,9 +5512,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5696
5512
|
at: method
|
|
5697
5513
|
});
|
|
5698
5514
|
}
|
|
5699
|
-
} else if (
|
|
5700
|
-
method.type === "MethodDefinition" && isConstructor &&
|
|
5701
|
-
method.value.params) {
|
|
5515
|
+
} else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
|
|
5702
5516
|
const params = method.value.params;
|
|
5703
5517
|
if (params.length > 0 && this.isThisParam(params[0])) {
|
|
5704
5518
|
this.raise(FlowErrors.ThisParamBannedInConstructor, {
|
|
@@ -5717,7 +5531,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5717
5531
|
}
|
|
5718
5532
|
super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync);
|
|
5719
5533
|
}
|
|
5720
|
-
|
|
5721
5534
|
parseClassSuper(node) {
|
|
5722
5535
|
super.parseClassSuper(node);
|
|
5723
5536
|
if (node.superClass && this.match(47)) {
|
|
@@ -5757,20 +5570,17 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5757
5570
|
parsePropertyNamePrefixOperator(node) {
|
|
5758
5571
|
node.variance = this.flowParseVariance();
|
|
5759
5572
|
}
|
|
5760
|
-
|
|
5761
5573
|
parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
|
|
5762
5574
|
if (prop.variance) {
|
|
5763
5575
|
this.unexpected(prop.variance.loc.start);
|
|
5764
5576
|
}
|
|
5765
5577
|
delete prop.variance;
|
|
5766
5578
|
let typeParameters;
|
|
5767
|
-
|
|
5768
5579
|
if (this.match(47) && !isAccessor) {
|
|
5769
5580
|
typeParameters = this.flowParseTypeParameterDeclaration();
|
|
5770
5581
|
if (!this.match(10)) this.unexpected();
|
|
5771
5582
|
}
|
|
5772
5583
|
const result = super.parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
|
|
5773
|
-
|
|
5774
5584
|
if (typeParameters) {
|
|
5775
5585
|
(result.value || result).typeParameters = typeParameters;
|
|
5776
5586
|
}
|
|
@@ -5832,7 +5642,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5832
5642
|
specifier.local = hasTypeImportKind(node) ? this.flowParseRestrictedIdentifier(true, true) : this.parseIdentifier();
|
|
5833
5643
|
node.specifiers.push(this.finishImportSpecifier(specifier, type));
|
|
5834
5644
|
}
|
|
5835
|
-
|
|
5836
5645
|
maybeParseDefaultImportSpecifier(node) {
|
|
5837
5646
|
node.importKind = "value";
|
|
5838
5647
|
let kind = null;
|
|
@@ -5846,7 +5655,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5846
5655
|
const {
|
|
5847
5656
|
type
|
|
5848
5657
|
} = lh;
|
|
5849
|
-
|
|
5850
5658
|
if (kind === "type" && type === 55) {
|
|
5851
5659
|
this.unexpected(null, lh.type);
|
|
5852
5660
|
}
|
|
@@ -5857,10 +5665,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5857
5665
|
}
|
|
5858
5666
|
return super.maybeParseDefaultImportSpecifier(node);
|
|
5859
5667
|
}
|
|
5860
|
-
|
|
5861
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport,
|
|
5862
|
-
isMaybeTypeOnly,
|
|
5863
|
-
bindingType) {
|
|
5668
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
5864
5669
|
const firstIdent = specifier.imported;
|
|
5865
5670
|
let specifierTypeKind = null;
|
|
5866
5671
|
if (firstIdent.type === "Identifier") {
|
|
@@ -5925,7 +5730,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5925
5730
|
return super.parseBindingAtom();
|
|
5926
5731
|
}
|
|
5927
5732
|
}
|
|
5928
|
-
|
|
5929
5733
|
parseFunctionParams(node, allowModifiers) {
|
|
5930
5734
|
const kind = node.kind;
|
|
5931
5735
|
if (kind !== "get" && kind !== "set" && this.match(47)) {
|
|
@@ -5933,7 +5737,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5933
5737
|
}
|
|
5934
5738
|
super.parseFunctionParams(node, allowModifiers);
|
|
5935
5739
|
}
|
|
5936
|
-
|
|
5937
5740
|
parseVarId(decl, kind) {
|
|
5938
5741
|
super.parseVarId(decl, kind);
|
|
5939
5742
|
if (this.match(14)) {
|
|
@@ -5941,7 +5744,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5941
5744
|
this.resetEndLocation(decl.id);
|
|
5942
5745
|
}
|
|
5943
5746
|
}
|
|
5944
|
-
|
|
5945
5747
|
parseAsyncArrowFromCallExpression(node, call) {
|
|
5946
5748
|
if (this.match(14)) {
|
|
5947
5749
|
const oldNoAnonFunctionType = this.state.noAnonFunctionType;
|
|
@@ -5951,11 +5753,9 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5951
5753
|
}
|
|
5952
5754
|
return super.parseAsyncArrowFromCallExpression(node, call);
|
|
5953
5755
|
}
|
|
5954
|
-
|
|
5955
5756
|
shouldParseAsyncArrow() {
|
|
5956
5757
|
return this.match(14) || super.shouldParseAsyncArrow();
|
|
5957
5758
|
}
|
|
5958
|
-
|
|
5959
5759
|
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
|
|
5960
5760
|
var _jsx;
|
|
5961
5761
|
let state = null;
|
|
@@ -5963,9 +5763,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5963
5763
|
if (this.hasPlugin("jsx") && (this.match(140) || this.match(47))) {
|
|
5964
5764
|
state = this.state.clone();
|
|
5965
5765
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
5966
|
-
|
|
5967
5766
|
if (!jsx.error) return jsx.node;
|
|
5968
|
-
|
|
5969
5767
|
const {
|
|
5970
5768
|
context
|
|
5971
5769
|
} = this.state;
|
|
@@ -5986,9 +5784,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5986
5784
|
this.resetStartLocationFromNode(result, typeParameters);
|
|
5987
5785
|
return result;
|
|
5988
5786
|
});
|
|
5989
|
-
|
|
5990
5787
|
if ((_arrowExpression$extr = arrowExpression.extra) != null && _arrowExpression$extr.parenthesized) abort();
|
|
5991
|
-
|
|
5992
5788
|
const expr = this.maybeUnwrapTypeCastExpression(arrowExpression);
|
|
5993
5789
|
if (expr.type !== "ArrowFunctionExpression") abort();
|
|
5994
5790
|
expr.typeParameters = typeParameters;
|
|
@@ -5996,8 +5792,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
5996
5792
|
return arrowExpression;
|
|
5997
5793
|
}, state);
|
|
5998
5794
|
let arrowExpression = null;
|
|
5999
|
-
if (arrow.node &&
|
|
6000
|
-
this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
|
|
5795
|
+
if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
|
|
6001
5796
|
if (!arrow.error && !arrow.aborted) {
|
|
6002
5797
|
if (arrow.node.async) {
|
|
6003
5798
|
this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, {
|
|
@@ -6006,10 +5801,8 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6006
5801
|
}
|
|
6007
5802
|
return arrow.node;
|
|
6008
5803
|
}
|
|
6009
|
-
|
|
6010
5804
|
arrowExpression = arrow.node;
|
|
6011
5805
|
}
|
|
6012
|
-
|
|
6013
5806
|
if ((_jsx2 = jsx) != null && _jsx2.node) {
|
|
6014
5807
|
this.state = jsx.failState;
|
|
6015
5808
|
return jsx.node;
|
|
@@ -6020,31 +5813,26 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6020
5813
|
}
|
|
6021
5814
|
if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
|
|
6022
5815
|
if (arrow.thrown) throw arrow.error;
|
|
6023
|
-
|
|
6024
5816
|
throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, {
|
|
6025
5817
|
at: typeParameters
|
|
6026
5818
|
});
|
|
6027
5819
|
}
|
|
6028
5820
|
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
6029
5821
|
}
|
|
6030
|
-
|
|
6031
5822
|
parseArrow(node) {
|
|
6032
5823
|
if (this.match(14)) {
|
|
6033
5824
|
const result = this.tryParse(() => {
|
|
6034
5825
|
const oldNoAnonFunctionType = this.state.noAnonFunctionType;
|
|
6035
5826
|
this.state.noAnonFunctionType = true;
|
|
6036
5827
|
const typeNode = this.startNode();
|
|
6037
|
-
[typeNode.typeAnnotation,
|
|
6038
|
-
node.predicate] = this.flowParseTypeAndPredicateInitialiser();
|
|
5828
|
+
[typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
|
|
6039
5829
|
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
6040
5830
|
if (this.canInsertSemicolon()) this.unexpected();
|
|
6041
5831
|
if (!this.match(19)) this.unexpected();
|
|
6042
5832
|
return typeNode;
|
|
6043
5833
|
});
|
|
6044
5834
|
if (result.thrown) return null;
|
|
6045
|
-
|
|
6046
5835
|
if (result.error) this.state = result.failState;
|
|
6047
|
-
|
|
6048
5836
|
node.returnType = result.node.typeAnnotation ? this.finishNode(result.node, "TypeAnnotation") : null;
|
|
6049
5837
|
}
|
|
6050
5838
|
return super.parseArrow(node);
|
|
@@ -6063,7 +5851,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6063
5851
|
if (isArrowFunction && this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
|
|
6064
5852
|
return;
|
|
6065
5853
|
}
|
|
6066
|
-
|
|
6067
5854
|
for (let i = 0; i < node.params.length; i++) {
|
|
6068
5855
|
if (this.isThisParam(node.params[i]) && i > 0) {
|
|
6069
5856
|
this.raise(FlowErrors.ThisParamMustBeFirst, {
|
|
@@ -6086,7 +5873,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6086
5873
|
} else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
|
|
6087
5874
|
const state = this.state.clone();
|
|
6088
5875
|
const arrow = this.tryParse(abort => this.parseAsyncArrowWithTypeParameters(startLoc) || abort(), state);
|
|
6089
|
-
|
|
6090
5876
|
if (!arrow.error && !arrow.aborted) return arrow.node;
|
|
6091
5877
|
const result = this.tryParse(() => super.parseSubscripts(base, startLoc, noCalls), state);
|
|
6092
5878
|
if (result.node && !result.error) return result.node;
|
|
@@ -6199,8 +5985,7 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6199
5985
|
pos
|
|
6200
5986
|
} = this.state;
|
|
6201
5987
|
let shiftToFirstNonWhiteSpace = 2;
|
|
6202
|
-
while ([32, 9].includes(
|
|
6203
|
-
this.input.charCodeAt(pos + shiftToFirstNonWhiteSpace))) {
|
|
5988
|
+
while ([32, 9].includes(this.input.charCodeAt(pos + shiftToFirstNonWhiteSpace))) {
|
|
6204
5989
|
shiftToFirstNonWhiteSpace++;
|
|
6205
5990
|
}
|
|
6206
5991
|
const ch2 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos);
|
|
@@ -6208,15 +5993,12 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6208
5993
|
if (ch2 === 58 && ch3 === 58) {
|
|
6209
5994
|
return shiftToFirstNonWhiteSpace + 2;
|
|
6210
5995
|
}
|
|
6211
|
-
|
|
6212
5996
|
if (this.input.slice(shiftToFirstNonWhiteSpace + pos, shiftToFirstNonWhiteSpace + pos + 12) === "flow-include") {
|
|
6213
5997
|
return shiftToFirstNonWhiteSpace + 12;
|
|
6214
5998
|
}
|
|
6215
|
-
|
|
6216
5999
|
if (ch2 === 58 && ch3 !== 58) {
|
|
6217
6000
|
return shiftToFirstNonWhiteSpace;
|
|
6218
6001
|
}
|
|
6219
|
-
|
|
6220
6002
|
return false;
|
|
6221
6003
|
}
|
|
6222
6004
|
hasFlowCommentCompletion() {
|
|
@@ -6227,7 +6009,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6227
6009
|
});
|
|
6228
6010
|
}
|
|
6229
6011
|
}
|
|
6230
|
-
|
|
6231
6012
|
flowEnumErrorBooleanMemberNotInitialized(loc, {
|
|
6232
6013
|
enumName,
|
|
6233
6014
|
memberName
|
|
@@ -6577,7 +6358,6 @@ var flow = (superClass => class FlowParserMixin extends superClass {
|
|
|
6577
6358
|
node.body = this.flowEnumBody(this.startNode(), id);
|
|
6578
6359
|
return this.finishNode(node, "EnumDeclaration");
|
|
6579
6360
|
}
|
|
6580
|
-
|
|
6581
6361
|
isLookaheadToken_lt() {
|
|
6582
6362
|
const next = this.nextTokenStart();
|
|
6583
6363
|
if (this.input.charCodeAt(next) === 60) {
|
|
@@ -6863,11 +6643,9 @@ const JsxErrors = ParseErrorEnum`jsx`({
|
|
|
6863
6643
|
UnterminatedJsxContent: "Unterminated JSX contents.",
|
|
6864
6644
|
UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
|
|
6865
6645
|
});
|
|
6866
|
-
|
|
6867
6646
|
function isFragment(object) {
|
|
6868
6647
|
return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false;
|
|
6869
6648
|
}
|
|
6870
|
-
|
|
6871
6649
|
function getQualifiedJSXName(object) {
|
|
6872
6650
|
if (object.type === "JSXIdentifier") {
|
|
6873
6651
|
return object.name;
|
|
@@ -6878,11 +6656,9 @@ function getQualifiedJSXName(object) {
|
|
|
6878
6656
|
if (object.type === "JSXMemberExpression") {
|
|
6879
6657
|
return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
|
|
6880
6658
|
}
|
|
6881
|
-
|
|
6882
6659
|
throw new Error("Node had unexpected type: " + object.type);
|
|
6883
6660
|
}
|
|
6884
6661
|
var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
6885
|
-
|
|
6886
6662
|
jsxReadToken() {
|
|
6887
6663
|
let out = "";
|
|
6888
6664
|
let chunkStart = this.state.pos;
|
|
@@ -6912,7 +6688,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
6912
6688
|
break;
|
|
6913
6689
|
case 62:
|
|
6914
6690
|
case 125:
|
|
6915
|
-
|
|
6916
6691
|
default:
|
|
6917
6692
|
if (isNewLine(ch)) {
|
|
6918
6693
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
@@ -6993,11 +6768,9 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
6993
6768
|
}
|
|
6994
6769
|
}
|
|
6995
6770
|
}
|
|
6996
|
-
|
|
6997
6771
|
this.state.pos = startPos;
|
|
6998
6772
|
return "&";
|
|
6999
6773
|
}
|
|
7000
|
-
|
|
7001
6774
|
jsxReadWord() {
|
|
7002
6775
|
let ch;
|
|
7003
6776
|
const start = this.state.pos;
|
|
@@ -7006,7 +6779,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7006
6779
|
} while (isIdentifierChar(ch) || ch === 45);
|
|
7007
6780
|
return this.finishToken(138, this.input.slice(start, this.state.pos));
|
|
7008
6781
|
}
|
|
7009
|
-
|
|
7010
6782
|
jsxParseIdentifier() {
|
|
7011
6783
|
const node = this.startNode();
|
|
7012
6784
|
if (this.match(138)) {
|
|
@@ -7019,7 +6791,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7019
6791
|
this.next();
|
|
7020
6792
|
return this.finishNode(node, "JSXIdentifier");
|
|
7021
6793
|
}
|
|
7022
|
-
|
|
7023
6794
|
jsxParseNamespacedName() {
|
|
7024
6795
|
const startLoc = this.state.startLoc;
|
|
7025
6796
|
const name = this.jsxParseIdentifier();
|
|
@@ -7029,7 +6800,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7029
6800
|
node.name = this.jsxParseIdentifier();
|
|
7030
6801
|
return this.finishNode(node, "JSXNamespacedName");
|
|
7031
6802
|
}
|
|
7032
|
-
|
|
7033
6803
|
jsxParseElementName() {
|
|
7034
6804
|
const startLoc = this.state.startLoc;
|
|
7035
6805
|
let node = this.jsxParseNamespacedName();
|
|
@@ -7044,7 +6814,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7044
6814
|
}
|
|
7045
6815
|
return node;
|
|
7046
6816
|
}
|
|
7047
|
-
|
|
7048
6817
|
jsxParseAttributeValue() {
|
|
7049
6818
|
let node;
|
|
7050
6819
|
switch (this.state.type) {
|
|
@@ -7068,12 +6837,10 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7068
6837
|
});
|
|
7069
6838
|
}
|
|
7070
6839
|
}
|
|
7071
|
-
|
|
7072
6840
|
jsxParseEmptyExpression() {
|
|
7073
6841
|
const node = this.startNodeAt(this.state.lastTokEndLoc);
|
|
7074
6842
|
return this.finishNodeAt(node, "JSXEmptyExpression", this.state.startLoc);
|
|
7075
6843
|
}
|
|
7076
|
-
|
|
7077
6844
|
jsxParseSpreadChild(node) {
|
|
7078
6845
|
this.next();
|
|
7079
6846
|
node.expression = this.parseExpression();
|
|
@@ -7082,7 +6849,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7082
6849
|
this.expect(8);
|
|
7083
6850
|
return this.finishNode(node, "JSXSpreadChild");
|
|
7084
6851
|
}
|
|
7085
|
-
|
|
7086
6852
|
jsxParseExpressionContainer(node, previousContext) {
|
|
7087
6853
|
if (this.match(8)) {
|
|
7088
6854
|
node.expression = this.jsxParseEmptyExpression();
|
|
@@ -7095,7 +6861,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7095
6861
|
this.expect(8);
|
|
7096
6862
|
return this.finishNode(node, "JSXExpressionContainer");
|
|
7097
6863
|
}
|
|
7098
|
-
|
|
7099
6864
|
jsxParseAttribute() {
|
|
7100
6865
|
const node = this.startNode();
|
|
7101
6866
|
if (this.match(5)) {
|
|
@@ -7112,7 +6877,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7112
6877
|
node.value = this.eat(29) ? this.jsxParseAttributeValue() : null;
|
|
7113
6878
|
return this.finishNode(node, "JSXAttribute");
|
|
7114
6879
|
}
|
|
7115
|
-
|
|
7116
6880
|
jsxParseOpeningElementAt(startLoc) {
|
|
7117
6881
|
const node = this.startNodeAt(startLoc);
|
|
7118
6882
|
if (this.eat(141)) {
|
|
@@ -7131,7 +6895,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7131
6895
|
this.expect(141);
|
|
7132
6896
|
return this.finishNode(node, "JSXOpeningElement");
|
|
7133
6897
|
}
|
|
7134
|
-
|
|
7135
6898
|
jsxParseClosingElementAt(startLoc) {
|
|
7136
6899
|
const node = this.startNodeAt(startLoc);
|
|
7137
6900
|
if (this.eat(141)) {
|
|
@@ -7141,7 +6904,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7141
6904
|
this.expect(141);
|
|
7142
6905
|
return this.finishNode(node, "JSXClosingElement");
|
|
7143
6906
|
}
|
|
7144
|
-
|
|
7145
6907
|
jsxParseElementAt(startLoc) {
|
|
7146
6908
|
const node = this.startNodeAt(startLoc);
|
|
7147
6909
|
const children = [];
|
|
@@ -7211,7 +6973,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7211
6973
|
}
|
|
7212
6974
|
return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
|
|
7213
6975
|
}
|
|
7214
|
-
|
|
7215
6976
|
jsxParseElement() {
|
|
7216
6977
|
const startLoc = this.state.startLoc;
|
|
7217
6978
|
this.next();
|
|
@@ -7223,7 +6984,6 @@ var jsx = (superClass => class JSXParserMixin extends superClass {
|
|
|
7223
6984
|
} = this.state;
|
|
7224
6985
|
context[context.length - 1] = newContext;
|
|
7225
6986
|
}
|
|
7226
|
-
|
|
7227
6987
|
parseExprAtom(refExpressionErrors) {
|
|
7228
6988
|
if (this.match(139)) {
|
|
7229
6989
|
return this.parseLiteral(this.state.value, "JSXText");
|
|
@@ -7298,7 +7058,6 @@ class TypeScriptScope extends Scope {
|
|
|
7298
7058
|
this.exportOnlyBindings = new Set();
|
|
7299
7059
|
}
|
|
7300
7060
|
}
|
|
7301
|
-
|
|
7302
7061
|
class TypeScriptScopeHandler extends ScopeHandler {
|
|
7303
7062
|
constructor(...args) {
|
|
7304
7063
|
super(...args);
|
|
@@ -7306,7 +7065,6 @@ class TypeScriptScopeHandler extends ScopeHandler {
|
|
|
7306
7065
|
}
|
|
7307
7066
|
createScope(flags) {
|
|
7308
7067
|
this.importsStack.push(new Set());
|
|
7309
|
-
|
|
7310
7068
|
return new TypeScriptScope(flags);
|
|
7311
7069
|
}
|
|
7312
7070
|
enter(flags) {
|
|
@@ -7429,8 +7187,7 @@ const TSErrors = ParseErrorEnum`typescript`({
|
|
|
7429
7187
|
}) => `'declare' is not allowed in ${kind}ters.`,
|
|
7430
7188
|
DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
|
|
7431
7189
|
DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
|
|
7432
|
-
DuplicateAccessibilityModifier:
|
|
7433
|
-
({
|
|
7190
|
+
DuplicateAccessibilityModifier: ({
|
|
7434
7191
|
modifier
|
|
7435
7192
|
}) => `Accessibility modifier already seen.`,
|
|
7436
7193
|
DuplicateModifier: ({
|
|
@@ -7504,7 +7261,6 @@ const TSErrors = ParseErrorEnum`typescript`({
|
|
|
7504
7261
|
type
|
|
7505
7262
|
}) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`
|
|
7506
7263
|
});
|
|
7507
|
-
|
|
7508
7264
|
function keywordTypeFromName(value) {
|
|
7509
7265
|
switch (value) {
|
|
7510
7266
|
case "any":
|
|
@@ -7551,7 +7307,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7551
7307
|
this.next();
|
|
7552
7308
|
return this.tsTokenCanFollowModifier();
|
|
7553
7309
|
}
|
|
7554
|
-
|
|
7555
7310
|
tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
|
|
7556
7311
|
if (!tokenIsIdentifier(this.state.type) && this.state.type !== 58) {
|
|
7557
7312
|
return undefined;
|
|
@@ -7567,7 +7322,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7567
7322
|
}
|
|
7568
7323
|
return undefined;
|
|
7569
7324
|
}
|
|
7570
|
-
|
|
7571
7325
|
tsParseModifiers({
|
|
7572
7326
|
modified,
|
|
7573
7327
|
allowedModifiers,
|
|
@@ -7666,7 +7420,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7666
7420
|
tsParseDelimitedList(kind, parseElement, refTrailingCommaPos) {
|
|
7667
7421
|
return nonNull(this.tsParseDelimitedListWorker(kind, parseElement, true, refTrailingCommaPos));
|
|
7668
7422
|
}
|
|
7669
|
-
|
|
7670
7423
|
tsParseDelimitedListWorker(kind, parseElement, expectSuccess, refTrailingCommaPos) {
|
|
7671
7424
|
const result = [];
|
|
7672
7425
|
let trailingCommaPos = -1;
|
|
@@ -7722,7 +7475,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7722
7475
|
at: this.state.startLoc
|
|
7723
7476
|
});
|
|
7724
7477
|
}
|
|
7725
|
-
|
|
7726
7478
|
node.argument = super.parseExprAtom();
|
|
7727
7479
|
this.expect(11);
|
|
7728
7480
|
if (this.eat(16)) {
|
|
@@ -7785,7 +7537,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7785
7537
|
errorTemplate: TSErrors.InvalidModifierOnTypeParameter
|
|
7786
7538
|
});
|
|
7787
7539
|
}
|
|
7788
|
-
|
|
7789
7540
|
tsParseNoneModifiers(node) {
|
|
7790
7541
|
this.tsParseModifiers({
|
|
7791
7542
|
modified: node,
|
|
@@ -7817,8 +7568,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7817
7568
|
const refTrailingCommaPos = {
|
|
7818
7569
|
value: -1
|
|
7819
7570
|
};
|
|
7820
|
-
node.params = this.tsParseBracketedList("TypeParametersOrArguments",
|
|
7821
|
-
this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
|
|
7571
|
+
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
|
|
7822
7572
|
if (node.params.length === 0) {
|
|
7823
7573
|
this.raise(TSErrors.EmptyTypeParameters, {
|
|
7824
7574
|
at: node
|
|
@@ -7829,10 +7579,8 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7829
7579
|
}
|
|
7830
7580
|
return this.finishNode(node, "TSTypeParameterDeclaration");
|
|
7831
7581
|
}
|
|
7832
|
-
|
|
7833
7582
|
tsFillSignature(returnToken, signature) {
|
|
7834
7583
|
const returnTokenRequired = returnToken === 19;
|
|
7835
|
-
|
|
7836
7584
|
const paramsKey = "parameters";
|
|
7837
7585
|
const returnTypeKey = "typeAnnotation";
|
|
7838
7586
|
signature.typeParameters = this.tsTryParseTypeParameters();
|
|
@@ -7881,7 +7629,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
7881
7629
|
const id = this.parseIdentifier();
|
|
7882
7630
|
id.typeAnnotation = this.tsParseTypeAnnotation();
|
|
7883
7631
|
this.resetEndLocation(id);
|
|
7884
|
-
|
|
7885
7632
|
this.expect(3);
|
|
7886
7633
|
node.parameters = [id];
|
|
7887
7634
|
const type = this.tsTryParseTypeAnnotation();
|
|
@@ -8055,7 +7802,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8055
7802
|
tsParseTupleType() {
|
|
8056
7803
|
const node = this.startNode();
|
|
8057
7804
|
node.elementTypes = this.tsParseBracketedList("TupleElementTypes", this.tsParseTupleElementType.bind(this), true, false);
|
|
8058
|
-
|
|
8059
7805
|
let seenOptionalElement = false;
|
|
8060
7806
|
let labeledElements = null;
|
|
8061
7807
|
node.elementTypes.forEach(elementNode => {
|
|
@@ -8069,7 +7815,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8069
7815
|
});
|
|
8070
7816
|
}
|
|
8071
7817
|
seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
|
|
8072
|
-
|
|
8073
7818
|
let checkType = type;
|
|
8074
7819
|
if (type === "TSRestType") {
|
|
8075
7820
|
elementNode = elementNode.typeAnnotation;
|
|
@@ -8086,7 +7831,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8086
7831
|
return this.finishNode(node, "TSTupleType");
|
|
8087
7832
|
}
|
|
8088
7833
|
tsParseTupleElementType() {
|
|
8089
|
-
|
|
8090
7834
|
const {
|
|
8091
7835
|
startLoc
|
|
8092
7836
|
} = this.state;
|
|
@@ -8133,7 +7877,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8133
7877
|
if (abstract) this.next();
|
|
8134
7878
|
this.next();
|
|
8135
7879
|
}
|
|
8136
|
-
|
|
8137
7880
|
this.tsInAllowConditionalTypesContext(() => this.tsFillSignature(19, node));
|
|
8138
7881
|
return this.finishNode(node, type);
|
|
8139
7882
|
}
|
|
@@ -8247,8 +7990,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8247
7990
|
node.operator = operator;
|
|
8248
7991
|
node.typeAnnotation = this.tsParseTypeOperatorOrHigher();
|
|
8249
7992
|
if (operator === "readonly") {
|
|
8250
|
-
this.tsCheckTypeAnnotationForReadOnly(
|
|
8251
|
-
node);
|
|
7993
|
+
this.tsCheckTypeAnnotationForReadOnly(node);
|
|
8252
7994
|
}
|
|
8253
7995
|
return this.finishNode(node, "TSTypeOperator");
|
|
8254
7996
|
}
|
|
@@ -8384,14 +8126,12 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8384
8126
|
if (!asserts) {
|
|
8385
8127
|
return this.tsParseTypeAnnotation(false, t);
|
|
8386
8128
|
}
|
|
8387
|
-
|
|
8388
8129
|
node.parameterName = this.parseIdentifier();
|
|
8389
8130
|
node.asserts = asserts;
|
|
8390
8131
|
node.typeAnnotation = null;
|
|
8391
8132
|
t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
|
|
8392
8133
|
return this.finishNode(t, "TSTypeAnnotation");
|
|
8393
8134
|
}
|
|
8394
|
-
|
|
8395
8135
|
const type = this.tsParseTypeAnnotation(false);
|
|
8396
8136
|
node.parameterName = typePredicateVariable;
|
|
8397
8137
|
node.typeAnnotation = type;
|
|
@@ -8440,7 +8180,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8440
8180
|
});
|
|
8441
8181
|
return this.finishNode(t, "TSTypeAnnotation");
|
|
8442
8182
|
}
|
|
8443
|
-
|
|
8444
8183
|
tsParseType() {
|
|
8445
8184
|
assert(this.state.inType);
|
|
8446
8185
|
const type = this.tsParseNonConditionalType();
|
|
@@ -8550,7 +8289,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8550
8289
|
this.state.context = oldContext;
|
|
8551
8290
|
}
|
|
8552
8291
|
}
|
|
8553
|
-
|
|
8554
8292
|
tsInType(cb) {
|
|
8555
8293
|
const oldInType = this.state.inType;
|
|
8556
8294
|
this.state.inType = true;
|
|
@@ -8690,7 +8428,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8690
8428
|
this.expect(11);
|
|
8691
8429
|
return this.finishNode(node, "TSExternalModuleReference");
|
|
8692
8430
|
}
|
|
8693
|
-
|
|
8694
8431
|
tsLookAhead(f) {
|
|
8695
8432
|
const state = this.state.clone();
|
|
8696
8433
|
const res = f();
|
|
@@ -8698,8 +8435,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8698
8435
|
return res;
|
|
8699
8436
|
}
|
|
8700
8437
|
tsTryParseAndCatch(f) {
|
|
8701
|
-
const result = this.tryParse(abort =>
|
|
8702
|
-
f() || abort());
|
|
8438
|
+
const result = this.tryParse(abort => f() || abort());
|
|
8703
8439
|
if (result.aborted || !result.node) return undefined;
|
|
8704
8440
|
if (result.error) this.state = result.failState;
|
|
8705
8441
|
return result.node;
|
|
@@ -8724,7 +8460,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8724
8460
|
starttype = 74;
|
|
8725
8461
|
kind = "let";
|
|
8726
8462
|
}
|
|
8727
|
-
|
|
8728
8463
|
return this.tsInAmbientContext(() => {
|
|
8729
8464
|
if (starttype === 68) {
|
|
8730
8465
|
nany.declare = true;
|
|
@@ -8747,7 +8482,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8747
8482
|
nany.declare = true;
|
|
8748
8483
|
return this.parseVarStatement(nany, kind || this.state.value, true);
|
|
8749
8484
|
}
|
|
8750
|
-
|
|
8751
8485
|
this.expect(75);
|
|
8752
8486
|
return this.tsParseEnumDeclaration(nany, {
|
|
8753
8487
|
const: true,
|
|
@@ -8765,7 +8499,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8765
8499
|
}
|
|
8766
8500
|
});
|
|
8767
8501
|
}
|
|
8768
|
-
|
|
8769
8502
|
tsTryParseExportDeclaration() {
|
|
8770
8503
|
return this.tsParseDeclaration(this.startNode(), this.state.value, true, null);
|
|
8771
8504
|
}
|
|
@@ -8797,7 +8530,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8797
8530
|
return this.tsParseDeclaration(node, expr.name, false, decorators);
|
|
8798
8531
|
}
|
|
8799
8532
|
}
|
|
8800
|
-
|
|
8801
8533
|
tsParseDeclaration(node, value, next, decorators) {
|
|
8802
8534
|
switch (value) {
|
|
8803
8535
|
case "abstract":
|
|
@@ -8854,7 +8586,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8854
8586
|
}
|
|
8855
8587
|
return super.parseArrowExpression(res, null, true);
|
|
8856
8588
|
}
|
|
8857
|
-
|
|
8858
8589
|
tsParseTypeArgumentsInExpression() {
|
|
8859
8590
|
if (this.reScan_lt() !== 47) {
|
|
8860
8591
|
return undefined;
|
|
@@ -8863,8 +8594,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8863
8594
|
}
|
|
8864
8595
|
tsParseTypeArguments() {
|
|
8865
8596
|
const node = this.startNode();
|
|
8866
|
-
node.params = this.tsInType(() =>
|
|
8867
|
-
this.tsInNoContext(() => {
|
|
8597
|
+
node.params = this.tsInType(() => this.tsInNoContext(() => {
|
|
8868
8598
|
this.expect(47);
|
|
8869
8599
|
return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
|
|
8870
8600
|
}));
|
|
@@ -8879,7 +8609,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8879
8609
|
tsIsDeclarationStart() {
|
|
8880
8610
|
return tokenIsTSDeclarationStart(this.state.type);
|
|
8881
8611
|
}
|
|
8882
|
-
|
|
8883
8612
|
isExportDefaultSpecifier() {
|
|
8884
8613
|
if (this.tsIsDeclarationStart()) return false;
|
|
8885
8614
|
return super.isExportDefaultSpecifier();
|
|
@@ -8965,8 +8694,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8965
8694
|
}
|
|
8966
8695
|
});
|
|
8967
8696
|
}
|
|
8968
|
-
toReferencedList(exprList,
|
|
8969
|
-
isInParens) {
|
|
8697
|
+
toReferencedList(exprList, isInParens) {
|
|
8970
8698
|
this.tsCheckForInvalidTypeCasts(exprList);
|
|
8971
8699
|
return exprList;
|
|
8972
8700
|
}
|
|
@@ -8994,7 +8722,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
8994
8722
|
state.optionalChainMember = isOptionalCall = true;
|
|
8995
8723
|
this.next();
|
|
8996
8724
|
}
|
|
8997
|
-
|
|
8998
8725
|
if (this.match(47) || this.match(51)) {
|
|
8999
8726
|
let missingParenErrorLoc;
|
|
9000
8727
|
const result = this.tsTryParseAndCatch(() => {
|
|
@@ -9019,7 +8746,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9019
8746
|
const node = this.startNodeAt(startLoc);
|
|
9020
8747
|
node.callee = base;
|
|
9021
8748
|
node.arguments = this.parseCallExpressionArguments(11, false);
|
|
9022
|
-
|
|
9023
8749
|
this.tsCheckForInvalidTypeCasts(node.arguments);
|
|
9024
8750
|
node.typeParameters = typeArguments;
|
|
9025
8751
|
if (state.optionalChainMember) {
|
|
@@ -9028,10 +8754,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9028
8754
|
return this.finishCallExpression(node, state.optionalChainMember);
|
|
9029
8755
|
}
|
|
9030
8756
|
const tokenType = this.state.type;
|
|
9031
|
-
if (
|
|
9032
|
-
tokenType === 48 ||
|
|
9033
|
-
tokenType === 52 ||
|
|
9034
|
-
tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
|
|
8757
|
+
if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
|
|
9035
8758
|
return;
|
|
9036
8759
|
}
|
|
9037
8760
|
const node = this.startNodeAt(startLoc);
|
|
@@ -9084,8 +8807,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9084
8807
|
});
|
|
9085
8808
|
this.finishNode(node, isSatisfies ? "TSSatisfiesExpression" : "TSAsExpression");
|
|
9086
8809
|
this.reScan_lt_gt();
|
|
9087
|
-
return this.parseExprOp(
|
|
9088
|
-
node, leftStartLoc, minPrec);
|
|
8810
|
+
return this.parseExprOp(node, leftStartLoc, minPrec);
|
|
9089
8811
|
}
|
|
9090
8812
|
return super.parseExprOp(left, leftStartLoc, minPrec);
|
|
9091
8813
|
}
|
|
@@ -9102,16 +8824,12 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9102
8824
|
});
|
|
9103
8825
|
}
|
|
9104
8826
|
}
|
|
9105
|
-
|
|
9106
8827
|
checkDuplicateExports() {}
|
|
9107
8828
|
parseImport(node) {
|
|
9108
8829
|
node.importKind = "value";
|
|
9109
8830
|
if (tokenIsIdentifier(this.state.type) || this.match(55) || this.match(5)) {
|
|
9110
8831
|
let ahead = this.lookahead();
|
|
9111
|
-
if (this.isContextual(128) &&
|
|
9112
|
-
ahead.type !== 12 &&
|
|
9113
|
-
ahead.type !== 97 &&
|
|
9114
|
-
ahead.type !== 29) {
|
|
8832
|
+
if (this.isContextual(128) && ahead.type !== 12 && ahead.type !== 97 && ahead.type !== 29) {
|
|
9115
8833
|
node.importKind = "type";
|
|
9116
8834
|
this.next();
|
|
9117
8835
|
ahead = this.lookahead();
|
|
@@ -9121,10 +8839,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9121
8839
|
}
|
|
9122
8840
|
}
|
|
9123
8841
|
const importNode = super.parseImport(node);
|
|
9124
|
-
|
|
9125
|
-
if (importNode.importKind === "type" &&
|
|
9126
|
-
importNode.specifiers.length > 1 &&
|
|
9127
|
-
importNode.specifiers[0].type === "ImportDefaultSpecifier") {
|
|
8842
|
+
if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
|
|
9128
8843
|
this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, {
|
|
9129
8844
|
at: importNode
|
|
9130
8845
|
});
|
|
@@ -9172,7 +8887,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9172
8887
|
cls.abstract = true;
|
|
9173
8888
|
return this.parseClass(cls, true, true);
|
|
9174
8889
|
}
|
|
9175
|
-
|
|
9176
8890
|
if (this.match(127)) {
|
|
9177
8891
|
const result = this.tsParseInterfaceDeclaration(this.startNode());
|
|
9178
8892
|
if (result) return result;
|
|
@@ -9190,12 +8904,11 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9190
8904
|
init
|
|
9191
8905
|
} of declaration.declarations) {
|
|
9192
8906
|
if (!init) continue;
|
|
9193
|
-
|
|
9194
8907
|
if (kind !== "const" || !!id.typeAnnotation) {
|
|
9195
8908
|
this.raise(TSErrors.InitializerNotAllowedInAmbientContext, {
|
|
9196
8909
|
at: init
|
|
9197
8910
|
});
|
|
9198
|
-
} else if (init
|
|
8911
|
+
} else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) {
|
|
9199
8912
|
this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, {
|
|
9200
8913
|
at: init
|
|
9201
8914
|
});
|
|
@@ -9302,7 +9015,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9302
9015
|
});
|
|
9303
9016
|
}
|
|
9304
9017
|
}
|
|
9305
|
-
|
|
9306
9018
|
super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
|
|
9307
9019
|
}
|
|
9308
9020
|
parsePostMemberNameModifiers(methodOrProp) {
|
|
@@ -9319,18 +9031,14 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9319
9031
|
});
|
|
9320
9032
|
}
|
|
9321
9033
|
}
|
|
9322
|
-
|
|
9323
9034
|
parseExpressionStatement(node, expr, decorators) {
|
|
9324
|
-
const decl = expr.type === "Identifier" ?
|
|
9325
|
-
this.tsParseExpressionStatement(node, expr, decorators) : undefined;
|
|
9035
|
+
const decl = expr.type === "Identifier" ? this.tsParseExpressionStatement(node, expr, decorators) : undefined;
|
|
9326
9036
|
return decl || super.parseExpressionStatement(node, expr, decorators);
|
|
9327
9037
|
}
|
|
9328
|
-
|
|
9329
9038
|
shouldParseExportDeclaration() {
|
|
9330
9039
|
if (this.tsIsDeclarationStart()) return true;
|
|
9331
9040
|
return super.shouldParseExportDeclaration();
|
|
9332
9041
|
}
|
|
9333
|
-
|
|
9334
9042
|
parseConditional(expr, startLoc, refExpressionErrors) {
|
|
9335
9043
|
if (!this.state.maybeInArrowParameters || !this.match(17)) {
|
|
9336
9044
|
return super.parseConditional(expr, startLoc, refExpressionErrors);
|
|
@@ -9345,7 +9053,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9345
9053
|
if (result.error) this.state = result.failState;
|
|
9346
9054
|
return result.node;
|
|
9347
9055
|
}
|
|
9348
|
-
|
|
9349
9056
|
parseParenItem(node, startLoc) {
|
|
9350
9057
|
node = super.parseParenItem(node, startLoc);
|
|
9351
9058
|
if (this.eat(17)) {
|
|
@@ -9364,7 +9071,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9364
9071
|
if (!this.state.isAmbientContext && this.isContextual(123)) {
|
|
9365
9072
|
return this.tsInAmbientContext(() => this.parseExportDeclaration(node));
|
|
9366
9073
|
}
|
|
9367
|
-
|
|
9368
9074
|
const startLoc = this.state.startLoc;
|
|
9369
9075
|
const isDeclare = this.eatContextual(123);
|
|
9370
9076
|
if (isDeclare && (this.isContextual(123) || !this.shouldParseExportDeclaration())) {
|
|
@@ -9384,8 +9090,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9384
9090
|
}
|
|
9385
9091
|
return declaration;
|
|
9386
9092
|
}
|
|
9387
|
-
parseClassId(node, isStatement, optionalId,
|
|
9388
|
-
bindingType) {
|
|
9093
|
+
parseClassId(node, isStatement, optionalId, bindingType) {
|
|
9389
9094
|
if ((!isStatement || optionalId) && this.isContextual(111)) {
|
|
9390
9095
|
return;
|
|
9391
9096
|
}
|
|
@@ -9428,7 +9133,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9428
9133
|
at: node
|
|
9429
9134
|
});
|
|
9430
9135
|
}
|
|
9431
|
-
|
|
9432
9136
|
if (node.accessibility) {
|
|
9433
9137
|
this.raise(TSErrors.PrivateElementHasAccessibility, {
|
|
9434
9138
|
at: node,
|
|
@@ -9454,7 +9158,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9454
9158
|
at: typeParameters
|
|
9455
9159
|
});
|
|
9456
9160
|
}
|
|
9457
|
-
|
|
9458
9161
|
const {
|
|
9459
9162
|
declare = false,
|
|
9460
9163
|
kind
|
|
@@ -9497,7 +9200,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9497
9200
|
if (typeParameters) node.typeParameters = typeParameters;
|
|
9498
9201
|
super.parseFunctionParams(node, allowModifiers);
|
|
9499
9202
|
}
|
|
9500
|
-
|
|
9501
9203
|
parseVarId(decl, kind) {
|
|
9502
9204
|
super.parseVarId(decl, kind);
|
|
9503
9205
|
if (decl.id.type === "Identifier" && !this.hasPrecedingLineBreak() && this.eat(35)) {
|
|
@@ -9509,7 +9211,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9509
9211
|
this.resetEndLocation(decl.id);
|
|
9510
9212
|
}
|
|
9511
9213
|
}
|
|
9512
|
-
|
|
9513
9214
|
parseAsyncArrowFromCallExpression(node, call) {
|
|
9514
9215
|
if (this.match(14)) {
|
|
9515
9216
|
node.returnType = this.tsParseTypeAnnotation();
|
|
@@ -9518,16 +9219,13 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9518
9219
|
}
|
|
9519
9220
|
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
|
|
9520
9221
|
var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2, _jsx4, _typeCast3;
|
|
9521
|
-
|
|
9522
9222
|
let state;
|
|
9523
9223
|
let jsx;
|
|
9524
9224
|
let typeCast;
|
|
9525
9225
|
if (this.hasPlugin("jsx") && (this.match(140) || this.match(47))) {
|
|
9526
9226
|
state = this.state.clone();
|
|
9527
9227
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
9528
|
-
|
|
9529
9228
|
if (!jsx.error) return jsx.node;
|
|
9530
|
-
|
|
9531
9229
|
const {
|
|
9532
9230
|
context
|
|
9533
9231
|
} = this.state;
|
|
@@ -9539,7 +9237,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9539
9237
|
if (!((_jsx = jsx) != null && _jsx.error) && !this.match(47)) {
|
|
9540
9238
|
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
9541
9239
|
}
|
|
9542
|
-
|
|
9543
9240
|
if (!state || state === this.state) state = this.state.clone();
|
|
9544
9241
|
let typeParameters;
|
|
9545
9242
|
const arrow = this.tryParse(abort => {
|
|
@@ -9549,21 +9246,18 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9549
9246
|
if (expr.type !== "ArrowFunctionExpression" || (_expr$extra = expr.extra) != null && _expr$extra.parenthesized) {
|
|
9550
9247
|
abort();
|
|
9551
9248
|
}
|
|
9552
|
-
|
|
9553
9249
|
if (((_typeParameters = typeParameters) == null ? void 0 : _typeParameters.params.length) !== 0) {
|
|
9554
9250
|
this.resetStartLocationFromNode(expr, typeParameters);
|
|
9555
9251
|
}
|
|
9556
9252
|
expr.typeParameters = typeParameters;
|
|
9557
9253
|
return expr;
|
|
9558
9254
|
}, state);
|
|
9559
|
-
|
|
9560
9255
|
if (!arrow.error && !arrow.aborted) {
|
|
9561
9256
|
if (typeParameters) this.reportReservedArrowTypeParam(typeParameters);
|
|
9562
9257
|
return arrow.node;
|
|
9563
9258
|
}
|
|
9564
9259
|
if (!jsx) {
|
|
9565
9260
|
assert(!this.hasPlugin("jsx"));
|
|
9566
|
-
|
|
9567
9261
|
typeCast = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
9568
9262
|
if (!typeCast.error) return typeCast.node;
|
|
9569
9263
|
}
|
|
@@ -9593,7 +9287,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9593
9287
|
});
|
|
9594
9288
|
}
|
|
9595
9289
|
}
|
|
9596
|
-
|
|
9597
9290
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
9598
9291
|
if (!this.hasPlugin("jsx") && this.match(47)) {
|
|
9599
9292
|
return this.tsParseTypeAssertion();
|
|
@@ -9603,7 +9296,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9603
9296
|
}
|
|
9604
9297
|
parseArrow(node) {
|
|
9605
9298
|
if (this.match(14)) {
|
|
9606
|
-
|
|
9607
9299
|
const result = this.tryParse(abort => {
|
|
9608
9300
|
const returnType = this.tsParseTypeOrTypePredicateAnnotation(14);
|
|
9609
9301
|
if (this.canInsertSemicolon() || !this.match(19)) abort();
|
|
@@ -9617,7 +9309,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9617
9309
|
}
|
|
9618
9310
|
return super.parseArrow(node);
|
|
9619
9311
|
}
|
|
9620
|
-
|
|
9621
9312
|
parseAssignableListItemTypes(param) {
|
|
9622
9313
|
if (this.eat(17)) {
|
|
9623
9314
|
if (param.type !== "Identifier" && !this.state.isAmbientContext && !this.state.inType) {
|
|
@@ -9695,7 +9386,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9695
9386
|
super.checkToRestConversion(node, allowPattern);
|
|
9696
9387
|
}
|
|
9697
9388
|
}
|
|
9698
|
-
|
|
9699
9389
|
isValidLVal(type, isUnparenthesizedInAssign, binding) {
|
|
9700
9390
|
return getOwn$1({
|
|
9701
9391
|
TSTypeCastExpression: true,
|
|
@@ -9734,7 +9424,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9734
9424
|
return super.checkCommaAfterRest(close);
|
|
9735
9425
|
}
|
|
9736
9426
|
}
|
|
9737
|
-
|
|
9738
9427
|
isClassMethod() {
|
|
9739
9428
|
return this.match(47) || super.isClassMethod();
|
|
9740
9429
|
}
|
|
@@ -9750,7 +9439,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9750
9439
|
}
|
|
9751
9440
|
return node;
|
|
9752
9441
|
}
|
|
9753
|
-
|
|
9754
9442
|
getTokenFromCode(code) {
|
|
9755
9443
|
if (this.state.inType) {
|
|
9756
9444
|
if (code === 62) {
|
|
@@ -9762,7 +9450,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9762
9450
|
}
|
|
9763
9451
|
return super.getTokenFromCode(code);
|
|
9764
9452
|
}
|
|
9765
|
-
|
|
9766
9453
|
reScan_lt_gt() {
|
|
9767
9454
|
const {
|
|
9768
9455
|
type
|
|
@@ -9814,8 +9501,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9814
9501
|
}
|
|
9815
9502
|
jsxParseOpeningElementAfterName(node) {
|
|
9816
9503
|
if (this.match(47) || this.match(51)) {
|
|
9817
|
-
const typeArguments = this.tsTryParseAndCatch(() =>
|
|
9818
|
-
this.tsParseTypeArgumentsInExpression());
|
|
9504
|
+
const typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArgumentsInExpression());
|
|
9819
9505
|
if (typeArguments) node.typeParameters = typeArguments;
|
|
9820
9506
|
}
|
|
9821
9507
|
return super.jsxParseOpeningElementAfterName(node);
|
|
@@ -9859,7 +9545,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9859
9545
|
node.abstract = true;
|
|
9860
9546
|
return this.maybeTakeDecorators(decorators, this.parseClass(node, true, false));
|
|
9861
9547
|
} else if (this.isContextual(127)) {
|
|
9862
|
-
|
|
9863
9548
|
if (!this.hasFollowingLineBreak()) {
|
|
9864
9549
|
node.abstract = true;
|
|
9865
9550
|
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, {
|
|
@@ -9874,8 +9559,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9874
9559
|
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope) {
|
|
9875
9560
|
const method = super.parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
|
|
9876
9561
|
if (method.abstract) {
|
|
9877
|
-
const hasBody = this.hasPlugin("estree") ?
|
|
9878
|
-
!!method.value.body : !!method.body;
|
|
9562
|
+
const hasBody = this.hasPlugin("estree") ? !!method.value.body : !!method.body;
|
|
9879
9563
|
if (hasBody) {
|
|
9880
9564
|
const {
|
|
9881
9565
|
key
|
|
@@ -9915,8 +9599,7 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9915
9599
|
node.exportKind = "value";
|
|
9916
9600
|
return super.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly);
|
|
9917
9601
|
}
|
|
9918
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly,
|
|
9919
|
-
bindingType) {
|
|
9602
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
9920
9603
|
if (!importedIsString && isMaybeTypeOnly) {
|
|
9921
9604
|
this.parseTypeOnlyImportExportSpecifier(specifier, true, isInTypeOnlyImport);
|
|
9922
9605
|
return this.finishNode(specifier, "ImportSpecifier");
|
|
@@ -9932,7 +9615,6 @@ var typescript = (superClass => class TypeScriptParserMixin extends superClass {
|
|
|
9932
9615
|
let hasTypeSpecifier = false;
|
|
9933
9616
|
let canParseAsKeyword = true;
|
|
9934
9617
|
const loc = leftOfAs.loc.start;
|
|
9935
|
-
|
|
9936
9618
|
if (this.isContextual(93)) {
|
|
9937
9619
|
const firstAs = this.parseIdentifier();
|
|
9938
9620
|
if (this.isContextual(93)) {
|
|
@@ -9995,6 +9677,58 @@ function isPossiblyLiteralEnum(expression) {
|
|
|
9995
9677
|
}
|
|
9996
9678
|
return isUncomputedMemberExpressionChain(expression.object);
|
|
9997
9679
|
}
|
|
9680
|
+
function isValidAmbientConstInitializer(expression, estree) {
|
|
9681
|
+
var _expression$extra;
|
|
9682
|
+
const {
|
|
9683
|
+
type
|
|
9684
|
+
} = expression;
|
|
9685
|
+
if ((_expression$extra = expression.extra) != null && _expression$extra.parenthesized) {
|
|
9686
|
+
return false;
|
|
9687
|
+
}
|
|
9688
|
+
if (estree) {
|
|
9689
|
+
if (type === "Literal") {
|
|
9690
|
+
const {
|
|
9691
|
+
value
|
|
9692
|
+
} = expression;
|
|
9693
|
+
if (typeof value === "string" || typeof value === "boolean") {
|
|
9694
|
+
return true;
|
|
9695
|
+
}
|
|
9696
|
+
}
|
|
9697
|
+
} else {
|
|
9698
|
+
if (type === "StringLiteral" || type === "BooleanLiteral") {
|
|
9699
|
+
return true;
|
|
9700
|
+
}
|
|
9701
|
+
}
|
|
9702
|
+
if (isNumber(expression, estree) || isNegativeNumber(expression, estree)) {
|
|
9703
|
+
return true;
|
|
9704
|
+
}
|
|
9705
|
+
if (type === "TemplateLiteral" && expression.expressions.length === 0) {
|
|
9706
|
+
return true;
|
|
9707
|
+
}
|
|
9708
|
+
if (isPossiblyLiteralEnum(expression)) {
|
|
9709
|
+
return true;
|
|
9710
|
+
}
|
|
9711
|
+
return false;
|
|
9712
|
+
}
|
|
9713
|
+
function isNumber(expression, estree) {
|
|
9714
|
+
if (estree) {
|
|
9715
|
+
return expression.type === "Literal" && (typeof expression.value === "number" || "bigint" in expression);
|
|
9716
|
+
} else {
|
|
9717
|
+
return expression.type === "NumericLiteral" || expression.type === "BigIntLiteral";
|
|
9718
|
+
}
|
|
9719
|
+
}
|
|
9720
|
+
function isNegativeNumber(expression, estree) {
|
|
9721
|
+
if (expression.type === "UnaryExpression") {
|
|
9722
|
+
const {
|
|
9723
|
+
operator,
|
|
9724
|
+
argument
|
|
9725
|
+
} = expression;
|
|
9726
|
+
if (operator === "-" && isNumber(argument, estree)) {
|
|
9727
|
+
return true;
|
|
9728
|
+
}
|
|
9729
|
+
}
|
|
9730
|
+
return false;
|
|
9731
|
+
}
|
|
9998
9732
|
function isUncomputedMemberExpressionChain(expression) {
|
|
9999
9733
|
if (expression.type === "Identifier") return true;
|
|
10000
9734
|
if (expression.type !== "MemberExpression") return false;
|
|
@@ -10006,14 +9740,12 @@ const PlaceholderErrors = ParseErrorEnum`placeholders`({
|
|
|
10006
9740
|
ClassNameIsRequired: "A class name is required.",
|
|
10007
9741
|
UnexpectedSpace: "Unexpected space in placeholder."
|
|
10008
9742
|
});
|
|
10009
|
-
|
|
10010
9743
|
var placeholders = (superClass => class PlaceholdersParserMixin extends superClass {
|
|
10011
9744
|
parsePlaceholder(expectedNode) {
|
|
10012
9745
|
if (this.match(142)) {
|
|
10013
9746
|
const node = this.startNode();
|
|
10014
9747
|
this.next();
|
|
10015
9748
|
this.assertNoSpace();
|
|
10016
|
-
|
|
10017
9749
|
node.name = super.parseIdentifier(true);
|
|
10018
9750
|
this.assertNoSpace();
|
|
10019
9751
|
this.expect(142);
|
|
@@ -10023,17 +9755,14 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10023
9755
|
finishPlaceholder(node, expectedNode) {
|
|
10024
9756
|
const isFinished = !!(node.expectedNode && node.type === "Placeholder");
|
|
10025
9757
|
node.expectedNode = expectedNode;
|
|
10026
|
-
|
|
10027
9758
|
return isFinished ? node : this.finishNode(node, "Placeholder");
|
|
10028
9759
|
}
|
|
10029
|
-
|
|
10030
9760
|
getTokenFromCode(code) {
|
|
10031
9761
|
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
|
|
10032
9762
|
return this.finishOp(142, 2);
|
|
10033
9763
|
}
|
|
10034
9764
|
return super.getTokenFromCode(code);
|
|
10035
9765
|
}
|
|
10036
|
-
|
|
10037
9766
|
parseExprAtom(refExpressionErrors) {
|
|
10038
9767
|
return this.parsePlaceholder("Expression") || super.parseExprAtom(refExpressionErrors);
|
|
10039
9768
|
}
|
|
@@ -10045,7 +9774,6 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10045
9774
|
super.checkReservedWord(word, startLoc, checkKeywords, isBinding);
|
|
10046
9775
|
}
|
|
10047
9776
|
}
|
|
10048
|
-
|
|
10049
9777
|
parseBindingAtom() {
|
|
10050
9778
|
return this.parsePlaceholder("Pattern") || super.parseBindingAtom();
|
|
10051
9779
|
}
|
|
@@ -10059,12 +9787,10 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10059
9787
|
super.toAssignable(node, isLHS);
|
|
10060
9788
|
}
|
|
10061
9789
|
}
|
|
10062
|
-
|
|
10063
9790
|
chStartsBindingIdentifier(ch, pos) {
|
|
10064
9791
|
if (super.chStartsBindingIdentifier(ch, pos)) {
|
|
10065
9792
|
return true;
|
|
10066
9793
|
}
|
|
10067
|
-
|
|
10068
9794
|
const nextToken = this.lookahead();
|
|
10069
9795
|
if (nextToken.type === 142) {
|
|
10070
9796
|
return true;
|
|
@@ -10075,7 +9801,6 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10075
9801
|
if (node.label && node.label.type === "Placeholder") return;
|
|
10076
9802
|
super.verifyBreakContinue(node, isBreak);
|
|
10077
9803
|
}
|
|
10078
|
-
|
|
10079
9804
|
parseExpressionStatement(node, expr) {
|
|
10080
9805
|
if (expr.type !== "Placeholder" || expr.extra && expr.extra.parenthesized) {
|
|
10081
9806
|
return super.parseExpressionStatement(node, expr);
|
|
@@ -10130,7 +9855,6 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10130
9855
|
node.declaration = this.finishPlaceholder(placeholder, "Declaration");
|
|
10131
9856
|
return this.finishNode(node, "ExportNamedDeclaration");
|
|
10132
9857
|
}
|
|
10133
|
-
|
|
10134
9858
|
this.expectPlugin("exportDefaultFrom");
|
|
10135
9859
|
const specifier = this.startNode();
|
|
10136
9860
|
specifier.exported = placeholder;
|
|
@@ -10159,8 +9883,7 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10159
9883
|
specifiers
|
|
10160
9884
|
} = node;
|
|
10161
9885
|
if (specifiers != null && specifiers.length) {
|
|
10162
|
-
node.specifiers = specifiers.filter(
|
|
10163
|
-
node => node.exported.type === "Placeholder");
|
|
9886
|
+
node.specifiers = specifiers.filter(node => node.exported.type === "Placeholder");
|
|
10164
9887
|
}
|
|
10165
9888
|
super.checkExport(node);
|
|
10166
9889
|
node.specifiers = specifiers;
|
|
@@ -10174,13 +9897,11 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10174
9897
|
this.semicolon();
|
|
10175
9898
|
return this.finishNode(node, "ImportDeclaration");
|
|
10176
9899
|
}
|
|
10177
|
-
|
|
10178
9900
|
const specifier = this.startNodeAtNode(placeholder);
|
|
10179
9901
|
specifier.local = placeholder;
|
|
10180
9902
|
node.specifiers.push(this.finishNode(specifier, "ImportDefaultSpecifier"));
|
|
10181
9903
|
if (this.eat(12)) {
|
|
10182
9904
|
const hasStarImport = this.maybeParseStarImportSpecifier(node);
|
|
10183
|
-
|
|
10184
9905
|
if (!hasStarImport) this.parseNamedImportSpecifiers(node);
|
|
10185
9906
|
}
|
|
10186
9907
|
this.expectContextual(97);
|
|
@@ -10189,10 +9910,8 @@ var placeholders = (superClass => class PlaceholdersParserMixin extends superCla
|
|
|
10189
9910
|
return this.finishNode(node, "ImportDeclaration");
|
|
10190
9911
|
}
|
|
10191
9912
|
parseImportSource() {
|
|
10192
|
-
|
|
10193
9913
|
return this.parsePlaceholder("StringLiteral") || super.parseImportSource();
|
|
10194
9914
|
}
|
|
10195
|
-
|
|
10196
9915
|
assertNoSpace() {
|
|
10197
9916
|
if (this.state.start > this.state.lastTokEndLoc.index) {
|
|
10198
9917
|
this.raise(PlaceholderErrors.UnexpectedSpace, {
|
|
@@ -10219,7 +9938,6 @@ var v8intrinsic = (superClass => class V8IntrinsicMixin extends superClass {
|
|
|
10219
9938
|
this.unexpected(v8IntrinsicStartLoc);
|
|
10220
9939
|
}
|
|
10221
9940
|
}
|
|
10222
|
-
|
|
10223
9941
|
parseExprAtom(refExpressionErrors) {
|
|
10224
9942
|
return this.parseV8Intrinsic() || super.parseExprAtom(refExpressionErrors);
|
|
10225
9943
|
}
|
|
@@ -10330,7 +10048,6 @@ function validatePlugins(plugins) {
|
|
|
10330
10048
|
throw error;
|
|
10331
10049
|
}
|
|
10332
10050
|
}
|
|
10333
|
-
|
|
10334
10051
|
const mixinPlugins = {
|
|
10335
10052
|
estree,
|
|
10336
10053
|
jsx,
|
|
@@ -10359,7 +10076,6 @@ const defaultOptions = {
|
|
|
10359
10076
|
errorRecovery: false,
|
|
10360
10077
|
attachComment: true
|
|
10361
10078
|
};
|
|
10362
|
-
|
|
10363
10079
|
function getOptions(opts) {
|
|
10364
10080
|
const options = {};
|
|
10365
10081
|
for (const key of Object.keys(defaultOptions)) {
|
|
@@ -10373,7 +10089,6 @@ const unwrapParenthesizedExpression = node => {
|
|
|
10373
10089
|
return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
|
|
10374
10090
|
};
|
|
10375
10091
|
class LValParser extends NodeUtils {
|
|
10376
|
-
|
|
10377
10092
|
toAssignable(node, isLHS = false) {
|
|
10378
10093
|
var _node$extra, _node$extra3;
|
|
10379
10094
|
let parenthesized = undefined;
|
|
@@ -10451,7 +10166,6 @@ class LValParser extends NodeUtils {
|
|
|
10451
10166
|
break;
|
|
10452
10167
|
}
|
|
10453
10168
|
}
|
|
10454
|
-
|
|
10455
10169
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
10456
10170
|
if (prop.type === "ObjectMethod") {
|
|
10457
10171
|
this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, {
|
|
@@ -10471,7 +10185,6 @@ class LValParser extends NodeUtils {
|
|
|
10471
10185
|
this.toAssignable(prop, isLHS);
|
|
10472
10186
|
}
|
|
10473
10187
|
}
|
|
10474
|
-
|
|
10475
10188
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
10476
10189
|
const end = exprList.length - 1;
|
|
10477
10190
|
for (let i = 0; i <= end; i++) {
|
|
@@ -10530,9 +10243,7 @@ class LValParser extends NodeUtils {
|
|
|
10530
10243
|
return false;
|
|
10531
10244
|
}
|
|
10532
10245
|
}
|
|
10533
|
-
|
|
10534
|
-
toReferencedList(exprList,
|
|
10535
|
-
isParenthesizedExpr) {
|
|
10246
|
+
toReferencedList(exprList, isParenthesizedExpr) {
|
|
10536
10247
|
return exprList;
|
|
10537
10248
|
}
|
|
10538
10249
|
toReferencedListDeep(exprList, isParenthesizedExpr) {
|
|
@@ -10543,21 +10254,18 @@ class LValParser extends NodeUtils {
|
|
|
10543
10254
|
}
|
|
10544
10255
|
}
|
|
10545
10256
|
}
|
|
10546
|
-
|
|
10547
10257
|
parseSpread(refExpressionErrors) {
|
|
10548
10258
|
const node = this.startNode();
|
|
10549
10259
|
this.next();
|
|
10550
10260
|
node.argument = this.parseMaybeAssignAllowIn(refExpressionErrors, undefined);
|
|
10551
10261
|
return this.finishNode(node, "SpreadElement");
|
|
10552
10262
|
}
|
|
10553
|
-
|
|
10554
10263
|
parseRestBinding() {
|
|
10555
10264
|
const node = this.startNode();
|
|
10556
10265
|
this.next();
|
|
10557
10266
|
node.argument = this.parseBindingAtom();
|
|
10558
10267
|
return this.finishNode(node, "RestElement");
|
|
10559
10268
|
}
|
|
10560
|
-
|
|
10561
10269
|
parseBindingAtom() {
|
|
10562
10270
|
switch (this.state.type) {
|
|
10563
10271
|
case 0:
|
|
@@ -10570,10 +10278,8 @@ class LValParser extends NodeUtils {
|
|
|
10570
10278
|
case 5:
|
|
10571
10279
|
return this.parseObjectLike(8, true);
|
|
10572
10280
|
}
|
|
10573
|
-
|
|
10574
10281
|
return this.parseIdentifier();
|
|
10575
10282
|
}
|
|
10576
|
-
|
|
10577
10283
|
parseBindingList(close, closeCharCode, allowEmpty, allowModifiers) {
|
|
10578
10284
|
const elts = [];
|
|
10579
10285
|
let first = true;
|
|
@@ -10608,14 +10314,12 @@ class LValParser extends NodeUtils {
|
|
|
10608
10314
|
}
|
|
10609
10315
|
return elts;
|
|
10610
10316
|
}
|
|
10611
|
-
|
|
10612
10317
|
parseBindingRestProperty(prop) {
|
|
10613
10318
|
this.next();
|
|
10614
10319
|
prop.argument = this.parseIdentifier();
|
|
10615
10320
|
this.checkCommaAfterRest(125);
|
|
10616
10321
|
return this.finishNode(prop, "RestElement");
|
|
10617
10322
|
}
|
|
10618
|
-
|
|
10619
10323
|
parseBindingProperty() {
|
|
10620
10324
|
const prop = this.startNode();
|
|
10621
10325
|
const {
|
|
@@ -10634,7 +10338,6 @@ class LValParser extends NodeUtils {
|
|
|
10634
10338
|
prop.method = false;
|
|
10635
10339
|
return this.parseObjPropValue(prop, startLoc, false, false, true, false);
|
|
10636
10340
|
}
|
|
10637
|
-
|
|
10638
10341
|
parseAssignableListItem(allowModifiers, decorators) {
|
|
10639
10342
|
const left = this.parseMaybeDefault();
|
|
10640
10343
|
this.parseAssignableListItemTypes(left);
|
|
@@ -10644,11 +10347,9 @@ class LValParser extends NodeUtils {
|
|
|
10644
10347
|
}
|
|
10645
10348
|
return elt;
|
|
10646
10349
|
}
|
|
10647
|
-
|
|
10648
10350
|
parseAssignableListItemTypes(param) {
|
|
10649
10351
|
return param;
|
|
10650
10352
|
}
|
|
10651
|
-
|
|
10652
10353
|
parseMaybeDefault(startLoc, left) {
|
|
10653
10354
|
var _startLoc, _left;
|
|
10654
10355
|
(_startLoc = startLoc) != null ? _startLoc : startLoc = this.state.startLoc;
|
|
@@ -10659,9 +10360,7 @@ class LValParser extends NodeUtils {
|
|
|
10659
10360
|
node.right = this.parseMaybeAssignAllowIn();
|
|
10660
10361
|
return this.finishNode(node, "AssignmentPattern");
|
|
10661
10362
|
}
|
|
10662
|
-
isValidLVal(type,
|
|
10663
|
-
isUnparenthesizedInAssign,
|
|
10664
|
-
binding) {
|
|
10363
|
+
isValidLVal(type, isUnparenthesizedInAssign, binding) {
|
|
10665
10364
|
return getOwn({
|
|
10666
10365
|
AssignmentPattern: "left",
|
|
10667
10366
|
RestElement: "argument",
|
|
@@ -10669,21 +10368,17 @@ class LValParser extends NodeUtils {
|
|
|
10669
10368
|
ParenthesizedExpression: "expression",
|
|
10670
10369
|
ArrayPattern: "elements",
|
|
10671
10370
|
ObjectPattern: "properties"
|
|
10672
|
-
},
|
|
10673
|
-
type);
|
|
10371
|
+
}, type);
|
|
10674
10372
|
}
|
|
10675
|
-
|
|
10676
10373
|
checkLVal(expression, {
|
|
10677
10374
|
in: ancestor,
|
|
10678
10375
|
binding = BIND_NONE,
|
|
10679
10376
|
checkClashes = false,
|
|
10680
10377
|
strictModeChanged = false,
|
|
10681
|
-
allowingSloppyLetBinding = !(binding & BIND_SCOPE_LEXICAL),
|
|
10682
10378
|
hasParenthesizedAncestor = false
|
|
10683
10379
|
}) {
|
|
10684
10380
|
var _expression$extra;
|
|
10685
10381
|
const type = expression.type;
|
|
10686
|
-
|
|
10687
10382
|
if (this.isObjectMethod(expression)) return;
|
|
10688
10383
|
if (type === "MemberExpression") {
|
|
10689
10384
|
if (binding !== BIND_NONE) {
|
|
@@ -10693,8 +10388,8 @@ class LValParser extends NodeUtils {
|
|
|
10693
10388
|
}
|
|
10694
10389
|
return;
|
|
10695
10390
|
}
|
|
10696
|
-
if (
|
|
10697
|
-
this.checkIdentifier(expression, binding, strictModeChanged
|
|
10391
|
+
if (type === "Identifier") {
|
|
10392
|
+
this.checkIdentifier(expression, binding, strictModeChanged);
|
|
10698
10393
|
const {
|
|
10699
10394
|
name
|
|
10700
10395
|
} = expression;
|
|
@@ -10709,38 +10404,33 @@ class LValParser extends NodeUtils {
|
|
|
10709
10404
|
}
|
|
10710
10405
|
return;
|
|
10711
10406
|
}
|
|
10712
|
-
const validity = this.isValidLVal(
|
|
10407
|
+
const validity = this.isValidLVal(type, !(hasParenthesizedAncestor || (_expression$extra = expression.extra) != null && _expression$extra.parenthesized) && ancestor.type === "AssignmentExpression", binding);
|
|
10713
10408
|
if (validity === true) return;
|
|
10714
10409
|
if (validity === false) {
|
|
10715
10410
|
const ParseErrorClass = binding === BIND_NONE ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
|
|
10716
10411
|
this.raise(ParseErrorClass, {
|
|
10717
10412
|
at: expression,
|
|
10718
|
-
ancestor
|
|
10719
|
-
type: "UpdateExpression",
|
|
10720
|
-
prefix: ancestor.prefix
|
|
10721
|
-
} : {
|
|
10722
|
-
type: ancestor.type
|
|
10723
|
-
}
|
|
10413
|
+
ancestor
|
|
10724
10414
|
});
|
|
10725
10415
|
return;
|
|
10726
10416
|
}
|
|
10727
10417
|
const [key, isParenthesizedExpression] = Array.isArray(validity) ? validity : [validity, type === "ParenthesizedExpression"];
|
|
10728
|
-
const nextAncestor =
|
|
10729
|
-
|
|
10418
|
+
const nextAncestor = type === "ArrayPattern" || type === "ObjectPattern" || type === "ParenthesizedExpression" ? {
|
|
10419
|
+
type
|
|
10420
|
+
} : ancestor;
|
|
10730
10421
|
for (const child of [].concat(expression[key])) {
|
|
10731
10422
|
if (child) {
|
|
10732
10423
|
this.checkLVal(child, {
|
|
10733
10424
|
in: nextAncestor,
|
|
10734
10425
|
binding,
|
|
10735
10426
|
checkClashes,
|
|
10736
|
-
allowingSloppyLetBinding,
|
|
10737
10427
|
strictModeChanged,
|
|
10738
10428
|
hasParenthesizedAncestor: isParenthesizedExpression
|
|
10739
10429
|
});
|
|
10740
10430
|
}
|
|
10741
10431
|
}
|
|
10742
10432
|
}
|
|
10743
|
-
checkIdentifier(at, bindingType, strictModeChanged = false
|
|
10433
|
+
checkIdentifier(at, bindingType, strictModeChanged = false) {
|
|
10744
10434
|
if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
|
|
10745
10435
|
if (bindingType === BIND_NONE) {
|
|
10746
10436
|
this.raise(Errors.StrictEvalArguments, {
|
|
@@ -10754,7 +10444,7 @@ class LValParser extends NodeUtils {
|
|
|
10754
10444
|
});
|
|
10755
10445
|
}
|
|
10756
10446
|
}
|
|
10757
|
-
if (
|
|
10447
|
+
if (bindingType & BIND_FLAGS_NO_LET_IN_LEXICAL && at.name === "let") {
|
|
10758
10448
|
this.raise(Errors.LetInLexicalBinding, {
|
|
10759
10449
|
at
|
|
10760
10450
|
});
|
|
@@ -10795,10 +10485,8 @@ class LValParser extends NodeUtils {
|
|
|
10795
10485
|
}
|
|
10796
10486
|
|
|
10797
10487
|
class ExpressionParser extends LValParser {
|
|
10798
|
-
|
|
10799
10488
|
checkProto(prop, isRecord, protoRef, refExpressionErrors) {
|
|
10800
|
-
if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed ||
|
|
10801
|
-
prop.shorthand) {
|
|
10489
|
+
if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) {
|
|
10802
10490
|
return;
|
|
10803
10491
|
}
|
|
10804
10492
|
const key = prop.key;
|
|
@@ -10827,7 +10515,6 @@ class ExpressionParser extends LValParser {
|
|
|
10827
10515
|
shouldExitDescending(expr, potentialArrowAt) {
|
|
10828
10516
|
return expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt;
|
|
10829
10517
|
}
|
|
10830
|
-
|
|
10831
10518
|
getExpression() {
|
|
10832
10519
|
this.enterInitialScopes();
|
|
10833
10520
|
this.nextToken();
|
|
@@ -10843,14 +10530,12 @@ class ExpressionParser extends LValParser {
|
|
|
10843
10530
|
}
|
|
10844
10531
|
return expr;
|
|
10845
10532
|
}
|
|
10846
|
-
|
|
10847
10533
|
parseExpression(disallowIn, refExpressionErrors) {
|
|
10848
10534
|
if (disallowIn) {
|
|
10849
10535
|
return this.disallowInAnd(() => this.parseExpressionBase(refExpressionErrors));
|
|
10850
10536
|
}
|
|
10851
10537
|
return this.allowInAnd(() => this.parseExpressionBase(refExpressionErrors));
|
|
10852
10538
|
}
|
|
10853
|
-
|
|
10854
10539
|
parseExpressionBase(refExpressionErrors) {
|
|
10855
10540
|
const startLoc = this.state.startLoc;
|
|
10856
10541
|
const expr = this.parseMaybeAssign(refExpressionErrors);
|
|
@@ -10865,20 +10550,16 @@ class ExpressionParser extends LValParser {
|
|
|
10865
10550
|
}
|
|
10866
10551
|
return expr;
|
|
10867
10552
|
}
|
|
10868
|
-
|
|
10869
10553
|
parseMaybeAssignDisallowIn(refExpressionErrors, afterLeftParse) {
|
|
10870
10554
|
return this.disallowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
|
|
10871
10555
|
}
|
|
10872
|
-
|
|
10873
10556
|
parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse) {
|
|
10874
10557
|
return this.allowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
|
|
10875
10558
|
}
|
|
10876
|
-
|
|
10877
10559
|
setOptionalParametersError(refExpressionErrors, resultError) {
|
|
10878
10560
|
var _resultError$loc;
|
|
10879
10561
|
refExpressionErrors.optionalParametersLoc = (_resultError$loc = resultError == null ? void 0 : resultError.loc) != null ? _resultError$loc : this.state.startLoc;
|
|
10880
10562
|
}
|
|
10881
|
-
|
|
10882
10563
|
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
|
|
10883
10564
|
const startLoc = this.state.startLoc;
|
|
10884
10565
|
if (this.isContextual(106)) {
|
|
@@ -10918,11 +10599,9 @@ class ExpressionParser extends LValParser {
|
|
|
10918
10599
|
if (refExpressionErrors.doubleProtoLoc != null && refExpressionErrors.doubleProtoLoc.index >= startIndex) {
|
|
10919
10600
|
refExpressionErrors.doubleProtoLoc = null;
|
|
10920
10601
|
}
|
|
10921
|
-
|
|
10922
10602
|
if (refExpressionErrors.shorthandAssignLoc != null && refExpressionErrors.shorthandAssignLoc.index >= startIndex) {
|
|
10923
10603
|
refExpressionErrors.shorthandAssignLoc = null;
|
|
10924
10604
|
}
|
|
10925
|
-
|
|
10926
10605
|
if (refExpressionErrors.privateKeyLoc != null && refExpressionErrors.privateKeyLoc.index >= startIndex) {
|
|
10927
10606
|
this.checkDestructuringPrivate(refExpressionErrors);
|
|
10928
10607
|
refExpressionErrors.privateKeyLoc = null;
|
|
@@ -10941,7 +10620,6 @@ class ExpressionParser extends LValParser {
|
|
|
10941
10620
|
}
|
|
10942
10621
|
return left;
|
|
10943
10622
|
}
|
|
10944
|
-
|
|
10945
10623
|
parseMaybeConditional(refExpressionErrors) {
|
|
10946
10624
|
const startLoc = this.state.startLoc;
|
|
10947
10625
|
const potentialArrowAt = this.state.potentialArrowAt;
|
|
@@ -10951,8 +10629,7 @@ class ExpressionParser extends LValParser {
|
|
|
10951
10629
|
}
|
|
10952
10630
|
return this.parseConditional(expr, startLoc, refExpressionErrors);
|
|
10953
10631
|
}
|
|
10954
|
-
parseConditional(expr, startLoc,
|
|
10955
|
-
refExpressionErrors) {
|
|
10632
|
+
parseConditional(expr, startLoc, refExpressionErrors) {
|
|
10956
10633
|
if (this.eat(17)) {
|
|
10957
10634
|
const node = this.startNodeAt(startLoc);
|
|
10958
10635
|
node.test = expr;
|
|
@@ -10966,7 +10643,6 @@ class ExpressionParser extends LValParser {
|
|
|
10966
10643
|
parseMaybeUnaryOrPrivate(refExpressionErrors) {
|
|
10967
10644
|
return this.match(136) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
|
|
10968
10645
|
}
|
|
10969
|
-
|
|
10970
10646
|
parseExprOps(refExpressionErrors) {
|
|
10971
10647
|
const startLoc = this.state.startLoc;
|
|
10972
10648
|
const potentialArrowAt = this.state.potentialArrowAt;
|
|
@@ -10976,10 +10652,8 @@ class ExpressionParser extends LValParser {
|
|
|
10976
10652
|
}
|
|
10977
10653
|
return this.parseExprOp(expr, startLoc, -1);
|
|
10978
10654
|
}
|
|
10979
|
-
|
|
10980
10655
|
parseExprOp(left, leftStartLoc, minPrec) {
|
|
10981
10656
|
if (this.isPrivateName(left)) {
|
|
10982
|
-
|
|
10983
10657
|
const value = this.getPrivateNameSV(left);
|
|
10984
10658
|
if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) {
|
|
10985
10659
|
this.raise(Errors.PrivateInExpectedIn, {
|
|
@@ -11031,7 +10705,6 @@ class ExpressionParser extends LValParser {
|
|
|
11031
10705
|
}
|
|
11032
10706
|
return left;
|
|
11033
10707
|
}
|
|
11034
|
-
|
|
11035
10708
|
parseExprOpRightExpr(op, prec) {
|
|
11036
10709
|
const startLoc = this.state.startLoc;
|
|
11037
10710
|
switch (op) {
|
|
@@ -11055,12 +10728,10 @@ class ExpressionParser extends LValParser {
|
|
|
11055
10728
|
return this.parseFSharpPipelineBody(prec);
|
|
11056
10729
|
});
|
|
11057
10730
|
}
|
|
11058
|
-
|
|
11059
10731
|
default:
|
|
11060
10732
|
return this.parseExprOpBaseRightExpr(op, prec);
|
|
11061
10733
|
}
|
|
11062
10734
|
}
|
|
11063
|
-
|
|
11064
10735
|
parseExprOpBaseRightExpr(op, prec) {
|
|
11065
10736
|
const startLoc = this.state.startLoc;
|
|
11066
10737
|
return this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startLoc, tokenIsRightAssociative(op) ? prec - 1 : prec);
|
|
@@ -11071,9 +10742,7 @@ class ExpressionParser extends LValParser {
|
|
|
11071
10742
|
startLoc
|
|
11072
10743
|
} = this.state;
|
|
11073
10744
|
const body = this.parseMaybeAssign();
|
|
11074
|
-
const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(
|
|
11075
|
-
body.type);
|
|
11076
|
-
|
|
10745
|
+
const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);
|
|
11077
10746
|
if (requiredParentheses && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) {
|
|
11078
10747
|
this.raise(Errors.PipeUnparenthesizedBody, {
|
|
11079
10748
|
at: startLoc,
|
|
@@ -11094,7 +10763,6 @@ class ExpressionParser extends LValParser {
|
|
|
11094
10763
|
});
|
|
11095
10764
|
}
|
|
11096
10765
|
}
|
|
11097
|
-
|
|
11098
10766
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
11099
10767
|
const startLoc = this.state.startLoc;
|
|
11100
10768
|
const isAwait = this.isContextual(96);
|
|
@@ -11135,8 +10803,7 @@ class ExpressionParser extends LValParser {
|
|
|
11135
10803
|
return this.finishNode(node, "UnaryExpression");
|
|
11136
10804
|
}
|
|
11137
10805
|
}
|
|
11138
|
-
const expr = this.parseUpdate(
|
|
11139
|
-
node, update, refExpressionErrors);
|
|
10806
|
+
const expr = this.parseUpdate(node, update, refExpressionErrors);
|
|
11140
10807
|
if (isAwait) {
|
|
11141
10808
|
const {
|
|
11142
10809
|
type
|
|
@@ -11151,7 +10818,6 @@ class ExpressionParser extends LValParser {
|
|
|
11151
10818
|
}
|
|
11152
10819
|
return expr;
|
|
11153
10820
|
}
|
|
11154
|
-
|
|
11155
10821
|
parseUpdate(node, update, refExpressionErrors) {
|
|
11156
10822
|
if (update) {
|
|
11157
10823
|
const updateExpressionNode = node;
|
|
@@ -11175,7 +10841,6 @@ class ExpressionParser extends LValParser {
|
|
|
11175
10841
|
}
|
|
11176
10842
|
return expr;
|
|
11177
10843
|
}
|
|
11178
|
-
|
|
11179
10844
|
parseExprSubscripts(refExpressionErrors) {
|
|
11180
10845
|
const startLoc = this.state.startLoc;
|
|
11181
10846
|
const potentialArrowAt = this.state.potentialArrowAt;
|
|
@@ -11193,12 +10858,10 @@ class ExpressionParser extends LValParser {
|
|
|
11193
10858
|
};
|
|
11194
10859
|
do {
|
|
11195
10860
|
base = this.parseSubscript(base, startLoc, noCalls, state);
|
|
11196
|
-
|
|
11197
10861
|
state.maybeAsyncArrow = false;
|
|
11198
10862
|
} while (!state.stop);
|
|
11199
10863
|
return base;
|
|
11200
10864
|
}
|
|
11201
|
-
|
|
11202
10865
|
parseSubscript(base, startLoc, noCalls, state) {
|
|
11203
10866
|
const {
|
|
11204
10867
|
type
|
|
@@ -11229,7 +10892,6 @@ class ExpressionParser extends LValParser {
|
|
|
11229
10892
|
}
|
|
11230
10893
|
}
|
|
11231
10894
|
}
|
|
11232
|
-
|
|
11233
10895
|
parseMember(base, startLoc, state, computed, optional) {
|
|
11234
10896
|
const node = this.startNodeAt(startLoc);
|
|
11235
10897
|
node.object = base;
|
|
@@ -11255,7 +10917,6 @@ class ExpressionParser extends LValParser {
|
|
|
11255
10917
|
return this.finishNode(node, "MemberExpression");
|
|
11256
10918
|
}
|
|
11257
10919
|
}
|
|
11258
|
-
|
|
11259
10920
|
parseBind(base, startLoc, noCalls, state) {
|
|
11260
10921
|
const node = this.startNodeAt(startLoc);
|
|
11261
10922
|
node.object = base;
|
|
@@ -11264,13 +10925,11 @@ class ExpressionParser extends LValParser {
|
|
|
11264
10925
|
state.stop = true;
|
|
11265
10926
|
return this.parseSubscripts(this.finishNode(node, "BindExpression"), startLoc, noCalls);
|
|
11266
10927
|
}
|
|
11267
|
-
|
|
11268
10928
|
parseCoverCallAndAsyncArrowHead(base, startLoc, state, optional) {
|
|
11269
10929
|
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
|
11270
10930
|
let refExpressionErrors = null;
|
|
11271
10931
|
this.state.maybeInArrowParameters = true;
|
|
11272
10932
|
this.next();
|
|
11273
|
-
|
|
11274
10933
|
const node = this.startNodeAt(startLoc);
|
|
11275
10934
|
node.callee = base;
|
|
11276
10935
|
const {
|
|
@@ -11287,8 +10946,7 @@ class ExpressionParser extends LValParser {
|
|
|
11287
10946
|
if (optional) {
|
|
11288
10947
|
node.arguments = this.parseCallExpressionArguments(11);
|
|
11289
10948
|
} else {
|
|
11290
|
-
node.arguments = this.parseCallExpressionArguments(11, base.type === "Import", base.type !== "Super",
|
|
11291
|
-
node, refExpressionErrors);
|
|
10949
|
+
node.arguments = this.parseCallExpressionArguments(11, base.type === "Import", base.type !== "Super", node, refExpressionErrors);
|
|
11292
10950
|
}
|
|
11293
10951
|
let finishedNode = this.finishCallExpression(node, optionalChainMember);
|
|
11294
10952
|
if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
|
|
@@ -11310,7 +10968,6 @@ class ExpressionParser extends LValParser {
|
|
|
11310
10968
|
toReferencedArguments(node, isParenthesizedExpr) {
|
|
11311
10969
|
this.toReferencedListDeep(node.arguments, isParenthesizedExpr);
|
|
11312
10970
|
}
|
|
11313
|
-
|
|
11314
10971
|
parseTaggedTemplateExpression(base, startLoc, state) {
|
|
11315
10972
|
const node = this.startNodeAt(startLoc);
|
|
11316
10973
|
node.tag = base;
|
|
@@ -11323,8 +10980,7 @@ class ExpressionParser extends LValParser {
|
|
|
11323
10980
|
return this.finishNode(node, "TaggedTemplateExpression");
|
|
11324
10981
|
}
|
|
11325
10982
|
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;
|
|
10983
|
+
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
10984
|
}
|
|
11329
10985
|
finishCallExpression(node, optional) {
|
|
11330
10986
|
if (node.callee.type === "Import") {
|
|
@@ -11396,12 +11052,10 @@ class ExpressionParser extends LValParser {
|
|
|
11396
11052
|
}
|
|
11397
11053
|
return node;
|
|
11398
11054
|
}
|
|
11399
|
-
|
|
11400
11055
|
parseNoCallExpr() {
|
|
11401
11056
|
const startLoc = this.state.startLoc;
|
|
11402
11057
|
return this.parseSubscripts(this.parseExprAtom(), startLoc, true);
|
|
11403
11058
|
}
|
|
11404
|
-
|
|
11405
11059
|
parseExprAtom(refExpressionErrors) {
|
|
11406
11060
|
let node;
|
|
11407
11061
|
let decorators = null;
|
|
@@ -11485,7 +11139,6 @@ class ExpressionParser extends LValParser {
|
|
|
11485
11139
|
case 25:
|
|
11486
11140
|
case 24:
|
|
11487
11141
|
return this.parseTemplate(false);
|
|
11488
|
-
|
|
11489
11142
|
case 15:
|
|
11490
11143
|
{
|
|
11491
11144
|
node = this.startNode();
|
|
@@ -11535,8 +11188,7 @@ class ExpressionParser extends LValParser {
|
|
|
11535
11188
|
case 47:
|
|
11536
11189
|
{
|
|
11537
11190
|
const lookaheadCh = this.input.codePointAt(this.nextTokenStart());
|
|
11538
|
-
if (isIdentifierStart(lookaheadCh) ||
|
|
11539
|
-
lookaheadCh === 62) {
|
|
11191
|
+
if (isIdentifierStart(lookaheadCh) || lookaheadCh === 62) {
|
|
11540
11192
|
this.expectOnePlugin(["jsx", "flow", "typescript"]);
|
|
11541
11193
|
break;
|
|
11542
11194
|
} else {
|
|
@@ -11580,7 +11232,6 @@ class ExpressionParser extends LValParser {
|
|
|
11580
11232
|
}
|
|
11581
11233
|
}
|
|
11582
11234
|
}
|
|
11583
|
-
|
|
11584
11235
|
parseTopicReferenceThenEqualsSign(topicTokenType, topicTokenValue) {
|
|
11585
11236
|
const pipeProposal = this.getPluginOption("pipelineOperator", "proposal");
|
|
11586
11237
|
if (pipeProposal) {
|
|
@@ -11594,30 +11245,21 @@ class ExpressionParser extends LValParser {
|
|
|
11594
11245
|
throw this.unexpected();
|
|
11595
11246
|
}
|
|
11596
11247
|
}
|
|
11597
|
-
|
|
11598
11248
|
parseTopicReference(pipeProposal) {
|
|
11599
11249
|
const node = this.startNode();
|
|
11600
11250
|
const startLoc = this.state.startLoc;
|
|
11601
11251
|
const tokenType = this.state.type;
|
|
11602
|
-
|
|
11603
11252
|
this.next();
|
|
11604
|
-
|
|
11605
11253
|
return this.finishTopicReference(node, startLoc, pipeProposal, tokenType);
|
|
11606
11254
|
}
|
|
11607
|
-
|
|
11608
11255
|
finishTopicReference(node, startLoc, pipeProposal, tokenType) {
|
|
11609
11256
|
if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
|
|
11610
|
-
|
|
11611
|
-
const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" :
|
|
11612
|
-
"TopicReference";
|
|
11257
|
+
const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" : "TopicReference";
|
|
11613
11258
|
if (!this.topicReferenceIsAllowedInCurrentContext()) {
|
|
11614
|
-
this.raise(
|
|
11615
|
-
pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed :
|
|
11616
|
-
Errors.PipeTopicUnbound, {
|
|
11259
|
+
this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, {
|
|
11617
11260
|
at: startLoc
|
|
11618
11261
|
});
|
|
11619
11262
|
}
|
|
11620
|
-
|
|
11621
11263
|
this.registerTopicReference();
|
|
11622
11264
|
return this.finishNode(node, nodeType);
|
|
11623
11265
|
} else {
|
|
@@ -11627,7 +11269,6 @@ class ExpressionParser extends LValParser {
|
|
|
11627
11269
|
});
|
|
11628
11270
|
}
|
|
11629
11271
|
}
|
|
11630
|
-
|
|
11631
11272
|
testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType) {
|
|
11632
11273
|
switch (pipeProposal) {
|
|
11633
11274
|
case "hack":
|
|
@@ -11644,7 +11285,6 @@ class ExpressionParser extends LValParser {
|
|
|
11644
11285
|
});
|
|
11645
11286
|
}
|
|
11646
11287
|
}
|
|
11647
|
-
|
|
11648
11288
|
parseAsyncArrowUnaryFunction(node) {
|
|
11649
11289
|
this.prodParam.enter(functionFlags(true, this.prodParam.hasYield));
|
|
11650
11290
|
const params = [this.parseIdentifier()];
|
|
@@ -11657,7 +11297,6 @@ class ExpressionParser extends LValParser {
|
|
|
11657
11297
|
this.expect(19);
|
|
11658
11298
|
return this.parseArrowExpression(node, params, true);
|
|
11659
11299
|
}
|
|
11660
|
-
|
|
11661
11300
|
parseDo(node, isAsync) {
|
|
11662
11301
|
this.expectPlugin("doExpressions");
|
|
11663
11302
|
if (isAsync) {
|
|
@@ -11677,7 +11316,6 @@ class ExpressionParser extends LValParser {
|
|
|
11677
11316
|
this.state.labels = oldLabels;
|
|
11678
11317
|
return this.finishNode(node, "DoExpression");
|
|
11679
11318
|
}
|
|
11680
|
-
|
|
11681
11319
|
parseSuper() {
|
|
11682
11320
|
const node = this.startNode();
|
|
11683
11321
|
this.next();
|
|
@@ -11699,8 +11337,7 @@ class ExpressionParser extends LValParser {
|
|
|
11699
11337
|
}
|
|
11700
11338
|
parsePrivateName() {
|
|
11701
11339
|
const node = this.startNode();
|
|
11702
|
-
const id = this.startNodeAt(
|
|
11703
|
-
createPositionWithColumnOffset(this.state.startLoc, 1));
|
|
11340
|
+
const id = this.startNodeAt(createPositionWithColumnOffset(this.state.startLoc, 1));
|
|
11704
11341
|
const name = this.state.value;
|
|
11705
11342
|
this.next();
|
|
11706
11343
|
node.id = this.createIdentifier(id, name);
|
|
@@ -11708,9 +11345,7 @@ class ExpressionParser extends LValParser {
|
|
|
11708
11345
|
}
|
|
11709
11346
|
parseFunctionOrFunctionSent() {
|
|
11710
11347
|
const node = this.startNode();
|
|
11711
|
-
|
|
11712
11348
|
this.next();
|
|
11713
|
-
|
|
11714
11349
|
if (this.prodParam.hasYield && this.match(16)) {
|
|
11715
11350
|
const meta = this.createIdentifier(this.startNodeAtNode(node), "function");
|
|
11716
11351
|
this.next();
|
|
@@ -11736,11 +11371,9 @@ class ExpressionParser extends LValParser {
|
|
|
11736
11371
|
}
|
|
11737
11372
|
return this.finishNode(node, "MetaProperty");
|
|
11738
11373
|
}
|
|
11739
|
-
|
|
11740
11374
|
parseImportMetaProperty(node) {
|
|
11741
11375
|
const id = this.createIdentifier(this.startNodeAtNode(node), "import");
|
|
11742
11376
|
this.next();
|
|
11743
|
-
|
|
11744
11377
|
if (this.isContextual(100)) {
|
|
11745
11378
|
if (!this.inModule) {
|
|
11746
11379
|
this.raise(Errors.ImportMetaOutsideModule, {
|
|
@@ -11791,7 +11424,6 @@ class ExpressionParser extends LValParser {
|
|
|
11791
11424
|
this.next();
|
|
11792
11425
|
return this.finishNode(node, "NullLiteral");
|
|
11793
11426
|
}
|
|
11794
|
-
|
|
11795
11427
|
parseParenAndDistinguishExpression(canBeArrow) {
|
|
11796
11428
|
const startLoc = this.state.startLoc;
|
|
11797
11429
|
let val;
|
|
@@ -11856,8 +11488,7 @@ class ExpressionParser extends LValParser {
|
|
|
11856
11488
|
} else {
|
|
11857
11489
|
val = exprList[0];
|
|
11858
11490
|
}
|
|
11859
|
-
return this.wrapParenthesis(startLoc,
|
|
11860
|
-
val);
|
|
11491
|
+
return this.wrapParenthesis(startLoc, val);
|
|
11861
11492
|
}
|
|
11862
11493
|
wrapParenthesis(startLoc, expression) {
|
|
11863
11494
|
if (!this.options.createParenthesizedExpressions) {
|
|
@@ -11870,7 +11501,6 @@ class ExpressionParser extends LValParser {
|
|
|
11870
11501
|
parenExpression.expression = expression;
|
|
11871
11502
|
return this.finishNode(parenExpression, "ParenthesizedExpression");
|
|
11872
11503
|
}
|
|
11873
|
-
|
|
11874
11504
|
shouldParseArrow(params) {
|
|
11875
11505
|
return !this.canInsertSemicolon();
|
|
11876
11506
|
}
|
|
@@ -11879,8 +11509,7 @@ class ExpressionParser extends LValParser {
|
|
|
11879
11509
|
return node;
|
|
11880
11510
|
}
|
|
11881
11511
|
}
|
|
11882
|
-
parseParenItem(node,
|
|
11883
|
-
startLoc) {
|
|
11512
|
+
parseParenItem(node, startLoc) {
|
|
11884
11513
|
return node;
|
|
11885
11514
|
}
|
|
11886
11515
|
parseNewOrNewTarget() {
|
|
@@ -11899,7 +11528,6 @@ class ExpressionParser extends LValParser {
|
|
|
11899
11528
|
}
|
|
11900
11529
|
return this.parseNew(node);
|
|
11901
11530
|
}
|
|
11902
|
-
|
|
11903
11531
|
parseNew(node) {
|
|
11904
11532
|
this.parseNewCallee(node);
|
|
11905
11533
|
if (this.eat(10)) {
|
|
@@ -11912,12 +11540,13 @@ class ExpressionParser extends LValParser {
|
|
|
11912
11540
|
return this.finishNode(node, "NewExpression");
|
|
11913
11541
|
}
|
|
11914
11542
|
parseNewCallee(node) {
|
|
11543
|
+
var _node$callee$extra;
|
|
11915
11544
|
node.callee = this.parseNoCallExpr();
|
|
11916
11545
|
if (node.callee.type === "Import") {
|
|
11917
11546
|
this.raise(Errors.ImportCallNotNewExpression, {
|
|
11918
11547
|
at: node.callee
|
|
11919
11548
|
});
|
|
11920
|
-
} else if (this.isOptionalChain(node.callee)) {
|
|
11549
|
+
} else if (this.isOptionalChain(node.callee) && !((_node$callee$extra = node.callee.extra) != null && _node$callee$extra.parenthesized)) {
|
|
11921
11550
|
this.raise(Errors.OptionalChainingNoNew, {
|
|
11922
11551
|
at: this.state.lastTokEndLoc
|
|
11923
11552
|
});
|
|
@@ -11927,7 +11556,6 @@ class ExpressionParser extends LValParser {
|
|
|
11927
11556
|
});
|
|
11928
11557
|
}
|
|
11929
11558
|
}
|
|
11930
|
-
|
|
11931
11559
|
parseTemplateElement(isTagged) {
|
|
11932
11560
|
const {
|
|
11933
11561
|
start,
|
|
@@ -11957,7 +11585,6 @@ class ExpressionParser extends LValParser {
|
|
|
11957
11585
|
this.resetEndLocation(finishedNode, createPositionWithColumnOffset(this.state.lastTokEndLoc, endOffset));
|
|
11958
11586
|
return finishedNode;
|
|
11959
11587
|
}
|
|
11960
|
-
|
|
11961
11588
|
parseTemplate(isTagged) {
|
|
11962
11589
|
const node = this.startNode();
|
|
11963
11590
|
node.expressions = [];
|
|
@@ -11970,11 +11597,9 @@ class ExpressionParser extends LValParser {
|
|
|
11970
11597
|
}
|
|
11971
11598
|
return this.finishNode(node, "TemplateLiteral");
|
|
11972
11599
|
}
|
|
11973
|
-
|
|
11974
11600
|
parseTemplateSubstitution() {
|
|
11975
11601
|
return this.parseExpression();
|
|
11976
11602
|
}
|
|
11977
|
-
|
|
11978
11603
|
parseObjectLike(close, isPattern, isRecord, refExpressionErrors) {
|
|
11979
11604
|
if (isRecord) {
|
|
11980
11605
|
this.expectPlugin("recordAndTuple");
|
|
@@ -11992,8 +11617,7 @@ class ExpressionParser extends LValParser {
|
|
|
11992
11617
|
} else {
|
|
11993
11618
|
this.expect(12);
|
|
11994
11619
|
if (this.match(close)) {
|
|
11995
|
-
this.addTrailingCommaExtraToNode(
|
|
11996
|
-
node);
|
|
11620
|
+
this.addTrailingCommaExtraToNode(node);
|
|
11997
11621
|
break;
|
|
11998
11622
|
}
|
|
11999
11623
|
}
|
|
@@ -12009,11 +11633,9 @@ class ExpressionParser extends LValParser {
|
|
|
12009
11633
|
at: prop
|
|
12010
11634
|
});
|
|
12011
11635
|
}
|
|
12012
|
-
|
|
12013
11636
|
if (prop.shorthand) {
|
|
12014
11637
|
this.addExtra(prop, "shorthand", true);
|
|
12015
11638
|
}
|
|
12016
|
-
|
|
12017
11639
|
node.properties.push(prop);
|
|
12018
11640
|
}
|
|
12019
11641
|
this.next();
|
|
@@ -12030,11 +11652,9 @@ class ExpressionParser extends LValParser {
|
|
|
12030
11652
|
this.addExtra(node, "trailingComma", this.state.lastTokStart);
|
|
12031
11653
|
this.addExtra(node, "trailingCommaLoc", this.state.lastTokStartLoc, false);
|
|
12032
11654
|
}
|
|
12033
|
-
|
|
12034
11655
|
maybeAsyncOrAccessorProp(prop) {
|
|
12035
11656
|
return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(55));
|
|
12036
11657
|
}
|
|
12037
|
-
|
|
12038
11658
|
parsePropertyDefinition(refExpressionErrors) {
|
|
12039
11659
|
let decorators = [];
|
|
12040
11660
|
if (this.match(26)) {
|
|
@@ -12043,7 +11663,6 @@ class ExpressionParser extends LValParser {
|
|
|
12043
11663
|
at: this.state.startLoc
|
|
12044
11664
|
});
|
|
12045
11665
|
}
|
|
12046
|
-
|
|
12047
11666
|
while (this.match(26)) {
|
|
12048
11667
|
decorators.push(this.parseDecorator());
|
|
12049
11668
|
}
|
|
@@ -12096,11 +11715,9 @@ class ExpressionParser extends LValParser {
|
|
|
12096
11715
|
getGetterSetterExpectedParamCount(method) {
|
|
12097
11716
|
return method.kind === "get" ? 0 : 1;
|
|
12098
11717
|
}
|
|
12099
|
-
|
|
12100
11718
|
getObjectOrClassMethodParams(method) {
|
|
12101
11719
|
return method.params;
|
|
12102
11720
|
}
|
|
12103
|
-
|
|
12104
11721
|
checkGetterSetterParams(method) {
|
|
12105
11722
|
var _params;
|
|
12106
11723
|
const paramCount = this.getGetterSetterExpectedParamCount(method);
|
|
@@ -12116,11 +11733,9 @@ class ExpressionParser extends LValParser {
|
|
|
12116
11733
|
});
|
|
12117
11734
|
}
|
|
12118
11735
|
}
|
|
12119
|
-
|
|
12120
11736
|
parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
|
|
12121
11737
|
if (isAccessor) {
|
|
12122
|
-
const finishedProp = this.parseMethod(prop,
|
|
12123
|
-
isGenerator, false, false, false, "ObjectMethod");
|
|
11738
|
+
const finishedProp = this.parseMethod(prop, isGenerator, false, false, false, "ObjectMethod");
|
|
12124
11739
|
this.checkGetterSetterParams(finishedProp);
|
|
12125
11740
|
return finishedProp;
|
|
12126
11741
|
}
|
|
@@ -12131,7 +11746,6 @@ class ExpressionParser extends LValParser {
|
|
|
12131
11746
|
return this.parseMethod(prop, isGenerator, isAsync, false, false, "ObjectMethod");
|
|
12132
11747
|
}
|
|
12133
11748
|
}
|
|
12134
|
-
|
|
12135
11749
|
parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) {
|
|
12136
11750
|
prop.shorthand = false;
|
|
12137
11751
|
if (this.eat(14)) {
|
|
@@ -12166,7 +11780,6 @@ class ExpressionParser extends LValParser {
|
|
|
12166
11780
|
if (!node) this.unexpected();
|
|
12167
11781
|
return node;
|
|
12168
11782
|
}
|
|
12169
|
-
|
|
12170
11783
|
parsePropertyName(prop, refExpressionErrors) {
|
|
12171
11784
|
if (this.eat(0)) {
|
|
12172
11785
|
prop.computed = true;
|
|
@@ -12220,13 +11833,11 @@ class ExpressionParser extends LValParser {
|
|
|
12220
11833
|
}
|
|
12221
11834
|
return prop.key;
|
|
12222
11835
|
}
|
|
12223
|
-
|
|
12224
11836
|
initFunction(node, isAsync) {
|
|
12225
11837
|
node.id = null;
|
|
12226
11838
|
node.generator = false;
|
|
12227
11839
|
node.async = isAsync;
|
|
12228
11840
|
}
|
|
12229
|
-
|
|
12230
11841
|
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
|
|
12231
11842
|
this.initFunction(node, isAsync);
|
|
12232
11843
|
node.generator = isGenerator;
|
|
@@ -12239,7 +11850,6 @@ class ExpressionParser extends LValParser {
|
|
|
12239
11850
|
this.scope.exit();
|
|
12240
11851
|
return finishedNode;
|
|
12241
11852
|
}
|
|
12242
|
-
|
|
12243
11853
|
parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
|
|
12244
11854
|
if (isTuple) {
|
|
12245
11855
|
this.expectPlugin("recordAndTuple");
|
|
@@ -12248,12 +11858,10 @@ class ExpressionParser extends LValParser {
|
|
|
12248
11858
|
this.state.inFSharpPipelineDirectBody = false;
|
|
12249
11859
|
const node = this.startNode();
|
|
12250
11860
|
this.next();
|
|
12251
|
-
node.elements = this.parseExprList(close, !isTuple, refExpressionErrors,
|
|
12252
|
-
node);
|
|
11861
|
+
node.elements = this.parseExprList(close, !isTuple, refExpressionErrors, node);
|
|
12253
11862
|
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
|
|
12254
11863
|
return this.finishNode(node, isTuple ? "TupleExpression" : "ArrayExpression");
|
|
12255
11864
|
}
|
|
12256
|
-
|
|
12257
11865
|
parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
|
|
12258
11866
|
this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW);
|
|
12259
11867
|
let flags = functionFlags(isAsync, false);
|
|
@@ -12282,7 +11890,6 @@ class ExpressionParser extends LValParser {
|
|
|
12282
11890
|
this.parseFunctionBody(node, false, isMethod);
|
|
12283
11891
|
return this.finishNode(node, type);
|
|
12284
11892
|
}
|
|
12285
|
-
|
|
12286
11893
|
parseFunctionBody(node, allowExpression, isMethod = false) {
|
|
12287
11894
|
const isExpression = allowExpression && !this.match(5);
|
|
12288
11895
|
this.expressionScope.enter(newExpressionScope());
|
|
@@ -12293,23 +11900,16 @@ class ExpressionParser extends LValParser {
|
|
|
12293
11900
|
const oldStrict = this.state.strict;
|
|
12294
11901
|
const oldLabels = this.state.labels;
|
|
12295
11902
|
this.state.labels = [];
|
|
12296
|
-
|
|
12297
11903
|
this.prodParam.enter(this.prodParam.currentFlags() | PARAM_RETURN);
|
|
12298
|
-
node.body = this.parseBlock(true, false,
|
|
12299
|
-
hasStrictModeDirective => {
|
|
11904
|
+
node.body = this.parseBlock(true, false, hasStrictModeDirective => {
|
|
12300
11905
|
const nonSimple = !this.isSimpleParamList(node.params);
|
|
12301
11906
|
if (hasStrictModeDirective && nonSimple) {
|
|
12302
11907
|
this.raise(Errors.IllegalLanguageModeDirective, {
|
|
12303
|
-
at:
|
|
12304
|
-
(node.kind === "method" || node.kind === "constructor") &&
|
|
12305
|
-
!!node.key ?
|
|
12306
|
-
node.key.loc.end : node
|
|
11908
|
+
at: (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node
|
|
12307
11909
|
});
|
|
12308
11910
|
}
|
|
12309
11911
|
const strictModeChanged = !oldStrict && this.state.strict;
|
|
12310
|
-
|
|
12311
11912
|
this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
|
|
12312
|
-
|
|
12313
11913
|
if (this.state.strict && node.id) {
|
|
12314
11914
|
this.checkIdentifier(node.id, BIND_OUTSIDE, strictModeChanged);
|
|
12315
11915
|
}
|
|
@@ -12328,8 +11928,7 @@ class ExpressionParser extends LValParser {
|
|
|
12328
11928
|
}
|
|
12329
11929
|
return true;
|
|
12330
11930
|
}
|
|
12331
|
-
checkParams(node, allowDuplicates,
|
|
12332
|
-
isArrowFunction, strictModeChanged = true) {
|
|
11931
|
+
checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) {
|
|
12333
11932
|
const checkClashes = !allowDuplicates && new Set();
|
|
12334
11933
|
const formalParameters = {
|
|
12335
11934
|
type: "FormalParameters"
|
|
@@ -12343,7 +11942,6 @@ class ExpressionParser extends LValParser {
|
|
|
12343
11942
|
});
|
|
12344
11943
|
}
|
|
12345
11944
|
}
|
|
12346
|
-
|
|
12347
11945
|
parseExprList(close, allowEmpty, refExpressionErrors, nodeForExtra) {
|
|
12348
11946
|
const elts = [];
|
|
12349
11947
|
let first = true;
|
|
@@ -12392,7 +11990,6 @@ class ExpressionParser extends LValParser {
|
|
|
12392
11990
|
}
|
|
12393
11991
|
return elt;
|
|
12394
11992
|
}
|
|
12395
|
-
|
|
12396
11993
|
parseIdentifier(liberal) {
|
|
12397
11994
|
const node = this.startNode();
|
|
12398
11995
|
const name = this.parseIdentifierName(liberal);
|
|
@@ -12485,7 +12082,6 @@ class ExpressionParser extends LValParser {
|
|
|
12485
12082
|
}
|
|
12486
12083
|
return false;
|
|
12487
12084
|
}
|
|
12488
|
-
|
|
12489
12085
|
parseAwait(startLoc) {
|
|
12490
12086
|
const node = this.startNodeAt(startLoc);
|
|
12491
12087
|
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, {
|
|
@@ -12513,13 +12109,8 @@ class ExpressionParser extends LValParser {
|
|
|
12513
12109
|
const {
|
|
12514
12110
|
type
|
|
12515
12111
|
} = 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
|
-
);
|
|
12112
|
+
return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 101 && !this.state.containsEsc || type === 135 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54;
|
|
12521
12113
|
}
|
|
12522
|
-
|
|
12523
12114
|
parseYield() {
|
|
12524
12115
|
const node = this.startNode();
|
|
12525
12116
|
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, {
|
|
@@ -12548,7 +12139,6 @@ class ExpressionParser extends LValParser {
|
|
|
12548
12139
|
node.argument = argument;
|
|
12549
12140
|
return this.finishNode(node, "YieldExpression");
|
|
12550
12141
|
}
|
|
12551
|
-
|
|
12552
12142
|
checkPipelineAtInfixOperator(left, leftStartLoc) {
|
|
12553
12143
|
if (this.hasPlugin(["pipelineOperator", {
|
|
12554
12144
|
proposal: "smart"
|
|
@@ -12582,21 +12172,18 @@ class ExpressionParser extends LValParser {
|
|
|
12582
12172
|
return false;
|
|
12583
12173
|
}
|
|
12584
12174
|
}
|
|
12585
|
-
|
|
12586
12175
|
checkSmartPipeTopicBodyEarlyErrors(startLoc) {
|
|
12587
12176
|
if (this.match(19)) {
|
|
12588
12177
|
throw this.raise(Errors.PipelineBodyNoArrow, {
|
|
12589
12178
|
at: this.state.startLoc
|
|
12590
12179
|
});
|
|
12591
12180
|
}
|
|
12592
|
-
|
|
12593
12181
|
if (!this.topicReferenceWasUsedInCurrentContext()) {
|
|
12594
12182
|
this.raise(Errors.PipelineTopicUnused, {
|
|
12595
12183
|
at: startLoc
|
|
12596
12184
|
});
|
|
12597
12185
|
}
|
|
12598
12186
|
}
|
|
12599
|
-
|
|
12600
12187
|
withTopicBindingContext(callback) {
|
|
12601
12188
|
const outerContextTopicState = this.state.topicContext;
|
|
12602
12189
|
this.state.topicContext = {
|
|
@@ -12609,7 +12196,6 @@ class ExpressionParser extends LValParser {
|
|
|
12609
12196
|
this.state.topicContext = outerContextTopicState;
|
|
12610
12197
|
}
|
|
12611
12198
|
}
|
|
12612
|
-
|
|
12613
12199
|
withSmartMixTopicForbiddingContext(callback) {
|
|
12614
12200
|
if (this.hasPlugin(["pipelineOperator", {
|
|
12615
12201
|
proposal: "smart"
|
|
@@ -12663,7 +12249,6 @@ class ExpressionParser extends LValParser {
|
|
|
12663
12249
|
}
|
|
12664
12250
|
return callback();
|
|
12665
12251
|
}
|
|
12666
|
-
|
|
12667
12252
|
registerTopicReference() {
|
|
12668
12253
|
this.state.topicContext.maxTopicIndex = 0;
|
|
12669
12254
|
}
|
|
@@ -12682,7 +12267,6 @@ class ExpressionParser extends LValParser {
|
|
|
12682
12267
|
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
|
|
12683
12268
|
return ret;
|
|
12684
12269
|
}
|
|
12685
|
-
|
|
12686
12270
|
parseModuleExpression() {
|
|
12687
12271
|
this.expectPlugin("moduleBlocks");
|
|
12688
12272
|
const node = this.startNode();
|
|
@@ -12692,7 +12276,6 @@ class ExpressionParser extends LValParser {
|
|
|
12692
12276
|
}
|
|
12693
12277
|
const program = this.startNodeAt(this.state.endLoc);
|
|
12694
12278
|
this.next();
|
|
12695
|
-
|
|
12696
12279
|
const revertScopes = this.initializeScopes(true);
|
|
12697
12280
|
this.enterInitialScopes();
|
|
12698
12281
|
try {
|
|
@@ -12702,9 +12285,7 @@ class ExpressionParser extends LValParser {
|
|
|
12702
12285
|
}
|
|
12703
12286
|
return this.finishNode(node, "ModuleExpression");
|
|
12704
12287
|
}
|
|
12705
|
-
|
|
12706
|
-
parsePropertyNamePrefixOperator(
|
|
12707
|
-
prop) {}
|
|
12288
|
+
parsePropertyNamePrefixOperator(prop) {}
|
|
12708
12289
|
}
|
|
12709
12290
|
|
|
12710
12291
|
const loopLabel = {
|
|
@@ -12729,7 +12310,6 @@ var ParseStatementFlag = {
|
|
|
12729
12310
|
};
|
|
12730
12311
|
const loneSurrogate = /[\uD800-\uDFFF]/u;
|
|
12731
12312
|
const keywordRelationalOperator = /in(?:stanceof)?/y;
|
|
12732
|
-
|
|
12733
12313
|
function babel7CompatTokens(tokens, input) {
|
|
12734
12314
|
for (let i = 0; i < tokens.length; i++) {
|
|
12735
12315
|
const token = tokens[i];
|
|
@@ -12838,7 +12418,6 @@ function babel7CompatTokens(tokens, input) {
|
|
|
12838
12418
|
return tokens;
|
|
12839
12419
|
}
|
|
12840
12420
|
class StatementParser extends ExpressionParser {
|
|
12841
|
-
|
|
12842
12421
|
parseTopLevel(file, program) {
|
|
12843
12422
|
file.program = this.parseProgram(program);
|
|
12844
12423
|
file.comments = this.state.comments;
|
|
@@ -12867,7 +12446,6 @@ class StatementParser extends ExpressionParser {
|
|
|
12867
12446
|
}
|
|
12868
12447
|
return finishedProgram;
|
|
12869
12448
|
}
|
|
12870
|
-
|
|
12871
12449
|
stmtToDirective(stmt) {
|
|
12872
12450
|
const directive = stmt;
|
|
12873
12451
|
directive.type = "Directive";
|
|
@@ -12877,7 +12455,6 @@ class StatementParser extends ExpressionParser {
|
|
|
12877
12455
|
const expressionValue = directiveLiteral.value;
|
|
12878
12456
|
const raw = this.input.slice(directiveLiteral.start, directiveLiteral.end);
|
|
12879
12457
|
const val = directiveLiteral.value = raw.slice(1, -1);
|
|
12880
|
-
|
|
12881
12458
|
this.addExtra(directiveLiteral, "raw", raw);
|
|
12882
12459
|
this.addExtra(directiveLiteral, "rawValue", val);
|
|
12883
12460
|
this.addExtra(directiveLiteral, "expressionValue", expressionValue);
|
|
@@ -12918,13 +12495,11 @@ class StatementParser extends ExpressionParser {
|
|
|
12918
12495
|
chStartsBindingPattern(ch) {
|
|
12919
12496
|
return ch === 91 || ch === 123;
|
|
12920
12497
|
}
|
|
12921
|
-
|
|
12922
12498
|
hasFollowingBindingAtom() {
|
|
12923
12499
|
const next = this.nextTokenStart();
|
|
12924
12500
|
const nextCh = this.codePointAtPos(next);
|
|
12925
12501
|
return this.chStartsBindingPattern(nextCh) || this.chStartsBindingIdentifier(nextCh, next);
|
|
12926
12502
|
}
|
|
12927
|
-
|
|
12928
12503
|
hasFollowingBindingIdentifier() {
|
|
12929
12504
|
const next = this.nextTokenStart();
|
|
12930
12505
|
const nextCh = this.codePointAtPos(next);
|
|
@@ -12939,22 +12514,18 @@ class StatementParser extends ExpressionParser {
|
|
|
12939
12514
|
return true;
|
|
12940
12515
|
}
|
|
12941
12516
|
}
|
|
12942
|
-
|
|
12943
12517
|
parseModuleItem() {
|
|
12944
12518
|
return this.parseStatementLike(ParseStatementFlag.AllowImportExport | ParseStatementFlag.AllowDeclaration | ParseStatementFlag.AllowFunctionDeclaration | ParseStatementFlag.AllowLabeledFunction);
|
|
12945
12519
|
}
|
|
12946
|
-
|
|
12947
12520
|
parseStatementListItem() {
|
|
12948
12521
|
return this.parseStatementLike(ParseStatementFlag.AllowDeclaration | ParseStatementFlag.AllowFunctionDeclaration | ParseStatementFlag.AllowLabeledFunction);
|
|
12949
12522
|
}
|
|
12950
12523
|
parseStatementOrFunctionDeclaration(disallowLabeledFunction) {
|
|
12951
12524
|
return this.parseStatementLike(ParseStatementFlag.AllowFunctionDeclaration | (disallowLabeledFunction ? 0 : ParseStatementFlag.AllowLabeledFunction));
|
|
12952
12525
|
}
|
|
12953
|
-
|
|
12954
12526
|
parseStatement() {
|
|
12955
12527
|
return this.parseStatementLike(ParseStatementFlag.StatementOnly);
|
|
12956
12528
|
}
|
|
12957
|
-
|
|
12958
12529
|
parseStatementLike(flags) {
|
|
12959
12530
|
let decorators = null;
|
|
12960
12531
|
if (this.match(26)) {
|
|
@@ -12968,7 +12539,6 @@ class StatementParser extends ExpressionParser {
|
|
|
12968
12539
|
const allowDeclaration = !!(flags & ParseStatementFlag.AllowDeclaration);
|
|
12969
12540
|
const allowFunctionDeclaration = !!(flags & ParseStatementFlag.AllowFunctionDeclaration);
|
|
12970
12541
|
const topLevel = flags & ParseStatementFlag.AllowImportExport;
|
|
12971
|
-
|
|
12972
12542
|
switch (starttype) {
|
|
12973
12543
|
case 60:
|
|
12974
12544
|
return this.parseBreakContinueStatement(node, true);
|
|
@@ -13060,8 +12630,7 @@ class StatementParser extends ExpressionParser {
|
|
|
13060
12630
|
case 83:
|
|
13061
12631
|
{
|
|
13062
12632
|
const nextTokenCharCode = this.lookaheadCharCode();
|
|
13063
|
-
if (nextTokenCharCode === 40 ||
|
|
13064
|
-
nextTokenCharCode === 46) {
|
|
12633
|
+
if (nextTokenCharCode === 40 || nextTokenCharCode === 46) {
|
|
13065
12634
|
break;
|
|
13066
12635
|
}
|
|
13067
12636
|
}
|
|
@@ -13073,7 +12642,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13073
12642
|
});
|
|
13074
12643
|
}
|
|
13075
12644
|
this.next();
|
|
13076
|
-
|
|
13077
12645
|
let result;
|
|
13078
12646
|
if (starttype === 83) {
|
|
13079
12647
|
result = this.parseImport(node);
|
|
@@ -13102,12 +12670,10 @@ class StatementParser extends ExpressionParser {
|
|
|
13102
12670
|
}
|
|
13103
12671
|
}
|
|
13104
12672
|
}
|
|
13105
|
-
|
|
13106
12673
|
const maybeName = this.state.value;
|
|
13107
12674
|
const expr = this.parseExpression();
|
|
13108
12675
|
if (tokenIsIdentifier(starttype) && expr.type === "Identifier" && this.eat(14)) {
|
|
13109
|
-
return this.parseLabeledStatement(node, maybeName,
|
|
13110
|
-
expr, flags);
|
|
12676
|
+
return this.parseLabeledStatement(node, maybeName, expr, flags);
|
|
13111
12677
|
} else {
|
|
13112
12678
|
return this.parseExpressionStatement(node, expr, decorators);
|
|
13113
12679
|
}
|
|
@@ -13123,7 +12689,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13123
12689
|
if (this.hasPlugin("decorators-legacy")) return true;
|
|
13124
12690
|
return this.hasPlugin("decorators") && !!this.getPluginOption("decorators", "decoratorsBeforeExport");
|
|
13125
12691
|
}
|
|
13126
|
-
|
|
13127
12692
|
maybeTakeDecorators(maybeDecorators, classNode, exportNode) {
|
|
13128
12693
|
if (maybeDecorators) {
|
|
13129
12694
|
classNode.decorators = maybeDecorators;
|
|
@@ -13246,21 +12811,16 @@ class StatementParser extends ExpressionParser {
|
|
|
13246
12811
|
this.expect(11);
|
|
13247
12812
|
return val;
|
|
13248
12813
|
}
|
|
13249
|
-
|
|
13250
12814
|
parseDoWhileStatement(node) {
|
|
13251
12815
|
this.next();
|
|
13252
12816
|
this.state.labels.push(loopLabel);
|
|
13253
|
-
|
|
13254
|
-
node.body =
|
|
13255
|
-
this.withSmartMixTopicForbiddingContext(() =>
|
|
13256
|
-
this.parseStatement());
|
|
12817
|
+
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
13257
12818
|
this.state.labels.pop();
|
|
13258
12819
|
this.expect(92);
|
|
13259
12820
|
node.test = this.parseHeaderExpression();
|
|
13260
12821
|
this.eat(13);
|
|
13261
12822
|
return this.finishNode(node, "DoWhileStatement");
|
|
13262
12823
|
}
|
|
13263
|
-
|
|
13264
12824
|
parseForStatement(node) {
|
|
13265
12825
|
this.next();
|
|
13266
12826
|
this.state.labels.push(loopLabel);
|
|
@@ -13299,7 +12859,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13299
12859
|
}
|
|
13300
12860
|
return this.parseFor(node, init);
|
|
13301
12861
|
}
|
|
13302
|
-
|
|
13303
12862
|
const startsWithAsync = this.isContextual(95);
|
|
13304
12863
|
const refExpressionErrors = new ExpressionErrors();
|
|
13305
12864
|
const init = this.parseExpression(true, refExpressionErrors);
|
|
@@ -13310,8 +12869,7 @@ class StatementParser extends ExpressionParser {
|
|
|
13310
12869
|
at: init
|
|
13311
12870
|
});
|
|
13312
12871
|
}
|
|
13313
|
-
if (
|
|
13314
|
-
awaitAt === null && startsWithAsync && init.type === "Identifier") {
|
|
12872
|
+
if (awaitAt === null && startsWithAsync && init.type === "Identifier") {
|
|
13315
12873
|
this.raise(Errors.ForOfAsync, {
|
|
13316
12874
|
at: init
|
|
13317
12875
|
});
|
|
@@ -13326,8 +12884,7 @@ class StatementParser extends ExpressionParser {
|
|
|
13326
12884
|
type
|
|
13327
12885
|
}
|
|
13328
12886
|
});
|
|
13329
|
-
return this.parseForIn(node,
|
|
13330
|
-
init, awaitAt);
|
|
12887
|
+
return this.parseForIn(node, init, awaitAt);
|
|
13331
12888
|
} else {
|
|
13332
12889
|
this.checkExpressionErrors(refExpressionErrors, true);
|
|
13333
12890
|
}
|
|
@@ -13336,17 +12893,14 @@ class StatementParser extends ExpressionParser {
|
|
|
13336
12893
|
}
|
|
13337
12894
|
return this.parseFor(node, init);
|
|
13338
12895
|
}
|
|
13339
|
-
|
|
13340
12896
|
parseFunctionStatement(node, isAsync, isHangingDeclaration) {
|
|
13341
12897
|
this.next();
|
|
13342
12898
|
return this.parseFunction(node, ParseFunctionFlag.Declaration | (isHangingDeclaration ? ParseFunctionFlag.HangingDeclaration : 0) | (isAsync ? ParseFunctionFlag.Async : 0));
|
|
13343
12899
|
}
|
|
13344
|
-
|
|
13345
12900
|
parseIfStatement(node) {
|
|
13346
12901
|
this.next();
|
|
13347
12902
|
node.test = this.parseHeaderExpression();
|
|
13348
|
-
node.consequent = this.parseStatementOrFunctionDeclaration(
|
|
13349
|
-
true);
|
|
12903
|
+
node.consequent = this.parseStatementOrFunctionDeclaration(true);
|
|
13350
12904
|
node.alternate = this.eat(66) ? this.parseStatementOrFunctionDeclaration(true) : null;
|
|
13351
12905
|
return this.finishNode(node, "IfStatement");
|
|
13352
12906
|
}
|
|
@@ -13357,7 +12911,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13357
12911
|
});
|
|
13358
12912
|
}
|
|
13359
12913
|
this.next();
|
|
13360
|
-
|
|
13361
12914
|
if (this.isLineTerminator()) {
|
|
13362
12915
|
node.argument = null;
|
|
13363
12916
|
} else {
|
|
@@ -13366,7 +12919,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13366
12919
|
}
|
|
13367
12920
|
return this.finishNode(node, "ReturnStatement");
|
|
13368
12921
|
}
|
|
13369
|
-
|
|
13370
12922
|
parseSwitchStatement(node) {
|
|
13371
12923
|
this.next();
|
|
13372
12924
|
node.discriminant = this.parseHeaderExpression();
|
|
@@ -13374,7 +12926,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13374
12926
|
this.expect(5);
|
|
13375
12927
|
this.state.labels.push(switchLabel);
|
|
13376
12928
|
this.scope.enter(SCOPE_OTHER);
|
|
13377
|
-
|
|
13378
12929
|
let cur;
|
|
13379
12930
|
for (let sawDefault; !this.match(8);) {
|
|
13380
12931
|
if (this.match(61) || this.match(65)) {
|
|
@@ -13428,8 +12979,7 @@ class StatementParser extends ExpressionParser {
|
|
|
13428
12979
|
in: {
|
|
13429
12980
|
type: "CatchClause"
|
|
13430
12981
|
},
|
|
13431
|
-
binding:
|
|
13432
|
-
allowingSloppyLetBinding: true
|
|
12982
|
+
binding: BIND_CATCH_PARAM
|
|
13433
12983
|
});
|
|
13434
12984
|
return param;
|
|
13435
12985
|
}
|
|
@@ -13448,10 +12998,7 @@ class StatementParser extends ExpressionParser {
|
|
|
13448
12998
|
clause.param = null;
|
|
13449
12999
|
this.scope.enter(SCOPE_OTHER);
|
|
13450
13000
|
}
|
|
13451
|
-
|
|
13452
|
-
clause.body =
|
|
13453
|
-
this.withSmartMixTopicForbiddingContext(() =>
|
|
13454
|
-
this.parseBlock(false, false));
|
|
13001
|
+
clause.body = this.withSmartMixTopicForbiddingContext(() => this.parseBlock(false, false));
|
|
13455
13002
|
this.scope.exit();
|
|
13456
13003
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
13457
13004
|
}
|
|
@@ -13463,22 +13010,17 @@ class StatementParser extends ExpressionParser {
|
|
|
13463
13010
|
}
|
|
13464
13011
|
return this.finishNode(node, "TryStatement");
|
|
13465
13012
|
}
|
|
13466
|
-
|
|
13467
13013
|
parseVarStatement(node, kind, allowMissingInitializer = false) {
|
|
13468
13014
|
this.next();
|
|
13469
13015
|
this.parseVar(node, false, kind, allowMissingInitializer);
|
|
13470
13016
|
this.semicolon();
|
|
13471
13017
|
return this.finishNode(node, "VariableDeclaration");
|
|
13472
13018
|
}
|
|
13473
|
-
|
|
13474
13019
|
parseWhileStatement(node) {
|
|
13475
13020
|
this.next();
|
|
13476
13021
|
node.test = this.parseHeaderExpression();
|
|
13477
13022
|
this.state.labels.push(loopLabel);
|
|
13478
|
-
|
|
13479
|
-
node.body =
|
|
13480
|
-
this.withSmartMixTopicForbiddingContext(() =>
|
|
13481
|
-
this.parseStatement());
|
|
13023
|
+
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
13482
13024
|
this.state.labels.pop();
|
|
13483
13025
|
return this.finishNode(node, "WhileStatement");
|
|
13484
13026
|
}
|
|
@@ -13490,17 +13032,13 @@ class StatementParser extends ExpressionParser {
|
|
|
13490
13032
|
}
|
|
13491
13033
|
this.next();
|
|
13492
13034
|
node.object = this.parseHeaderExpression();
|
|
13493
|
-
|
|
13494
|
-
node.body =
|
|
13495
|
-
this.withSmartMixTopicForbiddingContext(() =>
|
|
13496
|
-
this.parseStatement());
|
|
13035
|
+
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
13497
13036
|
return this.finishNode(node, "WithStatement");
|
|
13498
13037
|
}
|
|
13499
13038
|
parseEmptyStatement(node) {
|
|
13500
13039
|
this.next();
|
|
13501
13040
|
return this.finishNode(node, "EmptyStatement");
|
|
13502
13041
|
}
|
|
13503
|
-
|
|
13504
13042
|
parseLabeledStatement(node, maybeName, expr, flags) {
|
|
13505
13043
|
for (const label of this.state.labels) {
|
|
13506
13044
|
if (label.name === maybeName) {
|
|
@@ -13530,13 +13068,11 @@ class StatementParser extends ExpressionParser {
|
|
|
13530
13068
|
node.label = expr;
|
|
13531
13069
|
return this.finishNode(node, "LabeledStatement");
|
|
13532
13070
|
}
|
|
13533
|
-
parseExpressionStatement(node, expr,
|
|
13534
|
-
decorators) {
|
|
13071
|
+
parseExpressionStatement(node, expr, decorators) {
|
|
13535
13072
|
node.expression = expr;
|
|
13536
13073
|
this.semicolon();
|
|
13537
13074
|
return this.finishNode(node, "ExpressionStatement");
|
|
13538
13075
|
}
|
|
13539
|
-
|
|
13540
13076
|
parseBlock(allowDirectives = false, createNewLexicalScope = true, afterBlockParse) {
|
|
13541
13077
|
const node = this.startNode();
|
|
13542
13078
|
if (allowDirectives) {
|
|
@@ -13560,7 +13096,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13560
13096
|
const directives = node.directives = [];
|
|
13561
13097
|
this.parseBlockOrModuleBlockBody(body, allowDirectives ? directives : undefined, topLevel, end, afterBlockParse);
|
|
13562
13098
|
}
|
|
13563
|
-
|
|
13564
13099
|
parseBlockOrModuleBlockBody(body, directives, topLevel, end, afterBlockParse) {
|
|
13565
13100
|
const oldStrict = this.state.strict;
|
|
13566
13101
|
let hasStrictModeDirective = false;
|
|
@@ -13590,7 +13125,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13590
13125
|
}
|
|
13591
13126
|
this.next();
|
|
13592
13127
|
}
|
|
13593
|
-
|
|
13594
13128
|
parseFor(node, init) {
|
|
13595
13129
|
node.init = init;
|
|
13596
13130
|
this.semicolon(false);
|
|
@@ -13598,15 +13132,11 @@ class StatementParser extends ExpressionParser {
|
|
|
13598
13132
|
this.semicolon(false);
|
|
13599
13133
|
node.update = this.match(11) ? null : this.parseExpression();
|
|
13600
13134
|
this.expect(11);
|
|
13601
|
-
|
|
13602
|
-
node.body =
|
|
13603
|
-
this.withSmartMixTopicForbiddingContext(() =>
|
|
13604
|
-
this.parseStatement());
|
|
13135
|
+
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
13605
13136
|
this.scope.exit();
|
|
13606
13137
|
this.state.labels.pop();
|
|
13607
13138
|
return this.finishNode(node, "ForStatement");
|
|
13608
13139
|
}
|
|
13609
|
-
|
|
13610
13140
|
parseForIn(node, init, awaitAt) {
|
|
13611
13141
|
const isForIn = this.match(58);
|
|
13612
13142
|
this.next();
|
|
@@ -13632,15 +13162,11 @@ class StatementParser extends ExpressionParser {
|
|
|
13632
13162
|
node.left = init;
|
|
13633
13163
|
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssignAllowIn();
|
|
13634
13164
|
this.expect(11);
|
|
13635
|
-
|
|
13636
|
-
node.body =
|
|
13637
|
-
this.withSmartMixTopicForbiddingContext(() =>
|
|
13638
|
-
this.parseStatement());
|
|
13165
|
+
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
13639
13166
|
this.scope.exit();
|
|
13640
13167
|
this.state.labels.pop();
|
|
13641
13168
|
return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
|
|
13642
13169
|
}
|
|
13643
|
-
|
|
13644
13170
|
parseVar(node, isFor, kind, allowMissingInitializer = false) {
|
|
13645
13171
|
const declarations = node.declarations = [];
|
|
13646
13172
|
node.kind = kind;
|
|
@@ -13667,6 +13193,11 @@ class StatementParser extends ExpressionParser {
|
|
|
13667
13193
|
return node;
|
|
13668
13194
|
}
|
|
13669
13195
|
parseVarId(decl, kind) {
|
|
13196
|
+
if (kind === "using" && !this.inModule && this.match(96)) {
|
|
13197
|
+
this.raise(Errors.AwaitInUsingBinding, {
|
|
13198
|
+
at: this.state.startLoc
|
|
13199
|
+
});
|
|
13200
|
+
}
|
|
13670
13201
|
const id = this.parseBindingAtom();
|
|
13671
13202
|
this.checkLVal(id, {
|
|
13672
13203
|
in: {
|
|
@@ -13676,11 +13207,9 @@ class StatementParser extends ExpressionParser {
|
|
|
13676
13207
|
});
|
|
13677
13208
|
decl.id = id;
|
|
13678
13209
|
}
|
|
13679
|
-
|
|
13680
13210
|
parseAsyncFunctionExpression(node) {
|
|
13681
13211
|
return this.parseFunction(node, ParseFunctionFlag.Async);
|
|
13682
13212
|
}
|
|
13683
|
-
|
|
13684
13213
|
parseFunction(node, flags = ParseFunctionFlag.Expression) {
|
|
13685
13214
|
const hangingDeclaration = flags & ParseFunctionFlag.HangingDeclaration;
|
|
13686
13215
|
const isDeclaration = !!(flags & ParseFunctionFlag.Declaration);
|
|
@@ -13707,7 +13236,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13707
13236
|
node.id = this.parseFunctionId();
|
|
13708
13237
|
}
|
|
13709
13238
|
this.parseFunctionParams(node, false);
|
|
13710
|
-
|
|
13711
13239
|
this.withSmartMixTopicForbiddingContext(() => {
|
|
13712
13240
|
this.parseFunctionBodyAndFinish(node, isDeclaration ? "FunctionDeclaration" : "FunctionExpression");
|
|
13713
13241
|
});
|
|
@@ -13730,13 +13258,10 @@ class StatementParser extends ExpressionParser {
|
|
|
13730
13258
|
}
|
|
13731
13259
|
registerFunctionStatementId(node) {
|
|
13732
13260
|
if (!node.id) return;
|
|
13733
|
-
|
|
13734
13261
|
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
13262
|
}
|
|
13736
|
-
|
|
13737
13263
|
parseClass(node, isStatement, optionalId) {
|
|
13738
13264
|
this.next();
|
|
13739
|
-
|
|
13740
13265
|
const oldStrict = this.state.strict;
|
|
13741
13266
|
this.state.strict = true;
|
|
13742
13267
|
this.parseClassId(node, isStatement, optionalId);
|
|
@@ -13751,10 +13276,8 @@ class StatementParser extends ExpressionParser {
|
|
|
13751
13276
|
return this.match(10);
|
|
13752
13277
|
}
|
|
13753
13278
|
isNonstaticConstructor(method) {
|
|
13754
|
-
return !method.computed && !method.static && (method.key.name === "constructor" ||
|
|
13755
|
-
method.key.value === "constructor");
|
|
13279
|
+
return !method.computed && !method.static && (method.key.name === "constructor" || method.key.value === "constructor");
|
|
13756
13280
|
}
|
|
13757
|
-
|
|
13758
13281
|
parseClassBody(hadSuperClass, oldStrict) {
|
|
13759
13282
|
this.classScope.enter();
|
|
13760
13283
|
const state = {
|
|
@@ -13765,7 +13288,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13765
13288
|
const classBody = this.startNode();
|
|
13766
13289
|
classBody.body = [];
|
|
13767
13290
|
this.expect(5);
|
|
13768
|
-
|
|
13769
13291
|
this.withSmartMixTopicForbiddingContext(() => {
|
|
13770
13292
|
while (!this.match(8)) {
|
|
13771
13293
|
if (this.eat(13)) {
|
|
@@ -13781,17 +13303,13 @@ class StatementParser extends ExpressionParser {
|
|
|
13781
13303
|
continue;
|
|
13782
13304
|
}
|
|
13783
13305
|
const member = this.startNode();
|
|
13784
|
-
|
|
13785
13306
|
if (decorators.length) {
|
|
13786
13307
|
member.decorators = decorators;
|
|
13787
13308
|
this.resetStartLocationFromNode(member, decorators[0]);
|
|
13788
13309
|
decorators = [];
|
|
13789
13310
|
}
|
|
13790
13311
|
this.parseClassMember(classBody, member, state);
|
|
13791
|
-
if (
|
|
13792
|
-
member.kind === "constructor" &&
|
|
13793
|
-
member.decorators &&
|
|
13794
|
-
member.decorators.length > 0) {
|
|
13312
|
+
if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
|
|
13795
13313
|
this.raise(Errors.DecoratorConstructor, {
|
|
13796
13314
|
at: member
|
|
13797
13315
|
});
|
|
@@ -13800,7 +13318,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13800
13318
|
});
|
|
13801
13319
|
this.state.strict = oldStrict;
|
|
13802
13320
|
this.next();
|
|
13803
|
-
|
|
13804
13321
|
if (decorators.length) {
|
|
13805
13322
|
throw this.raise(Errors.TrailingDecorator, {
|
|
13806
13323
|
at: this.state.startLoc
|
|
@@ -13809,13 +13326,10 @@ class StatementParser extends ExpressionParser {
|
|
|
13809
13326
|
this.classScope.exit();
|
|
13810
13327
|
return this.finishNode(classBody, "ClassBody");
|
|
13811
13328
|
}
|
|
13812
|
-
|
|
13813
13329
|
parseClassMemberFromModifier(classBody, member) {
|
|
13814
13330
|
const key = this.parseIdentifier(true);
|
|
13815
|
-
|
|
13816
13331
|
if (this.isClassMethod()) {
|
|
13817
13332
|
const method = member;
|
|
13818
|
-
|
|
13819
13333
|
method.kind = "method";
|
|
13820
13334
|
method.computed = false;
|
|
13821
13335
|
method.key = key;
|
|
@@ -13824,7 +13338,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13824
13338
|
return true;
|
|
13825
13339
|
} else if (this.isClassProperty()) {
|
|
13826
13340
|
const prop = member;
|
|
13827
|
-
|
|
13828
13341
|
prop.computed = false;
|
|
13829
13342
|
prop.key = key;
|
|
13830
13343
|
prop.static = false;
|
|
@@ -13884,12 +13397,10 @@ class StatementParser extends ExpressionParser {
|
|
|
13884
13397
|
this.pushClassPrivateMethod(classBody, privateMethod, false, false);
|
|
13885
13398
|
return;
|
|
13886
13399
|
}
|
|
13887
|
-
|
|
13888
13400
|
const isConstructor = this.isNonstaticConstructor(publicMethod);
|
|
13889
13401
|
let allowsDirectSuper = false;
|
|
13890
13402
|
if (isConstructor) {
|
|
13891
13403
|
publicMethod.kind = "constructor";
|
|
13892
|
-
|
|
13893
13404
|
if (state.hadConstructor && !this.hasPlugin("typescript")) {
|
|
13894
13405
|
this.raise(Errors.DuplicateConstructor, {
|
|
13895
13406
|
at: key
|
|
@@ -13949,7 +13460,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13949
13460
|
} else if (isContextual && key.name === "accessor" && !this.isLineTerminator()) {
|
|
13950
13461
|
this.expectPlugin("decoratorAutoAccessors");
|
|
13951
13462
|
this.resetPreviousNodeTrailingComments(key);
|
|
13952
|
-
|
|
13953
13463
|
const isPrivate = this.match(136);
|
|
13954
13464
|
this.parseClassElementName(publicProp);
|
|
13955
13465
|
this.pushClassAccessorProperty(classBody, accessorProp, isPrivate);
|
|
@@ -13963,7 +13473,6 @@ class StatementParser extends ExpressionParser {
|
|
|
13963
13473
|
this.unexpected();
|
|
13964
13474
|
}
|
|
13965
13475
|
}
|
|
13966
|
-
|
|
13967
13476
|
parseClassElementName(member) {
|
|
13968
13477
|
const {
|
|
13969
13478
|
type,
|
|
@@ -14044,16 +13553,12 @@ class StatementParser extends ExpressionParser {
|
|
|
14044
13553
|
declareClassPrivateMethodInScope(node, kind) {
|
|
14045
13554
|
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), kind, node.key.loc.start);
|
|
14046
13555
|
}
|
|
14047
|
-
|
|
14048
|
-
parsePostMemberNameModifiers(
|
|
14049
|
-
methodOrProp) {}
|
|
14050
|
-
|
|
13556
|
+
parsePostMemberNameModifiers(methodOrProp) {}
|
|
14051
13557
|
parseClassPrivateProperty(node) {
|
|
14052
13558
|
this.parseInitializer(node);
|
|
14053
13559
|
this.semicolon();
|
|
14054
13560
|
return this.finishNode(node, "ClassPrivateProperty");
|
|
14055
13561
|
}
|
|
14056
|
-
|
|
14057
13562
|
parseClassProperty(node) {
|
|
14058
13563
|
this.parseInitializer(node);
|
|
14059
13564
|
this.semicolon();
|
|
@@ -14064,7 +13569,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14064
13569
|
this.semicolon();
|
|
14065
13570
|
return this.finishNode(node, "ClassAccessorProperty");
|
|
14066
13571
|
}
|
|
14067
|
-
|
|
14068
13572
|
parseInitializer(node) {
|
|
14069
13573
|
this.scope.enter(SCOPE_CLASS | SCOPE_SUPER);
|
|
14070
13574
|
this.expressionScope.enter(newExpressionScope());
|
|
@@ -14090,19 +13594,14 @@ class StatementParser extends ExpressionParser {
|
|
|
14090
13594
|
}
|
|
14091
13595
|
}
|
|
14092
13596
|
}
|
|
14093
|
-
|
|
14094
13597
|
parseClassSuper(node) {
|
|
14095
13598
|
node.superClass = this.eat(81) ? this.parseExprSubscripts() : null;
|
|
14096
13599
|
}
|
|
14097
|
-
|
|
14098
13600
|
parseExport(node, decorators) {
|
|
14099
|
-
const hasDefault = this.maybeParseExportDefaultSpecifier(
|
|
14100
|
-
node);
|
|
13601
|
+
const hasDefault = this.maybeParseExportDefaultSpecifier(node);
|
|
14101
13602
|
const parseAfterDefault = !hasDefault || this.eat(12);
|
|
14102
|
-
const hasStar = parseAfterDefault && this.eatExportStar(
|
|
14103
|
-
node);
|
|
14104
|
-
const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(
|
|
14105
|
-
node);
|
|
13603
|
+
const hasStar = parseAfterDefault && this.eatExportStar(node);
|
|
13604
|
+
const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(node);
|
|
14106
13605
|
const parseAfterNamespace = parseAfterDefault && (!hasNamespace || this.eat(12));
|
|
14107
13606
|
const isFromRequired = hasDefault || hasStar;
|
|
14108
13607
|
if (hasStar && !hasNamespace) {
|
|
@@ -14115,11 +13614,13 @@ class StatementParser extends ExpressionParser {
|
|
|
14115
13614
|
this.parseExportFrom(node, true);
|
|
14116
13615
|
return this.finishNode(node, "ExportAllDeclaration");
|
|
14117
13616
|
}
|
|
14118
|
-
const hasSpecifiers = this.maybeParseExportNamedSpecifiers(
|
|
14119
|
-
|
|
14120
|
-
if (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers || hasNamespace && parseAfterNamespace && !hasSpecifiers) {
|
|
13617
|
+
const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node);
|
|
13618
|
+
if (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers) {
|
|
14121
13619
|
throw this.unexpected(null, 5);
|
|
14122
13620
|
}
|
|
13621
|
+
if (hasNamespace && parseAfterNamespace) {
|
|
13622
|
+
throw this.unexpected(null, 97);
|
|
13623
|
+
}
|
|
14123
13624
|
let hasDeclaration;
|
|
14124
13625
|
if (isFromRequired || hasSpecifiers) {
|
|
14125
13626
|
hasDeclaration = false;
|
|
@@ -14161,7 +13662,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14161
13662
|
}
|
|
14162
13663
|
throw this.unexpected(null, 5);
|
|
14163
13664
|
}
|
|
14164
|
-
|
|
14165
13665
|
eatExportStar(node) {
|
|
14166
13666
|
return this.eat(55);
|
|
14167
13667
|
}
|
|
@@ -14247,9 +13747,7 @@ class StatementParser extends ExpressionParser {
|
|
|
14247
13747
|
this.semicolon();
|
|
14248
13748
|
return res;
|
|
14249
13749
|
}
|
|
14250
|
-
|
|
14251
|
-
parseExportDeclaration(
|
|
14252
|
-
node) {
|
|
13750
|
+
parseExportDeclaration(node) {
|
|
14253
13751
|
if (this.match(80)) {
|
|
14254
13752
|
const node = this.parseClass(this.startNode(), true, false);
|
|
14255
13753
|
return node;
|
|
@@ -14325,8 +13823,7 @@ class StatementParser extends ExpressionParser {
|
|
|
14325
13823
|
if (this.hasPlugin("exportDefaultFrom")) {
|
|
14326
13824
|
var _declaration$extra;
|
|
14327
13825
|
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)) {
|
|
13826
|
+
if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) {
|
|
14330
13827
|
this.raise(Errors.ExportDefaultFromAsIdentifier, {
|
|
14331
13828
|
at: declaration
|
|
14332
13829
|
});
|
|
@@ -14404,11 +13901,9 @@ class StatementParser extends ExpressionParser {
|
|
|
14404
13901
|
}
|
|
14405
13902
|
this.exportedIdentifiers.add(exportName);
|
|
14406
13903
|
}
|
|
14407
|
-
|
|
14408
13904
|
parseExportSpecifiers(isInTypeExport) {
|
|
14409
13905
|
const nodes = [];
|
|
14410
13906
|
let first = true;
|
|
14411
|
-
|
|
14412
13907
|
this.expect(5);
|
|
14413
13908
|
while (!this.eat(8)) {
|
|
14414
13909
|
if (first) {
|
|
@@ -14425,9 +13920,7 @@ class StatementParser extends ExpressionParser {
|
|
|
14425
13920
|
}
|
|
14426
13921
|
return nodes;
|
|
14427
13922
|
}
|
|
14428
|
-
parseExportSpecifier(node, isString,
|
|
14429
|
-
isInTypeExport, isMaybeTypeOnly
|
|
14430
|
-
) {
|
|
13923
|
+
parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
|
|
14431
13924
|
if (this.eatContextual(93)) {
|
|
14432
13925
|
node.exported = this.parseModuleExportName();
|
|
14433
13926
|
} else if (isString) {
|
|
@@ -14437,7 +13930,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14437
13930
|
}
|
|
14438
13931
|
return this.finishNode(node, "ExportSpecifier");
|
|
14439
13932
|
}
|
|
14440
|
-
|
|
14441
13933
|
parseModuleExportName() {
|
|
14442
13934
|
if (this.match(131)) {
|
|
14443
13935
|
const result = this.parseStringLiteral(this.state.value);
|
|
@@ -14529,7 +14021,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14529
14021
|
node.module = false;
|
|
14530
14022
|
}
|
|
14531
14023
|
}
|
|
14532
|
-
|
|
14533
14024
|
parseImport(node) {
|
|
14534
14025
|
node.specifiers = [];
|
|
14535
14026
|
if (!this.match(131)) {
|
|
@@ -14559,7 +14050,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14559
14050
|
if (!this.match(131)) this.unexpected();
|
|
14560
14051
|
return this.parseExprAtom();
|
|
14561
14052
|
}
|
|
14562
|
-
|
|
14563
14053
|
shouldParseDefaultImport(node) {
|
|
14564
14054
|
return tokenIsIdentifier(this.state.type);
|
|
14565
14055
|
}
|
|
@@ -14569,12 +14059,13 @@ class StatementParser extends ExpressionParser {
|
|
|
14569
14059
|
}
|
|
14570
14060
|
finishImportSpecifier(specifier, type, bindingType = BIND_LEXICAL) {
|
|
14571
14061
|
this.checkLVal(specifier.local, {
|
|
14572
|
-
in:
|
|
14062
|
+
in: {
|
|
14063
|
+
type
|
|
14064
|
+
},
|
|
14573
14065
|
binding: bindingType
|
|
14574
14066
|
});
|
|
14575
14067
|
return this.finishNode(specifier, type);
|
|
14576
14068
|
}
|
|
14577
|
-
|
|
14578
14069
|
parseAssertEntries() {
|
|
14579
14070
|
const attrs = [];
|
|
14580
14071
|
const attrNames = new Set();
|
|
@@ -14583,7 +14074,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14583
14074
|
break;
|
|
14584
14075
|
}
|
|
14585
14076
|
const node = this.startNode();
|
|
14586
|
-
|
|
14587
14077
|
const keyName = this.state.value;
|
|
14588
14078
|
if (attrNames.has(keyName)) {
|
|
14589
14079
|
this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
|
|
@@ -14608,7 +14098,6 @@ class StatementParser extends ExpressionParser {
|
|
|
14608
14098
|
} while (this.eat(12));
|
|
14609
14099
|
return attrs;
|
|
14610
14100
|
}
|
|
14611
|
-
|
|
14612
14101
|
maybeParseModuleAttributes() {
|
|
14613
14102
|
if (this.match(76) && !this.hasPrecedingLineBreak()) {
|
|
14614
14103
|
this.expectPlugin("moduleAttributes");
|
|
@@ -14699,10 +14188,7 @@ class StatementParser extends ExpressionParser {
|
|
|
14699
14188
|
node.specifiers.push(importSpecifier);
|
|
14700
14189
|
}
|
|
14701
14190
|
}
|
|
14702
|
-
|
|
14703
|
-
parseImportSpecifier(specifier, importedIsString,
|
|
14704
|
-
isInTypeOnlyImport, isMaybeTypeOnly, bindingType
|
|
14705
|
-
) {
|
|
14191
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
14706
14192
|
if (this.eatContextual(93)) {
|
|
14707
14193
|
specifier.local = this.parseIdentifier();
|
|
14708
14194
|
} else {
|
|
@@ -14722,14 +14208,12 @@ class StatementParser extends ExpressionParser {
|
|
|
14722
14208
|
}
|
|
14723
14209
|
return this.finishImportSpecifier(specifier, "ImportSpecifier", bindingType);
|
|
14724
14210
|
}
|
|
14725
|
-
|
|
14726
14211
|
isThisParam(param) {
|
|
14727
14212
|
return param.type === "Identifier" && param.name === "this";
|
|
14728
14213
|
}
|
|
14729
14214
|
}
|
|
14730
14215
|
|
|
14731
14216
|
class Parser extends StatementParser {
|
|
14732
|
-
|
|
14733
14217
|
constructor(options, input) {
|
|
14734
14218
|
options = getOptions(options);
|
|
14735
14219
|
super(options, input);
|
|
@@ -14738,7 +14222,6 @@ class Parser extends StatementParser {
|
|
|
14738
14222
|
this.plugins = pluginsMap(this.options.plugins);
|
|
14739
14223
|
this.filename = options.sourceFilename;
|
|
14740
14224
|
}
|
|
14741
|
-
|
|
14742
14225
|
getScopeHandler() {
|
|
14743
14226
|
return ScopeHandler;
|
|
14744
14227
|
}
|
|
@@ -14817,7 +14300,6 @@ function getParser(options, input) {
|
|
|
14817
14300
|
return new cls(options, input);
|
|
14818
14301
|
}
|
|
14819
14302
|
const parserClassCache = {};
|
|
14820
|
-
|
|
14821
14303
|
function getParserClass(pluginsFromOptions) {
|
|
14822
14304
|
const pluginList = mixinPluginNames.filter(name => hasPlugin(pluginsFromOptions, name));
|
|
14823
14305
|
const key = pluginList.join("/");
|