meriyah 7.3.1 → 7.3.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.3.1";
1
+ var version$1 = "7.3.2";
2
2
  var packageJson = {
3
3
  version: version$1};
4
4
 
@@ -2040,6 +2040,9 @@ function scanSingleToken(parser, context, state) {
2040
2040
  }
2041
2041
  case 8390721: {
2042
2042
  advanceChar(parser);
2043
+ if (context & 1048576) {
2044
+ return 8390721;
2045
+ }
2043
2046
  const ch = parser.currentChar;
2044
2047
  if (ch === 61) {
2045
2048
  advanceChar(parser);
@@ -4563,7 +4566,7 @@ function nextJSXToken(parser) {
4563
4566
  parser.setToken(138);
4564
4567
  }
4565
4568
  function rescanJSXIdentifier(parser) {
4566
- if ((parser.getToken() & 143360) === 143360) {
4569
+ if (parser.getToken() & 143360) {
4567
4570
  const { index } = parser;
4568
4571
  let char = parser.currentChar;
4569
4572
  while (CharTypes[char] & (32768 | 2)) {
@@ -4668,18 +4671,18 @@ class Scope {
4668
4671
  createChildScope(type) {
4669
4672
  return new Scope(this.parser, type, this);
4670
4673
  }
4671
- addVarOrBlock(context, name, kind, origin) {
4674
+ addVarOrBlock(context, name, kind, tokenStart, tokenEnd, origin) {
4672
4675
  if (kind & 4) {
4673
- this.addVarName(context, name, kind);
4676
+ this.addVarName(context, name, kind, tokenStart, tokenEnd);
4674
4677
  }
4675
4678
  else {
4676
- this.addBlockName(context, name, kind, origin);
4679
+ this.addBlockName(context, name, kind, tokenStart, tokenEnd, origin);
4677
4680
  }
4678
4681
  if (origin & 64) {
4679
4682
  this.parser.declareUnboundVariable(name);
4680
4683
  }
4681
4684
  }
4682
- addVarName(context, name, kind) {
4685
+ addVarName(context, name, kind, tokenStart, tokenEnd) {
4683
4686
  const { parser } = this;
4684
4687
  let currentScope = this;
4685
4688
  while (currentScope && (currentScope.type & 128) === 0) {
@@ -4691,17 +4694,17 @@ class Scope {
4691
4694
  ((kind & 128 && value & 68) ||
4692
4695
  (value & 128 && kind & 68))) ;
4693
4696
  else {
4694
- parser.report(147, name);
4697
+ throw new ParseError(tokenStart, tokenEnd, 147, name);
4695
4698
  }
4696
4699
  }
4697
4700
  if (currentScope === this) {
4698
4701
  if (value && value & 1 && kind & 1) {
4699
- currentScope.recordScopeError(147, name);
4702
+ currentScope.recordScopeError(147, tokenStart, tokenEnd, name);
4700
4703
  }
4701
4704
  }
4702
4705
  if (value &&
4703
4706
  (value & 256 || (value & 512 && !parser.options.webcompat))) {
4704
- parser.report(147, name);
4707
+ throw new ParseError(tokenStart, tokenEnd, 147, name);
4705
4708
  }
4706
4709
  currentScope.variableBindings.set(name, kind);
4707
4710
  currentScope = currentScope.parent;
@@ -4710,12 +4713,12 @@ class Scope {
4710
4713
  hasVariable(name) {
4711
4714
  return this.variableBindings.has(name);
4712
4715
  }
4713
- addBlockName(context, name, kind, origin = 0) {
4716
+ addBlockName(context, name, kind, tokenStart, tokenEnd, origin = 0) {
4714
4717
  const { parser } = this;
4715
4718
  const value = this.variableBindings.get(name);
4716
4719
  if (value && (value & 2) === 0) {
4717
4720
  if (kind & 1) {
4718
- this.recordScopeError(147, name);
4721
+ this.recordScopeError(147, tokenStart, tokenEnd, name);
4719
4722
  }
4720
4723
  else if (parser.options.webcompat &&
4721
4724
  (context & 1) === 0 &&
@@ -4723,31 +4726,31 @@ class Scope {
4723
4726
  value === 64 &&
4724
4727
  kind === 64) ;
4725
4728
  else {
4726
- parser.report(147, name);
4729
+ throw new ParseError(tokenStart, tokenEnd, 147, name);
4727
4730
  }
4728
4731
  }
4729
4732
  if (this.type & 64 &&
4730
4733
  this.parent?.hasVariable(name) &&
4731
4734
  (this.parent.variableBindings.get(name) & 2) === 0) {
4732
- parser.report(147, name);
4735
+ throw new ParseError(tokenStart, tokenEnd, 147, name);
4733
4736
  }
4734
4737
  if (this.type & 512 && value && (value & 2) === 0) {
4735
4738
  if (kind & 1) {
4736
- this.recordScopeError(147, name);
4739
+ this.recordScopeError(147, tokenStart, tokenEnd, name);
4737
4740
  }
4738
4741
  }
4739
4742
  if (this.type & 32) {
4740
4743
  if (this.parent.variableBindings.get(name) & 768)
4741
- parser.report(161, name);
4744
+ throw new ParseError(tokenStart, tokenEnd, 161, name);
4742
4745
  }
4743
4746
  this.variableBindings.set(name, kind);
4744
4747
  }
4745
- recordScopeError(type, ...params) {
4746
- this.scopeError = {
4748
+ recordScopeError(type, tokenStart, tokenEnd, ...params) {
4749
+ this.scopeError ??= {
4747
4750
  type,
4748
4751
  params,
4749
- start: this.parser.tokenStart,
4750
- end: this.parser.currentLocation,
4752
+ start: tokenStart,
4753
+ end: tokenEnd,
4751
4754
  };
4752
4755
  }
4753
4756
  reportScopeError() {
@@ -4758,9 +4761,9 @@ class Scope {
4758
4761
  throw new ParseError(scopeError.start, scopeError.end, scopeError.type, ...scopeError.params);
4759
4762
  }
4760
4763
  }
4761
- function createArrowHeadParsingScope(parser, context, value) {
4764
+ function createArrowHeadParsingScope(parser, context, value, tokenStart, tokenEnd) {
4762
4765
  const scope = parser.createScope().createChildScope(512);
4763
- scope.addBlockName(context, value, 1);
4766
+ scope.addBlockName(context, value, 1, tokenStart, tokenEnd);
4764
4767
  return scope;
4765
4768
  }
4766
4769
 
@@ -5522,7 +5525,7 @@ function parseDoWhileStatement(parser, context, scope, privateScope, labels) {
5522
5525
  }, start);
5523
5526
  }
5524
5527
  function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin) {
5525
- const { tokenValue, tokenStart } = parser;
5528
+ const { tokenValue, tokenStart, currentLocation } = parser;
5526
5529
  const token = parser.getToken();
5527
5530
  let expr = parseIdentifier(parser, context);
5528
5531
  if (parser.getToken() & (143360 | 2097152) &&
@@ -5544,7 +5547,7 @@ function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateS
5544
5547
  if (parser.getToken() === 10) {
5545
5548
  let scope = void 0;
5546
5549
  if (parser.options.lexical)
5547
- scope = createArrowHeadParsingScope(parser, context, tokenValue);
5550
+ scope = createArrowHeadParsingScope(parser, context, tokenValue, tokenStart, currentLocation);
5548
5551
  parser.flags = (parser.flags | 128) ^ 128;
5549
5552
  expr = parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], 0, tokenStart);
5550
5553
  }
@@ -5763,6 +5766,7 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
5763
5766
  }
5764
5767
  else if (parser.getToken() === 471156) {
5765
5768
  const ofStart = parser.tokenStart;
5769
+ const ofEnd = parser.currentLocation;
5766
5770
  const ofToken = parser.getToken();
5767
5771
  const ofValue = parser.tokenValue;
5768
5772
  const ofIdentifier = parseIdentifier(parser, context);
@@ -5778,7 +5782,7 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
5778
5782
  else {
5779
5783
  resourceDeclarationKind = 'using';
5780
5784
  validateBindingIdentifier(parser, context, 16, ofToken, 0);
5781
- scope?.addBlockName(context, ofValue, 16, 32);
5785
+ scope?.addBlockName(context, ofValue, 16, ofStart, ofEnd, 32);
5782
5786
  let declarationInitializer = null;
5783
5787
  if (parser.getToken() === 1077936155) {
5784
5788
  nextToken(parser, context | 32);
@@ -5969,7 +5973,7 @@ function parseRestrictedIdentifier(parser, context, scope) {
5969
5973
  parser.report(120);
5970
5974
  if ((parser.getToken() & 537079808) === 537079808)
5971
5975
  parser.report(121);
5972
- scope?.addBlockName(context, parser.tokenValue, 8);
5976
+ scope?.addBlockName(context, parser.tokenValue, 8, parser.tokenStart, parser.currentLocation);
5973
5977
  return parseIdentifier(parser, context);
5974
5978
  }
5975
5979
  function parseImportDeclaration(parser, context, scope) {
@@ -5986,7 +5990,7 @@ function parseImportDeclaration(parser, context, scope) {
5986
5990
  else {
5987
5991
  if (parser.getToken() & 143360) {
5988
5992
  const token = parser.getToken();
5989
- const { tokenValue } = parser;
5993
+ const { tokenValue, tokenStart: start, currentLocation } = parser;
5990
5994
  const isPhaseDefer = parser.features & 2 && (token & -2147483648) === 0 && tokenValue == 'defer';
5991
5995
  const isPhaseSource = parser.features & 4 && (token & -2147483648) === 0 && tokenValue == 'source';
5992
5996
  if (isPhaseDefer || isPhaseSource) {
@@ -5997,7 +6001,7 @@ function parseImportDeclaration(parser, context, scope) {
5997
6001
  specifiers = [parseImportNamespaceSpecifier(parser, context, scope)];
5998
6002
  }
5999
6003
  else if (parser.getToken() === 209011 || parser.getToken() === 18) {
6000
- scope?.addBlockName(context, tokenValue, 8);
6004
+ scope?.addBlockName(context, tokenValue, 8, start, currentLocation);
6001
6005
  specifiers = [
6002
6006
  parser.finishNode({
6003
6007
  type: 'ImportDefaultSpecifier',
@@ -6012,10 +6016,11 @@ function parseImportDeclaration(parser, context, scope) {
6012
6016
  else if (parser.getToken() === 209011) {
6013
6017
  const fromToken = parser.getToken();
6014
6018
  const fromStart = parser.tokenStart;
6019
+ const fromEnd = parser.currentLocation;
6015
6020
  const fromLocal = parseIdentifier(parser, context);
6016
6021
  if (parser.getToken() === 209011) {
6017
6022
  validateBindingIdentifier(parser, context, 16, fromToken, 0);
6018
- scope?.addBlockName(context, fromLocal.name, 8);
6023
+ scope?.addBlockName(context, fromLocal.name, 8, fromStart, fromEnd);
6019
6024
  phase = 'source';
6020
6025
  specifiers = [
6021
6026
  parser.finishNode({
@@ -6025,7 +6030,7 @@ function parseImportDeclaration(parser, context, scope) {
6025
6030
  ];
6026
6031
  }
6027
6032
  else {
6028
- scope?.addBlockName(context, tokenValue, 8);
6033
+ scope?.addBlockName(context, tokenValue, 8, start, currentLocation);
6029
6034
  specifiers = [
6030
6035
  parser.finishNode({
6031
6036
  type: 'ImportDefaultSpecifier',
@@ -6050,7 +6055,7 @@ function parseImportDeclaration(parser, context, scope) {
6050
6055
  ];
6051
6056
  }
6052
6057
  else if (parser.getToken() === 18) {
6053
- scope?.addBlockName(context, tokenValue, 8);
6058
+ scope?.addBlockName(context, tokenValue, 8, start, currentLocation);
6054
6059
  specifiers = [
6055
6060
  parser.finishNode({
6056
6061
  type: 'ImportDefaultSpecifier',
@@ -6135,7 +6140,8 @@ function parseModuleSpecifier(parser, context) {
6135
6140
  function parseImportSpecifierOrNamedImports(parser, context, scope, specifiers) {
6136
6141
  nextToken(parser, context);
6137
6142
  while (parser.getToken() & 143360 || parser.getToken() === 134283267) {
6138
- let { tokenValue, tokenStart } = parser;
6143
+ let { tokenValue, tokenStart, currentLocation } = parser;
6144
+ const start = tokenStart;
6139
6145
  const token = parser.getToken();
6140
6146
  const imported = parseModuleExportName(parser, context);
6141
6147
  let local;
@@ -6148,6 +6154,8 @@ function parseImportSpecifierOrNamedImports(parser, context, scope, specifiers)
6148
6154
  validateBindingIdentifier(parser, context, 16, parser.getToken(), 0);
6149
6155
  }
6150
6156
  tokenValue = parser.tokenValue;
6157
+ tokenStart = parser.tokenStart;
6158
+ currentLocation = parser.currentLocation;
6151
6159
  local = parseIdentifier(parser, context);
6152
6160
  }
6153
6161
  else if (imported.type === 'Identifier') {
@@ -6157,12 +6165,12 @@ function parseImportSpecifierOrNamedImports(parser, context, scope, specifiers)
6157
6165
  else {
6158
6166
  parser.report(25, KeywordDescTable[77932 & 255]);
6159
6167
  }
6160
- scope?.addBlockName(context, tokenValue, 8);
6168
+ scope?.addBlockName(context, tokenValue, 8, tokenStart, currentLocation);
6161
6169
  specifiers.push(parser.finishNode({
6162
6170
  type: 'ImportSpecifier',
6163
6171
  local,
6164
6172
  imported,
6165
- }, tokenStart));
6173
+ }, start));
6166
6174
  if (parser.getToken() !== 1074790415)
6167
6175
  consume(parser, context, 18);
6168
6176
  }
@@ -6229,7 +6237,7 @@ function parseExportDeclaration(parser, context, scope) {
6229
6237
  }
6230
6238
  else if (parser.getToken() & 143360) {
6231
6239
  if (scope)
6232
- scope = createArrowHeadParsingScope(parser, context, parser.tokenValue);
6240
+ scope = createArrowHeadParsingScope(parser, context, parser.tokenValue, parser.tokenStart, parser.currentLocation);
6233
6241
  declaration = parseIdentifier(parser, context);
6234
6242
  declaration = parseArrowFunctionExpression(parser, context, scope, undefined, [declaration], 1, tokenStart);
6235
6243
  }
@@ -7318,12 +7326,7 @@ function parseFunctionDeclaration(parser, context, scope, privateScope, allowGen
7318
7326
  : 64 | (isAsync ? 1024 : 0) | (isGenerator ? 1024 : 0);
7319
7327
  validateFunctionName(parser, context, parser.getToken());
7320
7328
  if (scope) {
7321
- if (kind & 4) {
7322
- scope.addVarName(context, parser.tokenValue, kind);
7323
- }
7324
- else {
7325
- scope.addBlockName(context, parser.tokenValue, kind, origin);
7326
- }
7329
+ scope.addVarOrBlock(context, parser.tokenValue, kind, parser.tokenStart, parser.currentLocation, origin);
7327
7330
  functionScope = functionScope?.createChildScope(128);
7328
7331
  if (flags) {
7329
7332
  if (flags & 2) {
@@ -7428,7 +7431,7 @@ function parseArrayExpressionOrPattern(parser, context, scope, privateScope, ski
7428
7431
  }
7429
7432
  else {
7430
7433
  let left;
7431
- const { tokenStart, tokenValue } = parser;
7434
+ const { tokenStart, tokenValue, currentLocation } = parser;
7432
7435
  const token = parser.getToken();
7433
7436
  if (token & 143360) {
7434
7437
  left = parsePrimaryExpression(parser, context, privateScope, kind, 0, 1, inGroup, 1, tokenStart);
@@ -7436,7 +7439,7 @@ function parseArrayExpressionOrPattern(parser, context, scope, privateScope, ski
7436
7439
  if (parser.assignable & 2)
7437
7440
  parser.report(26);
7438
7441
  nextToken(parser, context | 32);
7439
- scope?.addVarOrBlock(context, tokenValue, kind, origin);
7442
+ scope?.addVarOrBlock(context, tokenValue, kind, tokenStart, currentLocation, origin);
7440
7443
  const right = parseExpression(parser, context, privateScope, 1, inGroup, parser.tokenStart);
7441
7444
  left = parser.finishNode(isPattern
7442
7445
  ? {
@@ -7462,7 +7465,7 @@ function parseArrayExpressionOrPattern(parser, context, scope, privateScope, ski
7462
7465
  destructible |= 16;
7463
7466
  }
7464
7467
  else {
7465
- scope?.addVarOrBlock(context, tokenValue, kind, origin);
7468
+ scope?.addVarOrBlock(context, tokenValue, kind, tokenStart, currentLocation, origin);
7466
7469
  }
7467
7470
  destructible |=
7468
7471
  parser.destructible & 256
@@ -7600,7 +7603,7 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
7600
7603
  nextToken(parser, context | 32);
7601
7604
  let argument = null;
7602
7605
  let destructible = 0;
7603
- const { tokenValue, tokenStart } = parser;
7606
+ const { tokenValue, tokenStart, currentLocation } = parser;
7604
7607
  let token = parser.getToken();
7605
7608
  if (token & 143360) {
7606
7609
  parser.assignable = 1;
@@ -7617,7 +7620,7 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
7617
7620
  destructible |= 16;
7618
7621
  }
7619
7622
  else if (token === closingToken || token === 18) {
7620
- scope?.addVarOrBlock(context, tokenValue, kind, origin);
7623
+ scope?.addVarOrBlock(context, tokenValue, kind, tokenStart, currentLocation, origin);
7621
7624
  }
7622
7625
  else {
7623
7626
  destructible |= 32;
@@ -7772,7 +7775,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
7772
7775
  let prototypeCount = 0;
7773
7776
  context = (context | 131072) ^ 131072;
7774
7777
  while (parser.getToken() !== 1074790415) {
7775
- const { tokenValue, tokenStart } = parser;
7778
+ const { tokenValue, tokenStart, currentLocation } = parser;
7776
7779
  const token = parser.getToken();
7777
7780
  if (token === 14) {
7778
7781
  properties.push(parseSpreadOrRestElement(parser, context, scope, privateScope, 1074790415, kind, 0, inGroup, isPattern, origin));
@@ -7797,7 +7800,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
7797
7800
  else {
7798
7801
  validateBindingIdentifier(parser, context, kind, token, 0);
7799
7802
  }
7800
- scope?.addVarOrBlock(context, tokenValue, kind, origin);
7803
+ scope?.addVarOrBlock(context, tokenValue, kind, tokenStart, currentLocation, origin);
7801
7804
  if (consumeOpt(parser, context | 32, 1077936155)) {
7802
7805
  destructible |= 8;
7803
7806
  const right = parseExpression(parser, context, privateScope, 1, inGroup, parser.tokenStart);
@@ -7821,7 +7824,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
7821
7824
  }
7822
7825
  }
7823
7826
  else if (consumeOpt(parser, context | 32, 21)) {
7824
- const { tokenStart } = parser;
7827
+ const { tokenStart, currentLocation } = parser;
7825
7828
  if (tokenValue === '__proto__')
7826
7829
  prototypeCount++;
7827
7830
  if (parser.getToken() & 143360) {
@@ -7837,7 +7840,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
7837
7840
  destructible |= 16;
7838
7841
  }
7839
7842
  else if ((tokenAfterColon & 143360) === 143360) {
7840
- scope?.addVarOrBlock(context, valueAfterColon, kind, origin);
7843
+ scope?.addVarOrBlock(context, valueAfterColon, kind, tokenStart, currentLocation, origin);
7841
7844
  }
7842
7845
  }
7843
7846
  else {
@@ -7855,7 +7858,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
7855
7858
  destructible |= 32;
7856
7859
  }
7857
7860
  else {
7858
- scope?.addVarOrBlock(context, valueAfterColon, kind, origin);
7861
+ scope?.addVarOrBlock(context, valueAfterColon, kind, tokenStart, currentLocation, origin);
7859
7862
  }
7860
7863
  value = parseAssignmentExpression(parser, context, privateScope, inGroup, isPattern, tokenStart, value);
7861
7864
  }
@@ -8023,7 +8026,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
8023
8026
  prototypeCount++;
8024
8027
  if (parser.getToken() & 143360) {
8025
8028
  value = parsePrimaryExpression(parser, context, privateScope, kind, 0, 1, inGroup, 1, tokenStart);
8026
- const { tokenValue: valueAfterColon } = parser;
8029
+ const { tokenValue: valueAfterColon, tokenStart: start, currentLocation } = parser;
8027
8030
  const token = parser.getToken();
8028
8031
  value = parseMemberOrUpdateExpression(parser, context, privateScope, value, inGroup, 0, tokenStart);
8029
8032
  if (parser.getToken() === 18 || parser.getToken() === 1074790415) {
@@ -8032,7 +8035,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
8032
8035
  destructible |= 16;
8033
8036
  }
8034
8037
  else {
8035
- scope?.addVarOrBlock(context, valueAfterColon, kind, origin);
8038
+ scope?.addVarOrBlock(context, valueAfterColon, kind, start, currentLocation, origin);
8036
8039
  }
8037
8040
  }
8038
8041
  else {
@@ -8124,7 +8127,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
8124
8127
  state |= 2;
8125
8128
  if (parser.getToken() === 21) {
8126
8129
  nextToken(parser, context | 32);
8127
- const { tokenStart, tokenValue } = parser;
8130
+ const { tokenStart, tokenValue, currentLocation } = parser;
8128
8131
  const tokenAfterColon = parser.getToken();
8129
8132
  if (parser.getToken() & 143360) {
8130
8133
  value = parsePrimaryExpression(parser, context, privateScope, kind, 0, 1, inGroup, 1, tokenStart);
@@ -8145,7 +8148,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
8145
8148
  destructible |= 16;
8146
8149
  }
8147
8150
  else if ((tokenAfterColon & 143360) === 143360) {
8148
- scope?.addVarOrBlock(context, tokenValue, kind, origin);
8151
+ scope?.addVarOrBlock(context, tokenValue, kind, tokenStart, currentLocation, origin);
8149
8152
  }
8150
8153
  }
8151
8154
  else {
@@ -8404,10 +8407,10 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
8404
8407
  const tokenAfterParenthesesStart = parser.tokenStart;
8405
8408
  parser.assignable = 1;
8406
8409
  while (parser.getToken() !== 16) {
8407
- const { tokenStart } = parser;
8410
+ const { tokenStart, currentLocation } = parser;
8408
8411
  const token = parser.getToken();
8409
8412
  if (token & 143360) {
8410
- scope?.addBlockName(context, parser.tokenValue, 1);
8413
+ scope?.addBlockName(context, parser.tokenValue, 1, tokenStart, currentLocation);
8411
8414
  if ((token & 537079808) === 537079808) {
8412
8415
  isNonSimpleParameterList = 1;
8413
8416
  }
@@ -8564,8 +8567,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
8564
8567
  : expr;
8565
8568
  }
8566
8569
  function parseIdentifierOrArrow(parser, context, privateScope) {
8567
- const { tokenStart: start } = parser;
8568
- const { tokenValue } = parser;
8570
+ const { tokenValue, tokenStart, currentLocation } = parser;
8569
8571
  let isNonSimpleParameterList = 0;
8570
8572
  let hasStrictReserved = 0;
8571
8573
  if ((parser.getToken() & 537079808) === 537079808) {
@@ -8577,12 +8579,14 @@ function parseIdentifierOrArrow(parser, context, privateScope) {
8577
8579
  const expr = parseIdentifier(parser, context);
8578
8580
  parser.assignable = 1;
8579
8581
  if (parser.getToken() === 10) {
8580
- const scope = parser.options.lexical ? createArrowHeadParsingScope(parser, context, tokenValue) : undefined;
8582
+ const scope = parser.options.lexical
8583
+ ? createArrowHeadParsingScope(parser, context, tokenValue, tokenStart, currentLocation)
8584
+ : undefined;
8581
8585
  if (isNonSimpleParameterList)
8582
8586
  parser.flags |= 128;
8583
8587
  if (hasStrictReserved)
8584
8588
  parser.flags |= 256;
8585
- return parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], 0, start);
8589
+ return parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], 0, tokenStart);
8586
8590
  }
8587
8591
  return expr;
8588
8592
  }
@@ -8592,7 +8596,9 @@ function parseArrowFromIdentifier(parser, context, privateScope, value, expr, in
8592
8596
  if (inNew)
8593
8597
  parser.report(51);
8594
8598
  parser.flags &= -129;
8595
- const scope = parser.options.lexical ? createArrowHeadParsingScope(parser, context, value) : void 0;
8599
+ const scope = parser.options.lexical
8600
+ ? createArrowHeadParsingScope(parser, context, value, start, parser.currentLocation)
8601
+ : void 0;
8596
8602
  return parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], isAsync, start, origin);
8597
8603
  }
8598
8604
  function parseParenthesizedArrow(parser, context, scope, privateScope, params, canAssign, isAsync, start, origin = 0) {
@@ -8850,10 +8856,10 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
8850
8856
  (256 | 128);
8851
8857
  const params = [];
8852
8858
  while (parser.getToken() !== 16) {
8853
- const { tokenStart } = parser;
8859
+ const { tokenStart, currentLocation } = parser;
8854
8860
  const token = parser.getToken();
8855
8861
  if (token & 143360) {
8856
- scope?.addBlockName(context, parser.tokenValue, kind);
8862
+ scope?.addBlockName(context, parser.tokenValue, kind, tokenStart, currentLocation);
8857
8863
  if ((token & 537079808) === 537079808) {
8858
8864
  parser.flags |= 512;
8859
8865
  }
@@ -9010,7 +9016,7 @@ function parseClassDeclaration(parser, context, scope, privateScope, flags) {
9010
9016
  consume(parser, context, 86094);
9011
9017
  let id = null;
9012
9018
  let superClass = null;
9013
- const { tokenValue } = parser;
9019
+ const { tokenValue, tokenStart, currentLocation } = parser;
9014
9020
  if (parser.getToken() & 4096 && parser.getToken() !== 20565) {
9015
9021
  if (isStrictReservedWord(parser, context, parser.getToken())) {
9016
9022
  parser.report(120);
@@ -9019,7 +9025,7 @@ function parseClassDeclaration(parser, context, scope, privateScope, flags) {
9019
9025
  parser.report(121);
9020
9026
  }
9021
9027
  if (scope) {
9022
- scope.addBlockName(context, tokenValue, 32);
9028
+ scope.addBlockName(context, tokenValue, 32, tokenStart, currentLocation);
9023
9029
  if (flags) {
9024
9030
  if (flags & 2) {
9025
9031
  parser.declareUnboundVariable(tokenValue);
@@ -9422,13 +9428,13 @@ function parseAndClassifyIdentifier(parser, context, scope, kind, origin = 0) {
9422
9428
  if (context & 2)
9423
9429
  parser.report(112);
9424
9430
  }
9425
- const { tokenValue, tokenStart: start } = parser;
9431
+ const { tokenValue, tokenStart, currentLocation } = parser;
9426
9432
  nextToken(parser, context);
9427
- scope?.addVarOrBlock(context, tokenValue, kind, origin);
9433
+ scope?.addVarOrBlock(context, tokenValue, kind, tokenStart, currentLocation, origin);
9428
9434
  return parser.finishNode({
9429
9435
  type: 'Identifier',
9430
9436
  name: tokenValue,
9431
- }, start);
9437
+ }, tokenStart);
9432
9438
  }
9433
9439
  function parseJSXRootElementOrFragment(parser, context, privateScope, inJSXChild, start) {
9434
9440
  if (!inJSXChild)
@@ -9567,7 +9573,7 @@ function parseJSXOpeningElementOrSelfCloseElement(parser, context, privateScope,
9567
9573
  const attributes = parseJSXAttributes(parser, context, privateScope);
9568
9574
  const selfClosing = parser.getToken() === 8457014;
9569
9575
  if (selfClosing)
9570
- consume(parser, context, 8457014);
9576
+ consume(parser, context | 1048576, 8457014);
9571
9577
  if (parser.getToken() !== 8390721) {
9572
9578
  parser.report(25, KeywordDescTable[8390721 & 255]);
9573
9579
  }
@@ -9718,7 +9724,7 @@ function parseJSXIdentifier(parser, context) {
9718
9724
  parser.report(30, KeywordDescTable[parser.getToken() & 255]);
9719
9725
  }
9720
9726
  const { tokenValue } = parser;
9721
- nextToken(parser, context);
9727
+ nextToken(parser, context | 1048576);
9722
9728
  return parser.finishNode({
9723
9729
  type: 'JSXIdentifier',
9724
9730
  name: tokenValue,