meriyah 7.2.0 → 7.3.1
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/CHANGELOG.md +27 -0
- package/README.md +1 -3
- package/dist/meriyah.cjs +634 -430
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +634 -430
- package/dist/meriyah.umd.js +634 -430
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/errors.d.ts +74 -70
- package/dist/types/estree.d.ts +2 -0
- package/dist/types/features.d.ts +7 -0
- package/dist/types/options.d.ts +6 -2
- package/dist/types/parser/parser.d.ts +8 -3
- package/dist/types/parser/scope.d.ts +1 -1
- package/dist/types/parser.d.ts +2 -2
- package/dist/types/token.d.ts +3 -3
- package/package.json +1 -1
- package/dist/types/utilities.d.ts +0 -1
package/dist/meriyah.umd.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.meriyah = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
var version$1 = "7.
|
|
7
|
+
var version$1 = "7.3.1";
|
|
8
8
|
var packageJson = {
|
|
9
9
|
version: version$1};
|
|
10
10
|
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
0,
|
|
98
98
|
16384,
|
|
99
99
|
0,
|
|
100
|
-
|
|
100
|
+
16384,
|
|
101
101
|
0,
|
|
102
102
|
0,
|
|
103
103
|
1 | 2 | 64,
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
1 | 2 | 4,
|
|
161
161
|
16384,
|
|
162
162
|
0,
|
|
163
|
-
|
|
163
|
+
16384,
|
|
164
164
|
0,
|
|
165
165
|
0
|
|
166
166
|
];
|
|
@@ -627,7 +627,7 @@
|
|
|
627
627
|
[9]: 'Octal literals are not allowed in strict mode',
|
|
628
628
|
[8]: 'Decimal integer literals with a leading zero are forbidden in strict mode',
|
|
629
629
|
[10]: 'Expected number in radix %0',
|
|
630
|
-
[
|
|
630
|
+
[153]: 'Invalid left-hand side assignment to a destructible right-hand side',
|
|
631
631
|
[11]: 'Non-number found after exponent indicator',
|
|
632
632
|
[12]: 'Invalid BigIntLiteral',
|
|
633
633
|
[13]: 'No identifiers allowed directly after numeric literal',
|
|
@@ -651,7 +651,7 @@
|
|
|
651
651
|
[32]: 'Yield expression not allowed in formal parameter',
|
|
652
652
|
[95]: "Unexpected token: 'escaped keyword'",
|
|
653
653
|
[33]: 'Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses',
|
|
654
|
-
[
|
|
654
|
+
[125]: 'Async functions can only be declared at the top level or inside a block',
|
|
655
655
|
[34]: 'Unterminated regular expression',
|
|
656
656
|
[35]: 'Unexpected regular expression flag',
|
|
657
657
|
[36]: "Duplicate regular expression flag '%0'",
|
|
@@ -663,7 +663,7 @@
|
|
|
663
663
|
[42]: 'A getter cannot be a generator',
|
|
664
664
|
[43]: 'A setter cannot be a generator',
|
|
665
665
|
[44]: 'A computed property name must be followed by a colon or paren',
|
|
666
|
-
[
|
|
666
|
+
[136]: 'Object literal keys that are strings or numbers must be a method or have a colon',
|
|
667
667
|
[46]: 'Found `* async x(){}` but this should be `async * x(){}`',
|
|
668
668
|
[45]: 'Getters and setters can not be generators',
|
|
669
669
|
[47]: "'%0' can not be generator method",
|
|
@@ -725,73 +725,77 @@
|
|
|
725
725
|
[105]: '%0 source must be string',
|
|
726
726
|
[106]: 'Only a identifier or string can be used to indicate alias',
|
|
727
727
|
[107]: "Only '*' or '{...}' can be imported after default",
|
|
728
|
-
[108]: '
|
|
729
|
-
[109]: "
|
|
730
|
-
[110]: '
|
|
731
|
-
[111]: '
|
|
732
|
-
[112]: '
|
|
733
|
-
[113]:
|
|
734
|
-
[114]: '
|
|
735
|
-
[115]: "The
|
|
736
|
-
[116]: '
|
|
737
|
-
[117]:
|
|
738
|
-
[118]: '
|
|
739
|
-
[119]: '
|
|
740
|
-
[120]: '
|
|
741
|
-
[121]: '
|
|
742
|
-
[122]: '
|
|
743
|
-
[
|
|
744
|
-
[
|
|
745
|
-
[126]: '
|
|
746
|
-
[127]: '
|
|
747
|
-
[
|
|
748
|
-
[
|
|
749
|
-
[
|
|
750
|
-
[
|
|
751
|
-
[132]: '
|
|
752
|
-
[133]: '
|
|
753
|
-
[
|
|
754
|
-
[
|
|
755
|
-
[137]: '
|
|
756
|
-
[138]: "
|
|
757
|
-
[139]: '
|
|
758
|
-
[140]:
|
|
759
|
-
[141]: 'import()
|
|
760
|
-
[142]: '
|
|
761
|
-
[143]: '
|
|
762
|
-
[144]:
|
|
763
|
-
[145]:
|
|
764
|
-
[146]:
|
|
765
|
-
[147]: "
|
|
766
|
-
[
|
|
767
|
-
[
|
|
768
|
-
[
|
|
769
|
-
[
|
|
770
|
-
[
|
|
771
|
-
[
|
|
772
|
-
[
|
|
773
|
-
[156]: '
|
|
774
|
-
[157]:
|
|
775
|
-
[158]:
|
|
776
|
-
[159]: "
|
|
777
|
-
[160]: '
|
|
778
|
-
[161]: '
|
|
779
|
-
[162]: '
|
|
780
|
-
[163]: '
|
|
781
|
-
[164]: '
|
|
782
|
-
[165]: '
|
|
783
|
-
[166]: '
|
|
784
|
-
[167]: '
|
|
785
|
-
[168]: 'Invalid
|
|
786
|
-
[169]: '
|
|
787
|
-
[170]: '
|
|
788
|
-
[171]: '
|
|
789
|
-
[172]: '
|
|
790
|
-
[173]:
|
|
791
|
-
[174]:
|
|
792
|
-
[175]: "'
|
|
793
|
-
[176]:
|
|
794
|
-
[177]: '
|
|
728
|
+
[108]: "'import defer' must be followed by a namespace import",
|
|
729
|
+
[109]: "'import source' must be followed by a default import",
|
|
730
|
+
[110]: 'Trailing decorator may be followed by method',
|
|
731
|
+
[111]: "Decorators can't be used with a constructor",
|
|
732
|
+
[112]: 'Can not use `await` as identifier in module or async func',
|
|
733
|
+
[113]: 'Can not use `await` as identifier in module',
|
|
734
|
+
[114]: 'HTML comments are only allowed with web compatibility (Annex B)',
|
|
735
|
+
[115]: "The identifier 'let' must not be in expression position in strict mode",
|
|
736
|
+
[116]: 'Cannot assign to `eval` and `arguments` in strict mode',
|
|
737
|
+
[117]: "The left-hand side of a for-of loop may not start with 'let'",
|
|
738
|
+
[118]: 'Block body arrows can not be immediately invoked without a group',
|
|
739
|
+
[119]: 'Block body arrows can not be immediately accessed without a group',
|
|
740
|
+
[120]: 'Unexpected strict mode reserved word',
|
|
741
|
+
[121]: 'Unexpected eval or arguments in strict mode',
|
|
742
|
+
[122]: 'Decorators must not be followed by a semicolon',
|
|
743
|
+
[123]: 'Calling delete on expression not allowed in strict mode',
|
|
744
|
+
[124]: 'Pattern can not have a tail',
|
|
745
|
+
[126]: 'Can not have a `yield` expression on the left side of a ternary',
|
|
746
|
+
[127]: 'An arrow function can not have a postfix update operator',
|
|
747
|
+
[128]: 'Invalid object literal key character after generator star',
|
|
748
|
+
[129]: 'Private fields can not be deleted',
|
|
749
|
+
[131]: 'Classes may not have a field called constructor',
|
|
750
|
+
[130]: 'Classes may not have a private element named constructor',
|
|
751
|
+
[132]: 'A class field initializer or static block may not contain arguments',
|
|
752
|
+
[133]: 'Generators can only be declared at the top level or inside a block',
|
|
753
|
+
[134]: 'Async methods are a restricted production and cannot have a newline following it',
|
|
754
|
+
[135]: 'Unexpected character after object literal property name',
|
|
755
|
+
[137]: 'Invalid key token',
|
|
756
|
+
[138]: "Label '%0' has already been declared",
|
|
757
|
+
[139]: 'continue statement must be nested within an iteration statement',
|
|
758
|
+
[140]: "Undefined label '%0'",
|
|
759
|
+
[141]: 'Trailing comma is disallowed inside import(...) arguments',
|
|
760
|
+
[142]: 'Invalid binding in JSON import',
|
|
761
|
+
[143]: 'import() requires exactly one argument',
|
|
762
|
+
[144]: 'Cannot use new with import(...)',
|
|
763
|
+
[145]: '... is not allowed in import()',
|
|
764
|
+
[146]: "Expected '=>'",
|
|
765
|
+
[147]: "Duplicate binding '%0'",
|
|
766
|
+
[148]: 'Duplicate private identifier #%0',
|
|
767
|
+
[149]: "Cannot export a duplicate name '%0'",
|
|
768
|
+
[152]: 'Duplicate %0 for-binding',
|
|
769
|
+
[150]: "Exported binding '%0' needs to refer to a top-level declared variable",
|
|
770
|
+
[151]: 'Unexpected private field',
|
|
771
|
+
[155]: 'Numeric separators are not allowed at the end of numeric literals',
|
|
772
|
+
[154]: 'Only one underscore is allowed as numeric separator',
|
|
773
|
+
[156]: 'JSX value should be either an expression or a quoted JSX text',
|
|
774
|
+
[157]: 'Expected corresponding JSX closing tag for %0',
|
|
775
|
+
[158]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
|
|
776
|
+
[159]: "JSX attributes must only be assigned a non-empty 'expression'",
|
|
777
|
+
[160]: "'%0' has already been declared",
|
|
778
|
+
[161]: "'%0' shadowed a catch clause binding",
|
|
779
|
+
[162]: 'Dot property must be an identifier',
|
|
780
|
+
[163]: 'Encountered invalid input after spread/rest argument',
|
|
781
|
+
[164]: 'Catch without try',
|
|
782
|
+
[165]: 'Finally without try',
|
|
783
|
+
[166]: 'Expected corresponding closing tag for JSX fragment',
|
|
784
|
+
[167]: 'Coalescing and logical operators used together in the same expression must be disambiguated with parentheses',
|
|
785
|
+
[168]: 'Invalid tagged template on optional chain',
|
|
786
|
+
[169]: 'Invalid optional chain from super property',
|
|
787
|
+
[170]: 'Invalid optional chain from new expression',
|
|
788
|
+
[171]: 'Cannot use "import.meta" outside a module',
|
|
789
|
+
[172]: 'Leading decorators must be attached to a class declaration',
|
|
790
|
+
[173]: 'An export name cannot include a lone surrogate',
|
|
791
|
+
[174]: 'A string literal cannot be used as an exported binding without `from`',
|
|
792
|
+
[175]: "Private fields can't be accessed on super",
|
|
793
|
+
[176]: "The only valid meta property for import is 'import.meta'",
|
|
794
|
+
[177]: "'import.meta' must not contain escaped characters",
|
|
795
|
+
[178]: 'cannot use "await" as identifier inside an async function',
|
|
796
|
+
[179]: 'cannot use "await" in static blocks',
|
|
797
|
+
[180]: "Unexpected token `}`. Did you mean `}` or `{'}'}`?",
|
|
798
|
+
[181]: "Unexpected token `>`. Did you mean `>` or `{'>'}`?",
|
|
795
799
|
};
|
|
796
800
|
class ParseError extends SyntaxError {
|
|
797
801
|
start;
|
|
@@ -815,10 +819,6 @@
|
|
|
815
819
|
}
|
|
816
820
|
const isParseError = (error) => error instanceof ParseError;
|
|
817
821
|
|
|
818
|
-
function getOwnProperty(object, key) {
|
|
819
|
-
return Object.hasOwn(object, key) ? object[key] : undefined;
|
|
820
|
-
}
|
|
821
|
-
|
|
822
822
|
const KeywordDescTable = [
|
|
823
823
|
'end of source',
|
|
824
824
|
'identifier', 'number', 'string', 'regular expression',
|
|
@@ -840,75 +840,82 @@
|
|
|
840
840
|
'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
|
|
841
841
|
'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
|
|
842
842
|
];
|
|
843
|
-
const descKeywordTable =
|
|
844
|
-
this
|
|
845
|
-
function
|
|
846
|
-
if
|
|
847
|
-
return
|
|
848
|
-
var
|
|
849
|
-
else
|
|
850
|
-
for
|
|
851
|
-
new
|
|
852
|
-
in
|
|
853
|
-
typeof
|
|
854
|
-
while
|
|
855
|
-
case
|
|
856
|
-
break
|
|
857
|
-
try
|
|
858
|
-
catch
|
|
859
|
-
delete
|
|
860
|
-
throw
|
|
861
|
-
switch
|
|
862
|
-
continue
|
|
863
|
-
default
|
|
864
|
-
instanceof
|
|
865
|
-
do
|
|
866
|
-
void
|
|
867
|
-
finally
|
|
868
|
-
async
|
|
869
|
-
await
|
|
870
|
-
class
|
|
871
|
-
const
|
|
872
|
-
constructor
|
|
873
|
-
debugger
|
|
874
|
-
export
|
|
875
|
-
extends
|
|
876
|
-
false
|
|
877
|
-
from
|
|
878
|
-
get
|
|
879
|
-
implements
|
|
880
|
-
import
|
|
881
|
-
interface
|
|
882
|
-
let
|
|
883
|
-
null
|
|
884
|
-
of
|
|
885
|
-
using
|
|
886
|
-
package
|
|
887
|
-
private
|
|
888
|
-
protected
|
|
889
|
-
public
|
|
890
|
-
set
|
|
891
|
-
static
|
|
892
|
-
super
|
|
893
|
-
true
|
|
894
|
-
with
|
|
895
|
-
yield
|
|
896
|
-
enum
|
|
897
|
-
eval
|
|
898
|
-
as
|
|
899
|
-
arguments
|
|
900
|
-
target
|
|
901
|
-
meta
|
|
902
|
-
accessor
|
|
903
|
-
|
|
843
|
+
const descKeywordTable = new Map([
|
|
844
|
+
['this', 86111],
|
|
845
|
+
['function', 86104],
|
|
846
|
+
['if', 20569],
|
|
847
|
+
['return', 20572],
|
|
848
|
+
['var', 86088],
|
|
849
|
+
['else', 20563],
|
|
850
|
+
['for', 20567],
|
|
851
|
+
['new', 86107],
|
|
852
|
+
['in', 8673330],
|
|
853
|
+
['typeof', 16863275],
|
|
854
|
+
['while', 20578],
|
|
855
|
+
['case', 20556],
|
|
856
|
+
['break', 20555],
|
|
857
|
+
['try', 20577],
|
|
858
|
+
['catch', 20557],
|
|
859
|
+
['delete', 16863276],
|
|
860
|
+
['throw', 86112],
|
|
861
|
+
['switch', 86110],
|
|
862
|
+
['continue', 20559],
|
|
863
|
+
['default', 20561],
|
|
864
|
+
['instanceof', 8411187],
|
|
865
|
+
['do', 20562],
|
|
866
|
+
['void', 16863277],
|
|
867
|
+
['finally', 20566],
|
|
868
|
+
['async', 209005],
|
|
869
|
+
['await', 209006],
|
|
870
|
+
['class', 86094],
|
|
871
|
+
['const', 86090],
|
|
872
|
+
['constructor', 12399],
|
|
873
|
+
['debugger', 20560],
|
|
874
|
+
['export', 20564],
|
|
875
|
+
['extends', 20565],
|
|
876
|
+
['false', 86021],
|
|
877
|
+
['from', 209011],
|
|
878
|
+
['get', 209008],
|
|
879
|
+
['implements', 36964],
|
|
880
|
+
['import', 86106],
|
|
881
|
+
['interface', 36965],
|
|
882
|
+
['let', 241737],
|
|
883
|
+
['null', 86023],
|
|
884
|
+
['of', 471156],
|
|
885
|
+
['using', 209013],
|
|
886
|
+
['package', 36966],
|
|
887
|
+
['private', 36967],
|
|
888
|
+
['protected', 36968],
|
|
889
|
+
['public', 36969],
|
|
890
|
+
['set', 209009],
|
|
891
|
+
['static', 36970],
|
|
892
|
+
['super', 86109],
|
|
893
|
+
['true', 86022],
|
|
894
|
+
['with', 20579],
|
|
895
|
+
['yield', 241771],
|
|
896
|
+
['enum', 86134],
|
|
897
|
+
['eval', 537079927],
|
|
898
|
+
['as', 77932],
|
|
899
|
+
['arguments', 537079928],
|
|
900
|
+
['target', 209030],
|
|
901
|
+
['meta', 209031],
|
|
902
|
+
['accessor', 12402],
|
|
903
|
+
]);
|
|
904
|
+
const keywordLengths = [...descKeywordTable.keys()].map((keyword) => keyword.length);
|
|
905
|
+
const minKeywordLength = Math.min(...keywordLengths);
|
|
906
|
+
const maxKeywordLength = Math.max(...keywordLengths);
|
|
904
907
|
|
|
905
908
|
function scanIdentifier(parser, context, isValidAsKeyword) {
|
|
906
909
|
while (isIdPart[advanceChar(parser)])
|
|
907
910
|
;
|
|
908
911
|
parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
+
if (parser.currentChar === 92 || parser.currentChar > 0x7e) {
|
|
913
|
+
return scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword);
|
|
914
|
+
}
|
|
915
|
+
const length = parser.index - parser.tokenIndex;
|
|
916
|
+
if (length < minKeywordLength || length > maxKeywordLength)
|
|
917
|
+
return 208897;
|
|
918
|
+
return descKeywordTable.get(parser.tokenValue) ?? 208897;
|
|
912
919
|
}
|
|
913
920
|
function scanUnicodeIdentifier(parser, context) {
|
|
914
921
|
const cookedChar = scanIdentifierUnicodeEscape(parser);
|
|
@@ -950,8 +957,8 @@
|
|
|
950
957
|
parser.tokenValue += parser.source.slice(start, parser.index);
|
|
951
958
|
}
|
|
952
959
|
const { length } = parser.tokenValue;
|
|
953
|
-
if (isValidAsKeyword && length >=
|
|
954
|
-
const token =
|
|
960
|
+
if (isValidAsKeyword && length >= minKeywordLength && length <= maxKeywordLength) {
|
|
961
|
+
const token = descKeywordTable.get(parser.tokenValue);
|
|
955
962
|
if (token === void 0)
|
|
956
963
|
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
957
964
|
if (!hasEscape)
|
|
@@ -1075,7 +1082,7 @@
|
|
|
1075
1082
|
while (CharTypes[char] & (64 | 4096)) {
|
|
1076
1083
|
if (char === 95) {
|
|
1077
1084
|
if (!allowSeparator)
|
|
1078
|
-
parser.report(
|
|
1085
|
+
parser.report(154);
|
|
1079
1086
|
allowSeparator = 0;
|
|
1080
1087
|
char = advanceChar(parser);
|
|
1081
1088
|
continue;
|
|
@@ -1086,7 +1093,7 @@
|
|
|
1086
1093
|
char = advanceChar(parser);
|
|
1087
1094
|
}
|
|
1088
1095
|
if (digits === 0 || !allowSeparator) {
|
|
1089
|
-
parser.report(digits === 0 ? 21 :
|
|
1096
|
+
parser.report(digits === 0 ? 21 : 155);
|
|
1090
1097
|
}
|
|
1091
1098
|
}
|
|
1092
1099
|
else if ((char | 32) === 111) {
|
|
@@ -1095,7 +1102,7 @@
|
|
|
1095
1102
|
while (CharTypes[char] & (32 | 4096)) {
|
|
1096
1103
|
if (char === 95) {
|
|
1097
1104
|
if (!allowSeparator) {
|
|
1098
|
-
parser.report(
|
|
1105
|
+
parser.report(154);
|
|
1099
1106
|
}
|
|
1100
1107
|
allowSeparator = 0;
|
|
1101
1108
|
char = advanceChar(parser);
|
|
@@ -1107,7 +1114,7 @@
|
|
|
1107
1114
|
char = advanceChar(parser);
|
|
1108
1115
|
}
|
|
1109
1116
|
if (digits === 0 || !allowSeparator) {
|
|
1110
|
-
parser.report(digits === 0 ? 0 :
|
|
1117
|
+
parser.report(digits === 0 ? 0 : 155);
|
|
1111
1118
|
}
|
|
1112
1119
|
}
|
|
1113
1120
|
else if ((char | 32) === 98) {
|
|
@@ -1116,7 +1123,7 @@
|
|
|
1116
1123
|
while (CharTypes[char] & (128 | 4096)) {
|
|
1117
1124
|
if (char === 95) {
|
|
1118
1125
|
if (!allowSeparator) {
|
|
1119
|
-
parser.report(
|
|
1126
|
+
parser.report(154);
|
|
1120
1127
|
}
|
|
1121
1128
|
allowSeparator = 0;
|
|
1122
1129
|
char = advanceChar(parser);
|
|
@@ -1128,7 +1135,7 @@
|
|
|
1128
1135
|
char = advanceChar(parser);
|
|
1129
1136
|
}
|
|
1130
1137
|
if (digits === 0 || !allowSeparator) {
|
|
1131
|
-
parser.report(digits === 0 ? 0 :
|
|
1138
|
+
parser.report(digits === 0 ? 0 : 155);
|
|
1132
1139
|
}
|
|
1133
1140
|
}
|
|
1134
1141
|
else if (CharTypes[char] & 32) {
|
|
@@ -1161,7 +1168,7 @@
|
|
|
1161
1168
|
if (char === 95) {
|
|
1162
1169
|
char = advanceChar(parser);
|
|
1163
1170
|
if (char === 95 || kind & 32) {
|
|
1164
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column },
|
|
1171
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 154);
|
|
1165
1172
|
}
|
|
1166
1173
|
allowSeparator = 1;
|
|
1167
1174
|
continue;
|
|
@@ -1172,7 +1179,7 @@
|
|
|
1172
1179
|
--digit;
|
|
1173
1180
|
}
|
|
1174
1181
|
if (allowSeparator) {
|
|
1175
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column },
|
|
1182
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 155);
|
|
1176
1183
|
}
|
|
1177
1184
|
if (digit >= 0 && !isIdentifierStart(char) && char !== 46) {
|
|
1178
1185
|
parser.tokenValue = value;
|
|
@@ -1237,7 +1244,7 @@
|
|
|
1237
1244
|
const { index } = parser;
|
|
1238
1245
|
char = advanceChar(parser);
|
|
1239
1246
|
if (char === 95) {
|
|
1240
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column },
|
|
1247
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 154);
|
|
1241
1248
|
}
|
|
1242
1249
|
allowSeparator = 1;
|
|
1243
1250
|
ret += parser.source.substring(start, index);
|
|
@@ -1248,7 +1255,7 @@
|
|
|
1248
1255
|
char = advanceChar(parser);
|
|
1249
1256
|
}
|
|
1250
1257
|
if (allowSeparator) {
|
|
1251
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column },
|
|
1258
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 155);
|
|
1252
1259
|
}
|
|
1253
1260
|
return ret + parser.source.substring(start, parser.index);
|
|
1254
1261
|
}
|
|
@@ -1969,7 +1976,7 @@
|
|
|
1969
1976
|
advanceChar(parser);
|
|
1970
1977
|
if ((state & 1 || isStartOfLine) && parser.currentChar === 62) {
|
|
1971
1978
|
if (!parser.options.webcompat)
|
|
1972
|
-
parser.report(
|
|
1979
|
+
parser.report(114);
|
|
1973
1980
|
advanceChar(parser);
|
|
1974
1981
|
state = skipSingleHTMLComment(parser, source, state, context, 3, parser.tokenStart);
|
|
1975
1982
|
continue;
|
|
@@ -2198,10 +2205,10 @@
|
|
|
2198
2205
|
function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
2199
2206
|
if (context & 1) {
|
|
2200
2207
|
if ((t & 36864) === 36864) {
|
|
2201
|
-
parser.report(
|
|
2208
|
+
parser.report(120);
|
|
2202
2209
|
}
|
|
2203
2210
|
if (!skipEvalArgCheck && (t & 537079808) === 537079808) {
|
|
2204
|
-
parser.report(
|
|
2211
|
+
parser.report(121);
|
|
2205
2212
|
}
|
|
2206
2213
|
}
|
|
2207
2214
|
if ((t & 20480) === 20480 || t === -2147483527) {
|
|
@@ -2211,7 +2218,7 @@
|
|
|
2211
2218
|
parser.report(100);
|
|
2212
2219
|
}
|
|
2213
2220
|
if (context & (2048 | 2) && t === 209006) {
|
|
2214
|
-
parser.report(
|
|
2221
|
+
parser.report(112);
|
|
2215
2222
|
}
|
|
2216
2223
|
if (context & (1024 | 1) && t === 241771) {
|
|
2217
2224
|
parser.report(97, 'yield');
|
|
@@ -2220,10 +2227,10 @@
|
|
|
2220
2227
|
function validateFunctionName(parser, context, t) {
|
|
2221
2228
|
if (context & 1) {
|
|
2222
2229
|
if ((t & 36864) === 36864) {
|
|
2223
|
-
parser.report(
|
|
2230
|
+
parser.report(120);
|
|
2224
2231
|
}
|
|
2225
2232
|
if ((t & 537079808) === 537079808) {
|
|
2226
|
-
parser.report(
|
|
2233
|
+
parser.report(121);
|
|
2227
2234
|
}
|
|
2228
2235
|
if (t === -2147483526) {
|
|
2229
2236
|
parser.report(95);
|
|
@@ -2236,7 +2243,7 @@
|
|
|
2236
2243
|
parser.report(102);
|
|
2237
2244
|
}
|
|
2238
2245
|
if (context & (2048 | 2) && t === 209006) {
|
|
2239
|
-
parser.report(
|
|
2246
|
+
parser.report(112);
|
|
2240
2247
|
}
|
|
2241
2248
|
if (context & (1024 | 1) && t === 241771) {
|
|
2242
2249
|
parser.report(97, 'yield');
|
|
@@ -2245,7 +2252,10 @@
|
|
|
2245
2252
|
function isStrictReservedWord(parser, context, t) {
|
|
2246
2253
|
if (t === 209006) {
|
|
2247
2254
|
if (context & (2048 | 2))
|
|
2248
|
-
parser.report(
|
|
2255
|
+
parser.report(112);
|
|
2256
|
+
if ((parser.destructible & 128) === 0) {
|
|
2257
|
+
parser.firstAwaitLocation ??= { start: parser.tokenStart, end: parser.currentLocation };
|
|
2258
|
+
}
|
|
2249
2259
|
parser.destructible |= 128;
|
|
2250
2260
|
}
|
|
2251
2261
|
if (t === 241771 && context & 1024)
|
|
@@ -2261,7 +2271,7 @@
|
|
|
2261
2271
|
while (labels) {
|
|
2262
2272
|
if (labels['$' + name]) {
|
|
2263
2273
|
if (isIterationStatement)
|
|
2264
|
-
parser.report(
|
|
2274
|
+
parser.report(139);
|
|
2265
2275
|
return 1;
|
|
2266
2276
|
}
|
|
2267
2277
|
if (isIterationStatement && labels.loop)
|
|
@@ -2274,7 +2284,7 @@
|
|
|
2274
2284
|
let set = labels;
|
|
2275
2285
|
while (set) {
|
|
2276
2286
|
if (set['$' + name])
|
|
2277
|
-
parser.report(
|
|
2287
|
+
parser.report(138, name);
|
|
2278
2288
|
set = set['$'];
|
|
2279
2289
|
}
|
|
2280
2290
|
labels['$' + name] = 1;
|
|
@@ -2302,14 +2312,14 @@
|
|
|
2302
2312
|
function classifyIdentifier(parser, context, t) {
|
|
2303
2313
|
if ((t & 537079808) === 537079808) {
|
|
2304
2314
|
if (context & 1)
|
|
2305
|
-
parser.report(
|
|
2315
|
+
parser.report(121);
|
|
2306
2316
|
parser.flags |= 512;
|
|
2307
2317
|
}
|
|
2308
2318
|
if (!isValidIdentifier(context, t))
|
|
2309
2319
|
parser.report(0);
|
|
2310
2320
|
}
|
|
2311
2321
|
|
|
2312
|
-
const entities = {
|
|
2322
|
+
const entities = new Map(Object.entries({
|
|
2313
2323
|
AElig: '\u00C6',
|
|
2314
2324
|
AMP: '\u0026',
|
|
2315
2325
|
Aacute: '\u00C1',
|
|
@@ -4435,8 +4445,8 @@
|
|
|
4435
4445
|
zscr: '\uD835\uDCCF',
|
|
4436
4446
|
zwj: '\u200D',
|
|
4437
4447
|
zwnj: '\u200C',
|
|
4438
|
-
};
|
|
4439
|
-
const decodeMap = {
|
|
4448
|
+
}));
|
|
4449
|
+
const decodeMap = new Map(Object.entries({
|
|
4440
4450
|
'0': 65533,
|
|
4441
4451
|
'128': 8364,
|
|
4442
4452
|
'130': 8218,
|
|
@@ -4465,7 +4475,7 @@
|
|
|
4465
4475
|
'156': 339,
|
|
4466
4476
|
'158': 382,
|
|
4467
4477
|
'159': 376,
|
|
4468
|
-
};
|
|
4478
|
+
}).map(([key, value]) => [Number(key), value]));
|
|
4469
4479
|
function decodeHTMLStrict(text) {
|
|
4470
4480
|
return text.replaceAll(/&(?:[a-zA-Z]+|#[xX][\da-fA-F]+|#\d+);/g, (key) => {
|
|
4471
4481
|
if (key.charAt(1) === '#') {
|
|
@@ -4473,14 +4483,14 @@
|
|
|
4473
4483
|
const codePoint = secondChar === 'X' || secondChar === 'x' ? parseInt(key.slice(3), 16) : parseInt(key.slice(2), 10);
|
|
4474
4484
|
return decodeCodePoint(codePoint);
|
|
4475
4485
|
}
|
|
4476
|
-
return
|
|
4486
|
+
return entities.get(key.slice(1, -1)) ?? key;
|
|
4477
4487
|
});
|
|
4478
4488
|
}
|
|
4479
4489
|
function decodeCodePoint(codePoint) {
|
|
4480
4490
|
if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
|
|
4481
4491
|
return '\uFFFD';
|
|
4482
4492
|
}
|
|
4483
|
-
return String.fromCodePoint(
|
|
4493
|
+
return String.fromCodePoint(decodeMap.get(codePoint) ?? codePoint);
|
|
4484
4494
|
}
|
|
4485
4495
|
|
|
4486
4496
|
function scanJSXAttributeValue(parser, context) {
|
|
@@ -4527,6 +4537,12 @@
|
|
|
4527
4537
|
parser.setToken(2162700);
|
|
4528
4538
|
return;
|
|
4529
4539
|
}
|
|
4540
|
+
if (parser.currentChar === 125) {
|
|
4541
|
+
parser.report(180);
|
|
4542
|
+
}
|
|
4543
|
+
if (parser.currentChar === 62) {
|
|
4544
|
+
parser.report(181);
|
|
4545
|
+
}
|
|
4530
4546
|
let state = 0;
|
|
4531
4547
|
while (parser.index < parser.end) {
|
|
4532
4548
|
const type = CharTypes[parser.source.charCodeAt(parser.index)];
|
|
@@ -4565,6 +4581,8 @@
|
|
|
4565
4581
|
return parser.getToken();
|
|
4566
4582
|
}
|
|
4567
4583
|
|
|
4584
|
+
const nextFeatures = 1 | 2 | 4;
|
|
4585
|
+
|
|
4568
4586
|
function normalizeRanges(ranges) {
|
|
4569
4587
|
if (!ranges)
|
|
4570
4588
|
return undefined;
|
|
@@ -4577,17 +4595,27 @@
|
|
|
4577
4595
|
};
|
|
4578
4596
|
}
|
|
4579
4597
|
function normalizeOptions(rawOptions) {
|
|
4580
|
-
|
|
4598
|
+
let { features, next, ranges, module, sourceType, globalReturn, ...restOptions } = {
|
|
4581
4599
|
validateRegex: true,
|
|
4600
|
+
features: 0,
|
|
4582
4601
|
...rawOptions,
|
|
4583
|
-
ranges: normalizeRanges(rawOptions.ranges),
|
|
4584
4602
|
};
|
|
4585
|
-
if (
|
|
4586
|
-
|
|
4603
|
+
if (next) {
|
|
4604
|
+
features |= nextFeatures;
|
|
4587
4605
|
}
|
|
4588
|
-
|
|
4589
|
-
|
|
4606
|
+
ranges = normalizeRanges(ranges);
|
|
4607
|
+
if (module && !sourceType) {
|
|
4608
|
+
sourceType = 'module';
|
|
4590
4609
|
}
|
|
4610
|
+
if (globalReturn && (!sourceType || sourceType === 'script')) {
|
|
4611
|
+
sourceType = 'commonjs';
|
|
4612
|
+
}
|
|
4613
|
+
const options = {
|
|
4614
|
+
...restOptions,
|
|
4615
|
+
ranges,
|
|
4616
|
+
features,
|
|
4617
|
+
sourceType,
|
|
4618
|
+
};
|
|
4591
4619
|
return options;
|
|
4592
4620
|
}
|
|
4593
4621
|
|
|
@@ -4608,7 +4636,7 @@
|
|
|
4608
4636
|
const value = privateIdentifiers.get(name);
|
|
4609
4637
|
if (this.hasPrivateIdentifier(name) &&
|
|
4610
4638
|
((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
|
|
4611
|
-
this.parser.report(
|
|
4639
|
+
this.parser.report(148, name);
|
|
4612
4640
|
}
|
|
4613
4641
|
privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
|
|
4614
4642
|
}
|
|
@@ -4669,17 +4697,17 @@
|
|
|
4669
4697
|
((kind & 128 && value & 68) ||
|
|
4670
4698
|
(value & 128 && kind & 68))) ;
|
|
4671
4699
|
else {
|
|
4672
|
-
parser.report(
|
|
4700
|
+
parser.report(147, name);
|
|
4673
4701
|
}
|
|
4674
4702
|
}
|
|
4675
4703
|
if (currentScope === this) {
|
|
4676
4704
|
if (value && value & 1 && kind & 1) {
|
|
4677
|
-
currentScope.recordScopeError(
|
|
4705
|
+
currentScope.recordScopeError(147, name);
|
|
4678
4706
|
}
|
|
4679
4707
|
}
|
|
4680
4708
|
if (value &&
|
|
4681
4709
|
(value & 256 || (value & 512 && !parser.options.webcompat))) {
|
|
4682
|
-
parser.report(
|
|
4710
|
+
parser.report(147, name);
|
|
4683
4711
|
}
|
|
4684
4712
|
currentScope.variableBindings.set(name, kind);
|
|
4685
4713
|
currentScope = currentScope.parent;
|
|
@@ -4688,12 +4716,12 @@
|
|
|
4688
4716
|
hasVariable(name) {
|
|
4689
4717
|
return this.variableBindings.has(name);
|
|
4690
4718
|
}
|
|
4691
|
-
addBlockName(context, name, kind, origin) {
|
|
4719
|
+
addBlockName(context, name, kind, origin = 0) {
|
|
4692
4720
|
const { parser } = this;
|
|
4693
4721
|
const value = this.variableBindings.get(name);
|
|
4694
4722
|
if (value && (value & 2) === 0) {
|
|
4695
4723
|
if (kind & 1) {
|
|
4696
|
-
this.recordScopeError(
|
|
4724
|
+
this.recordScopeError(147, name);
|
|
4697
4725
|
}
|
|
4698
4726
|
else if (parser.options.webcompat &&
|
|
4699
4727
|
(context & 1) === 0 &&
|
|
@@ -4701,22 +4729,22 @@
|
|
|
4701
4729
|
value === 64 &&
|
|
4702
4730
|
kind === 64) ;
|
|
4703
4731
|
else {
|
|
4704
|
-
parser.report(
|
|
4732
|
+
parser.report(147, name);
|
|
4705
4733
|
}
|
|
4706
4734
|
}
|
|
4707
4735
|
if (this.type & 64 &&
|
|
4708
4736
|
this.parent?.hasVariable(name) &&
|
|
4709
4737
|
(this.parent.variableBindings.get(name) & 2) === 0) {
|
|
4710
|
-
parser.report(
|
|
4738
|
+
parser.report(147, name);
|
|
4711
4739
|
}
|
|
4712
4740
|
if (this.type & 512 && value && (value & 2) === 0) {
|
|
4713
4741
|
if (kind & 1) {
|
|
4714
|
-
this.recordScopeError(
|
|
4742
|
+
this.recordScopeError(147, name);
|
|
4715
4743
|
}
|
|
4716
4744
|
}
|
|
4717
4745
|
if (this.type & 32) {
|
|
4718
4746
|
if (this.parent.variableBindings.get(name) & 768)
|
|
4719
|
-
parser.report(
|
|
4747
|
+
parser.report(161, name);
|
|
4720
4748
|
}
|
|
4721
4749
|
this.variableBindings.set(name, kind);
|
|
4722
4750
|
}
|
|
@@ -4738,7 +4766,7 @@
|
|
|
4738
4766
|
}
|
|
4739
4767
|
function createArrowHeadParsingScope(parser, context, value) {
|
|
4740
4768
|
const scope = parser.createScope().createChildScope(512);
|
|
4741
|
-
scope.addBlockName(context, value, 1
|
|
4769
|
+
scope.addBlockName(context, value, 1);
|
|
4742
4770
|
return scope;
|
|
4743
4771
|
}
|
|
4744
4772
|
|
|
@@ -4748,6 +4776,7 @@
|
|
|
4748
4776
|
options;
|
|
4749
4777
|
token = 1048576;
|
|
4750
4778
|
flags = 0;
|
|
4779
|
+
features = 0;
|
|
4751
4780
|
index = 0;
|
|
4752
4781
|
line = 1;
|
|
4753
4782
|
column = 0;
|
|
@@ -4767,12 +4796,14 @@
|
|
|
4767
4796
|
assignable = 0;
|
|
4768
4797
|
destructible = 0;
|
|
4769
4798
|
strictReservedRange = null;
|
|
4799
|
+
firstAwaitLocation = null;
|
|
4770
4800
|
leadingDecorators = { decorators: [] };
|
|
4771
4801
|
constructor(source, rawOptions = {}) {
|
|
4772
4802
|
this.source = source;
|
|
4773
4803
|
this.end = source.length;
|
|
4774
4804
|
this.currentChar = source.charCodeAt(0);
|
|
4775
4805
|
this.options = normalizeOptions(rawOptions);
|
|
4806
|
+
this.features = this.options.features;
|
|
4776
4807
|
if (Array.isArray(this.options.onComment)) {
|
|
4777
4808
|
this.options.onComment = pushComment(this.options.onComment, this.options);
|
|
4778
4809
|
}
|
|
@@ -4853,7 +4884,7 @@
|
|
|
4853
4884
|
declareUnboundVariable(name) {
|
|
4854
4885
|
const { exportedNames } = this;
|
|
4855
4886
|
if (exportedNames.has(name)) {
|
|
4856
|
-
this.report(
|
|
4887
|
+
this.report(149, name);
|
|
4857
4888
|
}
|
|
4858
4889
|
exportedNames.add(name);
|
|
4859
4890
|
}
|
|
@@ -4876,29 +4907,10 @@
|
|
|
4876
4907
|
return undefined;
|
|
4877
4908
|
}
|
|
4878
4909
|
cloneIdentifier(original) {
|
|
4879
|
-
return
|
|
4910
|
+
return structuredClone(original);
|
|
4880
4911
|
}
|
|
4881
4912
|
cloneStringLiteral(original) {
|
|
4882
|
-
return
|
|
4883
|
-
}
|
|
4884
|
-
cloneLocationInformation(node, original) {
|
|
4885
|
-
const { ranges } = this.options;
|
|
4886
|
-
if (ranges) {
|
|
4887
|
-
if (ranges.start)
|
|
4888
|
-
node.start = original.start;
|
|
4889
|
-
if (ranges.end)
|
|
4890
|
-
node.end = original.end;
|
|
4891
|
-
if (ranges.range)
|
|
4892
|
-
node.range = [...original.range];
|
|
4893
|
-
}
|
|
4894
|
-
if (this.options.loc) {
|
|
4895
|
-
node.loc = {
|
|
4896
|
-
...original.loc,
|
|
4897
|
-
start: { ...original.loc.start },
|
|
4898
|
-
end: { ...original.loc.end },
|
|
4899
|
-
};
|
|
4900
|
-
}
|
|
4901
|
-
return node;
|
|
4913
|
+
return structuredClone(original);
|
|
4902
4914
|
}
|
|
4903
4915
|
}
|
|
4904
4916
|
function pushComment(comments, options) {
|
|
@@ -4961,7 +4973,7 @@
|
|
|
4961
4973
|
if (scope) {
|
|
4962
4974
|
for (const name of parser.exportedBindings) {
|
|
4963
4975
|
if (!scope.hasVariable(name))
|
|
4964
|
-
parser.report(
|
|
4976
|
+
parser.report(150, name);
|
|
4965
4977
|
}
|
|
4966
4978
|
}
|
|
4967
4979
|
}
|
|
@@ -4993,7 +5005,7 @@
|
|
|
4993
5005
|
statements.push(parseDirective(parser, context, expr, token, tokenStart));
|
|
4994
5006
|
}
|
|
4995
5007
|
while (parser.getToken() !== 1048576) {
|
|
4996
|
-
statements.push(parseStatementListItem(parser, context, scope, undefined,
|
|
5008
|
+
statements.push(parseStatementListItem(parser, context, scope, undefined, {}, 4));
|
|
4997
5009
|
}
|
|
4998
5010
|
return statements;
|
|
4999
5011
|
}
|
|
@@ -5023,36 +5035,42 @@
|
|
|
5023
5035
|
moduleItem = parseExportDeclaration(parser, context, scope);
|
|
5024
5036
|
break;
|
|
5025
5037
|
case 86106:
|
|
5038
|
+
if (parser.leadingDecorators.decorators.length) {
|
|
5039
|
+
parser.report(172);
|
|
5040
|
+
}
|
|
5026
5041
|
moduleItem = parseImportDeclaration(parser, context, scope);
|
|
5027
5042
|
break;
|
|
5028
5043
|
default:
|
|
5029
|
-
moduleItem = parseStatementListItem(parser, context, scope, undefined,
|
|
5030
|
-
}
|
|
5031
|
-
if (parser.leadingDecorators?.decorators.length) {
|
|
5032
|
-
parser.report(170);
|
|
5044
|
+
moduleItem = parseStatementListItem(parser, context, scope, undefined, {}, 4);
|
|
5033
5045
|
}
|
|
5034
5046
|
return moduleItem;
|
|
5035
5047
|
}
|
|
5036
|
-
function parseStatementListItem(parser, context, scope, privateScope,
|
|
5048
|
+
function parseStatementListItem(parser, context, scope, privateScope, labels, origin = 2) {
|
|
5037
5049
|
const start = parser.tokenStart;
|
|
5050
|
+
if (parser.leadingDecorators.decorators.length && parser.getToken() !== 86094) {
|
|
5051
|
+
parser.report(172);
|
|
5052
|
+
}
|
|
5038
5053
|
switch (parser.getToken()) {
|
|
5039
5054
|
case 86104:
|
|
5040
|
-
return parseFunctionDeclaration(parser, context, scope, privateScope,
|
|
5055
|
+
return parseFunctionDeclaration(parser, context, scope, privateScope, 1, 0, 0, start, origin);
|
|
5041
5056
|
case 133:
|
|
5057
|
+
if (!(parser.features & 1)) {
|
|
5058
|
+
parser.report(30, '@');
|
|
5059
|
+
}
|
|
5042
5060
|
case 86094:
|
|
5043
5061
|
return parseClassDeclaration(parser, context, scope, privateScope, 0);
|
|
5044
5062
|
case 86090:
|
|
5045
|
-
return parseLexicalDeclaration(parser, context, scope, privateScope, 16
|
|
5063
|
+
return parseLexicalDeclaration(parser, context, scope, privateScope, 16);
|
|
5046
5064
|
case 241737:
|
|
5047
5065
|
return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin);
|
|
5048
5066
|
case 209013:
|
|
5049
|
-
return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope,
|
|
5067
|
+
return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin);
|
|
5050
5068
|
case 209006:
|
|
5051
5069
|
if ((context & 2048 || (context & 2 && context & 8)) &&
|
|
5052
5070
|
nextTokenIsUsingOnSameLine(parser)) {
|
|
5053
|
-
return parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope,
|
|
5071
|
+
return parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin);
|
|
5054
5072
|
}
|
|
5055
|
-
return parseStatement(parser, context, scope, privateScope,
|
|
5073
|
+
return parseStatement(parser, context, scope, privateScope, labels, 1, origin);
|
|
5056
5074
|
case 20564:
|
|
5057
5075
|
parser.report(103, 'export');
|
|
5058
5076
|
case 86106:
|
|
@@ -5066,15 +5084,15 @@
|
|
|
5066
5084
|
parser.report(103, 'import');
|
|
5067
5085
|
}
|
|
5068
5086
|
case 209005:
|
|
5069
|
-
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope,
|
|
5087
|
+
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 1, origin);
|
|
5070
5088
|
default:
|
|
5071
|
-
return parseStatement(parser, context, scope, privateScope,
|
|
5089
|
+
return parseStatement(parser, context, scope, privateScope, labels, 1, origin);
|
|
5072
5090
|
}
|
|
5073
5091
|
}
|
|
5074
|
-
function parseStatement(parser, context, scope, privateScope,
|
|
5092
|
+
function parseStatement(parser, context, scope, privateScope, labels, allowFuncDecl, origin = 0) {
|
|
5075
5093
|
switch (parser.getToken()) {
|
|
5076
5094
|
case 86088:
|
|
5077
|
-
return parseVariableStatement(parser, context, scope, privateScope
|
|
5095
|
+
return parseVariableStatement(parser, context, scope, privateScope);
|
|
5078
5096
|
case 20572:
|
|
5079
5097
|
return parseReturnStatement(parser, context, privateScope);
|
|
5080
5098
|
case 20569:
|
|
@@ -5104,11 +5122,11 @@
|
|
|
5104
5122
|
case 20560:
|
|
5105
5123
|
return parseDebuggerStatement(parser, context);
|
|
5106
5124
|
case 209005:
|
|
5107
|
-
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope,
|
|
5125
|
+
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 0, origin);
|
|
5108
5126
|
case 20557:
|
|
5109
|
-
parser.report(
|
|
5127
|
+
parser.report(164);
|
|
5110
5128
|
case 20566:
|
|
5111
|
-
parser.report(
|
|
5129
|
+
parser.report(165);
|
|
5112
5130
|
case 86104:
|
|
5113
5131
|
parser.report(context & 1
|
|
5114
5132
|
? 76
|
|
@@ -5118,10 +5136,10 @@
|
|
|
5118
5136
|
case 86094:
|
|
5119
5137
|
parser.report(79);
|
|
5120
5138
|
default:
|
|
5121
|
-
return parseExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5139
|
+
return parseExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, origin);
|
|
5122
5140
|
}
|
|
5123
5141
|
}
|
|
5124
|
-
function parseExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5142
|
+
function parseExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, origin) {
|
|
5125
5143
|
const { tokenValue, tokenStart } = parser;
|
|
5126
5144
|
const token = parser.getToken();
|
|
5127
5145
|
let expr;
|
|
@@ -5136,11 +5154,11 @@
|
|
|
5136
5154
|
default:
|
|
5137
5155
|
expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart);
|
|
5138
5156
|
}
|
|
5139
|
-
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5157
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, expr, token, tokenValue, tokenStart, origin);
|
|
5140
5158
|
}
|
|
5141
|
-
function finishExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5159
|
+
function finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, initialExpression, token, tokenValue, tokenStart, origin) {
|
|
5142
5160
|
if (token & 143360 && parser.getToken() === 21) {
|
|
5143
|
-
return parseLabelledStatement(parser, context, scope, privateScope,
|
|
5161
|
+
return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, initialExpression, token, allowFuncDecl, tokenStart, origin);
|
|
5144
5162
|
}
|
|
5145
5163
|
let expression = parseMemberOrUpdateExpression(parser, context, privateScope, initialExpression, 0, 0, tokenStart);
|
|
5146
5164
|
expression = parseAssignmentExpression(parser, context, privateScope, 0, 0, tokenStart, expression);
|
|
@@ -5153,7 +5171,7 @@
|
|
|
5153
5171
|
const body = [];
|
|
5154
5172
|
consume(parser, context | 32, 2162700);
|
|
5155
5173
|
while (parser.getToken() !== 1074790415) {
|
|
5156
|
-
body.push(parseStatementListItem(parser, context, scope, privateScope,
|
|
5174
|
+
body.push(parseStatementListItem(parser, context, scope, privateScope, { $: labels }));
|
|
5157
5175
|
}
|
|
5158
5176
|
consume(parser, context | 32, 1074790415);
|
|
5159
5177
|
return parser.finishNode({
|
|
@@ -5182,7 +5200,7 @@
|
|
|
5182
5200
|
expression,
|
|
5183
5201
|
}, start);
|
|
5184
5202
|
}
|
|
5185
|
-
function parseLabelledStatement(parser, context, scope, privateScope,
|
|
5203
|
+
function parseLabelledStatement(parser, context, scope, privateScope, labels, value, expr, token, allowFuncDecl, start, origin) {
|
|
5186
5204
|
validateBindingIdentifier(parser, context, 0, token, 1);
|
|
5187
5205
|
validateAndDeclareLabel(parser, labels, value);
|
|
5188
5206
|
nextToken(parser, context | 32);
|
|
@@ -5190,27 +5208,27 @@
|
|
|
5190
5208
|
(context & 1) === 0 &&
|
|
5191
5209
|
parser.options.webcompat &&
|
|
5192
5210
|
parser.getToken() === 86104
|
|
5193
|
-
? parseFunctionDeclaration(parser, context, scope?.createChildScope(), privateScope,
|
|
5194
|
-
: parseStatement(parser, context, scope, privateScope,
|
|
5211
|
+
? parseFunctionDeclaration(parser, context, scope?.createChildScope(), privateScope, 0, 0, 0, parser.tokenStart, origin)
|
|
5212
|
+
: parseStatement(parser, context, scope, privateScope, labels, allowFuncDecl, origin);
|
|
5195
5213
|
return parser.finishNode({
|
|
5196
5214
|
type: 'LabeledStatement',
|
|
5197
5215
|
label: expr,
|
|
5198
5216
|
body,
|
|
5199
5217
|
}, start);
|
|
5200
5218
|
}
|
|
5201
|
-
function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope,
|
|
5219
|
+
function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, allowFuncDecl, origin) {
|
|
5202
5220
|
const { tokenValue, tokenStart: start } = parser;
|
|
5203
5221
|
const token = parser.getToken();
|
|
5204
5222
|
let expr = parseIdentifier(parser, context);
|
|
5205
5223
|
if (parser.getToken() === 21) {
|
|
5206
|
-
return parseLabelledStatement(parser, context, scope, privateScope,
|
|
5224
|
+
return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, 1, start, origin);
|
|
5207
5225
|
}
|
|
5208
5226
|
const asyncNewLine = parser.flags & 1;
|
|
5209
5227
|
if (!asyncNewLine) {
|
|
5210
5228
|
if (parser.getToken() === 86104) {
|
|
5211
5229
|
if (!allowFuncDecl)
|
|
5212
|
-
parser.report(
|
|
5213
|
-
return parseFunctionDeclaration(parser, context, scope, privateScope,
|
|
5230
|
+
parser.report(125);
|
|
5231
|
+
return parseFunctionDeclaration(parser, context, scope, privateScope, 1, 0, 1, start, origin);
|
|
5214
5232
|
}
|
|
5215
5233
|
if (isValidIdentifier(context, parser.getToken())) {
|
|
5216
5234
|
expr = parseAsyncArrowAfterIdent(parser, context, privateScope, 1, start);
|
|
@@ -5220,7 +5238,7 @@
|
|
|
5220
5238
|
}
|
|
5221
5239
|
}
|
|
5222
5240
|
if (parser.getToken() === 67174411) {
|
|
5223
|
-
expr = parseAsyncArrowOrCallExpression(parser, context, privateScope, expr, 1, 1,
|
|
5241
|
+
expr = parseAsyncArrowOrCallExpression(parser, context, privateScope, expr, 1, 1, asyncNewLine, start);
|
|
5224
5242
|
}
|
|
5225
5243
|
else {
|
|
5226
5244
|
if (parser.getToken() === 10) {
|
|
@@ -5306,8 +5324,8 @@
|
|
|
5306
5324
|
return context & 1 ||
|
|
5307
5325
|
!parser.options.webcompat ||
|
|
5308
5326
|
parser.getToken() !== 86104
|
|
5309
|
-
? parseStatement(parser, context, scope, privateScope,
|
|
5310
|
-
: parseFunctionDeclaration(parser, context, scope?.createChildScope(), privateScope, 0, 0, 0,
|
|
5327
|
+
? parseStatement(parser, context, scope, privateScope, { $: labels }, 0)
|
|
5328
|
+
: parseFunctionDeclaration(parser, context, scope?.createChildScope(), privateScope, 0, 0, 0, tokenStart);
|
|
5311
5329
|
}
|
|
5312
5330
|
function parseSwitchStatement(parser, context, scope, privateScope, labels) {
|
|
5313
5331
|
const start = parser.tokenStart;
|
|
@@ -5336,7 +5354,7 @@
|
|
|
5336
5354
|
while (parser.getToken() !== 20556 &&
|
|
5337
5355
|
parser.getToken() !== 1074790415 &&
|
|
5338
5356
|
parser.getToken() !== 20561) {
|
|
5339
|
-
const statement = parseStatementListItem(parser, context | 4, scope, privateScope,
|
|
5357
|
+
const statement = parseStatementListItem(parser, context | 4, scope, privateScope, {
|
|
5340
5358
|
$: labels,
|
|
5341
5359
|
});
|
|
5342
5360
|
if (statement.type === 'VariableDeclaration' &&
|
|
@@ -5372,7 +5390,7 @@
|
|
|
5372
5390
|
}, start);
|
|
5373
5391
|
}
|
|
5374
5392
|
function parseIterationStatementBody(parser, context, scope, privateScope, labels) {
|
|
5375
|
-
return parseStatement(parser, ((context | 131072) ^ 131072) | 128, scope, privateScope,
|
|
5393
|
+
return parseStatement(parser, ((context | 131072) ^ 131072) | 128, scope, privateScope, { loop: 1, $: labels }, 0);
|
|
5376
5394
|
}
|
|
5377
5395
|
function parseContinueStatement(parser, context, labels) {
|
|
5378
5396
|
if ((context & 128) === 0)
|
|
@@ -5384,7 +5402,7 @@
|
|
|
5384
5402
|
const { tokenValue } = parser;
|
|
5385
5403
|
label = parseIdentifier(parser, context | 32);
|
|
5386
5404
|
if (!isValidLabel(parser, labels, tokenValue, 1))
|
|
5387
|
-
parser.report(
|
|
5405
|
+
parser.report(140, tokenValue);
|
|
5388
5406
|
}
|
|
5389
5407
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5390
5408
|
return parser.finishNode({
|
|
@@ -5400,7 +5418,7 @@
|
|
|
5400
5418
|
const { tokenValue } = parser;
|
|
5401
5419
|
label = parseIdentifier(parser, context | 32);
|
|
5402
5420
|
if (!isValidLabel(parser, labels, tokenValue, 0))
|
|
5403
|
-
parser.report(
|
|
5421
|
+
parser.report(140, tokenValue);
|
|
5404
5422
|
}
|
|
5405
5423
|
else if ((context & (4 | 128)) === 0) {
|
|
5406
5424
|
parser.report(69);
|
|
@@ -5419,7 +5437,7 @@
|
|
|
5419
5437
|
consume(parser, context | 32, 67174411);
|
|
5420
5438
|
const object = parseExpressions(parser, context, privateScope, 0, 1, parser.tokenStart);
|
|
5421
5439
|
consume(parser, context | 32, 16);
|
|
5422
|
-
const body = parseStatement(parser, context, scope, privateScope,
|
|
5440
|
+
const body = parseStatement(parser, context, scope, privateScope, labels, 0, 2);
|
|
5423
5441
|
return parser.finishNode({
|
|
5424
5442
|
type: 'WithStatement',
|
|
5425
5443
|
object,
|
|
@@ -5466,7 +5484,7 @@
|
|
|
5466
5484
|
scope = scope?.createChildScope(4);
|
|
5467
5485
|
param = parseBindingPattern(parser, context, scope, privateScope, (parser.getToken() & 2097152) === 2097152
|
|
5468
5486
|
? 256
|
|
5469
|
-
: 512
|
|
5487
|
+
: 512);
|
|
5470
5488
|
if (parser.getToken() === 18) {
|
|
5471
5489
|
parser.report(86);
|
|
5472
5490
|
}
|
|
@@ -5515,7 +5533,7 @@
|
|
|
5515
5533
|
let expr = parseIdentifier(parser, context);
|
|
5516
5534
|
if (parser.getToken() & (143360 | 2097152) &&
|
|
5517
5535
|
(parser.getToken() & 20480) !== 20480) {
|
|
5518
|
-
const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, 8
|
|
5536
|
+
const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, 8);
|
|
5519
5537
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5520
5538
|
return parser.finishNode({
|
|
5521
5539
|
type: 'VariableDeclaration',
|
|
@@ -5527,7 +5545,7 @@
|
|
|
5527
5545
|
if (context & 1)
|
|
5528
5546
|
parser.report(85);
|
|
5529
5547
|
if (parser.getToken() === 21) {
|
|
5530
|
-
return parseLabelledStatement(parser, context, scope, privateScope,
|
|
5548
|
+
return parseLabelledStatement(parser, context, scope, privateScope, {}, tokenValue, expr, token, 0, tokenStart, origin);
|
|
5531
5549
|
}
|
|
5532
5550
|
if (parser.getToken() === 10) {
|
|
5533
5551
|
let scope = void 0;
|
|
@@ -5581,23 +5599,26 @@
|
|
|
5581
5599
|
function isResourceBindingStart(token) {
|
|
5582
5600
|
return (token & 143360) === 143360 && (token & 20480) !== 20480;
|
|
5583
5601
|
}
|
|
5584
|
-
function parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope,
|
|
5602
|
+
function parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin) {
|
|
5585
5603
|
const { tokenStart, tokenValue } = parser;
|
|
5586
5604
|
const token = parser.getToken();
|
|
5587
5605
|
const expression = parseIdentifier(parser, context);
|
|
5588
5606
|
if ((parser.flags & 1) === 0 && isResourceBindingStart(parser.getToken())) {
|
|
5589
|
-
if (origin & 4 &&
|
|
5607
|
+
if (origin & 4 &&
|
|
5608
|
+
context & 8 &&
|
|
5609
|
+
(context & 2) === 0 &&
|
|
5610
|
+
(context & 4096) === 0) {
|
|
5590
5611
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
5591
5612
|
}
|
|
5592
5613
|
return parseLexicalDeclaration(parser, context, scope, privateScope, 16, origin, 'using', tokenStart, 1);
|
|
5593
5614
|
}
|
|
5594
5615
|
parser.assignable = 1;
|
|
5595
|
-
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5616
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, 1, expression, token, tokenValue, tokenStart, origin);
|
|
5596
5617
|
}
|
|
5597
|
-
function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope,
|
|
5618
|
+
function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin) {
|
|
5598
5619
|
const start = parser.tokenStart;
|
|
5599
5620
|
if (context & 524288)
|
|
5600
|
-
parser.report(
|
|
5621
|
+
parser.report(179);
|
|
5601
5622
|
nextToken(parser, context | 32);
|
|
5602
5623
|
let argument;
|
|
5603
5624
|
if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
|
|
@@ -5618,9 +5639,9 @@
|
|
|
5618
5639
|
type: 'AwaitExpression',
|
|
5619
5640
|
argument,
|
|
5620
5641
|
}, start);
|
|
5621
|
-
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5642
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, 0, expression, 1048576, '', start, origin);
|
|
5622
5643
|
}
|
|
5623
|
-
function parseLexicalDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind, declarationStart = parser.tokenStart, keywordConsumed = 0) {
|
|
5644
|
+
function parseLexicalDeclaration(parser, context, scope, privateScope, kind, origin = 0, declarationKind, declarationStart = parser.tokenStart, keywordConsumed = 0) {
|
|
5624
5645
|
const start = declarationStart;
|
|
5625
5646
|
if (!keywordConsumed)
|
|
5626
5647
|
nextToken(parser, context);
|
|
@@ -5632,7 +5653,7 @@
|
|
|
5632
5653
|
declarations,
|
|
5633
5654
|
}, start);
|
|
5634
5655
|
}
|
|
5635
|
-
function parseVariableStatement(parser, context, scope, privateScope, origin) {
|
|
5656
|
+
function parseVariableStatement(parser, context, scope, privateScope, origin = 0) {
|
|
5636
5657
|
const start = parser.tokenStart;
|
|
5637
5658
|
nextToken(parser, context);
|
|
5638
5659
|
const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, 4, origin);
|
|
@@ -5643,7 +5664,7 @@
|
|
|
5643
5664
|
declarations,
|
|
5644
5665
|
}, start);
|
|
5645
5666
|
}
|
|
5646
|
-
function parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin, declarationKind) {
|
|
5667
|
+
function parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin = 0, declarationKind) {
|
|
5647
5668
|
let bindingCount = 1;
|
|
5648
5669
|
const firstDeclaration = parseVariableDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind);
|
|
5649
5670
|
const list = [firstDeclaration];
|
|
@@ -5654,7 +5675,7 @@
|
|
|
5654
5675
|
if (resourceNames) {
|
|
5655
5676
|
const { name } = declaration.id;
|
|
5656
5677
|
if (resourceNames.has(name))
|
|
5657
|
-
parser.report(
|
|
5678
|
+
parser.report(147, name);
|
|
5658
5679
|
resourceNames.add(name);
|
|
5659
5680
|
}
|
|
5660
5681
|
list.push(declaration);
|
|
@@ -5674,11 +5695,14 @@
|
|
|
5674
5695
|
const id = parseBindingPattern(parser, context, scope, privateScope, kind, origin);
|
|
5675
5696
|
if (parser.getToken() === 1077936155) {
|
|
5676
5697
|
nextToken(parser, context | 32);
|
|
5677
|
-
init = parseExpression(parser, context, privateScope, 1, 0, parser.tokenStart);
|
|
5698
|
+
init = parseExpression(parser, context, privateScope, 1, 0, parser.tokenStart, origin);
|
|
5678
5699
|
if (origin & 32) {
|
|
5679
5700
|
if (parser.getToken() === 471156 ||
|
|
5680
5701
|
(parser.getToken() === 8673330 &&
|
|
5681
|
-
(token & 2097152 ||
|
|
5702
|
+
(token & 2097152 ||
|
|
5703
|
+
(kind & 4) === 0 ||
|
|
5704
|
+
context & 1 ||
|
|
5705
|
+
!parser.options.webcompat))) {
|
|
5682
5706
|
throw new ParseError(tokenStart, parser.currentLocation, 60, parser.getToken() === 471156 ? 'of' : 'in');
|
|
5683
5707
|
}
|
|
5684
5708
|
}
|
|
@@ -5733,7 +5757,7 @@
|
|
|
5733
5757
|
parser.assignable = 1;
|
|
5734
5758
|
init = parseMemberOrUpdateExpression(parser, context, privateScope, init, 0, 0, tokenStart);
|
|
5735
5759
|
if (parser.getToken() === 471156)
|
|
5736
|
-
parser.report(
|
|
5760
|
+
parser.report(117);
|
|
5737
5761
|
}
|
|
5738
5762
|
}
|
|
5739
5763
|
else if (token === 209013) {
|
|
@@ -5785,7 +5809,7 @@
|
|
|
5785
5809
|
if (resourceNames) {
|
|
5786
5810
|
const { name } = declaration.id;
|
|
5787
5811
|
if (resourceNames.has(name))
|
|
5788
|
-
parser.report(
|
|
5812
|
+
parser.report(147, name);
|
|
5789
5813
|
resourceNames.add(name);
|
|
5790
5814
|
}
|
|
5791
5815
|
declarations.push(declaration);
|
|
@@ -5830,7 +5854,7 @@
|
|
|
5830
5854
|
else if (token === 209006 &&
|
|
5831
5855
|
(context & 2048 || (context & 2 && context & 8))) {
|
|
5832
5856
|
if (context & 524288)
|
|
5833
|
-
parser.report(
|
|
5857
|
+
parser.report(179);
|
|
5834
5858
|
nextToken(parser, context | 32);
|
|
5835
5859
|
let awaitArgument;
|
|
5836
5860
|
if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
|
|
@@ -5948,16 +5972,18 @@
|
|
|
5948
5972
|
}
|
|
5949
5973
|
function parseRestrictedIdentifier(parser, context, scope) {
|
|
5950
5974
|
if (!isValidIdentifier(context, parser.getToken()))
|
|
5951
|
-
parser.report(
|
|
5975
|
+
parser.report(120);
|
|
5952
5976
|
if ((parser.getToken() & 537079808) === 537079808)
|
|
5953
|
-
parser.report(
|
|
5954
|
-
scope?.addBlockName(context, parser.tokenValue, 8
|
|
5977
|
+
parser.report(121);
|
|
5978
|
+
scope?.addBlockName(context, parser.tokenValue, 8);
|
|
5955
5979
|
return parseIdentifier(parser, context);
|
|
5956
5980
|
}
|
|
5957
5981
|
function parseImportDeclaration(parser, context, scope) {
|
|
5958
5982
|
const start = parser.tokenStart;
|
|
5959
5983
|
nextToken(parser, context);
|
|
5960
5984
|
let source;
|
|
5985
|
+
let sourceParsed = false;
|
|
5986
|
+
let phase = null;
|
|
5961
5987
|
const { tokenStart } = parser;
|
|
5962
5988
|
let specifiers = [];
|
|
5963
5989
|
if (parser.getToken() === 134283267) {
|
|
@@ -5965,14 +5991,93 @@
|
|
|
5965
5991
|
}
|
|
5966
5992
|
else {
|
|
5967
5993
|
if (parser.getToken() & 143360) {
|
|
5968
|
-
const
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5994
|
+
const token = parser.getToken();
|
|
5995
|
+
const { tokenValue } = parser;
|
|
5996
|
+
const isPhaseDefer = parser.features & 2 && (token & -2147483648) === 0 && tokenValue == 'defer';
|
|
5997
|
+
const isPhaseSource = parser.features & 4 && (token & -2147483648) === 0 && tokenValue == 'source';
|
|
5998
|
+
if (isPhaseDefer || isPhaseSource) {
|
|
5999
|
+
const phaseOrLocal = parseIdentifier(parser, context);
|
|
6000
|
+
if (tokenValue === 'defer') {
|
|
6001
|
+
if (parser.getToken() === 8391476) {
|
|
6002
|
+
phase = 'defer';
|
|
6003
|
+
specifiers = [parseImportNamespaceSpecifier(parser, context, scope)];
|
|
6004
|
+
}
|
|
6005
|
+
else if (parser.getToken() === 209011 || parser.getToken() === 18) {
|
|
6006
|
+
scope?.addBlockName(context, tokenValue, 8);
|
|
6007
|
+
specifiers = [
|
|
6008
|
+
parser.finishNode({
|
|
6009
|
+
type: 'ImportDefaultSpecifier',
|
|
6010
|
+
local: phaseOrLocal,
|
|
6011
|
+
}, tokenStart),
|
|
6012
|
+
];
|
|
6013
|
+
}
|
|
6014
|
+
else {
|
|
6015
|
+
parser.report(108);
|
|
6016
|
+
}
|
|
6017
|
+
}
|
|
6018
|
+
else if (parser.getToken() === 209011) {
|
|
6019
|
+
const fromToken = parser.getToken();
|
|
6020
|
+
const fromStart = parser.tokenStart;
|
|
6021
|
+
const fromLocal = parseIdentifier(parser, context);
|
|
6022
|
+
if (parser.getToken() === 209011) {
|
|
6023
|
+
validateBindingIdentifier(parser, context, 16, fromToken, 0);
|
|
6024
|
+
scope?.addBlockName(context, fromLocal.name, 8);
|
|
6025
|
+
phase = 'source';
|
|
6026
|
+
specifiers = [
|
|
6027
|
+
parser.finishNode({
|
|
6028
|
+
type: 'ImportDefaultSpecifier',
|
|
6029
|
+
local: fromLocal,
|
|
6030
|
+
}, fromStart),
|
|
6031
|
+
];
|
|
6032
|
+
}
|
|
6033
|
+
else {
|
|
6034
|
+
scope?.addBlockName(context, tokenValue, 8);
|
|
6035
|
+
specifiers = [
|
|
6036
|
+
parser.finishNode({
|
|
6037
|
+
type: 'ImportDefaultSpecifier',
|
|
6038
|
+
local: phaseOrLocal,
|
|
6039
|
+
}, tokenStart),
|
|
6040
|
+
];
|
|
6041
|
+
if (parser.getToken() !== 134283267)
|
|
6042
|
+
parser.report(105, 'Import');
|
|
6043
|
+
source = parseLiteral(parser, context);
|
|
6044
|
+
sourceParsed = true;
|
|
6045
|
+
}
|
|
6046
|
+
}
|
|
6047
|
+
else if (parser.getToken() & 143360) {
|
|
6048
|
+
phase = 'source';
|
|
6049
|
+
const localStart = parser.tokenStart;
|
|
6050
|
+
const local = parseRestrictedIdentifier(parser, context, scope);
|
|
6051
|
+
specifiers = [
|
|
6052
|
+
parser.finishNode({
|
|
6053
|
+
type: 'ImportDefaultSpecifier',
|
|
6054
|
+
local,
|
|
6055
|
+
}, localStart),
|
|
6056
|
+
];
|
|
6057
|
+
}
|
|
6058
|
+
else if (parser.getToken() === 18) {
|
|
6059
|
+
scope?.addBlockName(context, tokenValue, 8);
|
|
6060
|
+
specifiers = [
|
|
6061
|
+
parser.finishNode({
|
|
6062
|
+
type: 'ImportDefaultSpecifier',
|
|
6063
|
+
local: phaseOrLocal,
|
|
6064
|
+
}, tokenStart),
|
|
6065
|
+
];
|
|
6066
|
+
}
|
|
6067
|
+
else {
|
|
6068
|
+
parser.report(109);
|
|
6069
|
+
}
|
|
6070
|
+
}
|
|
6071
|
+
else {
|
|
6072
|
+
const local = parseRestrictedIdentifier(parser, context, scope);
|
|
6073
|
+
specifiers = [
|
|
6074
|
+
parser.finishNode({
|
|
6075
|
+
type: 'ImportDefaultSpecifier',
|
|
6076
|
+
local,
|
|
6077
|
+
}, tokenStart),
|
|
6078
|
+
];
|
|
6079
|
+
}
|
|
6080
|
+
if (phase === null && !sourceParsed && consumeOpt(parser, context, 18)) {
|
|
5976
6081
|
switch (parser.getToken()) {
|
|
5977
6082
|
case 8391476:
|
|
5978
6083
|
specifiers.push(parseImportNamespaceSpecifier(parser, context, scope));
|
|
@@ -6001,7 +6106,8 @@
|
|
|
6001
6106
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
6002
6107
|
}
|
|
6003
6108
|
}
|
|
6004
|
-
|
|
6109
|
+
if (!sourceParsed)
|
|
6110
|
+
source = parseModuleSpecifier(parser, context);
|
|
6005
6111
|
}
|
|
6006
6112
|
const attributes = parseImportAttributes(parser, context);
|
|
6007
6113
|
const node = {
|
|
@@ -6009,6 +6115,7 @@
|
|
|
6009
6115
|
specifiers,
|
|
6010
6116
|
source,
|
|
6011
6117
|
attributes,
|
|
6118
|
+
...(parser.features & 2 || parser.features & 4 ? { phase } : null),
|
|
6012
6119
|
};
|
|
6013
6120
|
matchOrInsertSemicolon(parser, context | 32);
|
|
6014
6121
|
return parser.finishNode(node, start);
|
|
@@ -6056,7 +6163,7 @@
|
|
|
6056
6163
|
else {
|
|
6057
6164
|
parser.report(25, KeywordDescTable[77932 & 255]);
|
|
6058
6165
|
}
|
|
6059
|
-
scope?.addBlockName(context, tokenValue, 8
|
|
6166
|
+
scope?.addBlockName(context, tokenValue, 8);
|
|
6060
6167
|
specifiers.push(parser.finishNode({
|
|
6061
6168
|
type: 'ImportSpecifier',
|
|
6062
6169
|
local,
|
|
@@ -6091,17 +6198,24 @@
|
|
|
6091
6198
|
function parseExportDeclaration(parser, context, scope) {
|
|
6092
6199
|
const start = parser.leadingDecorators.decorators.length ? parser.leadingDecorators.start : parser.tokenStart;
|
|
6093
6200
|
nextToken(parser, context | 32);
|
|
6201
|
+
const isDefaultExport = consumeOpt(parser, context | 32, 20561);
|
|
6202
|
+
if (parser.leadingDecorators.decorators.length && parser.getToken() !== 86094) {
|
|
6203
|
+
parser.report(172);
|
|
6204
|
+
}
|
|
6094
6205
|
const specifiers = [];
|
|
6095
6206
|
let declaration = null;
|
|
6096
6207
|
let source = null;
|
|
6097
6208
|
let attributes = [];
|
|
6098
|
-
if (
|
|
6209
|
+
if (isDefaultExport) {
|
|
6099
6210
|
switch (parser.getToken()) {
|
|
6100
6211
|
case 86104: {
|
|
6101
|
-
declaration = parseFunctionDeclaration(parser, context, scope, undefined,
|
|
6212
|
+
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 1, 0, parser.tokenStart, 4);
|
|
6102
6213
|
break;
|
|
6103
6214
|
}
|
|
6104
6215
|
case 133:
|
|
6216
|
+
if (!(parser.features & 1)) {
|
|
6217
|
+
parser.report(30, '@');
|
|
6218
|
+
}
|
|
6105
6219
|
case 86094:
|
|
6106
6220
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 1);
|
|
6107
6221
|
break;
|
|
@@ -6111,11 +6225,11 @@
|
|
|
6111
6225
|
const { flags } = parser;
|
|
6112
6226
|
if ((flags & 1) === 0) {
|
|
6113
6227
|
if (parser.getToken() === 86104) {
|
|
6114
|
-
declaration = parseFunctionDeclaration(parser, context, scope, undefined,
|
|
6228
|
+
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 1, 1, tokenStart, 4);
|
|
6115
6229
|
}
|
|
6116
6230
|
else {
|
|
6117
6231
|
if (parser.getToken() === 67174411) {
|
|
6118
|
-
declaration = parseAsyncArrowOrCallExpression(parser, context, undefined, declaration, 1, 1,
|
|
6232
|
+
declaration = parseAsyncArrowOrCallExpression(parser, context, undefined, declaration, 1, 1, flags, tokenStart);
|
|
6119
6233
|
declaration = parseMemberOrUpdateExpression(parser, context, undefined, declaration, 0, 0, tokenStart);
|
|
6120
6234
|
declaration = parseAssignmentExpression(parser, context, undefined, 0, 0, tokenStart, declaration);
|
|
6121
6235
|
}
|
|
@@ -6214,7 +6328,7 @@
|
|
|
6214
6328
|
}
|
|
6215
6329
|
else {
|
|
6216
6330
|
if (hasLiteralLocal) {
|
|
6217
|
-
parser.report(
|
|
6331
|
+
parser.report(174);
|
|
6218
6332
|
}
|
|
6219
6333
|
if (scope) {
|
|
6220
6334
|
tmpExportedNames.forEach((n) => parser.declareUnboundVariable(n));
|
|
@@ -6225,11 +6339,14 @@
|
|
|
6225
6339
|
break;
|
|
6226
6340
|
}
|
|
6227
6341
|
case 133:
|
|
6342
|
+
if (!(parser.features & 1)) {
|
|
6343
|
+
parser.report(30, '@');
|
|
6344
|
+
}
|
|
6228
6345
|
case 86094:
|
|
6229
6346
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 2);
|
|
6230
6347
|
break;
|
|
6231
6348
|
case 86104:
|
|
6232
|
-
declaration = parseFunctionDeclaration(parser, context, scope, undefined,
|
|
6349
|
+
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 2, 0, parser.tokenStart, 4);
|
|
6233
6350
|
break;
|
|
6234
6351
|
case 241737:
|
|
6235
6352
|
declaration = parseLexicalDeclaration(parser, context, scope, undefined, 8, 64);
|
|
@@ -6244,7 +6361,7 @@
|
|
|
6244
6361
|
const { tokenStart } = parser;
|
|
6245
6362
|
nextToken(parser, context);
|
|
6246
6363
|
if ((parser.flags & 1) === 0 && parser.getToken() === 86104) {
|
|
6247
|
-
declaration = parseFunctionDeclaration(parser, context, scope, undefined,
|
|
6364
|
+
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 2, 1, tokenStart, 4);
|
|
6248
6365
|
break;
|
|
6249
6366
|
}
|
|
6250
6367
|
}
|
|
@@ -6260,8 +6377,8 @@
|
|
|
6260
6377
|
};
|
|
6261
6378
|
return parser.finishNode(node, start);
|
|
6262
6379
|
}
|
|
6263
|
-
function parseExpression(parser, context, privateScope, canAssign, inGroup, start) {
|
|
6264
|
-
let expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, canAssign, inGroup, 1, start);
|
|
6380
|
+
function parseExpression(parser, context, privateScope, canAssign, inGroup, start, origin = 0) {
|
|
6381
|
+
let expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, canAssign, inGroup, 1, start, origin);
|
|
6265
6382
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGroup, 0, start);
|
|
6266
6383
|
return parseAssignmentExpression(parser, context, privateScope, inGroup, 0, start, expr);
|
|
6267
6384
|
}
|
|
@@ -6357,7 +6474,7 @@
|
|
|
6357
6474
|
t = parser.getToken();
|
|
6358
6475
|
precedence = t & 3840;
|
|
6359
6476
|
if ((t & 524288 && operator & 268435456) || (operator & 524288 && t & 268435456)) {
|
|
6360
|
-
parser.report(
|
|
6477
|
+
parser.report(167);
|
|
6361
6478
|
}
|
|
6362
6479
|
if (precedence + ((t === 8391735) << 8) - ((bit === t) << 12) <= minPrecedence)
|
|
6363
6480
|
break;
|
|
@@ -6384,10 +6501,10 @@
|
|
|
6384
6501
|
parser.report(33);
|
|
6385
6502
|
if (context & 1 && unaryOperator === 16863276) {
|
|
6386
6503
|
if (arg.type === 'Identifier') {
|
|
6387
|
-
parser.report(
|
|
6504
|
+
parser.report(123);
|
|
6388
6505
|
}
|
|
6389
6506
|
else if (isPropertyWithPrivateFieldKey(arg)) {
|
|
6390
|
-
parser.report(
|
|
6507
|
+
parser.report(129);
|
|
6391
6508
|
}
|
|
6392
6509
|
}
|
|
6393
6510
|
parser.assignable = 2;
|
|
@@ -6416,7 +6533,7 @@
|
|
|
6416
6533
|
}
|
|
6417
6534
|
}
|
|
6418
6535
|
if (!inNew && parser.getToken() === 67174411) {
|
|
6419
|
-
return parseAsyncArrowOrCallExpression(parser, context, privateScope, expr, canAssign, 1,
|
|
6536
|
+
return parseAsyncArrowOrCallExpression(parser, context, privateScope, expr, canAssign, 1, flags, start);
|
|
6420
6537
|
}
|
|
6421
6538
|
if (parser.getToken() === 10) {
|
|
6422
6539
|
classifyIdentifier(parser, context, token);
|
|
@@ -6440,7 +6557,7 @@
|
|
|
6440
6557
|
if (!canAssign)
|
|
6441
6558
|
parser.report(26);
|
|
6442
6559
|
if (parser.getToken() === 22)
|
|
6443
|
-
parser.report(
|
|
6560
|
+
parser.report(126);
|
|
6444
6561
|
let argument = null;
|
|
6445
6562
|
let delegate = false;
|
|
6446
6563
|
if ((parser.flags & 1) === 0) {
|
|
@@ -6464,20 +6581,24 @@
|
|
|
6464
6581
|
return parseIdentifierOrArrow(parser, context, privateScope);
|
|
6465
6582
|
}
|
|
6466
6583
|
function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, start) {
|
|
6467
|
-
if (inGroup)
|
|
6584
|
+
if (inGroup) {
|
|
6585
|
+
if ((parser.destructible & 128) === 0) {
|
|
6586
|
+
parser.firstAwaitLocation ??= { start, end: parser.currentLocation };
|
|
6587
|
+
}
|
|
6468
6588
|
parser.destructible |= 128;
|
|
6589
|
+
}
|
|
6469
6590
|
if (context & 524288)
|
|
6470
|
-
parser.report(
|
|
6591
|
+
parser.report(179);
|
|
6471
6592
|
const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope);
|
|
6472
6593
|
const isIdentifier = possibleIdentifierOrArrowFunc.type === 'ArrowFunctionExpression' ||
|
|
6473
6594
|
(parser.getToken() & 65536) === 0;
|
|
6474
6595
|
if (isIdentifier) {
|
|
6475
6596
|
if (context & 2048)
|
|
6476
|
-
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn },
|
|
6597
|
+
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 178);
|
|
6477
6598
|
if (context & 2)
|
|
6478
|
-
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn },
|
|
6599
|
+
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 112);
|
|
6479
6600
|
if (context & 8192 && context & 2048)
|
|
6480
|
-
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn },
|
|
6601
|
+
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 112);
|
|
6481
6602
|
return possibleIdentifierOrArrowFunc;
|
|
6482
6603
|
}
|
|
6483
6604
|
if (context & 8192) {
|
|
@@ -6499,8 +6620,9 @@
|
|
|
6499
6620
|
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 98);
|
|
6500
6621
|
return possibleIdentifierOrArrowFunc;
|
|
6501
6622
|
}
|
|
6502
|
-
function parseFunctionBody(parser, context, scope, privateScope,
|
|
6623
|
+
function parseFunctionBody(parser, context, scope, privateScope, funcNameToken, functionScope, origin = 0) {
|
|
6503
6624
|
const { tokenStart } = parser;
|
|
6625
|
+
parser.flags &= -4161;
|
|
6504
6626
|
consume(parser, context | 32, 2162700);
|
|
6505
6627
|
const body = [];
|
|
6506
6628
|
if (parser.getToken() !== 1074790415) {
|
|
@@ -6526,19 +6648,19 @@
|
|
|
6526
6648
|
if (context & 1) {
|
|
6527
6649
|
if (funcNameToken) {
|
|
6528
6650
|
if ((funcNameToken & 537079808) === 537079808) {
|
|
6529
|
-
parser.report(
|
|
6651
|
+
parser.report(121);
|
|
6530
6652
|
}
|
|
6531
6653
|
if ((funcNameToken & 36864) === 36864) {
|
|
6532
6654
|
parser.report(40);
|
|
6533
6655
|
}
|
|
6534
6656
|
}
|
|
6535
6657
|
if (parser.flags & 512)
|
|
6536
|
-
parser.report(
|
|
6658
|
+
parser.report(121);
|
|
6537
6659
|
if (parser.flags & 256) {
|
|
6538
6660
|
if (parser.strictReservedRange) {
|
|
6539
|
-
throw new ParseError(parser.strictReservedRange[0], parser.strictReservedRange[1],
|
|
6661
|
+
throw new ParseError(parser.strictReservedRange[0], parser.strictReservedRange[1], 120);
|
|
6540
6662
|
}
|
|
6541
|
-
parser.report(
|
|
6663
|
+
parser.report(120);
|
|
6542
6664
|
}
|
|
6543
6665
|
}
|
|
6544
6666
|
}
|
|
@@ -6547,7 +6669,7 @@
|
|
|
6547
6669
|
(512 | 256 | 64 | 4096);
|
|
6548
6670
|
parser.destructible = (parser.destructible | 256) ^ 256;
|
|
6549
6671
|
while (parser.getToken() !== 1074790415) {
|
|
6550
|
-
body.push(parseStatementListItem(parser, context, scope, privateScope,
|
|
6672
|
+
body.push(parseStatementListItem(parser, context, scope, privateScope, {}, 4));
|
|
6551
6673
|
}
|
|
6552
6674
|
consume(parser, origin & (16 | 8) ? context | 32 : context, 1074790415);
|
|
6553
6675
|
parser.flags &= -4289;
|
|
@@ -6563,7 +6685,7 @@
|
|
|
6563
6685
|
nextToken(parser, context);
|
|
6564
6686
|
switch (parser.getToken()) {
|
|
6565
6687
|
case 67108991:
|
|
6566
|
-
parser.report(
|
|
6688
|
+
parser.report(169);
|
|
6567
6689
|
case 67174411: {
|
|
6568
6690
|
if ((context & 512) === 0)
|
|
6569
6691
|
parser.report(28);
|
|
@@ -6610,7 +6732,7 @@
|
|
|
6610
6732
|
case 67108877: {
|
|
6611
6733
|
nextToken(parser, (context | 262144 | 8) ^ 8);
|
|
6612
6734
|
if (context & 16 && parser.getToken() === 131 && parser.tokenValue === 'super') {
|
|
6613
|
-
parser.report(
|
|
6735
|
+
parser.report(175);
|
|
6614
6736
|
}
|
|
6615
6737
|
parser.assignable =
|
|
6616
6738
|
(parser.flags & 2048) === 2048
|
|
@@ -6690,7 +6812,7 @@
|
|
|
6690
6812
|
}
|
|
6691
6813
|
default:
|
|
6692
6814
|
if ((parser.flags & 2048) === 2048) {
|
|
6693
|
-
parser.report(
|
|
6815
|
+
parser.report(168);
|
|
6694
6816
|
}
|
|
6695
6817
|
parser.assignable = 2;
|
|
6696
6818
|
expr = parser.finishNode({
|
|
@@ -6771,7 +6893,7 @@
|
|
|
6771
6893
|
parser.getToken() !== -2147483527 &&
|
|
6772
6894
|
parser.getToken() !== -2147483526 &&
|
|
6773
6895
|
parser.getToken() !== 131) {
|
|
6774
|
-
parser.report(
|
|
6896
|
+
parser.report(162);
|
|
6775
6897
|
}
|
|
6776
6898
|
return parser.getToken() === 131
|
|
6777
6899
|
? parsePrivateIdentifier(parser, context, privateScope, 0)
|
|
@@ -6796,7 +6918,7 @@
|
|
|
6796
6918
|
prefix: true,
|
|
6797
6919
|
}, start);
|
|
6798
6920
|
}
|
|
6799
|
-
function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canAssign, inGroup, isLHS, start) {
|
|
6921
|
+
function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canAssign, inGroup, isLHS, start, origin = 0) {
|
|
6800
6922
|
if ((parser.getToken() & 143360) === 143360) {
|
|
6801
6923
|
switch (parser.getToken()) {
|
|
6802
6924
|
case 209006:
|
|
@@ -6816,16 +6938,16 @@
|
|
|
6816
6938
|
if ((token & 36864) === 36864) {
|
|
6817
6939
|
parser.flags |= 256;
|
|
6818
6940
|
}
|
|
6819
|
-
return parseArrowFromIdentifier(parser, context, privateScope, tokenValue, expr, inNew, canAssign, 0, start);
|
|
6941
|
+
return parseArrowFromIdentifier(parser, context, privateScope, tokenValue, expr, inNew, canAssign, 0, start, origin);
|
|
6820
6942
|
}
|
|
6821
6943
|
if (context & 16 &&
|
|
6822
6944
|
!(context & 32768) &&
|
|
6823
6945
|
!(context & 8192) &&
|
|
6824
6946
|
parser.tokenValue === 'arguments')
|
|
6825
|
-
parser.report(
|
|
6947
|
+
parser.report(132);
|
|
6826
6948
|
if ((token & 255) === (241737 & 255)) {
|
|
6827
6949
|
if (context & 1)
|
|
6828
|
-
parser.report(
|
|
6950
|
+
parser.report(115);
|
|
6829
6951
|
if (kind & (8 | 16))
|
|
6830
6952
|
parser.report(100);
|
|
6831
6953
|
}
|
|
@@ -6857,7 +6979,7 @@
|
|
|
6857
6979
|
case 69271571:
|
|
6858
6980
|
return parseArrayLiteral(parser, context, privateScope, canAssign ? 0 : 1, inGroup);
|
|
6859
6981
|
case 67174411:
|
|
6860
|
-
return parseParenthesizedExpression(parser, context | 64, privateScope, canAssign, 1,
|
|
6982
|
+
return parseParenthesizedExpression(parser, context | 64, privateScope, canAssign, 1, start, origin);
|
|
6861
6983
|
case 86021:
|
|
6862
6984
|
case 86022:
|
|
6863
6985
|
case 86023:
|
|
@@ -6867,6 +6989,9 @@
|
|
|
6867
6989
|
case 65540:
|
|
6868
6990
|
return parseRegExpLiteral(parser, context);
|
|
6869
6991
|
case 133:
|
|
6992
|
+
if (!(parser.features & 1)) {
|
|
6993
|
+
parser.report(30, '@');
|
|
6994
|
+
}
|
|
6870
6995
|
case 86094:
|
|
6871
6996
|
return parseClassExpression(parser, context, privateScope, inGroup, start);
|
|
6872
6997
|
case 86109:
|
|
@@ -6895,24 +7020,37 @@
|
|
|
6895
7020
|
function parseImportCallOrMetaExpression(parser, context, privateScope, inNew, inGroup, start) {
|
|
6896
7021
|
let expr = parseIdentifier(parser, context);
|
|
6897
7022
|
if (parser.getToken() === 67108877) {
|
|
6898
|
-
return parseImportMetaExpression(parser, context, expr, start);
|
|
7023
|
+
return parseImportMetaExpression(parser, context, expr, start, privateScope, inGroup, inNew);
|
|
6899
7024
|
}
|
|
6900
7025
|
if (inNew)
|
|
6901
|
-
parser.report(
|
|
7026
|
+
parser.report(144);
|
|
6902
7027
|
expr = parseImportExpression(parser, context, privateScope, inGroup, start);
|
|
6903
7028
|
parser.assignable = 2;
|
|
6904
7029
|
return parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGroup, 0, start);
|
|
6905
7030
|
}
|
|
6906
|
-
function parseImportMetaExpression(parser, context, meta, start) {
|
|
6907
|
-
|
|
6908
|
-
|
|
7031
|
+
function parseImportMetaExpression(parser, context, meta, start, privateScope, inGroup = 0, inNew = 0) {
|
|
7032
|
+
const propertyStart = parser.tokenStart;
|
|
7033
|
+
const propertyEnd = parser.currentLocation;
|
|
6909
7034
|
nextToken(parser, context);
|
|
6910
7035
|
const token = parser.getToken();
|
|
7036
|
+
const isPhaseDefer = parser.features & 2 && (token & -2147483648) === 0 && parser.tokenValue === 'defer';
|
|
7037
|
+
const isPhaseSource = parser.features & 4 && (token & -2147483648) === 0 && parser.tokenValue === 'source';
|
|
7038
|
+
if (isPhaseDefer || isPhaseSource) {
|
|
7039
|
+
if (inNew)
|
|
7040
|
+
parser.report(144);
|
|
7041
|
+
nextToken(parser, context);
|
|
7042
|
+
const expression = parseImportExpression(parser, context, privateScope, inGroup, start, parser.tokenValue);
|
|
7043
|
+
parser.assignable = 2;
|
|
7044
|
+
return expression;
|
|
7045
|
+
}
|
|
7046
|
+
if ((context & 2) === 0) {
|
|
7047
|
+
throw new ParseError(propertyStart, propertyEnd, 171);
|
|
7048
|
+
}
|
|
6911
7049
|
if (token !== 209031 && parser.tokenValue !== 'meta') {
|
|
6912
|
-
parser.report(
|
|
7050
|
+
parser.report(176);
|
|
6913
7051
|
}
|
|
6914
7052
|
else if (token & -2147483648) {
|
|
6915
|
-
parser.report(
|
|
7053
|
+
parser.report(177);
|
|
6916
7054
|
}
|
|
6917
7055
|
parser.assignable = 2;
|
|
6918
7056
|
return parser.finishNode({
|
|
@@ -6921,10 +7059,10 @@
|
|
|
6921
7059
|
property: parseIdentifier(parser, context),
|
|
6922
7060
|
}, start);
|
|
6923
7061
|
}
|
|
6924
|
-
function parseImportExpression(parser, context, privateScope, inGroup, start) {
|
|
7062
|
+
function parseImportExpression(parser, context, privateScope, inGroup, start, phase = null) {
|
|
6925
7063
|
consume(parser, context | 32, 67174411);
|
|
6926
7064
|
if (parser.getToken() === 14)
|
|
6927
|
-
parser.report(
|
|
7065
|
+
parser.report(145);
|
|
6928
7066
|
const source = parseExpression(parser, context, privateScope, 1, inGroup, parser.tokenStart);
|
|
6929
7067
|
let options = null;
|
|
6930
7068
|
if (parser.getToken() === 18) {
|
|
@@ -6939,6 +7077,7 @@
|
|
|
6939
7077
|
type: 'ImportExpression',
|
|
6940
7078
|
source,
|
|
6941
7079
|
options,
|
|
7080
|
+
...(parser.features & 2 || parser.features & 4 ? { phase } : null),
|
|
6942
7081
|
};
|
|
6943
7082
|
consume(parser, context, 16);
|
|
6944
7083
|
return parser.finishNode(node, start);
|
|
@@ -6956,7 +7095,7 @@
|
|
|
6956
7095
|
const value = parseStringLiteral(parser, context);
|
|
6957
7096
|
const keyContent = key.type === 'Literal' ? key.value : key.name;
|
|
6958
7097
|
if (keysContent.has(keyContent)) {
|
|
6959
|
-
parser.report(
|
|
7098
|
+
parser.report(147, keyContent);
|
|
6960
7099
|
}
|
|
6961
7100
|
keysContent.add(keyContent);
|
|
6962
7101
|
attributes.push(parser.finishNode({
|
|
@@ -6994,7 +7133,7 @@
|
|
|
6994
7133
|
if (parser.getToken() === 134283267) {
|
|
6995
7134
|
const value = parser.tokenValue;
|
|
6996
7135
|
if (!value.isWellFormed()) {
|
|
6997
|
-
parser.report(
|
|
7136
|
+
parser.report(173);
|
|
6998
7137
|
}
|
|
6999
7138
|
return parseLiteral(parser, context);
|
|
7000
7139
|
}
|
|
@@ -7169,7 +7308,7 @@
|
|
|
7169
7308
|
type: 'ThisExpression',
|
|
7170
7309
|
}, tokenStart);
|
|
7171
7310
|
}
|
|
7172
|
-
function parseFunctionDeclaration(parser, context, scope, privateScope,
|
|
7311
|
+
function parseFunctionDeclaration(parser, context, scope, privateScope, allowGen, flags, isAsync, start, origin = 0) {
|
|
7173
7312
|
nextToken(parser, context | 32);
|
|
7174
7313
|
const isGenerator = allowGen ? optionalBit(parser, context, 8391476) : 0;
|
|
7175
7314
|
let id = null;
|
|
@@ -7223,7 +7362,7 @@
|
|
|
7223
7362
|
functionScope = functionScope?.createChildScope(256);
|
|
7224
7363
|
const params = parseFormalParametersOrFormalList(parser, (context | 8192) & -524289, functionScope, privateScope, 0, 1);
|
|
7225
7364
|
const modifierFlags = 8 | 4 | 128 | 524288;
|
|
7226
|
-
const body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 32768 | 4096, functionScope?.createChildScope(64), privateScope,
|
|
7365
|
+
const body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 32768 | 4096, functionScope?.createChildScope(64), privateScope, funcNameToken, functionScope, 8);
|
|
7227
7366
|
return parser.finishNode({
|
|
7228
7367
|
type: 'FunctionDeclaration',
|
|
7229
7368
|
id,
|
|
@@ -7262,7 +7401,7 @@
|
|
|
7262
7401
|
const params = parseFormalParametersOrFormalList(parser, (context | 8192) & -524289, scope, privateScope, inGroup, 1);
|
|
7263
7402
|
const body = parseFunctionBody(parser, (context & -131229) |
|
|
7264
7403
|
32768 |
|
|
7265
|
-
4096, scope?.createChildScope(64), privateScope,
|
|
7404
|
+
4096, scope?.createChildScope(64), privateScope, funcNameToken, scope);
|
|
7266
7405
|
parser.assignable = 2;
|
|
7267
7406
|
return parser.finishNode({
|
|
7268
7407
|
type: 'FunctionExpression',
|
|
@@ -7274,7 +7413,7 @@
|
|
|
7274
7413
|
}, start);
|
|
7275
7414
|
}
|
|
7276
7415
|
function parseArrayLiteral(parser, context, privateScope, skipInitializer, inGroup) {
|
|
7277
|
-
const expr = parseArrayExpressionOrPattern(parser, context, void 0, privateScope, skipInitializer, inGroup, 0, 2
|
|
7416
|
+
const expr = parseArrayExpressionOrPattern(parser, context, void 0, privateScope, skipInitializer, inGroup, 0, 2);
|
|
7278
7417
|
if (parser.destructible & 64) {
|
|
7279
7418
|
parser.report(63);
|
|
7280
7419
|
}
|
|
@@ -7283,7 +7422,7 @@
|
|
|
7283
7422
|
}
|
|
7284
7423
|
return expr;
|
|
7285
7424
|
}
|
|
7286
|
-
function parseArrayExpressionOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin) {
|
|
7425
|
+
function parseArrayExpressionOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
|
|
7287
7426
|
const { tokenStart: start } = parser;
|
|
7288
7427
|
nextToken(parser, context | 32);
|
|
7289
7428
|
const elements = [];
|
|
@@ -7392,7 +7531,7 @@
|
|
|
7392
7531
|
}
|
|
7393
7532
|
}
|
|
7394
7533
|
else if (token === 14) {
|
|
7395
|
-
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 20, kind,
|
|
7534
|
+
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 20, kind, 0, inGroup, isPattern, origin);
|
|
7396
7535
|
destructible |= parser.destructible;
|
|
7397
7536
|
if (parser.getToken() !== 18 && parser.getToken() !== 20)
|
|
7398
7537
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
@@ -7462,7 +7601,7 @@
|
|
|
7462
7601
|
right,
|
|
7463
7602
|
}, start);
|
|
7464
7603
|
}
|
|
7465
|
-
function parseSpreadOrRestElement(parser, context, scope, privateScope, closingToken, kind,
|
|
7604
|
+
function parseSpreadOrRestElement(parser, context, scope, privateScope, closingToken, kind, isAsync, inGroup, isPattern, origin = 0) {
|
|
7466
7605
|
const { tokenStart: start } = parser;
|
|
7467
7606
|
nextToken(parser, context | 32);
|
|
7468
7607
|
let argument = null;
|
|
@@ -7555,7 +7694,7 @@
|
|
|
7555
7694
|
}
|
|
7556
7695
|
parser.destructible = destructible;
|
|
7557
7696
|
if (parser.getToken() !== closingToken && parser.getToken() !== 18)
|
|
7558
|
-
parser.report(
|
|
7697
|
+
parser.report(163);
|
|
7559
7698
|
return parser.finishNode({
|
|
7560
7699
|
type: isPattern ? 'RestElement' : 'SpreadElement',
|
|
7561
7700
|
argument: argument,
|
|
@@ -7611,7 +7750,7 @@
|
|
|
7611
7750
|
scope = scope?.createChildScope(64);
|
|
7612
7751
|
const body = parseFunctionBody(parser, (context & -655373) |
|
|
7613
7752
|
32768 |
|
|
7614
|
-
4096, scope, privateScope,
|
|
7753
|
+
4096, scope, privateScope, void 0, scope?.parent);
|
|
7615
7754
|
return parser.finishNode({
|
|
7616
7755
|
type: 'FunctionExpression',
|
|
7617
7756
|
params,
|
|
@@ -7622,7 +7761,7 @@
|
|
|
7622
7761
|
}, start);
|
|
7623
7762
|
}
|
|
7624
7763
|
function parseObjectLiteral(parser, context, privateScope, skipInitializer, inGroup) {
|
|
7625
|
-
const expr = parseObjectLiteralOrPattern(parser, context, void 0, privateScope, skipInitializer, inGroup, 0, 2
|
|
7764
|
+
const expr = parseObjectLiteralOrPattern(parser, context, void 0, privateScope, skipInitializer, inGroup, 0, 2);
|
|
7626
7765
|
if (parser.destructible & 64) {
|
|
7627
7766
|
parser.report(63);
|
|
7628
7767
|
}
|
|
@@ -7631,7 +7770,7 @@
|
|
|
7631
7770
|
}
|
|
7632
7771
|
return expr;
|
|
7633
7772
|
}
|
|
7634
|
-
function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin) {
|
|
7773
|
+
function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
|
|
7635
7774
|
const { tokenStart: start } = parser;
|
|
7636
7775
|
nextToken(parser, context);
|
|
7637
7776
|
const properties = [];
|
|
@@ -7642,7 +7781,7 @@
|
|
|
7642
7781
|
const { tokenValue, tokenStart } = parser;
|
|
7643
7782
|
const token = parser.getToken();
|
|
7644
7783
|
if (token === 14) {
|
|
7645
|
-
properties.push(parseSpreadOrRestElement(parser, context, scope, privateScope, 1074790415, kind,
|
|
7784
|
+
properties.push(parseSpreadOrRestElement(parser, context, scope, privateScope, 1074790415, kind, 0, inGroup, isPattern, origin));
|
|
7646
7785
|
}
|
|
7647
7786
|
else {
|
|
7648
7787
|
let state = 0;
|
|
@@ -7814,7 +7953,7 @@
|
|
|
7814
7953
|
parser.report(95);
|
|
7815
7954
|
if (token === 209005) {
|
|
7816
7955
|
if (parser.flags & 1)
|
|
7817
|
-
parser.report(
|
|
7956
|
+
parser.report(134);
|
|
7818
7957
|
state |= 16 | 1;
|
|
7819
7958
|
}
|
|
7820
7959
|
else if (token === 209008) {
|
|
@@ -7878,7 +8017,7 @@
|
|
|
7878
8017
|
value = parseMethodDefinition(parser, context, privateScope, state, inGroup, parser.tokenStart);
|
|
7879
8018
|
}
|
|
7880
8019
|
else {
|
|
7881
|
-
parser.report(
|
|
8020
|
+
parser.report(135);
|
|
7882
8021
|
}
|
|
7883
8022
|
}
|
|
7884
8023
|
else if ((parser.getToken() & 134217728) === 134217728) {
|
|
@@ -7982,7 +8121,7 @@
|
|
|
7982
8121
|
destructible = 16;
|
|
7983
8122
|
}
|
|
7984
8123
|
else {
|
|
7985
|
-
parser.report(
|
|
8124
|
+
parser.report(136);
|
|
7986
8125
|
}
|
|
7987
8126
|
}
|
|
7988
8127
|
else if (parser.getToken() === 69271571) {
|
|
@@ -8129,7 +8268,7 @@
|
|
|
8129
8268
|
value = parseMethodDefinition(parser, context, privateScope, state, inGroup, parser.tokenStart);
|
|
8130
8269
|
}
|
|
8131
8270
|
else {
|
|
8132
|
-
parser.report(
|
|
8271
|
+
parser.report(128);
|
|
8133
8272
|
}
|
|
8134
8273
|
}
|
|
8135
8274
|
else {
|
|
@@ -8170,6 +8309,7 @@
|
|
|
8170
8309
|
const params = [];
|
|
8171
8310
|
parser.flags = (parser.flags | 128) ^ 128;
|
|
8172
8311
|
parser.strictReservedRange = null;
|
|
8312
|
+
parser.firstAwaitLocation = null;
|
|
8173
8313
|
if (parser.getToken() === 16) {
|
|
8174
8314
|
if (kind & 512) {
|
|
8175
8315
|
parser.report(37, 'Setter', 'one', '');
|
|
@@ -8199,17 +8339,17 @@
|
|
|
8199
8339
|
parser.flags |= 512;
|
|
8200
8340
|
}
|
|
8201
8341
|
}
|
|
8202
|
-
left = parseAndClassifyIdentifier(parser, context, scope, kind | 1
|
|
8342
|
+
left = parseAndClassifyIdentifier(parser, context, scope, kind | 1);
|
|
8203
8343
|
}
|
|
8204
8344
|
else {
|
|
8205
8345
|
if (parser.getToken() === 2162700) {
|
|
8206
|
-
left = parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, type
|
|
8346
|
+
left = parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, type);
|
|
8207
8347
|
}
|
|
8208
8348
|
else if (parser.getToken() === 69271571) {
|
|
8209
|
-
left = parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, type
|
|
8349
|
+
left = parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, type);
|
|
8210
8350
|
}
|
|
8211
8351
|
else if (parser.getToken() === 14) {
|
|
8212
|
-
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, type, 0,
|
|
8352
|
+
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, type, 0, inGroup, 1);
|
|
8213
8353
|
}
|
|
8214
8354
|
isNonSimpleParameterList = 1;
|
|
8215
8355
|
if (parser.destructible & (32 | 16))
|
|
@@ -8248,17 +8388,20 @@
|
|
|
8248
8388
|
consume(parser, context, 20);
|
|
8249
8389
|
return key;
|
|
8250
8390
|
}
|
|
8251
|
-
function parseParenthesizedExpression(parser, context, privateScope, canAssign, kind,
|
|
8391
|
+
function parseParenthesizedExpression(parser, context, privateScope, canAssign, kind, start, origin) {
|
|
8252
8392
|
parser.flags = (parser.flags | 128) ^ 128;
|
|
8253
8393
|
const parenthesesStart = parser.tokenStart;
|
|
8254
8394
|
nextToken(parser, context | 32 | 262144);
|
|
8255
8395
|
const scope = parser.createScopeIfLexical()?.createChildScope(512);
|
|
8256
8396
|
context = (context | 131072) ^ 131072;
|
|
8257
8397
|
if (consumeOpt(parser, context, 16)) {
|
|
8258
|
-
return parseParenthesizedArrow(parser, context, scope, privateScope, [], canAssign, 0, start);
|
|
8398
|
+
return parseParenthesizedArrow(parser, context, scope, privateScope, [], canAssign, 0, start, origin);
|
|
8259
8399
|
}
|
|
8260
8400
|
let destructible = 0;
|
|
8401
|
+
const previousAwaitYield = parser.destructible & (256 | 128);
|
|
8261
8402
|
parser.destructible &= -385;
|
|
8403
|
+
const previousFirstAwaitLocation = parser.firstAwaitLocation;
|
|
8404
|
+
parser.firstAwaitLocation = null;
|
|
8262
8405
|
let expr;
|
|
8263
8406
|
let expressions = [];
|
|
8264
8407
|
let isSequence = 0;
|
|
@@ -8270,14 +8413,14 @@
|
|
|
8270
8413
|
const { tokenStart } = parser;
|
|
8271
8414
|
const token = parser.getToken();
|
|
8272
8415
|
if (token & 143360) {
|
|
8273
|
-
scope?.addBlockName(context, parser.tokenValue, 1
|
|
8416
|
+
scope?.addBlockName(context, parser.tokenValue, 1);
|
|
8274
8417
|
if ((token & 537079808) === 537079808) {
|
|
8275
8418
|
isNonSimpleParameterList = 1;
|
|
8276
8419
|
}
|
|
8277
8420
|
else if ((token & 36864) === 36864) {
|
|
8278
8421
|
hasStrictReserved = 1;
|
|
8279
8422
|
}
|
|
8280
|
-
expr = parsePrimaryExpression(parser, context, privateScope, kind, 0, 1, 1, 1, tokenStart);
|
|
8423
|
+
expr = parsePrimaryExpression(parser, context, privateScope, kind, 0, 1, 1, 1, tokenStart, 0);
|
|
8281
8424
|
if (parser.getToken() === 16 || parser.getToken() === 18) {
|
|
8282
8425
|
if (parser.assignable & 2) {
|
|
8283
8426
|
destructible |= 16;
|
|
@@ -8300,14 +8443,14 @@
|
|
|
8300
8443
|
else if ((token & 2097152) === 2097152) {
|
|
8301
8444
|
expr =
|
|
8302
8445
|
token === 2162700
|
|
8303
|
-
? parseObjectLiteralOrPattern(parser, context | 262144, scope, privateScope, 0, 1, 0, kind
|
|
8304
|
-
: parseArrayExpressionOrPattern(parser, context | 262144, scope, privateScope, 0, 1, 0, kind
|
|
8446
|
+
? parseObjectLiteralOrPattern(parser, context | 262144, scope, privateScope, 0, 1, 0, kind)
|
|
8447
|
+
: parseArrayExpressionOrPattern(parser, context | 262144, scope, privateScope, 0, 1, 0, kind);
|
|
8305
8448
|
destructible |= parser.destructible;
|
|
8306
8449
|
isNonSimpleParameterList = 1;
|
|
8307
8450
|
parser.assignable = 2;
|
|
8308
8451
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
8309
8452
|
if (destructible & 8)
|
|
8310
|
-
parser.report(
|
|
8453
|
+
parser.report(124);
|
|
8311
8454
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, tokenStart);
|
|
8312
8455
|
destructible |= 16;
|
|
8313
8456
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
@@ -8316,7 +8459,7 @@
|
|
|
8316
8459
|
}
|
|
8317
8460
|
}
|
|
8318
8461
|
else if (token === 14) {
|
|
8319
|
-
expr = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind,
|
|
8462
|
+
expr = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind, 0, 1, 0);
|
|
8320
8463
|
if (parser.destructible & 16)
|
|
8321
8464
|
parser.report(74);
|
|
8322
8465
|
isNonSimpleParameterList = 1;
|
|
@@ -8349,7 +8492,10 @@
|
|
|
8349
8492
|
}, tokenAfterParenthesesStart);
|
|
8350
8493
|
}
|
|
8351
8494
|
consume(parser, context, 16);
|
|
8352
|
-
parser.destructible = destructible;
|
|
8495
|
+
parser.destructible = destructible | previousAwaitYield;
|
|
8496
|
+
if (previousFirstAwaitLocation) {
|
|
8497
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8498
|
+
}
|
|
8353
8499
|
return parser.options.preserveParens
|
|
8354
8500
|
? parser.finishNode({
|
|
8355
8501
|
type: 'ParenthesizedExpression',
|
|
@@ -8380,7 +8526,7 @@
|
|
|
8380
8526
|
}
|
|
8381
8527
|
consume(parser, context, 16);
|
|
8382
8528
|
if (destructible & 16 && destructible & 8)
|
|
8383
|
-
parser.report(
|
|
8529
|
+
parser.report(153);
|
|
8384
8530
|
destructible |=
|
|
8385
8531
|
parser.destructible & 256
|
|
8386
8532
|
? 256
|
|
@@ -8390,8 +8536,12 @@
|
|
|
8390
8536
|
if (parser.getToken() === 10) {
|
|
8391
8537
|
if (destructible & (32 | 16))
|
|
8392
8538
|
parser.report(49);
|
|
8393
|
-
if (context & (2048 | 2) && destructible & 128)
|
|
8539
|
+
if (context & (2048 | 2) && destructible & 128) {
|
|
8540
|
+
const loc = parser.firstAwaitLocation;
|
|
8541
|
+
if (loc)
|
|
8542
|
+
throw new ParseError(loc.start, loc.end, 31);
|
|
8394
8543
|
parser.report(31);
|
|
8544
|
+
}
|
|
8395
8545
|
if (context & (1 | 1024) && destructible & 256) {
|
|
8396
8546
|
parser.report(32);
|
|
8397
8547
|
}
|
|
@@ -8399,15 +8549,19 @@
|
|
|
8399
8549
|
parser.flags |= 128;
|
|
8400
8550
|
if (hasStrictReserved)
|
|
8401
8551
|
parser.flags |= 256;
|
|
8402
|
-
return parseParenthesizedArrow(parser, context, scope, privateScope, isSequence ? expressions : [expr], canAssign, 0, start);
|
|
8552
|
+
return parseParenthesizedArrow(parser, context, scope, privateScope, isSequence ? expressions : [expr], canAssign, 0, start, origin);
|
|
8403
8553
|
}
|
|
8404
8554
|
if (destructible & 64) {
|
|
8405
8555
|
parser.report(63);
|
|
8406
8556
|
}
|
|
8407
8557
|
if (destructible & 8) {
|
|
8408
|
-
parser.report(
|
|
8558
|
+
parser.report(146);
|
|
8559
|
+
}
|
|
8560
|
+
parser.destructible =
|
|
8561
|
+
((parser.destructible | 256) ^ 256) | destructible | previousAwaitYield;
|
|
8562
|
+
if (previousFirstAwaitLocation) {
|
|
8563
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8409
8564
|
}
|
|
8410
|
-
parser.destructible = ((parser.destructible | 256) ^ 256) | destructible;
|
|
8411
8565
|
return parser.options.preserveParens
|
|
8412
8566
|
? parser.finishNode({
|
|
8413
8567
|
type: 'ParenthesizedExpression',
|
|
@@ -8438,23 +8592,23 @@
|
|
|
8438
8592
|
}
|
|
8439
8593
|
return expr;
|
|
8440
8594
|
}
|
|
8441
|
-
function parseArrowFromIdentifier(parser, context, privateScope, value, expr, inNew, canAssign, isAsync, start) {
|
|
8595
|
+
function parseArrowFromIdentifier(parser, context, privateScope, value, expr, inNew, canAssign, isAsync, start, origin = 0) {
|
|
8442
8596
|
if (!canAssign)
|
|
8443
8597
|
parser.report(57);
|
|
8444
8598
|
if (inNew)
|
|
8445
8599
|
parser.report(51);
|
|
8446
8600
|
parser.flags &= -129;
|
|
8447
8601
|
const scope = parser.options.lexical ? createArrowHeadParsingScope(parser, context, value) : void 0;
|
|
8448
|
-
return parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], isAsync, start);
|
|
8602
|
+
return parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], isAsync, start, origin);
|
|
8449
8603
|
}
|
|
8450
|
-
function parseParenthesizedArrow(parser, context, scope, privateScope, params, canAssign, isAsync, start) {
|
|
8604
|
+
function parseParenthesizedArrow(parser, context, scope, privateScope, params, canAssign, isAsync, start, origin = 0) {
|
|
8451
8605
|
if (!canAssign)
|
|
8452
8606
|
parser.report(57);
|
|
8453
8607
|
for (let i = 0; i < params.length; ++i)
|
|
8454
8608
|
reinterpretToPattern(parser, params[i]);
|
|
8455
|
-
return parseArrowFunctionExpression(parser, context, scope, privateScope, params, isAsync, start);
|
|
8609
|
+
return parseArrowFunctionExpression(parser, context, scope, privateScope, params, isAsync, start, origin);
|
|
8456
8610
|
}
|
|
8457
|
-
function parseArrowFunctionExpression(parser, context, scope, privateScope, params, isAsync, start) {
|
|
8611
|
+
function parseArrowFunctionExpression(parser, context, scope, privateScope, params, isAsync, start, origin = 0) {
|
|
8458
8612
|
if (parser.flags & 1)
|
|
8459
8613
|
parser.report(48);
|
|
8460
8614
|
consume(parser, context | 32, 10);
|
|
@@ -8472,29 +8626,32 @@
|
|
|
8472
8626
|
else {
|
|
8473
8627
|
scope = scope?.createChildScope(64);
|
|
8474
8628
|
const modifierFlags = 4 | 131072 | 8;
|
|
8475
|
-
body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 4096, scope, privateScope,
|
|
8629
|
+
body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 4096, scope, privateScope, void 0, void 0, 16);
|
|
8476
8630
|
switch (parser.getToken()) {
|
|
8477
8631
|
case 69271571:
|
|
8478
8632
|
if ((parser.flags & 1) === 0) {
|
|
8479
|
-
parser.report(
|
|
8633
|
+
parser.report(118);
|
|
8480
8634
|
}
|
|
8481
8635
|
parser.flags |= 8192;
|
|
8482
8636
|
break;
|
|
8483
8637
|
case 67108877:
|
|
8484
8638
|
case 67174409:
|
|
8485
8639
|
case 22:
|
|
8486
|
-
parser.report(
|
|
8640
|
+
parser.report(119);
|
|
8487
8641
|
case 67174411:
|
|
8488
8642
|
if ((parser.flags & 1) === 0) {
|
|
8489
|
-
parser.report(
|
|
8643
|
+
parser.report(118);
|
|
8490
8644
|
}
|
|
8491
8645
|
parser.flags |= 1024;
|
|
8492
8646
|
break;
|
|
8493
8647
|
}
|
|
8494
|
-
if ((parser.getToken() & 8388608) === 8388608 && (parser.flags & 1) === 0)
|
|
8495
|
-
|
|
8648
|
+
if ((parser.getToken() & 8388608) === 8388608 && (parser.flags & 1) === 0) {
|
|
8649
|
+
if (parser.getToken() !== 8673330 || origin !== 32) {
|
|
8650
|
+
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
8651
|
+
}
|
|
8652
|
+
}
|
|
8496
8653
|
if ((parser.getToken() & 33619968) === 33619968)
|
|
8497
|
-
parser.report(
|
|
8654
|
+
parser.report(127);
|
|
8498
8655
|
}
|
|
8499
8656
|
parser.assignable = 2;
|
|
8500
8657
|
return parser.finishNode({
|
|
@@ -8510,6 +8667,7 @@
|
|
|
8510
8667
|
consume(parser, context, 67174411);
|
|
8511
8668
|
parser.flags = (parser.flags | 128) ^ 128;
|
|
8512
8669
|
parser.strictReservedRange = null;
|
|
8670
|
+
parser.firstAwaitLocation = null;
|
|
8513
8671
|
const params = [];
|
|
8514
8672
|
if (consumeOpt(parser, context, 16))
|
|
8515
8673
|
return params;
|
|
@@ -8529,17 +8687,17 @@
|
|
|
8529
8687
|
parser.flags |= 512;
|
|
8530
8688
|
}
|
|
8531
8689
|
}
|
|
8532
|
-
left = parseAndClassifyIdentifier(parser, context, scope, kind | 1
|
|
8690
|
+
left = parseAndClassifyIdentifier(parser, context, scope, kind | 1);
|
|
8533
8691
|
}
|
|
8534
8692
|
else {
|
|
8535
8693
|
if (token === 2162700) {
|
|
8536
|
-
left = parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, kind
|
|
8694
|
+
left = parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, kind);
|
|
8537
8695
|
}
|
|
8538
8696
|
else if (token === 69271571) {
|
|
8539
|
-
left = parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, kind
|
|
8697
|
+
left = parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, kind);
|
|
8540
8698
|
}
|
|
8541
8699
|
else if (token === 14) {
|
|
8542
|
-
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind, 0,
|
|
8700
|
+
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind, 0, inGroup, 1);
|
|
8543
8701
|
}
|
|
8544
8702
|
else {
|
|
8545
8703
|
parser.report(30, KeywordDescTable[token & 255]);
|
|
@@ -8634,7 +8792,7 @@
|
|
|
8634
8792
|
const expr = parsePrimaryExpression(parser, context, privateScope, 2, 1, 0, inGroup, 1, tokenStart);
|
|
8635
8793
|
context = (context | 131072) ^ 131072;
|
|
8636
8794
|
if (parser.getToken() === 67108991)
|
|
8637
|
-
parser.report(
|
|
8795
|
+
parser.report(170);
|
|
8638
8796
|
const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
|
|
8639
8797
|
parser.assignable = 2;
|
|
8640
8798
|
return parser.finishNode({
|
|
@@ -8663,9 +8821,11 @@
|
|
|
8663
8821
|
}
|
|
8664
8822
|
return parseArrowFromIdentifier(parser, (context & -524289) | 2048, privateScope, parser.tokenValue, parseIdentifier(parser, context), 0, canAssign, 1, start);
|
|
8665
8823
|
}
|
|
8666
|
-
function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee, canAssign, kind,
|
|
8824
|
+
function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee, canAssign, kind, flags, start) {
|
|
8667
8825
|
nextToken(parser, context | 32);
|
|
8668
8826
|
const scope = parser.createScopeIfLexical()?.createChildScope(512);
|
|
8827
|
+
const previousFirstAwaitLocation = parser.firstAwaitLocation;
|
|
8828
|
+
parser.firstAwaitLocation = null;
|
|
8669
8829
|
context = (context | 131072) ^ 131072;
|
|
8670
8830
|
if (consumeOpt(parser, context, 16)) {
|
|
8671
8831
|
if (parser.getToken() === 10) {
|
|
@@ -8679,6 +8839,8 @@
|
|
|
8679
8839
|
else {
|
|
8680
8840
|
parser.assignable = 2;
|
|
8681
8841
|
}
|
|
8842
|
+
if (previousFirstAwaitLocation)
|
|
8843
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8682
8844
|
return parser.finishNode({
|
|
8683
8845
|
type: 'CallExpression',
|
|
8684
8846
|
callee,
|
|
@@ -8697,7 +8859,7 @@
|
|
|
8697
8859
|
const { tokenStart } = parser;
|
|
8698
8860
|
const token = parser.getToken();
|
|
8699
8861
|
if (token & 143360) {
|
|
8700
|
-
scope?.addBlockName(context, parser.tokenValue, kind
|
|
8862
|
+
scope?.addBlockName(context, parser.tokenValue, kind);
|
|
8701
8863
|
if ((token & 537079808) === 537079808) {
|
|
8702
8864
|
parser.flags |= 512;
|
|
8703
8865
|
}
|
|
@@ -8727,13 +8889,13 @@
|
|
|
8727
8889
|
else if (token & 2097152) {
|
|
8728
8890
|
expr =
|
|
8729
8891
|
token === 2162700
|
|
8730
|
-
? parseObjectLiteralOrPattern(parser, context, scope, privateScope, 0, 1, 0, kind
|
|
8731
|
-
: parseArrayExpressionOrPattern(parser, context, scope, privateScope, 0, 1, 0, kind
|
|
8892
|
+
? parseObjectLiteralOrPattern(parser, context, scope, privateScope, 0, 1, 0, kind)
|
|
8893
|
+
: parseArrayExpressionOrPattern(parser, context, scope, privateScope, 0, 1, 0, kind);
|
|
8732
8894
|
destructible |= parser.destructible;
|
|
8733
8895
|
isNonSimpleParameterList = 1;
|
|
8734
8896
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
8735
8897
|
if (destructible & 8)
|
|
8736
|
-
parser.report(
|
|
8898
|
+
parser.report(124);
|
|
8737
8899
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, tokenStart);
|
|
8738
8900
|
destructible |= 16;
|
|
8739
8901
|
if ((parser.getToken() & 8388608) === 8388608) {
|
|
@@ -8745,7 +8907,7 @@
|
|
|
8745
8907
|
}
|
|
8746
8908
|
}
|
|
8747
8909
|
else if (token === 14) {
|
|
8748
|
-
expr = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind,
|
|
8910
|
+
expr = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind, 1, 1, 0);
|
|
8749
8911
|
destructible |=
|
|
8750
8912
|
(parser.getToken() === 16 ? 0 : 16) | parser.destructible;
|
|
8751
8913
|
isNonSimpleParameterList = 1;
|
|
@@ -8766,6 +8928,8 @@
|
|
|
8766
8928
|
else {
|
|
8767
8929
|
parser.assignable = 2;
|
|
8768
8930
|
}
|
|
8931
|
+
if (previousFirstAwaitLocation)
|
|
8932
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8769
8933
|
return parser.finishNode({
|
|
8770
8934
|
type: 'CallExpression',
|
|
8771
8935
|
callee,
|
|
@@ -8789,8 +8953,12 @@
|
|
|
8789
8953
|
parser.report(27);
|
|
8790
8954
|
if (parser.flags & 1 || flags & 1)
|
|
8791
8955
|
parser.report(48);
|
|
8792
|
-
if (destructible & 128)
|
|
8956
|
+
if (destructible & 128) {
|
|
8957
|
+
const loc = parser.firstAwaitLocation;
|
|
8958
|
+
if (loc)
|
|
8959
|
+
throw new ParseError(loc.start, loc.end, 31);
|
|
8793
8960
|
parser.report(31);
|
|
8961
|
+
}
|
|
8794
8962
|
if (context & (1 | 1024) && destructible & 256)
|
|
8795
8963
|
parser.report(32);
|
|
8796
8964
|
if (isNonSimpleParameterList)
|
|
@@ -8809,6 +8977,8 @@
|
|
|
8809
8977
|
else {
|
|
8810
8978
|
parser.assignable = 2;
|
|
8811
8979
|
}
|
|
8980
|
+
if (previousFirstAwaitLocation)
|
|
8981
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8812
8982
|
return parser.finishNode({
|
|
8813
8983
|
type: 'CallExpression',
|
|
8814
8984
|
callee,
|
|
@@ -8834,9 +9004,6 @@
|
|
|
8834
9004
|
let start;
|
|
8835
9005
|
let decorators;
|
|
8836
9006
|
if (parser.leadingDecorators.decorators.length) {
|
|
8837
|
-
if (parser.getToken() === 133) {
|
|
8838
|
-
parser.report(30, '@');
|
|
8839
|
-
}
|
|
8840
9007
|
start = parser.leadingDecorators.start;
|
|
8841
9008
|
decorators = [...parser.leadingDecorators.decorators];
|
|
8842
9009
|
parser.leadingDecorators.decorators.length = 0;
|
|
@@ -8846,19 +9013,19 @@
|
|
|
8846
9013
|
decorators = parseDecorators(parser, context, privateScope);
|
|
8847
9014
|
}
|
|
8848
9015
|
context = (context | 16384 | 1) ^ 16384;
|
|
8849
|
-
|
|
9016
|
+
consume(parser, context, 86094);
|
|
8850
9017
|
let id = null;
|
|
8851
9018
|
let superClass = null;
|
|
8852
9019
|
const { tokenValue } = parser;
|
|
8853
9020
|
if (parser.getToken() & 4096 && parser.getToken() !== 20565) {
|
|
8854
9021
|
if (isStrictReservedWord(parser, context, parser.getToken())) {
|
|
8855
|
-
parser.report(
|
|
9022
|
+
parser.report(120);
|
|
8856
9023
|
}
|
|
8857
9024
|
if ((parser.getToken() & 537079808) === 537079808) {
|
|
8858
|
-
parser.report(
|
|
9025
|
+
parser.report(121);
|
|
8859
9026
|
}
|
|
8860
9027
|
if (scope) {
|
|
8861
|
-
scope.addBlockName(context, tokenValue, 32
|
|
9028
|
+
scope.addBlockName(context, tokenValue, 32);
|
|
8862
9029
|
if (flags) {
|
|
8863
9030
|
if (flags & 2) {
|
|
8864
9031
|
parser.declareUnboundVariable(tokenValue);
|
|
@@ -8879,13 +9046,13 @@
|
|
|
8879
9046
|
else {
|
|
8880
9047
|
inheritedContext = (inheritedContext | 512) ^ 512;
|
|
8881
9048
|
}
|
|
8882
|
-
const body = parseClassBody(parser, inheritedContext, context, scope, privateScope, 2,
|
|
9049
|
+
const body = parseClassBody(parser, inheritedContext, context, scope, privateScope, 2, 0, 8);
|
|
8883
9050
|
return parser.finishNode({
|
|
8884
9051
|
type: 'ClassDeclaration',
|
|
8885
9052
|
id,
|
|
8886
9053
|
superClass,
|
|
8887
9054
|
body,
|
|
8888
|
-
...(parser.
|
|
9055
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
8889
9056
|
}, start);
|
|
8890
9057
|
}
|
|
8891
9058
|
function parseClassExpression(parser, context, privateScope, inGroup, start) {
|
|
@@ -8893,12 +9060,12 @@
|
|
|
8893
9060
|
let superClass = null;
|
|
8894
9061
|
const decorators = parseDecorators(parser, context, privateScope);
|
|
8895
9062
|
context = (context | 1 | 16384) ^ 16384;
|
|
8896
|
-
|
|
9063
|
+
consume(parser, context, 86094);
|
|
8897
9064
|
if (parser.getToken() & 4096 && parser.getToken() !== 20565) {
|
|
8898
9065
|
if (isStrictReservedWord(parser, context, parser.getToken()))
|
|
8899
|
-
parser.report(
|
|
9066
|
+
parser.report(120);
|
|
8900
9067
|
if ((parser.getToken() & 537079808) === 537079808) {
|
|
8901
|
-
parser.report(
|
|
9068
|
+
parser.report(121);
|
|
8902
9069
|
}
|
|
8903
9070
|
id = parseIdentifier(parser, context);
|
|
8904
9071
|
}
|
|
@@ -8910,37 +9077,74 @@
|
|
|
8910
9077
|
else {
|
|
8911
9078
|
inheritedContext = (inheritedContext | 512) ^ 512;
|
|
8912
9079
|
}
|
|
8913
|
-
const body = parseClassBody(parser, inheritedContext, context, void 0, privateScope, 2,
|
|
9080
|
+
const body = parseClassBody(parser, inheritedContext, context, void 0, privateScope, 2, inGroup);
|
|
8914
9081
|
parser.assignable = 2;
|
|
8915
9082
|
return parser.finishNode({
|
|
8916
9083
|
type: 'ClassExpression',
|
|
8917
9084
|
id,
|
|
8918
9085
|
superClass,
|
|
8919
9086
|
body,
|
|
8920
|
-
...(parser.
|
|
9087
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
8921
9088
|
}, start);
|
|
8922
9089
|
}
|
|
8923
9090
|
function parseDecorators(parser, context, privateScope) {
|
|
8924
9091
|
const list = [];
|
|
8925
|
-
if (parser.
|
|
9092
|
+
if (parser.features & 1) {
|
|
8926
9093
|
while (parser.getToken() === 133) {
|
|
8927
|
-
list.push(
|
|
9094
|
+
list.push(parseDecorator(parser, context, privateScope));
|
|
8928
9095
|
}
|
|
8929
9096
|
}
|
|
8930
9097
|
return list;
|
|
8931
9098
|
}
|
|
8932
|
-
function
|
|
9099
|
+
function parseDecorator(parser, context, privateScope) {
|
|
8933
9100
|
const start = parser.tokenStart;
|
|
8934
9101
|
nextToken(parser, context | 32);
|
|
8935
9102
|
const expressionStart = parser.tokenStart;
|
|
8936
|
-
let expression
|
|
8937
|
-
|
|
9103
|
+
let expression;
|
|
9104
|
+
if (parser.getToken() === 67174411) {
|
|
9105
|
+
expression = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, start);
|
|
9106
|
+
}
|
|
9107
|
+
else {
|
|
9108
|
+
const token = parser.getToken();
|
|
9109
|
+
if (((token & 143360) !== 143360 && !isValidIdentifier(context, token)) ||
|
|
9110
|
+
(context & 1 && (token & 36864) === 36864)) {
|
|
9111
|
+
parser.report(30, KeywordDescTable[token & 255]);
|
|
9112
|
+
}
|
|
9113
|
+
if (token === 209006 && context & (2048 | 2)) {
|
|
9114
|
+
parser.report(112);
|
|
9115
|
+
}
|
|
9116
|
+
if (token === 241771 && context & 1024) {
|
|
9117
|
+
parser.report(97, 'yield');
|
|
9118
|
+
}
|
|
9119
|
+
let memberExpression = parseIdentifier(parser, context | 64);
|
|
9120
|
+
while (parser.getToken() === 67108877) {
|
|
9121
|
+
nextToken(parser, (context | 262144 | 8) ^ 8);
|
|
9122
|
+
const property = parsePropertyOrPrivatePropertyName(parser, context | 64, privateScope);
|
|
9123
|
+
memberExpression = parser.finishNode({
|
|
9124
|
+
type: 'MemberExpression',
|
|
9125
|
+
object: memberExpression,
|
|
9126
|
+
computed: false,
|
|
9127
|
+
property,
|
|
9128
|
+
optional: false,
|
|
9129
|
+
}, expressionStart);
|
|
9130
|
+
}
|
|
9131
|
+
expression = memberExpression;
|
|
9132
|
+
if (parser.getToken() === 67174411) {
|
|
9133
|
+
const args = parseArguments(parser, context, privateScope, 0);
|
|
9134
|
+
expression = parser.finishNode({
|
|
9135
|
+
type: 'CallExpression',
|
|
9136
|
+
callee: memberExpression,
|
|
9137
|
+
arguments: args,
|
|
9138
|
+
optional: false,
|
|
9139
|
+
}, expressionStart);
|
|
9140
|
+
}
|
|
9141
|
+
}
|
|
8938
9142
|
return parser.finishNode({
|
|
8939
9143
|
type: 'Decorator',
|
|
8940
9144
|
expression,
|
|
8941
9145
|
}, start);
|
|
8942
9146
|
}
|
|
8943
|
-
function parseClassBody(parser, context, inheritedContext, scope, parentScope, kind,
|
|
9147
|
+
function parseClassBody(parser, context, inheritedContext, scope, parentScope, kind, inGroup, origin = 0) {
|
|
8944
9148
|
const { tokenStart } = parser;
|
|
8945
9149
|
const privateScope = parser.createPrivateScopeIfLexical(parentScope);
|
|
8946
9150
|
consume(parser, context | 32, 2162700);
|
|
@@ -8953,13 +9157,13 @@
|
|
|
8953
9157
|
const decoratorStart = parser.tokenStart;
|
|
8954
9158
|
const decorators = parseDecorators(parser, context, privateScope);
|
|
8955
9159
|
if (decorators.length > 0 && parser.tokenValue === 'constructor') {
|
|
8956
|
-
parser.report(
|
|
9160
|
+
parser.report(111);
|
|
8957
9161
|
}
|
|
8958
9162
|
if (parser.getToken() === 1074790415)
|
|
8959
|
-
parser.report(
|
|
9163
|
+
parser.report(110);
|
|
8960
9164
|
if (consumeOpt(parser, context, 1074790417)) {
|
|
8961
9165
|
if (decorators.length > 0)
|
|
8962
|
-
parser.report(
|
|
9166
|
+
parser.report(122);
|
|
8963
9167
|
continue;
|
|
8964
9168
|
}
|
|
8965
9169
|
body.push(parseClassElementList(parser, context, scope, privateScope, inheritedContext, kind, decorators, 0, inGroup, decorators.length > 0 ? decoratorStart : parser.tokenStart));
|
|
@@ -9022,7 +9226,7 @@
|
|
|
9022
9226
|
if ((parser.getToken() & 1073741824) === 1073741824) {
|
|
9023
9227
|
return parsePropertyDefinition(parser, context, privateScope, key, kind, decorators, start);
|
|
9024
9228
|
}
|
|
9025
|
-
if (parser.
|
|
9229
|
+
if (parser.features & 1)
|
|
9026
9230
|
kind |= 1024;
|
|
9027
9231
|
}
|
|
9028
9232
|
break;
|
|
@@ -9075,12 +9279,12 @@
|
|
|
9075
9279
|
key = parsePrivateIdentifier(parser, context, privateScope, kind);
|
|
9076
9280
|
}
|
|
9077
9281
|
else
|
|
9078
|
-
parser.report(
|
|
9282
|
+
parser.report(137);
|
|
9079
9283
|
}
|
|
9080
9284
|
if ((kind & 2) === 0) {
|
|
9081
9285
|
if (parser.tokenValue === 'constructor') {
|
|
9082
9286
|
if ((parser.getToken() & 1073741824) === 1073741824) {
|
|
9083
|
-
parser.report(
|
|
9287
|
+
parser.report(131);
|
|
9084
9288
|
}
|
|
9085
9289
|
else if ((kind & 32) === 0 && parser.getToken() === 67174411) {
|
|
9086
9290
|
if (kind & (768 | 16 | 128 | 8)) {
|
|
@@ -9118,7 +9322,7 @@
|
|
|
9118
9322
|
computed: (kind & 2) > 0,
|
|
9119
9323
|
key,
|
|
9120
9324
|
value,
|
|
9121
|
-
...(parser.
|
|
9325
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
9122
9326
|
}, start);
|
|
9123
9327
|
}
|
|
9124
9328
|
function parsePrivateIdentifier(parser, context, privateScope, kind) {
|
|
@@ -9126,7 +9330,7 @@
|
|
|
9126
9330
|
nextToken(parser, context);
|
|
9127
9331
|
const { tokenValue } = parser;
|
|
9128
9332
|
if (tokenValue === 'constructor')
|
|
9129
|
-
parser.report(
|
|
9333
|
+
parser.report(130);
|
|
9130
9334
|
if (parser.options.lexical) {
|
|
9131
9335
|
if (!privateScope)
|
|
9132
9336
|
parser.report(4, tokenValue);
|
|
@@ -9151,7 +9355,7 @@
|
|
|
9151
9355
|
nextToken(parser, context | 32);
|
|
9152
9356
|
const { tokenStart } = parser;
|
|
9153
9357
|
if (parser.getToken() === 537079928)
|
|
9154
|
-
parser.report(
|
|
9358
|
+
parser.report(121);
|
|
9155
9359
|
const modifierFlags = 1024 |
|
|
9156
9360
|
2048 |
|
|
9157
9361
|
8192 |
|
|
@@ -9177,32 +9381,32 @@
|
|
|
9177
9381
|
value,
|
|
9178
9382
|
static: (state & 32) > 0,
|
|
9179
9383
|
computed: (state & 2) > 0,
|
|
9180
|
-
...(parser.
|
|
9384
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
9181
9385
|
}, start);
|
|
9182
9386
|
}
|
|
9183
|
-
function parseBindingPattern(parser, context, scope, privateScope,
|
|
9387
|
+
function parseBindingPattern(parser, context, scope, privateScope, kind, origin = 0) {
|
|
9184
9388
|
if (parser.getToken() & 143360 ||
|
|
9185
9389
|
((context & 1) === 0 && parser.getToken() === -2147483526))
|
|
9186
|
-
return parseAndClassifyIdentifier(parser, context, scope,
|
|
9390
|
+
return parseAndClassifyIdentifier(parser, context, scope, kind, origin);
|
|
9187
9391
|
if ((parser.getToken() & 2097152) !== 2097152)
|
|
9188
9392
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
9189
9393
|
const left = parser.getToken() === 69271571
|
|
9190
|
-
? parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, 0, 1,
|
|
9191
|
-
: parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, 0, 1,
|
|
9394
|
+
? parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, 0, 1, kind, origin)
|
|
9395
|
+
: parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, 0, 1, kind, origin);
|
|
9192
9396
|
if (parser.destructible & 16)
|
|
9193
9397
|
parser.report(50);
|
|
9194
9398
|
if (parser.destructible & 32)
|
|
9195
9399
|
parser.report(50);
|
|
9196
9400
|
return left;
|
|
9197
9401
|
}
|
|
9198
|
-
function parseAndClassifyIdentifier(parser, context, scope, kind, origin) {
|
|
9402
|
+
function parseAndClassifyIdentifier(parser, context, scope, kind, origin = 0) {
|
|
9199
9403
|
const token = parser.getToken();
|
|
9200
9404
|
if (context & 1) {
|
|
9201
9405
|
if ((token & 537079808) === 537079808) {
|
|
9202
|
-
parser.report(
|
|
9406
|
+
parser.report(121);
|
|
9203
9407
|
}
|
|
9204
9408
|
else if ((token & 36864) === 36864 || token === -2147483526) {
|
|
9205
|
-
parser.report(
|
|
9409
|
+
parser.report(120);
|
|
9206
9410
|
}
|
|
9207
9411
|
}
|
|
9208
9412
|
if ((token & 20480) === 20480) {
|
|
@@ -9212,7 +9416,7 @@
|
|
|
9212
9416
|
if (context & 1024)
|
|
9213
9417
|
parser.report(32);
|
|
9214
9418
|
if (context & 2)
|
|
9215
|
-
parser.report(
|
|
9419
|
+
parser.report(113);
|
|
9216
9420
|
}
|
|
9217
9421
|
if ((token & 255) === (241737 & 255)) {
|
|
9218
9422
|
if (kind & (8 | 16))
|
|
@@ -9220,9 +9424,9 @@
|
|
|
9220
9424
|
}
|
|
9221
9425
|
if (token === 209006) {
|
|
9222
9426
|
if (context & 2048)
|
|
9223
|
-
parser.report(
|
|
9427
|
+
parser.report(178);
|
|
9224
9428
|
if (context & 2)
|
|
9225
|
-
parser.report(
|
|
9429
|
+
parser.report(112);
|
|
9226
9430
|
}
|
|
9227
9431
|
const { tokenValue, tokenStart: start } = parser;
|
|
9228
9432
|
nextToken(parser, context);
|
|
@@ -9254,7 +9458,7 @@
|
|
|
9254
9458
|
[children, closingElement] = parseJSXChildrenAndClosingElement(parser, context, privateScope, inJSXChild);
|
|
9255
9459
|
const close = isEqualTagName(closingElement.name);
|
|
9256
9460
|
if (isEqualTagName(openingElement.name) !== close)
|
|
9257
|
-
parser.report(
|
|
9461
|
+
parser.report(157, close);
|
|
9258
9462
|
}
|
|
9259
9463
|
return parser.finishNode({
|
|
9260
9464
|
type: 'JSXElement',
|
|
@@ -9323,7 +9527,7 @@
|
|
|
9323
9527
|
}
|
|
9324
9528
|
function parseJSXChildOrClosingElement(parser, context, privateScope, inJSXChild) {
|
|
9325
9529
|
if (parser.getToken() === 138)
|
|
9326
|
-
return parseJSXText(parser
|
|
9530
|
+
return parseJSXText(parser);
|
|
9327
9531
|
if (parser.getToken() === 2162700)
|
|
9328
9532
|
return parseJSXExpressionContainer(parser, context, privateScope, 1, 0);
|
|
9329
9533
|
if (parser.getToken() === 8456256) {
|
|
@@ -9337,7 +9541,7 @@
|
|
|
9337
9541
|
}
|
|
9338
9542
|
function parseJSXChildOrClosingFragment(parser, context, privateScope, inJSXChild) {
|
|
9339
9543
|
if (parser.getToken() === 138)
|
|
9340
|
-
return parseJSXText(parser
|
|
9544
|
+
return parseJSXText(parser);
|
|
9341
9545
|
if (parser.getToken() === 2162700)
|
|
9342
9546
|
return parseJSXExpressionContainer(parser, context, privateScope, 1, 0);
|
|
9343
9547
|
if (parser.getToken() === 8456256) {
|
|
@@ -9349,9 +9553,9 @@
|
|
|
9349
9553
|
}
|
|
9350
9554
|
parser.report(0);
|
|
9351
9555
|
}
|
|
9352
|
-
function parseJSXText(parser
|
|
9556
|
+
function parseJSXText(parser) {
|
|
9353
9557
|
const start = parser.tokenStart;
|
|
9354
|
-
|
|
9558
|
+
nextJSXToken(parser);
|
|
9355
9559
|
const node = {
|
|
9356
9560
|
type: 'JSXText',
|
|
9357
9561
|
value: parser.tokenValue,
|
|
@@ -9449,7 +9653,7 @@
|
|
|
9449
9653
|
value = parseJSXExpressionContainer(parser, context, privateScope, 0, 1);
|
|
9450
9654
|
break;
|
|
9451
9655
|
default:
|
|
9452
|
-
parser.report(
|
|
9656
|
+
parser.report(156);
|
|
9453
9657
|
}
|
|
9454
9658
|
}
|
|
9455
9659
|
return parser.finishNode({
|
|
@@ -9476,7 +9680,7 @@
|
|
|
9476
9680
|
let expression;
|
|
9477
9681
|
if (parser.getToken() === 1074790415) {
|
|
9478
9682
|
if (isAttr)
|
|
9479
|
-
parser.report(
|
|
9683
|
+
parser.report(159);
|
|
9480
9684
|
expression = parseJSXEmptyExpression(parser, {
|
|
9481
9685
|
index: parser.startIndex,
|
|
9482
9686
|
line: parser.startLine,
|