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.
@@ -4,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.meriyah = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- var version$1 = "7.4.0";
7
+ var version$1 = "7.4.2";
8
8
  var packageJson = {
9
9
  version: version$1};
10
10
 
@@ -1892,7 +1892,9 @@
1892
1892
  }
1893
1893
  if (ch === 33) {
1894
1894
  const index = parser.index + 1;
1895
- if (index + 1 < parser.end &&
1895
+ if (parser.options.webcompat &&
1896
+ !(context & 2) &&
1897
+ index + 1 < parser.end &&
1896
1898
  source.charCodeAt(index) === 45 &&
1897
1899
  source.charCodeAt(index + 1) == 45) {
1898
1900
  parser.column += 3;
@@ -1974,7 +1976,10 @@
1974
1976
  const ch = parser.currentChar;
1975
1977
  if (ch === 45) {
1976
1978
  advanceChar(parser);
1977
- if ((state & 1 || isStartOfLine) && parser.currentChar === 62) {
1979
+ if (parser.currentChar === 62 &&
1980
+ (state & 1 ||
1981
+ isStartOfLine ||
1982
+ (parser.getToken() === 1048576 && parser.line > 1))) {
1978
1983
  if (!parser.options.webcompat)
1979
1984
  parser.report(114);
1980
1985
  advanceChar(parser);
@@ -2246,10 +2251,10 @@
2246
2251
  if ((t & 20480) === 20480) {
2247
2252
  parser.report(102);
2248
2253
  }
2249
- if (context & (2048 | 2) && t === 209006) {
2254
+ if (context & (2048 | 2) && (t & 2147483647) === 209006) {
2250
2255
  parser.report(112);
2251
2256
  }
2252
- if (context & (1024 | 1) && t === 241771) {
2257
+ if (context & (1024 | 1) && (t & 2147483647) === 241771) {
2253
2258
  parser.report(97, 'yield');
2254
2259
  }
2255
2260
  }
@@ -2309,7 +2314,8 @@
2309
2314
  return false;
2310
2315
  if (context & 1024 && t === 241771)
2311
2316
  return false;
2312
- return (t & 12288) === 12288;
2317
+ if (context & 1)
2318
+ return (t & 12288) === 12288;
2313
2319
  }
2314
2320
  return (t & 12288) === 12288 || (t & 36864) === 36864;
2315
2321
  }
@@ -2319,6 +2325,9 @@
2319
2325
  parser.report(121);
2320
2326
  parser.flags |= 512;
2321
2327
  }
2328
+ if (context & 1 && (t & 255) === (241737 & 255)) {
2329
+ parser.report(99);
2330
+ }
2322
2331
  if (!isValidIdentifier(context, t))
2323
2332
  parser.report(0);
2324
2333
  }
@@ -2760,12 +2769,14 @@
2760
2769
  this.refs[name] ??= [];
2761
2770
  this.refs[name].push(this.parser.tokenStart);
2762
2771
  }
2763
- isPrivateIdentifierDefined(name) {
2764
- return this.hasPrivateIdentifier(name) || Boolean(this.parent?.isPrivateIdentifierDefined(name));
2765
- }
2766
2772
  validatePrivateIdentifierRefs() {
2767
2773
  for (const name in this.refs) {
2768
- if (!this.isPrivateIdentifierDefined(name)) {
2774
+ if (this.hasPrivateIdentifier(name))
2775
+ continue;
2776
+ if (this.parent) {
2777
+ (this.parent.refs[name] ??= []).push(...this.refs[name]);
2778
+ }
2779
+ else {
2769
2780
  const { index, line, column } = this.refs[name][0];
2770
2781
  throw new ParseError({ index, line, column }, { index: index + name.length, line, column: column + name.length }, 4, name);
2771
2782
  }
@@ -3186,7 +3197,7 @@
3186
3197
  case 86090:
3187
3198
  return parseLexicalDeclaration(parser, context, scope, privateScope, 16);
3188
3199
  case 241737:
3189
- return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin);
3200
+ return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, labels, origin);
3190
3201
  case 209013:
3191
3202
  return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin);
3192
3203
  case 209006:
@@ -3208,7 +3219,7 @@
3208
3219
  parser.report(103, 'import');
3209
3220
  }
3210
3221
  case 209005:
3211
- return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 1, origin);
3222
+ return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 1, 1, origin);
3212
3223
  default:
3213
3224
  return parseStatement(parser, context, scope, privateScope, labels, 1, origin);
3214
3225
  }
@@ -3246,7 +3257,7 @@
3246
3257
  case 20560:
3247
3258
  return parseDebuggerStatement(parser, context);
3248
3259
  case 209005:
3249
- return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 0, origin);
3260
+ return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 0, allowFuncDecl, origin);
3250
3261
  case 20557:
3251
3262
  parser.report(164);
3252
3263
  case 20566:
@@ -3276,7 +3287,7 @@
3276
3287
  parser.report(84);
3277
3288
  break;
3278
3289
  default:
3279
- expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart, 0, 1);
3290
+ expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart, 1, 1);
3280
3291
  }
3281
3292
  return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, expr, token, tokenValue, tokenStart, origin);
3282
3293
  }
@@ -3340,17 +3351,17 @@
3340
3351
  body,
3341
3352
  }, start);
3342
3353
  }
3343
- function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, allowFuncDecl, origin) {
3354
+ function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, allowAsyncFuncDecl, allowFuncDecl, origin) {
3344
3355
  const { tokenValue, tokenStart: start } = parser;
3345
3356
  const token = parser.getToken();
3346
3357
  let expr = parseIdentifier(parser, context);
3347
3358
  if (parser.getToken() === 21) {
3348
- return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, 1, start, origin);
3359
+ return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, allowFuncDecl, start, origin);
3349
3360
  }
3350
3361
  const asyncNewLine = parser.flags & 1;
3351
3362
  if (!asyncNewLine) {
3352
3363
  if (parser.getToken() === 86104) {
3353
- if (!allowFuncDecl)
3364
+ if (!allowAsyncFuncDecl)
3354
3365
  parser.report(125);
3355
3366
  return parseFunctionDeclaration(parser, context, scope, privateScope, 1, 0, 1, start, origin);
3356
3367
  }
@@ -3372,7 +3383,9 @@
3372
3383
  }
3373
3384
  expr = parseArrowFromIdentifier(parser, context | 2048, privateScope, parser.tokenValue, expr, 0, 1, 0, start);
3374
3385
  }
3375
- parser.assignable = 1;
3386
+ else {
3387
+ parser.assignable = 1;
3388
+ }
3376
3389
  }
3377
3390
  expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, start);
3378
3391
  expr = parseAssignmentExpression(parser, context, privateScope, 0, 0, start, expr);
@@ -3627,7 +3640,12 @@
3627
3640
  }
3628
3641
  function parseStaticBlock(parser, context, scope, privateScope, start) {
3629
3642
  scope = scope?.createChildScope();
3630
- const ctorContext = 512 | 4096 | 1024 | 4 | 128;
3643
+ const ctorContext = 512 |
3644
+ 4096 |
3645
+ 1024 |
3646
+ 4 |
3647
+ 128 |
3648
+ 32768;
3631
3649
  context =
3632
3650
  ((context | ctorContext) ^ ctorContext) |
3633
3651
  256 |
@@ -3651,7 +3669,7 @@
3651
3669
  test,
3652
3670
  }, start);
3653
3671
  }
3654
- function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin) {
3672
+ function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, labels, origin) {
3655
3673
  const { tokenValue, tokenStart, currentLocation } = parser;
3656
3674
  const token = parser.getToken();
3657
3675
  let expr = parseIdentifier(parser, context);
@@ -3669,7 +3687,7 @@
3669
3687
  if (context & 1)
3670
3688
  parser.report(85);
3671
3689
  if (parser.getToken() === 21) {
3672
- return parseLabelledStatement(parser, context, scope, privateScope, {}, tokenValue, expr, token, 0, tokenStart, origin);
3690
+ return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, 1, tokenStart, origin);
3673
3691
  }
3674
3692
  if (parser.getToken() === 10) {
3675
3693
  let scope = void 0;
@@ -3852,6 +3870,9 @@
3852
3870
  function parseForStatement(parser, context, scope, privateScope, labels) {
3853
3871
  const start = parser.tokenStart;
3854
3872
  nextToken(parser, context);
3873
+ if (context & 524288 && parser.getToken() === 209006) {
3874
+ parser.report(179);
3875
+ }
3855
3876
  const forAwait = ((context & 2048) > 0 || ((context & 2) > 0 && (context & 8) > 0)) &&
3856
3877
  consumeOpt(parser, context, 209006);
3857
3878
  consume(parser, context | 32, 67174411);
@@ -4331,7 +4352,9 @@
4331
4352
  }
4332
4353
  function parseImportCallDeclaration(parser, context, privateScope, start) {
4333
4354
  let expr = parseImportExpression(parser, context, privateScope, 0, start);
4355
+ parser.assignable = 2;
4334
4356
  expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, start);
4357
+ expr = parseAssignmentExpression(parser, context, privateScope, 0, 0, start, expr);
4335
4358
  if (parser.getToken() === 18) {
4336
4359
  expr = parseSequenceExpression(parser, context, privateScope, 0, start, expr);
4337
4360
  }
@@ -4365,24 +4388,29 @@
4365
4388
  const { tokenStart } = parser;
4366
4389
  declaration = parseIdentifier(parser, context);
4367
4390
  const { flags } = parser;
4368
- if ((flags & 1) === 0) {
4369
- if (parser.getToken() === 86104) {
4370
- declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 1, 1, tokenStart, 4);
4371
- }
4372
- else {
4373
- if (parser.getToken() === 67174411) {
4374
- declaration = parseAsyncArrowOrCallExpression(parser, context, undefined, declaration, 1, 1, flags, tokenStart);
4375
- declaration = parseMemberOrUpdateExpression(parser, context, undefined, declaration, 0, 0, tokenStart);
4376
- declaration = parseAssignmentExpression(parser, context, undefined, 0, 0, tokenStart, declaration);
4377
- }
4378
- else if (parser.getToken() & 143360) {
4379
- if (scope)
4380
- scope = createArrowHeadParsingScope(parser, context, parser.tokenValue, parser.tokenStart, parser.currentLocation);
4381
- declaration = parseIdentifier(parser, context);
4382
- declaration = parseArrowFunctionExpression(parser, context, scope, undefined, [declaration], 1, tokenStart);
4383
- }
4384
- }
4391
+ if ((flags & 1) === 0 && parser.getToken() === 86104) {
4392
+ declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 1, 1, tokenStart, 4);
4393
+ break;
4394
+ }
4395
+ if (parser.getToken() === 10) {
4396
+ declaration = parseArrowFromIdentifier(parser, context & -9, undefined, 'async', declaration, 0, 1, 0, tokenStart);
4397
+ }
4398
+ else if ((flags & 1) === 0 && parser.getToken() === 67174411) {
4399
+ declaration = parseAsyncArrowOrCallExpression(parser, context, undefined, declaration, 1, 1, flags, tokenStart);
4400
+ declaration = parseMemberOrUpdateExpression(parser, context, undefined, declaration, 0, 0, tokenStart);
4401
+ declaration = parseAssignmentExpression(parser, context, undefined, 0, 0, tokenStart, declaration);
4402
+ }
4403
+ else if ((flags & 1) === 0 && parser.getToken() & 143360) {
4404
+ if (scope)
4405
+ scope = createArrowHeadParsingScope(parser, context, parser.tokenValue, parser.tokenStart, parser.currentLocation);
4406
+ declaration = parseIdentifier(parser, context);
4407
+ declaration = parseArrowFunctionExpression(parser, context, scope, undefined, [declaration], 1, tokenStart);
4408
+ }
4409
+ else {
4410
+ declaration = parseMemberOrUpdateExpression(parser, context, undefined, declaration, 0, 0, tokenStart);
4411
+ declaration = parseAssignmentExpression(parser, context, undefined, 0, 0, tokenStart, declaration);
4385
4412
  }
4413
+ matchOrInsertSemicolon(parser, context | 32);
4386
4414
  break;
4387
4415
  }
4388
4416
  default:
@@ -4608,6 +4636,10 @@
4608
4636
  }, start);
4609
4637
  }
4610
4638
  function parseBinaryExpression(parser, context, privateScope, inGroup, start, minPrecedence, operator, left) {
4639
+ if ((parser.flags & 16384) === 16384) {
4640
+ parser.flags = (parser.flags | 16384) ^ 16384;
4641
+ return left;
4642
+ }
4611
4643
  const bit = -((context & 131072) > 0) & 8673330;
4612
4644
  let t;
4613
4645
  let precedence;
@@ -4715,6 +4747,12 @@
4715
4747
  else if (parser.getToken() === 8391476) {
4716
4748
  parser.report(30, KeywordDescTable[parser.getToken() & 255]);
4717
4749
  }
4750
+ if (parser.getToken() & (67108864 | 8388608)) {
4751
+ if (argument === null && (parser.flags & 1) === 0) {
4752
+ parser.report(30, KeywordDescTable[parser.getToken() & 255]);
4753
+ }
4754
+ parser.flags |= 16384;
4755
+ }
4718
4756
  parser.assignable = 2;
4719
4757
  return parser.finishNode({
4720
4758
  type: 'YieldExpression',
@@ -4724,9 +4762,9 @@
4724
4762
  }
4725
4763
  if (context & 1)
4726
4764
  parser.report(97, 'yield');
4727
- return parseIdentifierOrArrow(parser, context, privateScope);
4765
+ return parseIdentifierOrArrow(parser, context, privateScope, 0, canAssign);
4728
4766
  }
4729
- function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, start) {
4767
+ function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, canAssign, start) {
4730
4768
  if (inGroup) {
4731
4769
  if ((parser.destructible & 128) === 0) {
4732
4770
  parser.firstAwaitLocation ??= { start, end: parser.currentLocation };
@@ -4737,10 +4775,11 @@
4737
4775
  parser.report(179);
4738
4776
  const isEscaped = (parser.getToken() & -2147483648) !== 0;
4739
4777
  const allowRegExp = !isEscaped && context & (2048 | 2) ? 1 : 0;
4740
- const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope, allowRegExp);
4778
+ const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope, allowRegExp, canAssign);
4741
4779
  const isIdentifier = isEscaped ||
4742
4780
  possibleIdentifierOrArrowFunc.type === 'ArrowFunctionExpression' ||
4743
- (parser.getToken() & 65536) === 0;
4781
+ ((parser.getToken() & 65536) === 0 &&
4782
+ (parser.getToken() & 36864) !== 36864);
4744
4783
  if (isIdentifier) {
4745
4784
  if (context & 2048)
4746
4785
  throw new ParseError(start, parser.startPosition, 178);
@@ -4860,8 +4899,11 @@
4860
4899
  return parseMemberOrUpdateExpression(parser, context, privateScope, expression, inGroup, 0, start);
4861
4900
  }
4862
4901
  function parseUpdateExpression(parser, context, expr, start) {
4863
- if (parser.assignable & 2)
4902
+ if (parser.assignable & 2 ||
4903
+ expr.type === 'ArrayExpression' ||
4904
+ expr.type === 'ObjectExpression') {
4864
4905
  parser.report(55);
4906
+ }
4865
4907
  const token = parser.getToken();
4866
4908
  nextToken(parser, context);
4867
4909
  parser.assignable = 2;
@@ -4877,6 +4919,10 @@
4877
4919
  expr = parseUpdateExpression(parser, context, expr, start);
4878
4920
  }
4879
4921
  else if ((parser.getToken() & 67108864) === 67108864) {
4922
+ if ((parser.flags & 16384) === 16384) {
4923
+ parser.flags = (parser.flags | 16384) ^ 16384;
4924
+ return expr;
4925
+ }
4880
4926
  context = (context | 131072) ^ 131072;
4881
4927
  switch (parser.getToken()) {
4882
4928
  case 67108877: {
@@ -4936,7 +4982,7 @@
4936
4982
  parser.flags = (parser.flags | 2048) ^ 2048;
4937
4983
  }
4938
4984
  const args = parseArguments(parser, context, privateScope, inGroup);
4939
- if (!(context & 1) && parser.options.webcompat) {
4985
+ if (!restoreHasOptionalChaining && !(context & 1) && parser.options.webcompat) {
4940
4986
  parser.assignable = 4;
4941
4987
  }
4942
4988
  else {
@@ -5009,12 +5055,7 @@
5009
5055
  }
5010
5056
  else if (parser.getToken() === 67174411) {
5011
5057
  const args = parseArguments(parser, context, privateScope, 0);
5012
- if (!(context & 1) && parser.options.webcompat) {
5013
- parser.assignable = 4;
5014
- }
5015
- else {
5016
- parser.assignable = 2;
5017
- }
5058
+ parser.assignable = 2;
5018
5059
  node = parser.finishNode({
5019
5060
  type: 'CallExpression',
5020
5061
  callee: expr,
@@ -5073,7 +5114,7 @@
5073
5114
  switch (parser.getToken()) {
5074
5115
  case 209006:
5075
5116
  case 209006 | -2147483648:
5076
- return parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, start);
5117
+ return parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, canAssign, start);
5077
5118
  case 241771:
5078
5119
  return parseYieldExpressionOrIdentifier(parser, context, privateScope, inGroup, canAssign, start);
5079
5120
  case 209005:
@@ -5094,8 +5135,9 @@
5094
5135
  if (context & 16 &&
5095
5136
  !(context & 32768) &&
5096
5137
  !(context & 8192) &&
5097
- parser.tokenValue === 'arguments')
5098
- parser.report(132);
5138
+ parser.tokenValue === 'arguments' &&
5139
+ !(origin & 1 && parser.getToken() === 21))
5140
+ throw new ParseError(start, parser.startPosition, 132);
5099
5141
  if ((token & 255) === (241737 & 255)) {
5100
5142
  if (context & 1)
5101
5143
  parser.report(115);
@@ -5130,7 +5172,7 @@
5130
5172
  case 69271571:
5131
5173
  return parseArrayLiteral(parser, context, privateScope, canAssign ? 0 : 1, inGroup);
5132
5174
  case 67174411:
5133
- return parseParenthesizedExpression(parser, context | 64, privateScope, canAssign, 1, start, origin);
5175
+ return parseParenthesizedExpression(parser, context, privateScope, canAssign, 1, start, origin);
5134
5176
  case 86021:
5135
5177
  case 86022:
5136
5178
  case 86023:
@@ -5171,8 +5213,9 @@
5171
5213
  if (parser.options.jsx)
5172
5214
  return parseJSXRootElementOrFragment(parser, context, privateScope, 0, parser.tokenStart);
5173
5215
  default:
5174
- if (isValidIdentifier(context, parser.getToken()))
5175
- return parseIdentifierOrArrow(parser, context, privateScope);
5216
+ if (isValidIdentifier(context, parser.getToken())) {
5217
+ return parseIdentifierOrArrow(parser, context, privateScope, 0, canAssign);
5218
+ }
5176
5219
  parser.report(30, KeywordDescTable[parser.getToken() & 255]);
5177
5220
  }
5178
5221
  }
@@ -5573,6 +5616,8 @@
5573
5616
  if (parser.destructible & 8) {
5574
5617
  parser.report(62);
5575
5618
  }
5619
+ if (expr.type === 'ArrayExpression')
5620
+ parser.assignable = 2;
5576
5621
  return expr;
5577
5622
  }
5578
5623
  function parseArrayExpressionOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
@@ -5684,8 +5729,10 @@
5684
5729
  parser.report(30, KeywordDescTable[parser.getToken() & 255]);
5685
5730
  }
5686
5731
  else {
5687
- left = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1);
5732
+ left = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1, context & 131072 ? 0 : 1);
5688
5733
  if (parser.getToken() !== 18 && parser.getToken() !== 20) {
5734
+ if (parser.getToken() !== 1077936155)
5735
+ destructible |= 16;
5689
5736
  left = parseAssignmentExpression(parser, context, privateScope, inGroup, isPattern, tokenStart, left);
5690
5737
  if ((kind & (2 | 1)) === 0 && token === 67174411)
5691
5738
  destructible |= 16;
@@ -5817,8 +5864,7 @@
5817
5864
  }
5818
5865
  else {
5819
5866
  destructible |= 32;
5820
- argument = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1);
5821
- const { tokenStart } = parser;
5867
+ argument = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1, context & 131072 ? 0 : 1);
5822
5868
  const token = parser.getToken();
5823
5869
  if (token === 1077936155) {
5824
5870
  if (parser.assignable & 2)
@@ -5894,7 +5940,8 @@
5894
5940
  let scope = parser.createScopeIfLexical(256);
5895
5941
  const params = parseMethodFormals(parser, (context | 8192) & -524289, scope, privateScope, kind, 1, inGroup);
5896
5942
  scope = scope?.createChildScope(64);
5897
- const body = parseFunctionBody(parser, (context & -655373) |
5943
+ const body = parseFunctionBody(parser, (context &
5944
+ -655501) |
5898
5945
  32768 |
5899
5946
  4096, scope, privateScope, void 0, scope?.parent);
5900
5947
  return parser.finishNode({
@@ -5914,6 +5961,8 @@
5914
5961
  if (parser.destructible & 8) {
5915
5962
  parser.report(62);
5916
5963
  }
5964
+ if (expr.type === 'ObjectExpression')
5965
+ parser.assignable = 2;
5917
5966
  return expr;
5918
5967
  }
5919
5968
  function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
@@ -5943,6 +5992,11 @@
5943
5992
  parser.getToken() === 1074790415 ||
5944
5993
  parser.getToken() === 1077936155) {
5945
5994
  state |= 4;
5995
+ if (context & 16 &&
5996
+ !(context & 32768) &&
5997
+ !(context & 8192) &&
5998
+ tokenValue === 'arguments')
5999
+ throw new ParseError(tokenStart, currentLocation, 132);
5946
6000
  if (context & 1 && (token & 537079808) === 537079808) {
5947
6001
  destructible |= 16;
5948
6002
  }
@@ -6056,7 +6110,7 @@
6056
6110
  }
6057
6111
  }
6058
6112
  else {
6059
- value = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1);
6113
+ value = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1, context & 131072 ? 0 : 1);
6060
6114
  destructible |=
6061
6115
  parser.assignable & 1
6062
6116
  ? 32
@@ -6237,7 +6291,7 @@
6237
6291
  }
6238
6292
  }
6239
6293
  else {
6240
- value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1);
6294
+ value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1, context & 131072 ? 0 : 1);
6241
6295
  destructible |=
6242
6296
  parser.assignable & 1
6243
6297
  ? 32
@@ -6350,7 +6404,7 @@
6350
6404
  }
6351
6405
  }
6352
6406
  else {
6353
- value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1);
6407
+ value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1, context & 131072 ? 0 : 1);
6354
6408
  destructible |=
6355
6409
  parser.assignable & 1
6356
6410
  ? 32
@@ -6483,7 +6537,7 @@
6483
6537
  parser.flags |= 512;
6484
6538
  }
6485
6539
  }
6486
- left = parseAndClassifyIdentifier(parser, context, scope, kind | 1);
6540
+ left = parseAndClassifyIdentifier(parser, context, scope, type);
6487
6541
  }
6488
6542
  else {
6489
6543
  if (parser.getToken() === 2162700) {
@@ -6637,7 +6691,7 @@
6637
6691
  expressions: expressions,
6638
6692
  }, tokenAfterParenthesesStart);
6639
6693
  }
6640
- consume(parser, context, 16);
6694
+ consume(parser, context | 64, 16);
6641
6695
  parser.destructible = destructible | previousAwaitYield;
6642
6696
  if (previousFirstAwaitLocation) {
6643
6697
  parser.firstAwaitLocation = previousFirstAwaitLocation;
@@ -6673,7 +6727,7 @@
6673
6727
  expressions: expressions,
6674
6728
  }, tokenAfterParenthesesStart);
6675
6729
  }
6676
- consume(parser, context, 16);
6730
+ consume(parser, context | 64, 16);
6677
6731
  if (destructible & 16 && destructible & 8)
6678
6732
  parser.report(153);
6679
6733
  destructible |=
@@ -6728,7 +6782,7 @@
6728
6782
  }, parenthesesStart)
6729
6783
  : expr;
6730
6784
  }
6731
- function parseIdentifierOrArrow(parser, context, privateScope, allowRegExp = 0) {
6785
+ function parseIdentifierOrArrow(parser, context, privateScope, allowRegExp = 0, canAssign = 1) {
6732
6786
  const { tokenValue, tokenStart, currentLocation } = parser;
6733
6787
  let isNonSimpleParameterList = 0;
6734
6788
  let hasStrictReserved = 0;
@@ -6741,6 +6795,8 @@
6741
6795
  const expr = parseIdentifier(parser, context, allowRegExp);
6742
6796
  parser.assignable = 1;
6743
6797
  if (parser.getToken() === 10) {
6798
+ if (!canAssign)
6799
+ parser.report(57);
6744
6800
  const scope = parser.options.lexical
6745
6801
  ? createArrowHeadParsingScope(parser, context, tokenValue, tokenStart, currentLocation)
6746
6802
  : undefined;
@@ -6774,7 +6830,7 @@
6774
6830
  if (parser.flags & 1)
6775
6831
  parser.report(48);
6776
6832
  consume(parser, context | 32, 10);
6777
- const modifierFlags = 1024 | 2048 | 8192 | 524288;
6833
+ const modifierFlags = 1024 | 2048 | 8192 | 524288 | 8;
6778
6834
  context = ((context | modifierFlags) ^ modifierFlags) | (isAsync ? 2048 : 0);
6779
6835
  const expression = parser.getToken() !== 2162700;
6780
6836
  let body;
@@ -6787,7 +6843,7 @@
6787
6843
  }
6788
6844
  else {
6789
6845
  scope = scope?.createChildScope(64);
6790
- const modifierFlags = 4 | 131072 | 8;
6846
+ const modifierFlags = 4 | 128 | 131072 | 8;
6791
6847
  body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 4096, scope, privateScope, void 0, void 0, 16);
6792
6848
  switch (parser.getToken()) {
6793
6849
  case 69271571:
@@ -6797,7 +6853,9 @@
6797
6853
  parser.flags |= 8192;
6798
6854
  break;
6799
6855
  case 67108877:
6856
+ case 67108991:
6800
6857
  case 67174409:
6858
+ case 67174408:
6801
6859
  case 22:
6802
6860
  parser.report(119);
6803
6861
  case 67174411:
@@ -6954,9 +7012,9 @@
6954
7012
  }
6955
7013
  const expr = parsePrimaryExpression(parser, context, privateScope, 2, 1, 0, inGroup, 1, tokenStart);
6956
7014
  context = (context | 131072) ^ 131072;
7015
+ const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
6957
7016
  if (parser.getToken() === 67108991)
6958
7017
  parser.report(170);
6959
- const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
6960
7018
  parser.assignable = 2;
6961
7019
  return parser.finishNode({
6962
7020
  type: 'NewExpression',
@@ -7426,8 +7484,6 @@
7426
7484
  }
7427
7485
  else if (token === -2147483526) {
7428
7486
  key = parseIdentifier(parser, context);
7429
- if (parser.getToken() !== 67174411)
7430
- parser.report(30, KeywordDescTable[parser.getToken() & 255]);
7431
7487
  }
7432
7488
  else {
7433
7489
  parser.report(30, KeywordDescTable[parser.getToken() & 255]);
@@ -7443,7 +7499,7 @@
7443
7499
  }
7444
7500
  else if (parser.getToken() === 69271571) {
7445
7501
  kind |= 2;
7446
- key = parseComputedPropertyName(parser, context, privateScope, 0);
7502
+ key = parseComputedPropertyName(parser, inheritedContext, privateScope, 0);
7447
7503
  }
7448
7504
  else if (parser.getToken() === 131) {
7449
7505
  kind |= 8192;
@@ -7531,6 +7587,7 @@
7531
7587
  2048 |
7532
7588
  8 |
7533
7589
  8192 |
7590
+ 32768 |
7534
7591
  ((state & 64) === 0 ? 512 | 16384 : 0);
7535
7592
  context =
7536
7593
  ((context | modifierFlags) ^ modifierFlags) |