meriyah 7.2.0 → 7.3.0

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/dist/meriyah.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version$1 = "7.2.0";
3
+ var version$1 = "7.3.0";
4
4
  var packageJson = {
5
5
  version: version$1};
6
6
 
@@ -623,7 +623,7 @@ const errorMessages = {
623
623
  [9]: 'Octal literals are not allowed in strict mode',
624
624
  [8]: 'Decimal integer literals with a leading zero are forbidden in strict mode',
625
625
  [10]: 'Expected number in radix %0',
626
- [151]: 'Invalid left-hand side assignment to a destructible right-hand side',
626
+ [153]: 'Invalid left-hand side assignment to a destructible right-hand side',
627
627
  [11]: 'Non-number found after exponent indicator',
628
628
  [12]: 'Invalid BigIntLiteral',
629
629
  [13]: 'No identifiers allowed directly after numeric literal',
@@ -647,7 +647,7 @@ const errorMessages = {
647
647
  [32]: 'Yield expression not allowed in formal parameter',
648
648
  [95]: "Unexpected token: 'escaped keyword'",
649
649
  [33]: 'Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses',
650
- [123]: 'Async functions can only be declared at the top level or inside a block',
650
+ [125]: 'Async functions can only be declared at the top level or inside a block',
651
651
  [34]: 'Unterminated regular expression',
652
652
  [35]: 'Unexpected regular expression flag',
653
653
  [36]: "Duplicate regular expression flag '%0'",
@@ -659,7 +659,7 @@ const errorMessages = {
659
659
  [42]: 'A getter cannot be a generator',
660
660
  [43]: 'A setter cannot be a generator',
661
661
  [44]: 'A computed property name must be followed by a colon or paren',
662
- [134]: 'Object literal keys that are strings or numbers must be a method or have a colon',
662
+ [136]: 'Object literal keys that are strings or numbers must be a method or have a colon',
663
663
  [46]: 'Found `* async x(){}` but this should be `async * x(){}`',
664
664
  [45]: 'Getters and setters can not be generators',
665
665
  [47]: "'%0' can not be generator method",
@@ -721,73 +721,75 @@ const errorMessages = {
721
721
  [105]: '%0 source must be string',
722
722
  [106]: 'Only a identifier or string can be used to indicate alias',
723
723
  [107]: "Only '*' or '{...}' can be imported after default",
724
- [108]: 'Trailing decorator may be followed by method',
725
- [109]: "Decorators can't be used with a constructor",
726
- [110]: 'Can not use `await` as identifier in module or async func',
727
- [111]: 'Can not use `await` as identifier in module',
728
- [112]: 'HTML comments are only allowed with web compatibility (Annex B)',
729
- [113]: "The identifier 'let' must not be in expression position in strict mode",
730
- [114]: 'Cannot assign to `eval` and `arguments` in strict mode',
731
- [115]: "The left-hand side of a for-of loop may not start with 'let'",
732
- [116]: 'Block body arrows can not be immediately invoked without a group',
733
- [117]: 'Block body arrows can not be immediately accessed without a group',
734
- [118]: 'Unexpected strict mode reserved word',
735
- [119]: 'Unexpected eval or arguments in strict mode',
736
- [120]: 'Decorators must not be followed by a semicolon',
737
- [121]: 'Calling delete on expression not allowed in strict mode',
738
- [122]: 'Pattern can not have a tail',
739
- [124]: 'Can not have a `yield` expression on the left side of a ternary',
740
- [125]: 'An arrow function can not have a postfix update operator',
741
- [126]: 'Invalid object literal key character after generator star',
742
- [127]: 'Private fields can not be deleted',
743
- [129]: 'Classes may not have a field called constructor',
744
- [128]: 'Classes may not have a private element named constructor',
745
- [130]: 'A class field initializer or static block may not contain arguments',
746
- [131]: 'Generators can only be declared at the top level or inside a block',
747
- [132]: 'Async methods are a restricted production and cannot have a newline following it',
748
- [133]: 'Unexpected character after object literal property name',
749
- [135]: 'Invalid key token',
750
- [136]: "Label '%0' has already been declared",
751
- [137]: 'continue statement must be nested within an iteration statement',
752
- [138]: "Undefined label '%0'",
753
- [139]: 'Trailing comma is disallowed inside import(...) arguments',
754
- [140]: 'Invalid binding in JSON import',
755
- [141]: 'import() requires exactly one argument',
756
- [142]: 'Cannot use new with import(...)',
757
- [143]: '... is not allowed in import()',
758
- [144]: "Expected '=>'",
759
- [145]: "Duplicate binding '%0'",
760
- [146]: 'Duplicate private identifier #%0',
761
- [147]: "Cannot export a duplicate name '%0'",
762
- [150]: 'Duplicate %0 for-binding',
763
- [148]: "Exported binding '%0' needs to refer to a top-level declared variable",
764
- [149]: 'Unexpected private field',
765
- [153]: 'Numeric separators are not allowed at the end of numeric literals',
766
- [152]: 'Only one underscore is allowed as numeric separator',
767
- [154]: 'JSX value should be either an expression or a quoted JSX text',
768
- [155]: 'Expected corresponding JSX closing tag for %0',
769
- [156]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
770
- [157]: "JSX attributes must only be assigned a non-empty 'expression'",
771
- [158]: "'%0' has already been declared",
772
- [159]: "'%0' shadowed a catch clause binding",
773
- [160]: 'Dot property must be an identifier',
774
- [161]: 'Encountered invalid input after spread/rest argument',
775
- [162]: 'Catch without try',
776
- [163]: 'Finally without try',
777
- [164]: 'Expected corresponding closing tag for JSX fragment',
778
- [165]: 'Coalescing and logical operators used together in the same expression must be disambiguated with parentheses',
779
- [166]: 'Invalid tagged template on optional chain',
780
- [167]: 'Invalid optional chain from super property',
781
- [168]: 'Invalid optional chain from new expression',
782
- [169]: 'Cannot use "import.meta" outside a module',
783
- [170]: 'Leading decorators must be attached to a class declaration',
784
- [171]: 'An export name cannot include a lone surrogate',
785
- [172]: 'A string literal cannot be used as an exported binding without `from`',
786
- [173]: "Private fields can't be accessed on super",
787
- [174]: "The only valid meta property for import is 'import.meta'",
788
- [175]: "'import.meta' must not contain escaped characters",
789
- [176]: 'cannot use "await" as identifier inside an async function',
790
- [177]: 'cannot use "await" in static blocks',
724
+ [108]: "'import defer' must be followed by a namespace import",
725
+ [109]: "'import source' must be followed by a default import",
726
+ [110]: 'Trailing decorator may be followed by method',
727
+ [111]: "Decorators can't be used with a constructor",
728
+ [112]: 'Can not use `await` as identifier in module or async func',
729
+ [113]: 'Can not use `await` as identifier in module',
730
+ [114]: 'HTML comments are only allowed with web compatibility (Annex B)',
731
+ [115]: "The identifier 'let' must not be in expression position in strict mode",
732
+ [116]: 'Cannot assign to `eval` and `arguments` in strict mode',
733
+ [117]: "The left-hand side of a for-of loop may not start with 'let'",
734
+ [118]: 'Block body arrows can not be immediately invoked without a group',
735
+ [119]: 'Block body arrows can not be immediately accessed without a group',
736
+ [120]: 'Unexpected strict mode reserved word',
737
+ [121]: 'Unexpected eval or arguments in strict mode',
738
+ [122]: 'Decorators must not be followed by a semicolon',
739
+ [123]: 'Calling delete on expression not allowed in strict mode',
740
+ [124]: 'Pattern can not have a tail',
741
+ [126]: 'Can not have a `yield` expression on the left side of a ternary',
742
+ [127]: 'An arrow function can not have a postfix update operator',
743
+ [128]: 'Invalid object literal key character after generator star',
744
+ [129]: 'Private fields can not be deleted',
745
+ [131]: 'Classes may not have a field called constructor',
746
+ [130]: 'Classes may not have a private element named constructor',
747
+ [132]: 'A class field initializer or static block may not contain arguments',
748
+ [133]: 'Generators can only be declared at the top level or inside a block',
749
+ [134]: 'Async methods are a restricted production and cannot have a newline following it',
750
+ [135]: 'Unexpected character after object literal property name',
751
+ [137]: 'Invalid key token',
752
+ [138]: "Label '%0' has already been declared",
753
+ [139]: 'continue statement must be nested within an iteration statement',
754
+ [140]: "Undefined label '%0'",
755
+ [141]: 'Trailing comma is disallowed inside import(...) arguments',
756
+ [142]: 'Invalid binding in JSON import',
757
+ [143]: 'import() requires exactly one argument',
758
+ [144]: 'Cannot use new with import(...)',
759
+ [145]: '... is not allowed in import()',
760
+ [146]: "Expected '=>'",
761
+ [147]: "Duplicate binding '%0'",
762
+ [148]: 'Duplicate private identifier #%0',
763
+ [149]: "Cannot export a duplicate name '%0'",
764
+ [152]: 'Duplicate %0 for-binding',
765
+ [150]: "Exported binding '%0' needs to refer to a top-level declared variable",
766
+ [151]: 'Unexpected private field',
767
+ [155]: 'Numeric separators are not allowed at the end of numeric literals',
768
+ [154]: 'Only one underscore is allowed as numeric separator',
769
+ [156]: 'JSX value should be either an expression or a quoted JSX text',
770
+ [157]: 'Expected corresponding JSX closing tag for %0',
771
+ [158]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
772
+ [159]: "JSX attributes must only be assigned a non-empty 'expression'",
773
+ [160]: "'%0' has already been declared",
774
+ [161]: "'%0' shadowed a catch clause binding",
775
+ [162]: 'Dot property must be an identifier',
776
+ [163]: 'Encountered invalid input after spread/rest argument',
777
+ [164]: 'Catch without try',
778
+ [165]: 'Finally without try',
779
+ [166]: 'Expected corresponding closing tag for JSX fragment',
780
+ [167]: 'Coalescing and logical operators used together in the same expression must be disambiguated with parentheses',
781
+ [168]: 'Invalid tagged template on optional chain',
782
+ [169]: 'Invalid optional chain from super property',
783
+ [170]: 'Invalid optional chain from new expression',
784
+ [171]: 'Cannot use "import.meta" outside a module',
785
+ [172]: 'Leading decorators must be attached to a class declaration',
786
+ [173]: 'An export name cannot include a lone surrogate',
787
+ [174]: 'A string literal cannot be used as an exported binding without `from`',
788
+ [175]: "Private fields can't be accessed on super",
789
+ [176]: "The only valid meta property for import is 'import.meta'",
790
+ [177]: "'import.meta' must not contain escaped characters",
791
+ [178]: 'cannot use "await" as identifier inside an async function',
792
+ [179]: 'cannot use "await" in static blocks',
791
793
  };
792
794
  class ParseError extends SyntaxError {
793
795
  start;
@@ -811,10 +813,6 @@ class ParseError extends SyntaxError {
811
813
  }
812
814
  const isParseError = (error) => error instanceof ParseError;
813
815
 
814
- function getOwnProperty(object, key) {
815
- return Object.hasOwn(object, key) ? object[key] : undefined;
816
- }
817
-
818
816
  const KeywordDescTable = [
819
817
  'end of source',
820
818
  'identifier', 'number', 'string', 'regular expression',
@@ -836,75 +834,82 @@ const KeywordDescTable = [
836
834
  'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
837
835
  'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
838
836
  ];
839
- const descKeywordTable = {
840
- this: 86111,
841
- function: 86104,
842
- if: 20569,
843
- return: 20572,
844
- var: 86088,
845
- else: 20563,
846
- for: 20567,
847
- new: 86107,
848
- in: 8673330,
849
- typeof: 16863275,
850
- while: 20578,
851
- case: 20556,
852
- break: 20555,
853
- try: 20577,
854
- catch: 20557,
855
- delete: 16863276,
856
- throw: 86112,
857
- switch: 86110,
858
- continue: 20559,
859
- default: 20561,
860
- instanceof: 8411187,
861
- do: 20562,
862
- void: 16863277,
863
- finally: 20566,
864
- async: 209005,
865
- await: 209006,
866
- class: 86094,
867
- const: 86090,
868
- constructor: 12399,
869
- debugger: 20560,
870
- export: 20564,
871
- extends: 20565,
872
- false: 86021,
873
- from: 209011,
874
- get: 209008,
875
- implements: 36964,
876
- import: 86106,
877
- interface: 36965,
878
- let: 241737,
879
- null: 86023,
880
- of: 471156,
881
- using: 209013,
882
- package: 36966,
883
- private: 36967,
884
- protected: 36968,
885
- public: 36969,
886
- set: 209009,
887
- static: 36970,
888
- super: 86109,
889
- true: 86022,
890
- with: 20579,
891
- yield: 241771,
892
- enum: 86134,
893
- eval: 537079927,
894
- as: 77932,
895
- arguments: 537079928,
896
- target: 209030,
897
- meta: 209031,
898
- accessor: 12402,
899
- };
837
+ const descKeywordTable = new Map([
838
+ ['this', 86111],
839
+ ['function', 86104],
840
+ ['if', 20569],
841
+ ['return', 20572],
842
+ ['var', 86088],
843
+ ['else', 20563],
844
+ ['for', 20567],
845
+ ['new', 86107],
846
+ ['in', 8673330],
847
+ ['typeof', 16863275],
848
+ ['while', 20578],
849
+ ['case', 20556],
850
+ ['break', 20555],
851
+ ['try', 20577],
852
+ ['catch', 20557],
853
+ ['delete', 16863276],
854
+ ['throw', 86112],
855
+ ['switch', 86110],
856
+ ['continue', 20559],
857
+ ['default', 20561],
858
+ ['instanceof', 8411187],
859
+ ['do', 20562],
860
+ ['void', 16863277],
861
+ ['finally', 20566],
862
+ ['async', 209005],
863
+ ['await', 209006],
864
+ ['class', 86094],
865
+ ['const', 86090],
866
+ ['constructor', 12399],
867
+ ['debugger', 20560],
868
+ ['export', 20564],
869
+ ['extends', 20565],
870
+ ['false', 86021],
871
+ ['from', 209011],
872
+ ['get', 209008],
873
+ ['implements', 36964],
874
+ ['import', 86106],
875
+ ['interface', 36965],
876
+ ['let', 241737],
877
+ ['null', 86023],
878
+ ['of', 471156],
879
+ ['using', 209013],
880
+ ['package', 36966],
881
+ ['private', 36967],
882
+ ['protected', 36968],
883
+ ['public', 36969],
884
+ ['set', 209009],
885
+ ['static', 36970],
886
+ ['super', 86109],
887
+ ['true', 86022],
888
+ ['with', 20579],
889
+ ['yield', 241771],
890
+ ['enum', 86134],
891
+ ['eval', 537079927],
892
+ ['as', 77932],
893
+ ['arguments', 537079928],
894
+ ['target', 209030],
895
+ ['meta', 209031],
896
+ ['accessor', 12402],
897
+ ]);
898
+ const keywordLengths = [...descKeywordTable.keys()].map((keyword) => keyword.length);
899
+ const minKeywordLength = Math.min(...keywordLengths);
900
+ const maxKeywordLength = Math.max(...keywordLengths);
900
901
 
901
902
  function scanIdentifier(parser, context, isValidAsKeyword) {
902
903
  while (isIdPart[advanceChar(parser)])
903
904
  ;
904
905
  parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
905
- return parser.currentChar !== 92 && parser.currentChar <= 0x7e
906
- ? (getOwnProperty(descKeywordTable, parser.tokenValue) ?? 208897)
907
- : scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword);
906
+ if (parser.currentChar === 92 || parser.currentChar > 0x7e) {
907
+ return scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword);
908
+ }
909
+ const length = parser.index - parser.tokenIndex;
910
+ if (length < minKeywordLength || length > maxKeywordLength)
911
+ return 208897;
912
+ return descKeywordTable.get(parser.tokenValue) ?? 208897;
908
913
  }
909
914
  function scanUnicodeIdentifier(parser, context) {
910
915
  const cookedChar = scanIdentifierUnicodeEscape(parser);
@@ -946,8 +951,8 @@ function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) {
946
951
  parser.tokenValue += parser.source.slice(start, parser.index);
947
952
  }
948
953
  const { length } = parser.tokenValue;
949
- if (isValidAsKeyword && length >= 2 && length <= 11) {
950
- const token = getOwnProperty(descKeywordTable, parser.tokenValue);
954
+ if (isValidAsKeyword && length >= minKeywordLength && length <= maxKeywordLength) {
955
+ const token = descKeywordTable.get(parser.tokenValue);
951
956
  if (token === void 0)
952
957
  return 208897 | (hasEscape ? -2147483648 : 0);
953
958
  if (!hasEscape)
@@ -1071,7 +1076,7 @@ function scanNumber(parser, context, kind) {
1071
1076
  while (CharTypes[char] & (64 | 4096)) {
1072
1077
  if (char === 95) {
1073
1078
  if (!allowSeparator)
1074
- parser.report(152);
1079
+ parser.report(154);
1075
1080
  allowSeparator = 0;
1076
1081
  char = advanceChar(parser);
1077
1082
  continue;
@@ -1082,7 +1087,7 @@ function scanNumber(parser, context, kind) {
1082
1087
  char = advanceChar(parser);
1083
1088
  }
1084
1089
  if (digits === 0 || !allowSeparator) {
1085
- parser.report(digits === 0 ? 21 : 153);
1090
+ parser.report(digits === 0 ? 21 : 155);
1086
1091
  }
1087
1092
  }
1088
1093
  else if ((char | 32) === 111) {
@@ -1091,7 +1096,7 @@ function scanNumber(parser, context, kind) {
1091
1096
  while (CharTypes[char] & (32 | 4096)) {
1092
1097
  if (char === 95) {
1093
1098
  if (!allowSeparator) {
1094
- parser.report(152);
1099
+ parser.report(154);
1095
1100
  }
1096
1101
  allowSeparator = 0;
1097
1102
  char = advanceChar(parser);
@@ -1103,7 +1108,7 @@ function scanNumber(parser, context, kind) {
1103
1108
  char = advanceChar(parser);
1104
1109
  }
1105
1110
  if (digits === 0 || !allowSeparator) {
1106
- parser.report(digits === 0 ? 0 : 153);
1111
+ parser.report(digits === 0 ? 0 : 155);
1107
1112
  }
1108
1113
  }
1109
1114
  else if ((char | 32) === 98) {
@@ -1112,7 +1117,7 @@ function scanNumber(parser, context, kind) {
1112
1117
  while (CharTypes[char] & (128 | 4096)) {
1113
1118
  if (char === 95) {
1114
1119
  if (!allowSeparator) {
1115
- parser.report(152);
1120
+ parser.report(154);
1116
1121
  }
1117
1122
  allowSeparator = 0;
1118
1123
  char = advanceChar(parser);
@@ -1124,7 +1129,7 @@ function scanNumber(parser, context, kind) {
1124
1129
  char = advanceChar(parser);
1125
1130
  }
1126
1131
  if (digits === 0 || !allowSeparator) {
1127
- parser.report(digits === 0 ? 0 : 153);
1132
+ parser.report(digits === 0 ? 0 : 155);
1128
1133
  }
1129
1134
  }
1130
1135
  else if (CharTypes[char] & 32) {
@@ -1157,7 +1162,7 @@ function scanNumber(parser, context, kind) {
1157
1162
  if (char === 95) {
1158
1163
  char = advanceChar(parser);
1159
1164
  if (char === 95 || kind & 32) {
1160
- throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
1165
+ throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 154);
1161
1166
  }
1162
1167
  allowSeparator = 1;
1163
1168
  continue;
@@ -1168,7 +1173,7 @@ function scanNumber(parser, context, kind) {
1168
1173
  --digit;
1169
1174
  }
1170
1175
  if (allowSeparator) {
1171
- throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
1176
+ throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 155);
1172
1177
  }
1173
1178
  if (digit >= 0 && !isIdentifierStart(char) && char !== 46) {
1174
1179
  parser.tokenValue = value;
@@ -1233,7 +1238,7 @@ function scanDecimalDigitsOrSeparator(parser, char) {
1233
1238
  const { index } = parser;
1234
1239
  char = advanceChar(parser);
1235
1240
  if (char === 95) {
1236
- throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
1241
+ throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 154);
1237
1242
  }
1238
1243
  allowSeparator = 1;
1239
1244
  ret += parser.source.substring(start, index);
@@ -1244,7 +1249,7 @@ function scanDecimalDigitsOrSeparator(parser, char) {
1244
1249
  char = advanceChar(parser);
1245
1250
  }
1246
1251
  if (allowSeparator) {
1247
- throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
1252
+ throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 155);
1248
1253
  }
1249
1254
  return ret + parser.source.substring(start, parser.index);
1250
1255
  }
@@ -1965,7 +1970,7 @@ function scanSingleToken(parser, context, state) {
1965
1970
  advanceChar(parser);
1966
1971
  if ((state & 1 || isStartOfLine) && parser.currentChar === 62) {
1967
1972
  if (!parser.options.webcompat)
1968
- parser.report(112);
1973
+ parser.report(114);
1969
1974
  advanceChar(parser);
1970
1975
  state = skipSingleHTMLComment(parser, source, state, context, 3, parser.tokenStart);
1971
1976
  continue;
@@ -2194,10 +2199,10 @@ function reinterpretToPattern(parser, node) {
2194
2199
  function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
2195
2200
  if (context & 1) {
2196
2201
  if ((t & 36864) === 36864) {
2197
- parser.report(118);
2202
+ parser.report(120);
2198
2203
  }
2199
2204
  if (!skipEvalArgCheck && (t & 537079808) === 537079808) {
2200
- parser.report(119);
2205
+ parser.report(121);
2201
2206
  }
2202
2207
  }
2203
2208
  if ((t & 20480) === 20480 || t === -2147483527) {
@@ -2207,7 +2212,7 @@ function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
2207
2212
  parser.report(100);
2208
2213
  }
2209
2214
  if (context & (2048 | 2) && t === 209006) {
2210
- parser.report(110);
2215
+ parser.report(112);
2211
2216
  }
2212
2217
  if (context & (1024 | 1) && t === 241771) {
2213
2218
  parser.report(97, 'yield');
@@ -2216,10 +2221,10 @@ function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
2216
2221
  function validateFunctionName(parser, context, t) {
2217
2222
  if (context & 1) {
2218
2223
  if ((t & 36864) === 36864) {
2219
- parser.report(118);
2224
+ parser.report(120);
2220
2225
  }
2221
2226
  if ((t & 537079808) === 537079808) {
2222
- parser.report(119);
2227
+ parser.report(121);
2223
2228
  }
2224
2229
  if (t === -2147483526) {
2225
2230
  parser.report(95);
@@ -2232,7 +2237,7 @@ function validateFunctionName(parser, context, t) {
2232
2237
  parser.report(102);
2233
2238
  }
2234
2239
  if (context & (2048 | 2) && t === 209006) {
2235
- parser.report(110);
2240
+ parser.report(112);
2236
2241
  }
2237
2242
  if (context & (1024 | 1) && t === 241771) {
2238
2243
  parser.report(97, 'yield');
@@ -2241,7 +2246,7 @@ function validateFunctionName(parser, context, t) {
2241
2246
  function isStrictReservedWord(parser, context, t) {
2242
2247
  if (t === 209006) {
2243
2248
  if (context & (2048 | 2))
2244
- parser.report(110);
2249
+ parser.report(112);
2245
2250
  parser.destructible |= 128;
2246
2251
  }
2247
2252
  if (t === 241771 && context & 1024)
@@ -2257,7 +2262,7 @@ function isValidLabel(parser, labels, name, isIterationStatement) {
2257
2262
  while (labels) {
2258
2263
  if (labels['$' + name]) {
2259
2264
  if (isIterationStatement)
2260
- parser.report(137);
2265
+ parser.report(139);
2261
2266
  return 1;
2262
2267
  }
2263
2268
  if (isIterationStatement && labels.loop)
@@ -2270,7 +2275,7 @@ function validateAndDeclareLabel(parser, labels, name) {
2270
2275
  let set = labels;
2271
2276
  while (set) {
2272
2277
  if (set['$' + name])
2273
- parser.report(136, name);
2278
+ parser.report(138, name);
2274
2279
  set = set['$'];
2275
2280
  }
2276
2281
  labels['$' + name] = 1;
@@ -2298,14 +2303,14 @@ function isValidIdentifier(context, t) {
2298
2303
  function classifyIdentifier(parser, context, t) {
2299
2304
  if ((t & 537079808) === 537079808) {
2300
2305
  if (context & 1)
2301
- parser.report(119);
2306
+ parser.report(121);
2302
2307
  parser.flags |= 512;
2303
2308
  }
2304
2309
  if (!isValidIdentifier(context, t))
2305
2310
  parser.report(0);
2306
2311
  }
2307
2312
 
2308
- const entities = {
2313
+ const entities = new Map(Object.entries({
2309
2314
  AElig: '\u00C6',
2310
2315
  AMP: '\u0026',
2311
2316
  Aacute: '\u00C1',
@@ -4431,8 +4436,8 @@ const entities = {
4431
4436
  zscr: '\uD835\uDCCF',
4432
4437
  zwj: '\u200D',
4433
4438
  zwnj: '\u200C',
4434
- };
4435
- const decodeMap = {
4439
+ }));
4440
+ const decodeMap = new Map(Object.entries({
4436
4441
  '0': 65533,
4437
4442
  '128': 8364,
4438
4443
  '130': 8218,
@@ -4461,7 +4466,7 @@ const decodeMap = {
4461
4466
  '156': 339,
4462
4467
  '158': 382,
4463
4468
  '159': 376,
4464
- };
4469
+ }).map(([key, value]) => [Number(key), value]));
4465
4470
  function decodeHTMLStrict(text) {
4466
4471
  return text.replaceAll(/&(?:[a-zA-Z]+|#[xX][\da-fA-F]+|#\d+);/g, (key) => {
4467
4472
  if (key.charAt(1) === '#') {
@@ -4469,14 +4474,14 @@ function decodeHTMLStrict(text) {
4469
4474
  const codePoint = secondChar === 'X' || secondChar === 'x' ? parseInt(key.slice(3), 16) : parseInt(key.slice(2), 10);
4470
4475
  return decodeCodePoint(codePoint);
4471
4476
  }
4472
- return getOwnProperty(entities, key.slice(1, -1)) ?? key;
4477
+ return entities.get(key.slice(1, -1)) ?? key;
4473
4478
  });
4474
4479
  }
4475
4480
  function decodeCodePoint(codePoint) {
4476
4481
  if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
4477
4482
  return '\uFFFD';
4478
4483
  }
4479
- return String.fromCodePoint(getOwnProperty(decodeMap, codePoint) ?? codePoint);
4484
+ return String.fromCodePoint(decodeMap.get(codePoint) ?? codePoint);
4480
4485
  }
4481
4486
 
4482
4487
  function scanJSXAttributeValue(parser, context) {
@@ -4561,6 +4566,8 @@ function rescanJSXIdentifier(parser) {
4561
4566
  return parser.getToken();
4562
4567
  }
4563
4568
 
4569
+ const nextFeatures = 1 | 2 | 4;
4570
+
4564
4571
  function normalizeRanges(ranges) {
4565
4572
  if (!ranges)
4566
4573
  return undefined;
@@ -4573,17 +4580,27 @@ function normalizeRanges(ranges) {
4573
4580
  };
4574
4581
  }
4575
4582
  function normalizeOptions(rawOptions) {
4576
- const options = {
4583
+ let { features, next, ranges, module, sourceType, globalReturn, ...restOptions } = {
4577
4584
  validateRegex: true,
4585
+ features: 0,
4578
4586
  ...rawOptions,
4579
- ranges: normalizeRanges(rawOptions.ranges),
4580
4587
  };
4581
- if (options.module && !options.sourceType) {
4582
- options.sourceType = 'module';
4588
+ if (next) {
4589
+ features |= nextFeatures;
4590
+ }
4591
+ ranges = normalizeRanges(ranges);
4592
+ if (module && !sourceType) {
4593
+ sourceType = 'module';
4583
4594
  }
4584
- if (options.globalReturn && (!options.sourceType || options.sourceType === 'script')) {
4585
- options.sourceType = 'commonjs';
4595
+ if (globalReturn && (!sourceType || sourceType === 'script')) {
4596
+ sourceType = 'commonjs';
4586
4597
  }
4598
+ const options = {
4599
+ ...restOptions,
4600
+ ranges,
4601
+ features,
4602
+ sourceType,
4603
+ };
4587
4604
  return options;
4588
4605
  }
4589
4606
 
@@ -4604,7 +4621,7 @@ class PrivateScope {
4604
4621
  const value = privateIdentifiers.get(name);
4605
4622
  if (this.hasPrivateIdentifier(name) &&
4606
4623
  ((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
4607
- this.parser.report(146, name);
4624
+ this.parser.report(148, name);
4608
4625
  }
4609
4626
  privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
4610
4627
  }
@@ -4665,17 +4682,17 @@ class Scope {
4665
4682
  ((kind & 128 && value & 68) ||
4666
4683
  (value & 128 && kind & 68))) ;
4667
4684
  else {
4668
- parser.report(145, name);
4685
+ parser.report(147, name);
4669
4686
  }
4670
4687
  }
4671
4688
  if (currentScope === this) {
4672
4689
  if (value && value & 1 && kind & 1) {
4673
- currentScope.recordScopeError(145, name);
4690
+ currentScope.recordScopeError(147, name);
4674
4691
  }
4675
4692
  }
4676
4693
  if (value &&
4677
4694
  (value & 256 || (value & 512 && !parser.options.webcompat))) {
4678
- parser.report(145, name);
4695
+ parser.report(147, name);
4679
4696
  }
4680
4697
  currentScope.variableBindings.set(name, kind);
4681
4698
  currentScope = currentScope.parent;
@@ -4689,7 +4706,7 @@ class Scope {
4689
4706
  const value = this.variableBindings.get(name);
4690
4707
  if (value && (value & 2) === 0) {
4691
4708
  if (kind & 1) {
4692
- this.recordScopeError(145, name);
4709
+ this.recordScopeError(147, name);
4693
4710
  }
4694
4711
  else if (parser.options.webcompat &&
4695
4712
  (context & 1) === 0 &&
@@ -4697,22 +4714,22 @@ class Scope {
4697
4714
  value === 64 &&
4698
4715
  kind === 64) ;
4699
4716
  else {
4700
- parser.report(145, name);
4717
+ parser.report(147, name);
4701
4718
  }
4702
4719
  }
4703
4720
  if (this.type & 64 &&
4704
4721
  this.parent?.hasVariable(name) &&
4705
4722
  (this.parent.variableBindings.get(name) & 2) === 0) {
4706
- parser.report(145, name);
4723
+ parser.report(147, name);
4707
4724
  }
4708
4725
  if (this.type & 512 && value && (value & 2) === 0) {
4709
4726
  if (kind & 1) {
4710
- this.recordScopeError(145, name);
4727
+ this.recordScopeError(147, name);
4711
4728
  }
4712
4729
  }
4713
4730
  if (this.type & 32) {
4714
4731
  if (this.parent.variableBindings.get(name) & 768)
4715
- parser.report(159, name);
4732
+ parser.report(161, name);
4716
4733
  }
4717
4734
  this.variableBindings.set(name, kind);
4718
4735
  }
@@ -4744,6 +4761,7 @@ class Parser {
4744
4761
  options;
4745
4762
  token = 1048576;
4746
4763
  flags = 0;
4764
+ features = 0;
4747
4765
  index = 0;
4748
4766
  line = 1;
4749
4767
  column = 0;
@@ -4769,6 +4787,7 @@ class Parser {
4769
4787
  this.end = source.length;
4770
4788
  this.currentChar = source.charCodeAt(0);
4771
4789
  this.options = normalizeOptions(rawOptions);
4790
+ this.features = this.options.features;
4772
4791
  if (Array.isArray(this.options.onComment)) {
4773
4792
  this.options.onComment = pushComment(this.options.onComment, this.options);
4774
4793
  }
@@ -4849,7 +4868,7 @@ class Parser {
4849
4868
  declareUnboundVariable(name) {
4850
4869
  const { exportedNames } = this;
4851
4870
  if (exportedNames.has(name)) {
4852
- this.report(147, name);
4871
+ this.report(149, name);
4853
4872
  }
4854
4873
  exportedNames.add(name);
4855
4874
  }
@@ -4872,29 +4891,10 @@ class Parser {
4872
4891
  return undefined;
4873
4892
  }
4874
4893
  cloneIdentifier(original) {
4875
- return this.cloneLocationInformation({ ...original }, original);
4894
+ return structuredClone(original);
4876
4895
  }
4877
4896
  cloneStringLiteral(original) {
4878
- return this.cloneLocationInformation({ ...original }, original);
4879
- }
4880
- cloneLocationInformation(node, original) {
4881
- const { ranges } = this.options;
4882
- if (ranges) {
4883
- if (ranges.start)
4884
- node.start = original.start;
4885
- if (ranges.end)
4886
- node.end = original.end;
4887
- if (ranges.range)
4888
- node.range = [...original.range];
4889
- }
4890
- if (this.options.loc) {
4891
- node.loc = {
4892
- ...original.loc,
4893
- start: { ...original.loc.start },
4894
- end: { ...original.loc.end },
4895
- };
4896
- }
4897
- return node;
4897
+ return structuredClone(original);
4898
4898
  }
4899
4899
  }
4900
4900
  function pushComment(comments, options) {
@@ -4957,7 +4957,7 @@ function parseSource(source, rawOptions = {}, context = 0) {
4957
4957
  if (scope) {
4958
4958
  for (const name of parser.exportedBindings) {
4959
4959
  if (!scope.hasVariable(name))
4960
- parser.report(148, name);
4960
+ parser.report(150, name);
4961
4961
  }
4962
4962
  }
4963
4963
  }
@@ -5019,22 +5019,28 @@ function parseModuleItem(parser, context, scope) {
5019
5019
  moduleItem = parseExportDeclaration(parser, context, scope);
5020
5020
  break;
5021
5021
  case 86106:
5022
+ if (parser.leadingDecorators.decorators.length) {
5023
+ parser.report(172);
5024
+ }
5022
5025
  moduleItem = parseImportDeclaration(parser, context, scope);
5023
5026
  break;
5024
5027
  default:
5025
5028
  moduleItem = parseStatementListItem(parser, context, scope, undefined, 4, {});
5026
5029
  }
5027
- if (parser.leadingDecorators?.decorators.length) {
5028
- parser.report(170);
5029
- }
5030
5030
  return moduleItem;
5031
5031
  }
5032
5032
  function parseStatementListItem(parser, context, scope, privateScope, origin, labels) {
5033
5033
  const start = parser.tokenStart;
5034
+ if (parser.leadingDecorators.decorators.length && parser.getToken() !== 86094) {
5035
+ parser.report(172);
5036
+ }
5034
5037
  switch (parser.getToken()) {
5035
5038
  case 86104:
5036
5039
  return parseFunctionDeclaration(parser, context, scope, privateScope, origin, 1, 0, 0, start);
5037
5040
  case 133:
5041
+ if (!(parser.features & 1)) {
5042
+ parser.report(30, '@');
5043
+ }
5038
5044
  case 86094:
5039
5045
  return parseClassDeclaration(parser, context, scope, privateScope, 0);
5040
5046
  case 86090:
@@ -5102,9 +5108,9 @@ function parseStatement(parser, context, scope, privateScope, origin, labels, al
5102
5108
  case 209005:
5103
5109
  return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, origin, labels, 0);
5104
5110
  case 20557:
5105
- parser.report(162);
5111
+ parser.report(164);
5106
5112
  case 20566:
5107
- parser.report(163);
5113
+ parser.report(165);
5108
5114
  case 86104:
5109
5115
  parser.report(context & 1
5110
5116
  ? 76
@@ -5205,7 +5211,7 @@ function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, priva
5205
5211
  if (!asyncNewLine) {
5206
5212
  if (parser.getToken() === 86104) {
5207
5213
  if (!allowFuncDecl)
5208
- parser.report(123);
5214
+ parser.report(125);
5209
5215
  return parseFunctionDeclaration(parser, context, scope, privateScope, origin, 1, 0, 1, start);
5210
5216
  }
5211
5217
  if (isValidIdentifier(context, parser.getToken())) {
@@ -5380,7 +5386,7 @@ function parseContinueStatement(parser, context, labels) {
5380
5386
  const { tokenValue } = parser;
5381
5387
  label = parseIdentifier(parser, context | 32);
5382
5388
  if (!isValidLabel(parser, labels, tokenValue, 1))
5383
- parser.report(138, tokenValue);
5389
+ parser.report(140, tokenValue);
5384
5390
  }
5385
5391
  matchOrInsertSemicolon(parser, context | 32);
5386
5392
  return parser.finishNode({
@@ -5396,7 +5402,7 @@ function parseBreakStatement(parser, context, labels) {
5396
5402
  const { tokenValue } = parser;
5397
5403
  label = parseIdentifier(parser, context | 32);
5398
5404
  if (!isValidLabel(parser, labels, tokenValue, 0))
5399
- parser.report(138, tokenValue);
5405
+ parser.report(140, tokenValue);
5400
5406
  }
5401
5407
  else if ((context & (4 | 128)) === 0) {
5402
5408
  parser.report(69);
@@ -5593,7 +5599,7 @@ function parseUsingDeclarationOrExpressionStatement(parser, context, scope, priv
5593
5599
  function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels) {
5594
5600
  const start = parser.tokenStart;
5595
5601
  if (context & 524288)
5596
- parser.report(177);
5602
+ parser.report(179);
5597
5603
  nextToken(parser, context | 32);
5598
5604
  let argument;
5599
5605
  if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
@@ -5650,7 +5656,7 @@ function parseVariableDeclarationList(parser, context, scope, privateScope, kind
5650
5656
  if (resourceNames) {
5651
5657
  const { name } = declaration.id;
5652
5658
  if (resourceNames.has(name))
5653
- parser.report(145, name);
5659
+ parser.report(147, name);
5654
5660
  resourceNames.add(name);
5655
5661
  }
5656
5662
  list.push(declaration);
@@ -5729,7 +5735,7 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
5729
5735
  parser.assignable = 1;
5730
5736
  init = parseMemberOrUpdateExpression(parser, context, privateScope, init, 0, 0, tokenStart);
5731
5737
  if (parser.getToken() === 471156)
5732
- parser.report(115);
5738
+ parser.report(117);
5733
5739
  }
5734
5740
  }
5735
5741
  else if (token === 209013) {
@@ -5781,7 +5787,7 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
5781
5787
  if (resourceNames) {
5782
5788
  const { name } = declaration.id;
5783
5789
  if (resourceNames.has(name))
5784
- parser.report(145, name);
5790
+ parser.report(147, name);
5785
5791
  resourceNames.add(name);
5786
5792
  }
5787
5793
  declarations.push(declaration);
@@ -5826,7 +5832,7 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
5826
5832
  else if (token === 209006 &&
5827
5833
  (context & 2048 || (context & 2 && context & 8))) {
5828
5834
  if (context & 524288)
5829
- parser.report(177);
5835
+ parser.report(179);
5830
5836
  nextToken(parser, context | 32);
5831
5837
  let awaitArgument;
5832
5838
  if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
@@ -5944,9 +5950,9 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
5944
5950
  }
5945
5951
  function parseRestrictedIdentifier(parser, context, scope) {
5946
5952
  if (!isValidIdentifier(context, parser.getToken()))
5947
- parser.report(118);
5953
+ parser.report(120);
5948
5954
  if ((parser.getToken() & 537079808) === 537079808)
5949
- parser.report(119);
5955
+ parser.report(121);
5950
5956
  scope?.addBlockName(context, parser.tokenValue, 8, 0);
5951
5957
  return parseIdentifier(parser, context);
5952
5958
  }
@@ -5954,6 +5960,8 @@ function parseImportDeclaration(parser, context, scope) {
5954
5960
  const start = parser.tokenStart;
5955
5961
  nextToken(parser, context);
5956
5962
  let source;
5963
+ let sourceParsed = false;
5964
+ let phase = null;
5957
5965
  const { tokenStart } = parser;
5958
5966
  let specifiers = [];
5959
5967
  if (parser.getToken() === 134283267) {
@@ -5961,14 +5969,93 @@ function parseImportDeclaration(parser, context, scope) {
5961
5969
  }
5962
5970
  else {
5963
5971
  if (parser.getToken() & 143360) {
5964
- const local = parseRestrictedIdentifier(parser, context, scope);
5965
- specifiers = [
5966
- parser.finishNode({
5967
- type: 'ImportDefaultSpecifier',
5968
- local,
5969
- }, tokenStart),
5970
- ];
5971
- if (consumeOpt(parser, context, 18)) {
5972
+ const token = parser.getToken();
5973
+ const { tokenValue } = parser;
5974
+ const isPhaseDefer = parser.features & 2 && (token & -2147483648) === 0 && tokenValue == 'defer';
5975
+ const isPhaseSource = parser.features & 4 && (token & -2147483648) === 0 && tokenValue == 'source';
5976
+ if (isPhaseDefer || isPhaseSource) {
5977
+ const phaseOrLocal = parseIdentifier(parser, context);
5978
+ if (tokenValue === 'defer') {
5979
+ if (parser.getToken() === 8391476) {
5980
+ phase = 'defer';
5981
+ specifiers = [parseImportNamespaceSpecifier(parser, context, scope)];
5982
+ }
5983
+ else if (parser.getToken() === 209011 || parser.getToken() === 18) {
5984
+ scope?.addBlockName(context, tokenValue, 8, 0);
5985
+ specifiers = [
5986
+ parser.finishNode({
5987
+ type: 'ImportDefaultSpecifier',
5988
+ local: phaseOrLocal,
5989
+ }, tokenStart),
5990
+ ];
5991
+ }
5992
+ else {
5993
+ parser.report(108);
5994
+ }
5995
+ }
5996
+ else if (parser.getToken() === 209011) {
5997
+ const fromToken = parser.getToken();
5998
+ const fromStart = parser.tokenStart;
5999
+ const fromLocal = parseIdentifier(parser, context);
6000
+ if (parser.getToken() === 209011) {
6001
+ validateBindingIdentifier(parser, context, 16, fromToken, 0);
6002
+ scope?.addBlockName(context, fromLocal.name, 8, 0);
6003
+ phase = 'source';
6004
+ specifiers = [
6005
+ parser.finishNode({
6006
+ type: 'ImportDefaultSpecifier',
6007
+ local: fromLocal,
6008
+ }, fromStart),
6009
+ ];
6010
+ }
6011
+ else {
6012
+ scope?.addBlockName(context, tokenValue, 8, 0);
6013
+ specifiers = [
6014
+ parser.finishNode({
6015
+ type: 'ImportDefaultSpecifier',
6016
+ local: phaseOrLocal,
6017
+ }, tokenStart),
6018
+ ];
6019
+ if (parser.getToken() !== 134283267)
6020
+ parser.report(105, 'Import');
6021
+ source = parseLiteral(parser, context);
6022
+ sourceParsed = true;
6023
+ }
6024
+ }
6025
+ else if (parser.getToken() & 143360) {
6026
+ phase = 'source';
6027
+ const localStart = parser.tokenStart;
6028
+ const local = parseRestrictedIdentifier(parser, context, scope);
6029
+ specifiers = [
6030
+ parser.finishNode({
6031
+ type: 'ImportDefaultSpecifier',
6032
+ local,
6033
+ }, localStart),
6034
+ ];
6035
+ }
6036
+ else if (parser.getToken() === 18) {
6037
+ scope?.addBlockName(context, tokenValue, 8, 0);
6038
+ specifiers = [
6039
+ parser.finishNode({
6040
+ type: 'ImportDefaultSpecifier',
6041
+ local: phaseOrLocal,
6042
+ }, tokenStart),
6043
+ ];
6044
+ }
6045
+ else {
6046
+ parser.report(109);
6047
+ }
6048
+ }
6049
+ else {
6050
+ const local = parseRestrictedIdentifier(parser, context, scope);
6051
+ specifiers = [
6052
+ parser.finishNode({
6053
+ type: 'ImportDefaultSpecifier',
6054
+ local,
6055
+ }, tokenStart),
6056
+ ];
6057
+ }
6058
+ if (phase === null && !sourceParsed && consumeOpt(parser, context, 18)) {
5972
6059
  switch (parser.getToken()) {
5973
6060
  case 8391476:
5974
6061
  specifiers.push(parseImportNamespaceSpecifier(parser, context, scope));
@@ -5997,7 +6084,8 @@ function parseImportDeclaration(parser, context, scope) {
5997
6084
  parser.report(30, KeywordDescTable[parser.getToken() & 255]);
5998
6085
  }
5999
6086
  }
6000
- source = parseModuleSpecifier(parser, context);
6087
+ if (!sourceParsed)
6088
+ source = parseModuleSpecifier(parser, context);
6001
6089
  }
6002
6090
  const attributes = parseImportAttributes(parser, context);
6003
6091
  const node = {
@@ -6005,6 +6093,7 @@ function parseImportDeclaration(parser, context, scope) {
6005
6093
  specifiers,
6006
6094
  source,
6007
6095
  attributes,
6096
+ ...(parser.features & 2 || parser.features & 4 ? { phase } : null),
6008
6097
  };
6009
6098
  matchOrInsertSemicolon(parser, context | 32);
6010
6099
  return parser.finishNode(node, start);
@@ -6087,17 +6176,24 @@ function parseImportCallDeclaration(parser, context, privateScope, start) {
6087
6176
  function parseExportDeclaration(parser, context, scope) {
6088
6177
  const start = parser.leadingDecorators.decorators.length ? parser.leadingDecorators.start : parser.tokenStart;
6089
6178
  nextToken(parser, context | 32);
6179
+ const isDefaultExport = consumeOpt(parser, context | 32, 20561);
6180
+ if (parser.leadingDecorators.decorators.length && parser.getToken() !== 86094) {
6181
+ parser.report(172);
6182
+ }
6090
6183
  const specifiers = [];
6091
6184
  let declaration = null;
6092
6185
  let source = null;
6093
6186
  let attributes = [];
6094
- if (consumeOpt(parser, context | 32, 20561)) {
6187
+ if (isDefaultExport) {
6095
6188
  switch (parser.getToken()) {
6096
6189
  case 86104: {
6097
6190
  declaration = parseFunctionDeclaration(parser, context, scope, undefined, 4, 1, 1, 0, parser.tokenStart);
6098
6191
  break;
6099
6192
  }
6100
6193
  case 133:
6194
+ if (!(parser.features & 1)) {
6195
+ parser.report(30, '@');
6196
+ }
6101
6197
  case 86094:
6102
6198
  declaration = parseClassDeclaration(parser, context, scope, undefined, 1);
6103
6199
  break;
@@ -6210,7 +6306,7 @@ function parseExportDeclaration(parser, context, scope) {
6210
6306
  }
6211
6307
  else {
6212
6308
  if (hasLiteralLocal) {
6213
- parser.report(172);
6309
+ parser.report(174);
6214
6310
  }
6215
6311
  if (scope) {
6216
6312
  tmpExportedNames.forEach((n) => parser.declareUnboundVariable(n));
@@ -6221,6 +6317,9 @@ function parseExportDeclaration(parser, context, scope) {
6221
6317
  break;
6222
6318
  }
6223
6319
  case 133:
6320
+ if (!(parser.features & 1)) {
6321
+ parser.report(30, '@');
6322
+ }
6224
6323
  case 86094:
6225
6324
  declaration = parseClassDeclaration(parser, context, scope, undefined, 2);
6226
6325
  break;
@@ -6353,7 +6452,7 @@ function parseBinaryExpression(parser, context, privateScope, inGroup, start, mi
6353
6452
  t = parser.getToken();
6354
6453
  precedence = t & 3840;
6355
6454
  if ((t & 524288 && operator & 268435456) || (operator & 524288 && t & 268435456)) {
6356
- parser.report(165);
6455
+ parser.report(167);
6357
6456
  }
6358
6457
  if (precedence + ((t === 8391735) << 8) - ((bit === t) << 12) <= minPrecedence)
6359
6458
  break;
@@ -6380,10 +6479,10 @@ function parseUnaryExpression(parser, context, privateScope, isLHS, inGroup) {
6380
6479
  parser.report(33);
6381
6480
  if (context & 1 && unaryOperator === 16863276) {
6382
6481
  if (arg.type === 'Identifier') {
6383
- parser.report(121);
6482
+ parser.report(123);
6384
6483
  }
6385
6484
  else if (isPropertyWithPrivateFieldKey(arg)) {
6386
- parser.report(127);
6485
+ parser.report(129);
6387
6486
  }
6388
6487
  }
6389
6488
  parser.assignable = 2;
@@ -6436,7 +6535,7 @@ function parseYieldExpressionOrIdentifier(parser, context, privateScope, inGroup
6436
6535
  if (!canAssign)
6437
6536
  parser.report(26);
6438
6537
  if (parser.getToken() === 22)
6439
- parser.report(124);
6538
+ parser.report(126);
6440
6539
  let argument = null;
6441
6540
  let delegate = false;
6442
6541
  if ((parser.flags & 1) === 0) {
@@ -6463,17 +6562,17 @@ function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew,
6463
6562
  if (inGroup)
6464
6563
  parser.destructible |= 128;
6465
6564
  if (context & 524288)
6466
- parser.report(177);
6565
+ parser.report(179);
6467
6566
  const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope);
6468
6567
  const isIdentifier = possibleIdentifierOrArrowFunc.type === 'ArrowFunctionExpression' ||
6469
6568
  (parser.getToken() & 65536) === 0;
6470
6569
  if (isIdentifier) {
6471
6570
  if (context & 2048)
6472
- throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 176);
6571
+ throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 178);
6473
6572
  if (context & 2)
6474
- throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 110);
6573
+ throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 112);
6475
6574
  if (context & 8192 && context & 2048)
6476
- throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 110);
6575
+ throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 112);
6477
6576
  return possibleIdentifierOrArrowFunc;
6478
6577
  }
6479
6578
  if (context & 8192) {
@@ -6497,6 +6596,7 @@ function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew,
6497
6596
  }
6498
6597
  function parseFunctionBody(parser, context, scope, privateScope, origin, funcNameToken, functionScope) {
6499
6598
  const { tokenStart } = parser;
6599
+ parser.flags &= -4161;
6500
6600
  consume(parser, context | 32, 2162700);
6501
6601
  const body = [];
6502
6602
  if (parser.getToken() !== 1074790415) {
@@ -6522,19 +6622,19 @@ function parseFunctionBody(parser, context, scope, privateScope, origin, funcNam
6522
6622
  if (context & 1) {
6523
6623
  if (funcNameToken) {
6524
6624
  if ((funcNameToken & 537079808) === 537079808) {
6525
- parser.report(119);
6625
+ parser.report(121);
6526
6626
  }
6527
6627
  if ((funcNameToken & 36864) === 36864) {
6528
6628
  parser.report(40);
6529
6629
  }
6530
6630
  }
6531
6631
  if (parser.flags & 512)
6532
- parser.report(119);
6632
+ parser.report(121);
6533
6633
  if (parser.flags & 256) {
6534
6634
  if (parser.strictReservedRange) {
6535
- throw new ParseError(parser.strictReservedRange[0], parser.strictReservedRange[1], 118);
6635
+ throw new ParseError(parser.strictReservedRange[0], parser.strictReservedRange[1], 120);
6536
6636
  }
6537
- parser.report(118);
6637
+ parser.report(120);
6538
6638
  }
6539
6639
  }
6540
6640
  }
@@ -6559,7 +6659,7 @@ function parseSuperExpression(parser, context) {
6559
6659
  nextToken(parser, context);
6560
6660
  switch (parser.getToken()) {
6561
6661
  case 67108991:
6562
- parser.report(167);
6662
+ parser.report(169);
6563
6663
  case 67174411: {
6564
6664
  if ((context & 512) === 0)
6565
6665
  parser.report(28);
@@ -6606,7 +6706,7 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
6606
6706
  case 67108877: {
6607
6707
  nextToken(parser, (context | 262144 | 8) ^ 8);
6608
6708
  if (context & 16 && parser.getToken() === 131 && parser.tokenValue === 'super') {
6609
- parser.report(173);
6709
+ parser.report(175);
6610
6710
  }
6611
6711
  parser.assignable =
6612
6712
  (parser.flags & 2048) === 2048
@@ -6686,7 +6786,7 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
6686
6786
  }
6687
6787
  default:
6688
6788
  if ((parser.flags & 2048) === 2048) {
6689
- parser.report(166);
6789
+ parser.report(168);
6690
6790
  }
6691
6791
  parser.assignable = 2;
6692
6792
  expr = parser.finishNode({
@@ -6767,7 +6867,7 @@ function parsePropertyOrPrivatePropertyName(parser, context, privateScope) {
6767
6867
  parser.getToken() !== -2147483527 &&
6768
6868
  parser.getToken() !== -2147483526 &&
6769
6869
  parser.getToken() !== 131) {
6770
- parser.report(160);
6870
+ parser.report(162);
6771
6871
  }
6772
6872
  return parser.getToken() === 131
6773
6873
  ? parsePrivateIdentifier(parser, context, privateScope, 0)
@@ -6818,10 +6918,10 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
6818
6918
  !(context & 32768) &&
6819
6919
  !(context & 8192) &&
6820
6920
  parser.tokenValue === 'arguments')
6821
- parser.report(130);
6921
+ parser.report(132);
6822
6922
  if ((token & 255) === (241737 & 255)) {
6823
6923
  if (context & 1)
6824
- parser.report(113);
6924
+ parser.report(115);
6825
6925
  if (kind & (8 | 16))
6826
6926
  parser.report(100);
6827
6927
  }
@@ -6863,6 +6963,9 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
6863
6963
  case 65540:
6864
6964
  return parseRegExpLiteral(parser, context);
6865
6965
  case 133:
6966
+ if (!(parser.features & 1)) {
6967
+ parser.report(30, '@');
6968
+ }
6866
6969
  case 86094:
6867
6970
  return parseClassExpression(parser, context, privateScope, inGroup, start);
6868
6971
  case 86109:
@@ -6891,24 +6994,37 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
6891
6994
  function parseImportCallOrMetaExpression(parser, context, privateScope, inNew, inGroup, start) {
6892
6995
  let expr = parseIdentifier(parser, context);
6893
6996
  if (parser.getToken() === 67108877) {
6894
- return parseImportMetaExpression(parser, context, expr, start);
6997
+ return parseImportMetaExpression(parser, context, expr, start, privateScope, inGroup, inNew);
6895
6998
  }
6896
6999
  if (inNew)
6897
- parser.report(142);
7000
+ parser.report(144);
6898
7001
  expr = parseImportExpression(parser, context, privateScope, inGroup, start);
6899
7002
  parser.assignable = 2;
6900
7003
  return parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGroup, 0, start);
6901
7004
  }
6902
- function parseImportMetaExpression(parser, context, meta, start) {
6903
- if ((context & 2) === 0)
6904
- parser.report(169);
7005
+ function parseImportMetaExpression(parser, context, meta, start, privateScope, inGroup = 0, inNew = 0) {
7006
+ const propertyStart = parser.tokenStart;
7007
+ const propertyEnd = parser.currentLocation;
6905
7008
  nextToken(parser, context);
6906
7009
  const token = parser.getToken();
7010
+ const isPhaseDefer = parser.features & 2 && (token & -2147483648) === 0 && parser.tokenValue === 'defer';
7011
+ const isPhaseSource = parser.features & 4 && (token & -2147483648) === 0 && parser.tokenValue === 'source';
7012
+ if (isPhaseDefer || isPhaseSource) {
7013
+ if (inNew)
7014
+ parser.report(144);
7015
+ nextToken(parser, context);
7016
+ const expression = parseImportExpression(parser, context, privateScope, inGroup, start, parser.tokenValue);
7017
+ parser.assignable = 2;
7018
+ return expression;
7019
+ }
7020
+ if ((context & 2) === 0) {
7021
+ throw new ParseError(propertyStart, propertyEnd, 171);
7022
+ }
6907
7023
  if (token !== 209031 && parser.tokenValue !== 'meta') {
6908
- parser.report(174);
7024
+ parser.report(176);
6909
7025
  }
6910
7026
  else if (token & -2147483648) {
6911
- parser.report(175);
7027
+ parser.report(177);
6912
7028
  }
6913
7029
  parser.assignable = 2;
6914
7030
  return parser.finishNode({
@@ -6917,10 +7033,10 @@ function parseImportMetaExpression(parser, context, meta, start) {
6917
7033
  property: parseIdentifier(parser, context),
6918
7034
  }, start);
6919
7035
  }
6920
- function parseImportExpression(parser, context, privateScope, inGroup, start) {
7036
+ function parseImportExpression(parser, context, privateScope, inGroup, start, phase = null) {
6921
7037
  consume(parser, context | 32, 67174411);
6922
7038
  if (parser.getToken() === 14)
6923
- parser.report(143);
7039
+ parser.report(145);
6924
7040
  const source = parseExpression(parser, context, privateScope, 1, inGroup, parser.tokenStart);
6925
7041
  let options = null;
6926
7042
  if (parser.getToken() === 18) {
@@ -6935,6 +7051,7 @@ function parseImportExpression(parser, context, privateScope, inGroup, start) {
6935
7051
  type: 'ImportExpression',
6936
7052
  source,
6937
7053
  options,
7054
+ ...(parser.features & 2 || parser.features & 4 ? { phase } : null),
6938
7055
  };
6939
7056
  consume(parser, context, 16);
6940
7057
  return parser.finishNode(node, start);
@@ -6952,7 +7069,7 @@ function parseImportAttributes(parser, context) {
6952
7069
  const value = parseStringLiteral(parser, context);
6953
7070
  const keyContent = key.type === 'Literal' ? key.value : key.name;
6954
7071
  if (keysContent.has(keyContent)) {
6955
- parser.report(145, keyContent);
7072
+ parser.report(147, keyContent);
6956
7073
  }
6957
7074
  keysContent.add(keyContent);
6958
7075
  attributes.push(parser.finishNode({
@@ -6990,7 +7107,7 @@ function parseModuleExportName(parser, context) {
6990
7107
  if (parser.getToken() === 134283267) {
6991
7108
  const value = parser.tokenValue;
6992
7109
  if (!value.isWellFormed()) {
6993
- parser.report(171);
7110
+ parser.report(173);
6994
7111
  }
6995
7112
  return parseLiteral(parser, context);
6996
7113
  }
@@ -7551,7 +7668,7 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
7551
7668
  }
7552
7669
  parser.destructible = destructible;
7553
7670
  if (parser.getToken() !== closingToken && parser.getToken() !== 18)
7554
- parser.report(161);
7671
+ parser.report(163);
7555
7672
  return parser.finishNode({
7556
7673
  type: isPattern ? 'RestElement' : 'SpreadElement',
7557
7674
  argument: argument,
@@ -7810,7 +7927,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
7810
7927
  parser.report(95);
7811
7928
  if (token === 209005) {
7812
7929
  if (parser.flags & 1)
7813
- parser.report(132);
7930
+ parser.report(134);
7814
7931
  state |= 16 | 1;
7815
7932
  }
7816
7933
  else if (token === 209008) {
@@ -7874,7 +7991,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
7874
7991
  value = parseMethodDefinition(parser, context, privateScope, state, inGroup, parser.tokenStart);
7875
7992
  }
7876
7993
  else {
7877
- parser.report(133);
7994
+ parser.report(135);
7878
7995
  }
7879
7996
  }
7880
7997
  else if ((parser.getToken() & 134217728) === 134217728) {
@@ -7978,7 +8095,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
7978
8095
  destructible = 16;
7979
8096
  }
7980
8097
  else {
7981
- parser.report(134);
8098
+ parser.report(136);
7982
8099
  }
7983
8100
  }
7984
8101
  else if (parser.getToken() === 69271571) {
@@ -8125,7 +8242,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
8125
8242
  value = parseMethodDefinition(parser, context, privateScope, state, inGroup, parser.tokenStart);
8126
8243
  }
8127
8244
  else {
8128
- parser.report(126);
8245
+ parser.report(128);
8129
8246
  }
8130
8247
  }
8131
8248
  else {
@@ -8303,7 +8420,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
8303
8420
  parser.assignable = 2;
8304
8421
  if (parser.getToken() !== 16 && parser.getToken() !== 18) {
8305
8422
  if (destructible & 8)
8306
- parser.report(122);
8423
+ parser.report(124);
8307
8424
  expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, tokenStart);
8308
8425
  destructible |= 16;
8309
8426
  if (parser.getToken() !== 16 && parser.getToken() !== 18) {
@@ -8376,7 +8493,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
8376
8493
  }
8377
8494
  consume(parser, context, 16);
8378
8495
  if (destructible & 16 && destructible & 8)
8379
- parser.report(151);
8496
+ parser.report(153);
8380
8497
  destructible |=
8381
8498
  parser.destructible & 256
8382
8499
  ? 256
@@ -8401,7 +8518,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
8401
8518
  parser.report(63);
8402
8519
  }
8403
8520
  if (destructible & 8) {
8404
- parser.report(144);
8521
+ parser.report(146);
8405
8522
  }
8406
8523
  parser.destructible = ((parser.destructible | 256) ^ 256) | destructible;
8407
8524
  return parser.options.preserveParens
@@ -8472,17 +8589,17 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
8472
8589
  switch (parser.getToken()) {
8473
8590
  case 69271571:
8474
8591
  if ((parser.flags & 1) === 0) {
8475
- parser.report(116);
8592
+ parser.report(118);
8476
8593
  }
8477
8594
  parser.flags |= 8192;
8478
8595
  break;
8479
8596
  case 67108877:
8480
8597
  case 67174409:
8481
8598
  case 22:
8482
- parser.report(117);
8599
+ parser.report(119);
8483
8600
  case 67174411:
8484
8601
  if ((parser.flags & 1) === 0) {
8485
- parser.report(116);
8602
+ parser.report(118);
8486
8603
  }
8487
8604
  parser.flags |= 1024;
8488
8605
  break;
@@ -8490,7 +8607,7 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
8490
8607
  if ((parser.getToken() & 8388608) === 8388608 && (parser.flags & 1) === 0)
8491
8608
  parser.report(30, KeywordDescTable[parser.getToken() & 255]);
8492
8609
  if ((parser.getToken() & 33619968) === 33619968)
8493
- parser.report(125);
8610
+ parser.report(127);
8494
8611
  }
8495
8612
  parser.assignable = 2;
8496
8613
  return parser.finishNode({
@@ -8630,7 +8747,7 @@ function parseNewExpression(parser, context, privateScope, inGroup) {
8630
8747
  const expr = parsePrimaryExpression(parser, context, privateScope, 2, 1, 0, inGroup, 1, tokenStart);
8631
8748
  context = (context | 131072) ^ 131072;
8632
8749
  if (parser.getToken() === 67108991)
8633
- parser.report(168);
8750
+ parser.report(170);
8634
8751
  const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
8635
8752
  parser.assignable = 2;
8636
8753
  return parser.finishNode({
@@ -8729,7 +8846,7 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
8729
8846
  isNonSimpleParameterList = 1;
8730
8847
  if (parser.getToken() !== 16 && parser.getToken() !== 18) {
8731
8848
  if (destructible & 8)
8732
- parser.report(122);
8849
+ parser.report(124);
8733
8850
  expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, tokenStart);
8734
8851
  destructible |= 16;
8735
8852
  if ((parser.getToken() & 8388608) === 8388608) {
@@ -8830,9 +8947,6 @@ function parseClassDeclaration(parser, context, scope, privateScope, flags) {
8830
8947
  let start;
8831
8948
  let decorators;
8832
8949
  if (parser.leadingDecorators.decorators.length) {
8833
- if (parser.getToken() === 133) {
8834
- parser.report(30, '@');
8835
- }
8836
8950
  start = parser.leadingDecorators.start;
8837
8951
  decorators = [...parser.leadingDecorators.decorators];
8838
8952
  parser.leadingDecorators.decorators.length = 0;
@@ -8842,16 +8956,16 @@ function parseClassDeclaration(parser, context, scope, privateScope, flags) {
8842
8956
  decorators = parseDecorators(parser, context, privateScope);
8843
8957
  }
8844
8958
  context = (context | 16384 | 1) ^ 16384;
8845
- nextToken(parser, context);
8959
+ consume(parser, context, 86094);
8846
8960
  let id = null;
8847
8961
  let superClass = null;
8848
8962
  const { tokenValue } = parser;
8849
8963
  if (parser.getToken() & 4096 && parser.getToken() !== 20565) {
8850
8964
  if (isStrictReservedWord(parser, context, parser.getToken())) {
8851
- parser.report(118);
8965
+ parser.report(120);
8852
8966
  }
8853
8967
  if ((parser.getToken() & 537079808) === 537079808) {
8854
- parser.report(119);
8968
+ parser.report(121);
8855
8969
  }
8856
8970
  if (scope) {
8857
8971
  scope.addBlockName(context, tokenValue, 32, 0);
@@ -8881,7 +8995,7 @@ function parseClassDeclaration(parser, context, scope, privateScope, flags) {
8881
8995
  id,
8882
8996
  superClass,
8883
8997
  body,
8884
- ...(parser.options.next ? { decorators } : null),
8998
+ ...(parser.features & 1 ? { decorators } : null),
8885
8999
  }, start);
8886
9000
  }
8887
9001
  function parseClassExpression(parser, context, privateScope, inGroup, start) {
@@ -8889,12 +9003,12 @@ function parseClassExpression(parser, context, privateScope, inGroup, start) {
8889
9003
  let superClass = null;
8890
9004
  const decorators = parseDecorators(parser, context, privateScope);
8891
9005
  context = (context | 1 | 16384) ^ 16384;
8892
- nextToken(parser, context);
9006
+ consume(parser, context, 86094);
8893
9007
  if (parser.getToken() & 4096 && parser.getToken() !== 20565) {
8894
9008
  if (isStrictReservedWord(parser, context, parser.getToken()))
8895
- parser.report(118);
9009
+ parser.report(120);
8896
9010
  if ((parser.getToken() & 537079808) === 537079808) {
8897
- parser.report(119);
9011
+ parser.report(121);
8898
9012
  }
8899
9013
  id = parseIdentifier(parser, context);
8900
9014
  }
@@ -8913,24 +9027,61 @@ function parseClassExpression(parser, context, privateScope, inGroup, start) {
8913
9027
  id,
8914
9028
  superClass,
8915
9029
  body,
8916
- ...(parser.options.next ? { decorators } : null),
9030
+ ...(parser.features & 1 ? { decorators } : null),
8917
9031
  }, start);
8918
9032
  }
8919
9033
  function parseDecorators(parser, context, privateScope) {
8920
9034
  const list = [];
8921
- if (parser.options.next) {
9035
+ if (parser.features & 1) {
8922
9036
  while (parser.getToken() === 133) {
8923
- list.push(parseDecoratorList(parser, context, privateScope));
9037
+ list.push(parseDecorator(parser, context, privateScope));
8924
9038
  }
8925
9039
  }
8926
9040
  return list;
8927
9041
  }
8928
- function parseDecoratorList(parser, context, privateScope) {
9042
+ function parseDecorator(parser, context, privateScope) {
8929
9043
  const start = parser.tokenStart;
8930
9044
  nextToken(parser, context | 32);
8931
9045
  const expressionStart = parser.tokenStart;
8932
- let expression = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, start);
8933
- expression = parseMemberOrUpdateExpression(parser, context, privateScope, expression, 0, 0, expressionStart);
9046
+ let expression;
9047
+ if (parser.getToken() === 67174411) {
9048
+ expression = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, start);
9049
+ }
9050
+ else {
9051
+ const token = parser.getToken();
9052
+ if (((token & 143360) !== 143360 && !isValidIdentifier(context, token)) ||
9053
+ (context & 1 && (token & 36864) === 36864)) {
9054
+ parser.report(30, KeywordDescTable[token & 255]);
9055
+ }
9056
+ if (token === 209006 && context & (2048 | 2)) {
9057
+ parser.report(112);
9058
+ }
9059
+ if (token === 241771 && context & 1024) {
9060
+ parser.report(97, 'yield');
9061
+ }
9062
+ let memberExpression = parseIdentifier(parser, context | 64);
9063
+ while (parser.getToken() === 67108877) {
9064
+ nextToken(parser, (context | 262144 | 8) ^ 8);
9065
+ const property = parsePropertyOrPrivatePropertyName(parser, context | 64, privateScope);
9066
+ memberExpression = parser.finishNode({
9067
+ type: 'MemberExpression',
9068
+ object: memberExpression,
9069
+ computed: false,
9070
+ property,
9071
+ optional: false,
9072
+ }, expressionStart);
9073
+ }
9074
+ expression = memberExpression;
9075
+ if (parser.getToken() === 67174411) {
9076
+ const args = parseArguments(parser, context, privateScope, 0);
9077
+ expression = parser.finishNode({
9078
+ type: 'CallExpression',
9079
+ callee: memberExpression,
9080
+ arguments: args,
9081
+ optional: false,
9082
+ }, expressionStart);
9083
+ }
9084
+ }
8934
9085
  return parser.finishNode({
8935
9086
  type: 'Decorator',
8936
9087
  expression,
@@ -8949,13 +9100,13 @@ function parseClassBody(parser, context, inheritedContext, scope, parentScope, k
8949
9100
  const decoratorStart = parser.tokenStart;
8950
9101
  const decorators = parseDecorators(parser, context, privateScope);
8951
9102
  if (decorators.length > 0 && parser.tokenValue === 'constructor') {
8952
- parser.report(109);
9103
+ parser.report(111);
8953
9104
  }
8954
9105
  if (parser.getToken() === 1074790415)
8955
- parser.report(108);
9106
+ parser.report(110);
8956
9107
  if (consumeOpt(parser, context, 1074790417)) {
8957
9108
  if (decorators.length > 0)
8958
- parser.report(120);
9109
+ parser.report(122);
8959
9110
  continue;
8960
9111
  }
8961
9112
  body.push(parseClassElementList(parser, context, scope, privateScope, inheritedContext, kind, decorators, 0, inGroup, decorators.length > 0 ? decoratorStart : parser.tokenStart));
@@ -9018,7 +9169,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
9018
9169
  if ((parser.getToken() & 1073741824) === 1073741824) {
9019
9170
  return parsePropertyDefinition(parser, context, privateScope, key, kind, decorators, start);
9020
9171
  }
9021
- if (parser.options.next)
9172
+ if (parser.features & 1)
9022
9173
  kind |= 1024;
9023
9174
  }
9024
9175
  break;
@@ -9071,12 +9222,12 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
9071
9222
  key = parsePrivateIdentifier(parser, context, privateScope, kind);
9072
9223
  }
9073
9224
  else
9074
- parser.report(135);
9225
+ parser.report(137);
9075
9226
  }
9076
9227
  if ((kind & 2) === 0) {
9077
9228
  if (parser.tokenValue === 'constructor') {
9078
9229
  if ((parser.getToken() & 1073741824) === 1073741824) {
9079
- parser.report(129);
9230
+ parser.report(131);
9080
9231
  }
9081
9232
  else if ((kind & 32) === 0 && parser.getToken() === 67174411) {
9082
9233
  if (kind & (768 | 16 | 128 | 8)) {
@@ -9114,7 +9265,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
9114
9265
  computed: (kind & 2) > 0,
9115
9266
  key,
9116
9267
  value,
9117
- ...(parser.options.next ? { decorators } : null),
9268
+ ...(parser.features & 1 ? { decorators } : null),
9118
9269
  }, start);
9119
9270
  }
9120
9271
  function parsePrivateIdentifier(parser, context, privateScope, kind) {
@@ -9122,7 +9273,7 @@ function parsePrivateIdentifier(parser, context, privateScope, kind) {
9122
9273
  nextToken(parser, context);
9123
9274
  const { tokenValue } = parser;
9124
9275
  if (tokenValue === 'constructor')
9125
- parser.report(128);
9276
+ parser.report(130);
9126
9277
  if (parser.options.lexical) {
9127
9278
  if (!privateScope)
9128
9279
  parser.report(4, tokenValue);
@@ -9147,7 +9298,7 @@ function parsePropertyDefinition(parser, context, privateScope, key, state, deco
9147
9298
  nextToken(parser, context | 32);
9148
9299
  const { tokenStart } = parser;
9149
9300
  if (parser.getToken() === 537079928)
9150
- parser.report(119);
9301
+ parser.report(121);
9151
9302
  const modifierFlags = 1024 |
9152
9303
  2048 |
9153
9304
  8192 |
@@ -9173,7 +9324,7 @@ function parsePropertyDefinition(parser, context, privateScope, key, state, deco
9173
9324
  value,
9174
9325
  static: (state & 32) > 0,
9175
9326
  computed: (state & 2) > 0,
9176
- ...(parser.options.next ? { decorators } : null),
9327
+ ...(parser.features & 1 ? { decorators } : null),
9177
9328
  }, start);
9178
9329
  }
9179
9330
  function parseBindingPattern(parser, context, scope, privateScope, type, origin) {
@@ -9195,10 +9346,10 @@ function parseAndClassifyIdentifier(parser, context, scope, kind, origin) {
9195
9346
  const token = parser.getToken();
9196
9347
  if (context & 1) {
9197
9348
  if ((token & 537079808) === 537079808) {
9198
- parser.report(119);
9349
+ parser.report(121);
9199
9350
  }
9200
9351
  else if ((token & 36864) === 36864 || token === -2147483526) {
9201
- parser.report(118);
9352
+ parser.report(120);
9202
9353
  }
9203
9354
  }
9204
9355
  if ((token & 20480) === 20480) {
@@ -9208,7 +9359,7 @@ function parseAndClassifyIdentifier(parser, context, scope, kind, origin) {
9208
9359
  if (context & 1024)
9209
9360
  parser.report(32);
9210
9361
  if (context & 2)
9211
- parser.report(111);
9362
+ parser.report(113);
9212
9363
  }
9213
9364
  if ((token & 255) === (241737 & 255)) {
9214
9365
  if (kind & (8 | 16))
@@ -9216,9 +9367,9 @@ function parseAndClassifyIdentifier(parser, context, scope, kind, origin) {
9216
9367
  }
9217
9368
  if (token === 209006) {
9218
9369
  if (context & 2048)
9219
- parser.report(176);
9370
+ parser.report(178);
9220
9371
  if (context & 2)
9221
- parser.report(110);
9372
+ parser.report(112);
9222
9373
  }
9223
9374
  const { tokenValue, tokenStart: start } = parser;
9224
9375
  nextToken(parser, context);
@@ -9250,7 +9401,7 @@ function parseJSXRootElementOrFragment(parser, context, privateScope, inJSXChild
9250
9401
  [children, closingElement] = parseJSXChildrenAndClosingElement(parser, context, privateScope, inJSXChild);
9251
9402
  const close = isEqualTagName(closingElement.name);
9252
9403
  if (isEqualTagName(openingElement.name) !== close)
9253
- parser.report(155, close);
9404
+ parser.report(157, close);
9254
9405
  }
9255
9406
  return parser.finishNode({
9256
9407
  type: 'JSXElement',
@@ -9445,7 +9596,7 @@ function parseJsxAttribute(parser, context, privateScope) {
9445
9596
  value = parseJSXExpressionContainer(parser, context, privateScope, 0, 1);
9446
9597
  break;
9447
9598
  default:
9448
- parser.report(154);
9599
+ parser.report(156);
9449
9600
  }
9450
9601
  }
9451
9602
  return parser.finishNode({
@@ -9472,7 +9623,7 @@ function parseJSXExpressionContainer(parser, context, privateScope, inJSXChild,
9472
9623
  let expression;
9473
9624
  if (parser.getToken() === 1074790415) {
9474
9625
  if (isAttr)
9475
- parser.report(157);
9626
+ parser.report(159);
9476
9627
  expression = parseJSXEmptyExpression(parser, {
9477
9628
  index: parser.startIndex,
9478
9629
  line: parser.startLine,