meriyah 7.4.0 → 7.4.2

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var version$1 = "7.4.0";
1
+ var version$1 = "7.4.2";
2
2
  var packageJson = {
3
3
  version: version$1};
4
4
 
@@ -1886,7 +1886,9 @@ function scanSingleToken(parser, context, state) {
1886
1886
  }
1887
1887
  if (ch === 33) {
1888
1888
  const index = parser.index + 1;
1889
- if (index + 1 < parser.end &&
1889
+ if (parser.options.webcompat &&
1890
+ !(context & 2) &&
1891
+ index + 1 < parser.end &&
1890
1892
  source.charCodeAt(index) === 45 &&
1891
1893
  source.charCodeAt(index + 1) == 45) {
1892
1894
  parser.column += 3;
@@ -1968,7 +1970,10 @@ function scanSingleToken(parser, context, state) {
1968
1970
  const ch = parser.currentChar;
1969
1971
  if (ch === 45) {
1970
1972
  advanceChar(parser);
1971
- if ((state & 1 || isStartOfLine) && parser.currentChar === 62) {
1973
+ if (parser.currentChar === 62 &&
1974
+ (state & 1 ||
1975
+ isStartOfLine ||
1976
+ (parser.getToken() === 1048576 && parser.line > 1))) {
1972
1977
  if (!parser.options.webcompat)
1973
1978
  parser.report(114);
1974
1979
  advanceChar(parser);
@@ -2240,10 +2245,10 @@ function validateFunctionName(parser, context, t) {
2240
2245
  if ((t & 20480) === 20480) {
2241
2246
  parser.report(102);
2242
2247
  }
2243
- if (context & (2048 | 2) && t === 209006) {
2248
+ if (context & (2048 | 2) && (t & 2147483647) === 209006) {
2244
2249
  parser.report(112);
2245
2250
  }
2246
- if (context & (1024 | 1) && t === 241771) {
2251
+ if (context & (1024 | 1) && (t & 2147483647) === 241771) {
2247
2252
  parser.report(97, 'yield');
2248
2253
  }
2249
2254
  }
@@ -2303,7 +2308,8 @@ function isValidIdentifier(context, t) {
2303
2308
  return false;
2304
2309
  if (context & 1024 && t === 241771)
2305
2310
  return false;
2306
- return (t & 12288) === 12288;
2311
+ if (context & 1)
2312
+ return (t & 12288) === 12288;
2307
2313
  }
2308
2314
  return (t & 12288) === 12288 || (t & 36864) === 36864;
2309
2315
  }
@@ -2313,6 +2319,9 @@ function classifyIdentifier(parser, context, t) {
2313
2319
  parser.report(121);
2314
2320
  parser.flags |= 512;
2315
2321
  }
2322
+ if (context & 1 && (t & 255) === (241737 & 255)) {
2323
+ parser.report(99);
2324
+ }
2316
2325
  if (!isValidIdentifier(context, t))
2317
2326
  parser.report(0);
2318
2327
  }
@@ -2754,12 +2763,14 @@ class PrivateScope {
2754
2763
  this.refs[name] ??= [];
2755
2764
  this.refs[name].push(this.parser.tokenStart);
2756
2765
  }
2757
- isPrivateIdentifierDefined(name) {
2758
- return this.hasPrivateIdentifier(name) || Boolean(this.parent?.isPrivateIdentifierDefined(name));
2759
- }
2760
2766
  validatePrivateIdentifierRefs() {
2761
2767
  for (const name in this.refs) {
2762
- if (!this.isPrivateIdentifierDefined(name)) {
2768
+ if (this.hasPrivateIdentifier(name))
2769
+ continue;
2770
+ if (this.parent) {
2771
+ (this.parent.refs[name] ??= []).push(...this.refs[name]);
2772
+ }
2773
+ else {
2763
2774
  const { index, line, column } = this.refs[name][0];
2764
2775
  throw new ParseError({ index, line, column }, { index: index + name.length, line, column: column + name.length }, 4, name);
2765
2776
  }
@@ -3180,7 +3191,7 @@ function parseStatementListItem(parser, context, scope, privateScope, labels, or
3180
3191
  case 86090:
3181
3192
  return parseLexicalDeclaration(parser, context, scope, privateScope, 16);
3182
3193
  case 241737:
3183
- return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin);
3194
+ return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, labels, origin);
3184
3195
  case 209013:
3185
3196
  return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin);
3186
3197
  case 209006:
@@ -3202,7 +3213,7 @@ function parseStatementListItem(parser, context, scope, privateScope, labels, or
3202
3213
  parser.report(103, 'import');
3203
3214
  }
3204
3215
  case 209005:
3205
- return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 1, origin);
3216
+ return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 1, 1, origin);
3206
3217
  default:
3207
3218
  return parseStatement(parser, context, scope, privateScope, labels, 1, origin);
3208
3219
  }
@@ -3240,7 +3251,7 @@ function parseStatement(parser, context, scope, privateScope, labels, allowFuncD
3240
3251
  case 20560:
3241
3252
  return parseDebuggerStatement(parser, context);
3242
3253
  case 209005:
3243
- return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 0, origin);
3254
+ return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 0, allowFuncDecl, origin);
3244
3255
  case 20557:
3245
3256
  parser.report(164);
3246
3257
  case 20566:
@@ -3270,7 +3281,7 @@ function parseExpressionOrLabelledStatement(parser, context, scope, privateScope
3270
3281
  parser.report(84);
3271
3282
  break;
3272
3283
  default:
3273
- expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart, 0, 1);
3284
+ expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart, 1, 1);
3274
3285
  }
3275
3286
  return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, expr, token, tokenValue, tokenStart, origin);
3276
3287
  }
@@ -3334,17 +3345,17 @@ function parseLabelledStatement(parser, context, scope, privateScope, labels, va
3334
3345
  body,
3335
3346
  }, start);
3336
3347
  }
3337
- function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, allowFuncDecl, origin) {
3348
+ function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, allowAsyncFuncDecl, allowFuncDecl, origin) {
3338
3349
  const { tokenValue, tokenStart: start } = parser;
3339
3350
  const token = parser.getToken();
3340
3351
  let expr = parseIdentifier(parser, context);
3341
3352
  if (parser.getToken() === 21) {
3342
- return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, 1, start, origin);
3353
+ return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, allowFuncDecl, start, origin);
3343
3354
  }
3344
3355
  const asyncNewLine = parser.flags & 1;
3345
3356
  if (!asyncNewLine) {
3346
3357
  if (parser.getToken() === 86104) {
3347
- if (!allowFuncDecl)
3358
+ if (!allowAsyncFuncDecl)
3348
3359
  parser.report(125);
3349
3360
  return parseFunctionDeclaration(parser, context, scope, privateScope, 1, 0, 1, start, origin);
3350
3361
  }
@@ -3366,7 +3377,9 @@ function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, priva
3366
3377
  }
3367
3378
  expr = parseArrowFromIdentifier(parser, context | 2048, privateScope, parser.tokenValue, expr, 0, 1, 0, start);
3368
3379
  }
3369
- parser.assignable = 1;
3380
+ else {
3381
+ parser.assignable = 1;
3382
+ }
3370
3383
  }
3371
3384
  expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, start);
3372
3385
  expr = parseAssignmentExpression(parser, context, privateScope, 0, 0, start, expr);
@@ -3621,7 +3634,12 @@ function parseCatchBlock(parser, context, scope, privateScope, labels, start) {
3621
3634
  }
3622
3635
  function parseStaticBlock(parser, context, scope, privateScope, start) {
3623
3636
  scope = scope?.createChildScope();
3624
- const ctorContext = 512 | 4096 | 1024 | 4 | 128;
3637
+ const ctorContext = 512 |
3638
+ 4096 |
3639
+ 1024 |
3640
+ 4 |
3641
+ 128 |
3642
+ 32768;
3625
3643
  context =
3626
3644
  ((context | ctorContext) ^ ctorContext) |
3627
3645
  256 |
@@ -3645,7 +3663,7 @@ function parseDoWhileStatement(parser, context, scope, privateScope, labels) {
3645
3663
  test,
3646
3664
  }, start);
3647
3665
  }
3648
- function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin) {
3666
+ function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, labels, origin) {
3649
3667
  const { tokenValue, tokenStart, currentLocation } = parser;
3650
3668
  const token = parser.getToken();
3651
3669
  let expr = parseIdentifier(parser, context);
@@ -3663,7 +3681,7 @@ function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateS
3663
3681
  if (context & 1)
3664
3682
  parser.report(85);
3665
3683
  if (parser.getToken() === 21) {
3666
- return parseLabelledStatement(parser, context, scope, privateScope, {}, tokenValue, expr, token, 0, tokenStart, origin);
3684
+ return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, 1, tokenStart, origin);
3667
3685
  }
3668
3686
  if (parser.getToken() === 10) {
3669
3687
  let scope = void 0;
@@ -3846,6 +3864,9 @@ function parseVariableDeclaration(parser, context, scope, privateScope, kind, or
3846
3864
  function parseForStatement(parser, context, scope, privateScope, labels) {
3847
3865
  const start = parser.tokenStart;
3848
3866
  nextToken(parser, context);
3867
+ if (context & 524288 && parser.getToken() === 209006) {
3868
+ parser.report(179);
3869
+ }
3849
3870
  const forAwait = ((context & 2048) > 0 || ((context & 2) > 0 && (context & 8) > 0)) &&
3850
3871
  consumeOpt(parser, context, 209006);
3851
3872
  consume(parser, context | 32, 67174411);
@@ -4325,7 +4346,9 @@ function parseImportMetaDeclaration(parser, context, start) {
4325
4346
  }
4326
4347
  function parseImportCallDeclaration(parser, context, privateScope, start) {
4327
4348
  let expr = parseImportExpression(parser, context, privateScope, 0, start);
4349
+ parser.assignable = 2;
4328
4350
  expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, start);
4351
+ expr = parseAssignmentExpression(parser, context, privateScope, 0, 0, start, expr);
4329
4352
  if (parser.getToken() === 18) {
4330
4353
  expr = parseSequenceExpression(parser, context, privateScope, 0, start, expr);
4331
4354
  }
@@ -4359,24 +4382,29 @@ function parseExportDeclaration(parser, context, scope) {
4359
4382
  const { tokenStart } = parser;
4360
4383
  declaration = parseIdentifier(parser, context);
4361
4384
  const { flags } = parser;
4362
- if ((flags & 1) === 0) {
4363
- if (parser.getToken() === 86104) {
4364
- declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 1, 1, tokenStart, 4);
4365
- }
4366
- else {
4367
- if (parser.getToken() === 67174411) {
4368
- declaration = parseAsyncArrowOrCallExpression(parser, context, undefined, declaration, 1, 1, flags, tokenStart);
4369
- declaration = parseMemberOrUpdateExpression(parser, context, undefined, declaration, 0, 0, tokenStart);
4370
- declaration = parseAssignmentExpression(parser, context, undefined, 0, 0, tokenStart, declaration);
4371
- }
4372
- else if (parser.getToken() & 143360) {
4373
- if (scope)
4374
- scope = createArrowHeadParsingScope(parser, context, parser.tokenValue, parser.tokenStart, parser.currentLocation);
4375
- declaration = parseIdentifier(parser, context);
4376
- declaration = parseArrowFunctionExpression(parser, context, scope, undefined, [declaration], 1, tokenStart);
4377
- }
4378
- }
4385
+ if ((flags & 1) === 0 && parser.getToken() === 86104) {
4386
+ declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 1, 1, tokenStart, 4);
4387
+ break;
4388
+ }
4389
+ if (parser.getToken() === 10) {
4390
+ declaration = parseArrowFromIdentifier(parser, context & -9, undefined, 'async', declaration, 0, 1, 0, tokenStart);
4391
+ }
4392
+ else if ((flags & 1) === 0 && parser.getToken() === 67174411) {
4393
+ declaration = parseAsyncArrowOrCallExpression(parser, context, undefined, declaration, 1, 1, flags, tokenStart);
4394
+ declaration = parseMemberOrUpdateExpression(parser, context, undefined, declaration, 0, 0, tokenStart);
4395
+ declaration = parseAssignmentExpression(parser, context, undefined, 0, 0, tokenStart, declaration);
4396
+ }
4397
+ else if ((flags & 1) === 0 && parser.getToken() & 143360) {
4398
+ if (scope)
4399
+ scope = createArrowHeadParsingScope(parser, context, parser.tokenValue, parser.tokenStart, parser.currentLocation);
4400
+ declaration = parseIdentifier(parser, context);
4401
+ declaration = parseArrowFunctionExpression(parser, context, scope, undefined, [declaration], 1, tokenStart);
4402
+ }
4403
+ else {
4404
+ declaration = parseMemberOrUpdateExpression(parser, context, undefined, declaration, 0, 0, tokenStart);
4405
+ declaration = parseAssignmentExpression(parser, context, undefined, 0, 0, tokenStart, declaration);
4379
4406
  }
4407
+ matchOrInsertSemicolon(parser, context | 32);
4380
4408
  break;
4381
4409
  }
4382
4410
  default:
@@ -4602,6 +4630,10 @@ function parseConditionalExpression(parser, context, privateScope, test, start)
4602
4630
  }, start);
4603
4631
  }
4604
4632
  function parseBinaryExpression(parser, context, privateScope, inGroup, start, minPrecedence, operator, left) {
4633
+ if ((parser.flags & 16384) === 16384) {
4634
+ parser.flags = (parser.flags | 16384) ^ 16384;
4635
+ return left;
4636
+ }
4605
4637
  const bit = -((context & 131072) > 0) & 8673330;
4606
4638
  let t;
4607
4639
  let precedence;
@@ -4709,6 +4741,12 @@ function parseYieldExpressionOrIdentifier(parser, context, privateScope, inGroup
4709
4741
  else if (parser.getToken() === 8391476) {
4710
4742
  parser.report(30, KeywordDescTable[parser.getToken() & 255]);
4711
4743
  }
4744
+ if (parser.getToken() & (67108864 | 8388608)) {
4745
+ if (argument === null && (parser.flags & 1) === 0) {
4746
+ parser.report(30, KeywordDescTable[parser.getToken() & 255]);
4747
+ }
4748
+ parser.flags |= 16384;
4749
+ }
4712
4750
  parser.assignable = 2;
4713
4751
  return parser.finishNode({
4714
4752
  type: 'YieldExpression',
@@ -4718,9 +4756,9 @@ function parseYieldExpressionOrIdentifier(parser, context, privateScope, inGroup
4718
4756
  }
4719
4757
  if (context & 1)
4720
4758
  parser.report(97, 'yield');
4721
- return parseIdentifierOrArrow(parser, context, privateScope);
4759
+ return parseIdentifierOrArrow(parser, context, privateScope, 0, canAssign);
4722
4760
  }
4723
- function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, start) {
4761
+ function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, canAssign, start) {
4724
4762
  if (inGroup) {
4725
4763
  if ((parser.destructible & 128) === 0) {
4726
4764
  parser.firstAwaitLocation ??= { start, end: parser.currentLocation };
@@ -4731,10 +4769,11 @@ function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew,
4731
4769
  parser.report(179);
4732
4770
  const isEscaped = (parser.getToken() & -2147483648) !== 0;
4733
4771
  const allowRegExp = !isEscaped && context & (2048 | 2) ? 1 : 0;
4734
- const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope, allowRegExp);
4772
+ const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope, allowRegExp, canAssign);
4735
4773
  const isIdentifier = isEscaped ||
4736
4774
  possibleIdentifierOrArrowFunc.type === 'ArrowFunctionExpression' ||
4737
- (parser.getToken() & 65536) === 0;
4775
+ ((parser.getToken() & 65536) === 0 &&
4776
+ (parser.getToken() & 36864) !== 36864);
4738
4777
  if (isIdentifier) {
4739
4778
  if (context & 2048)
4740
4779
  throw new ParseError(start, parser.startPosition, 178);
@@ -4854,8 +4893,11 @@ function parseLeftHandSideExpression(parser, context, privateScope, canAssign, i
4854
4893
  return parseMemberOrUpdateExpression(parser, context, privateScope, expression, inGroup, 0, start);
4855
4894
  }
4856
4895
  function parseUpdateExpression(parser, context, expr, start) {
4857
- if (parser.assignable & 2)
4896
+ if (parser.assignable & 2 ||
4897
+ expr.type === 'ArrayExpression' ||
4898
+ expr.type === 'ObjectExpression') {
4858
4899
  parser.report(55);
4900
+ }
4859
4901
  const token = parser.getToken();
4860
4902
  nextToken(parser, context);
4861
4903
  parser.assignable = 2;
@@ -4871,6 +4913,10 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
4871
4913
  expr = parseUpdateExpression(parser, context, expr, start);
4872
4914
  }
4873
4915
  else if ((parser.getToken() & 67108864) === 67108864) {
4916
+ if ((parser.flags & 16384) === 16384) {
4917
+ parser.flags = (parser.flags | 16384) ^ 16384;
4918
+ return expr;
4919
+ }
4874
4920
  context = (context | 131072) ^ 131072;
4875
4921
  switch (parser.getToken()) {
4876
4922
  case 67108877: {
@@ -4930,7 +4976,7 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
4930
4976
  parser.flags = (parser.flags | 2048) ^ 2048;
4931
4977
  }
4932
4978
  const args = parseArguments(parser, context, privateScope, inGroup);
4933
- if (!(context & 1) && parser.options.webcompat) {
4979
+ if (!restoreHasOptionalChaining && !(context & 1) && parser.options.webcompat) {
4934
4980
  parser.assignable = 4;
4935
4981
  }
4936
4982
  else {
@@ -5003,12 +5049,7 @@ function parseOptionalChain(parser, context, privateScope, expr, start) {
5003
5049
  }
5004
5050
  else if (parser.getToken() === 67174411) {
5005
5051
  const args = parseArguments(parser, context, privateScope, 0);
5006
- if (!(context & 1) && parser.options.webcompat) {
5007
- parser.assignable = 4;
5008
- }
5009
- else {
5010
- parser.assignable = 2;
5011
- }
5052
+ parser.assignable = 2;
5012
5053
  node = parser.finishNode({
5013
5054
  type: 'CallExpression',
5014
5055
  callee: expr,
@@ -5067,7 +5108,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
5067
5108
  switch (parser.getToken()) {
5068
5109
  case 209006:
5069
5110
  case 209006 | -2147483648:
5070
- return parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, start);
5111
+ return parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, canAssign, start);
5071
5112
  case 241771:
5072
5113
  return parseYieldExpressionOrIdentifier(parser, context, privateScope, inGroup, canAssign, start);
5073
5114
  case 209005:
@@ -5088,8 +5129,9 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
5088
5129
  if (context & 16 &&
5089
5130
  !(context & 32768) &&
5090
5131
  !(context & 8192) &&
5091
- parser.tokenValue === 'arguments')
5092
- parser.report(132);
5132
+ parser.tokenValue === 'arguments' &&
5133
+ !(origin & 1 && parser.getToken() === 21))
5134
+ throw new ParseError(start, parser.startPosition, 132);
5093
5135
  if ((token & 255) === (241737 & 255)) {
5094
5136
  if (context & 1)
5095
5137
  parser.report(115);
@@ -5124,7 +5166,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
5124
5166
  case 69271571:
5125
5167
  return parseArrayLiteral(parser, context, privateScope, canAssign ? 0 : 1, inGroup);
5126
5168
  case 67174411:
5127
- return parseParenthesizedExpression(parser, context | 64, privateScope, canAssign, 1, start, origin);
5169
+ return parseParenthesizedExpression(parser, context, privateScope, canAssign, 1, start, origin);
5128
5170
  case 86021:
5129
5171
  case 86022:
5130
5172
  case 86023:
@@ -5165,8 +5207,9 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
5165
5207
  if (parser.options.jsx)
5166
5208
  return parseJSXRootElementOrFragment(parser, context, privateScope, 0, parser.tokenStart);
5167
5209
  default:
5168
- if (isValidIdentifier(context, parser.getToken()))
5169
- return parseIdentifierOrArrow(parser, context, privateScope);
5210
+ if (isValidIdentifier(context, parser.getToken())) {
5211
+ return parseIdentifierOrArrow(parser, context, privateScope, 0, canAssign);
5212
+ }
5170
5213
  parser.report(30, KeywordDescTable[parser.getToken() & 255]);
5171
5214
  }
5172
5215
  }
@@ -5567,6 +5610,8 @@ function parseArrayLiteral(parser, context, privateScope, skipInitializer, inGro
5567
5610
  if (parser.destructible & 8) {
5568
5611
  parser.report(62);
5569
5612
  }
5613
+ if (expr.type === 'ArrayExpression')
5614
+ parser.assignable = 2;
5570
5615
  return expr;
5571
5616
  }
5572
5617
  function parseArrayExpressionOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
@@ -5678,8 +5723,10 @@ function parseArrayExpressionOrPattern(parser, context, scope, privateScope, ski
5678
5723
  parser.report(30, KeywordDescTable[parser.getToken() & 255]);
5679
5724
  }
5680
5725
  else {
5681
- left = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1);
5726
+ left = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1, context & 131072 ? 0 : 1);
5682
5727
  if (parser.getToken() !== 18 && parser.getToken() !== 20) {
5728
+ if (parser.getToken() !== 1077936155)
5729
+ destructible |= 16;
5683
5730
  left = parseAssignmentExpression(parser, context, privateScope, inGroup, isPattern, tokenStart, left);
5684
5731
  if ((kind & (2 | 1)) === 0 && token === 67174411)
5685
5732
  destructible |= 16;
@@ -5811,8 +5858,7 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
5811
5858
  }
5812
5859
  else {
5813
5860
  destructible |= 32;
5814
- argument = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1);
5815
- const { tokenStart } = parser;
5861
+ argument = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1, context & 131072 ? 0 : 1);
5816
5862
  const token = parser.getToken();
5817
5863
  if (token === 1077936155) {
5818
5864
  if (parser.assignable & 2)
@@ -5888,7 +5934,8 @@ function parseMethodDefinition(parser, context, privateScope, kind, inGroup, sta
5888
5934
  let scope = parser.createScopeIfLexical(256);
5889
5935
  const params = parseMethodFormals(parser, (context | 8192) & -524289, scope, privateScope, kind, 1, inGroup);
5890
5936
  scope = scope?.createChildScope(64);
5891
- const body = parseFunctionBody(parser, (context & -655373) |
5937
+ const body = parseFunctionBody(parser, (context &
5938
+ -655501) |
5892
5939
  32768 |
5893
5940
  4096, scope, privateScope, void 0, scope?.parent);
5894
5941
  return parser.finishNode({
@@ -5908,6 +5955,8 @@ function parseObjectLiteral(parser, context, privateScope, skipInitializer, inGr
5908
5955
  if (parser.destructible & 8) {
5909
5956
  parser.report(62);
5910
5957
  }
5958
+ if (expr.type === 'ObjectExpression')
5959
+ parser.assignable = 2;
5911
5960
  return expr;
5912
5961
  }
5913
5962
  function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
@@ -5937,6 +5986,11 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
5937
5986
  parser.getToken() === 1074790415 ||
5938
5987
  parser.getToken() === 1077936155) {
5939
5988
  state |= 4;
5989
+ if (context & 16 &&
5990
+ !(context & 32768) &&
5991
+ !(context & 8192) &&
5992
+ tokenValue === 'arguments')
5993
+ throw new ParseError(tokenStart, currentLocation, 132);
5940
5994
  if (context & 1 && (token & 537079808) === 537079808) {
5941
5995
  destructible |= 16;
5942
5996
  }
@@ -6050,7 +6104,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
6050
6104
  }
6051
6105
  }
6052
6106
  else {
6053
- value = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1);
6107
+ value = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1, context & 131072 ? 0 : 1);
6054
6108
  destructible |=
6055
6109
  parser.assignable & 1
6056
6110
  ? 32
@@ -6231,7 +6285,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
6231
6285
  }
6232
6286
  }
6233
6287
  else {
6234
- value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1);
6288
+ value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1, context & 131072 ? 0 : 1);
6235
6289
  destructible |=
6236
6290
  parser.assignable & 1
6237
6291
  ? 32
@@ -6344,7 +6398,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
6344
6398
  }
6345
6399
  }
6346
6400
  else {
6347
- value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1);
6401
+ value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1, context & 131072 ? 0 : 1);
6348
6402
  destructible |=
6349
6403
  parser.assignable & 1
6350
6404
  ? 32
@@ -6477,7 +6531,7 @@ function parseMethodFormals(parser, context, scope, privateScope, kind, type, in
6477
6531
  parser.flags |= 512;
6478
6532
  }
6479
6533
  }
6480
- left = parseAndClassifyIdentifier(parser, context, scope, kind | 1);
6534
+ left = parseAndClassifyIdentifier(parser, context, scope, type);
6481
6535
  }
6482
6536
  else {
6483
6537
  if (parser.getToken() === 2162700) {
@@ -6631,7 +6685,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
6631
6685
  expressions: expressions,
6632
6686
  }, tokenAfterParenthesesStart);
6633
6687
  }
6634
- consume(parser, context, 16);
6688
+ consume(parser, context | 64, 16);
6635
6689
  parser.destructible = destructible | previousAwaitYield;
6636
6690
  if (previousFirstAwaitLocation) {
6637
6691
  parser.firstAwaitLocation = previousFirstAwaitLocation;
@@ -6667,7 +6721,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
6667
6721
  expressions: expressions,
6668
6722
  }, tokenAfterParenthesesStart);
6669
6723
  }
6670
- consume(parser, context, 16);
6724
+ consume(parser, context | 64, 16);
6671
6725
  if (destructible & 16 && destructible & 8)
6672
6726
  parser.report(153);
6673
6727
  destructible |=
@@ -6722,7 +6776,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
6722
6776
  }, parenthesesStart)
6723
6777
  : expr;
6724
6778
  }
6725
- function parseIdentifierOrArrow(parser, context, privateScope, allowRegExp = 0) {
6779
+ function parseIdentifierOrArrow(parser, context, privateScope, allowRegExp = 0, canAssign = 1) {
6726
6780
  const { tokenValue, tokenStart, currentLocation } = parser;
6727
6781
  let isNonSimpleParameterList = 0;
6728
6782
  let hasStrictReserved = 0;
@@ -6735,6 +6789,8 @@ function parseIdentifierOrArrow(parser, context, privateScope, allowRegExp = 0)
6735
6789
  const expr = parseIdentifier(parser, context, allowRegExp);
6736
6790
  parser.assignable = 1;
6737
6791
  if (parser.getToken() === 10) {
6792
+ if (!canAssign)
6793
+ parser.report(57);
6738
6794
  const scope = parser.options.lexical
6739
6795
  ? createArrowHeadParsingScope(parser, context, tokenValue, tokenStart, currentLocation)
6740
6796
  : undefined;
@@ -6768,7 +6824,7 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
6768
6824
  if (parser.flags & 1)
6769
6825
  parser.report(48);
6770
6826
  consume(parser, context | 32, 10);
6771
- const modifierFlags = 1024 | 2048 | 8192 | 524288;
6827
+ const modifierFlags = 1024 | 2048 | 8192 | 524288 | 8;
6772
6828
  context = ((context | modifierFlags) ^ modifierFlags) | (isAsync ? 2048 : 0);
6773
6829
  const expression = parser.getToken() !== 2162700;
6774
6830
  let body;
@@ -6781,7 +6837,7 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
6781
6837
  }
6782
6838
  else {
6783
6839
  scope = scope?.createChildScope(64);
6784
- const modifierFlags = 4 | 131072 | 8;
6840
+ const modifierFlags = 4 | 128 | 131072 | 8;
6785
6841
  body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 4096, scope, privateScope, void 0, void 0, 16);
6786
6842
  switch (parser.getToken()) {
6787
6843
  case 69271571:
@@ -6791,7 +6847,9 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
6791
6847
  parser.flags |= 8192;
6792
6848
  break;
6793
6849
  case 67108877:
6850
+ case 67108991:
6794
6851
  case 67174409:
6852
+ case 67174408:
6795
6853
  case 22:
6796
6854
  parser.report(119);
6797
6855
  case 67174411:
@@ -6948,9 +7006,9 @@ function parseNewExpression(parser, context, privateScope, inGroup) {
6948
7006
  }
6949
7007
  const expr = parsePrimaryExpression(parser, context, privateScope, 2, 1, 0, inGroup, 1, tokenStart);
6950
7008
  context = (context | 131072) ^ 131072;
7009
+ const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
6951
7010
  if (parser.getToken() === 67108991)
6952
7011
  parser.report(170);
6953
- const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
6954
7012
  parser.assignable = 2;
6955
7013
  return parser.finishNode({
6956
7014
  type: 'NewExpression',
@@ -7420,8 +7478,6 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
7420
7478
  }
7421
7479
  else if (token === -2147483526) {
7422
7480
  key = parseIdentifier(parser, context);
7423
- if (parser.getToken() !== 67174411)
7424
- parser.report(30, KeywordDescTable[parser.getToken() & 255]);
7425
7481
  }
7426
7482
  else {
7427
7483
  parser.report(30, KeywordDescTable[parser.getToken() & 255]);
@@ -7437,7 +7493,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
7437
7493
  }
7438
7494
  else if (parser.getToken() === 69271571) {
7439
7495
  kind |= 2;
7440
- key = parseComputedPropertyName(parser, context, privateScope, 0);
7496
+ key = parseComputedPropertyName(parser, inheritedContext, privateScope, 0);
7441
7497
  }
7442
7498
  else if (parser.getToken() === 131) {
7443
7499
  kind |= 8192;
@@ -7525,6 +7581,7 @@ function parsePropertyDefinition(parser, context, privateScope, key, state, deco
7525
7581
  2048 |
7526
7582
  8 |
7527
7583
  8192 |
7584
+ 32768 |
7528
7585
  ((state & 64) === 0 ? 512 | 16384 : 0);
7529
7586
  context =
7530
7587
  ((context | modifierFlags) ^ modifierFlags) |