@sanity/pkg-utils 4.0.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/_chunks/{build-xtvcN4rn.cjs → build-AuLlgQCD.cjs} +5 -4
  2. package/dist/_chunks/{build-xtvcN4rn.cjs.map → build-AuLlgQCD.cjs.map} +1 -1
  3. package/dist/_chunks/{buildAction-lOl6hAY8.cjs → buildAction-aKVmXTPP.cjs} +2 -2
  4. package/dist/_chunks/{buildAction-lOl6hAY8.cjs.map → buildAction-aKVmXTPP.cjs.map} +1 -1
  5. package/dist/_chunks/{check-5On74q2h.cjs → check-j5YR3hUi.cjs} +4 -3
  6. package/dist/_chunks/check-j5YR3hUi.cjs.map +1 -0
  7. package/dist/_chunks/{checkAction-RYG9-Wqo.cjs → checkAction-AD9RJftD.cjs} +2 -2
  8. package/dist/_chunks/{checkAction-RYG9-Wqo.cjs.map → checkAction-AD9RJftD.cjs.map} +1 -1
  9. package/dist/_chunks/{consoleSpy-bV4ZI2h8.cjs → consoleSpy-HqQIfX7k.cjs} +112 -73
  10. package/dist/_chunks/consoleSpy-HqQIfX7k.cjs.map +1 -0
  11. package/dist/_chunks/{index-YSy1xob6.cjs → index-FaD5mo-6.cjs} +558 -1037
  12. package/dist/_chunks/index-FaD5mo-6.cjs.map +1 -0
  13. package/dist/_chunks/{init-tT7f7xkO.cjs → init-9DSt45GN.cjs} +3 -2
  14. package/dist/_chunks/{init-tT7f7xkO.cjs.map → init-9DSt45GN.cjs.map} +1 -1
  15. package/dist/_chunks/{initAction-zkJJWu4U.cjs → initAction-sChm6v2i.cjs} +2 -2
  16. package/dist/_chunks/{initAction-zkJJWu4U.cjs.map → initAction-sChm6v2i.cjs.map} +1 -1
  17. package/dist/_chunks/{logger-c-JGqYo_.cjs → logger-L4V-Be7d.cjs} +2 -2
  18. package/dist/_chunks/logger-L4V-Be7d.cjs.map +1 -0
  19. package/dist/_chunks/{watch-Mo2KRBJf.cjs → watch-fXO97GL2.cjs} +5 -4
  20. package/dist/_chunks/{watch-Mo2KRBJf.cjs.map → watch-fXO97GL2.cjs.map} +1 -1
  21. package/dist/_chunks/{watchAction-7JsrPTEX.cjs → watchAction-SAJ1nU-a.cjs} +2 -2
  22. package/dist/_chunks/{watchAction-7JsrPTEX.cjs.map → watchAction-SAJ1nU-a.cjs.map} +1 -1
  23. package/dist/cli.cjs +5 -5
  24. package/dist/index.cjs +7 -7
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +662 -1104
  27. package/dist/index.js.map +1 -1
  28. package/package.json +13 -10
  29. package/src/node/core/defaults.ts +3 -6
  30. package/src/node/core/pkg/types.ts +1 -1
  31. package/src/node/core/pkg/validatePkg.ts +1 -1
  32. package/src/node/resolveBrowserTarget.ts +10 -28
  33. package/src/node/resolveBuildContext.ts +13 -2
  34. package/src/node/resolveNodeTarget.ts +2 -8
  35. package/dist/_chunks/check-5On74q2h.cjs.map +0 -1
  36. package/dist/_chunks/consoleSpy-bV4ZI2h8.cjs.map +0 -1
  37. package/dist/_chunks/index-YSy1xob6.cjs.map +0 -1
  38. package/dist/_chunks/logger-c-JGqYo_.cjs.map +0 -1
  39. package/src/node/resolveBrowserslistVersions.ts +0 -60
@@ -15,7 +15,7 @@ var fs$1 = require('fs');
15
15
  var require$$1 = require('assert');
16
16
  var require$$4 = require('os');
17
17
  var rollup = require('rollup');
18
- var consoleSpy = require('./consoleSpy-bV4ZI2h8.cjs');
18
+ var consoleSpy = require('./consoleSpy-HqQIfX7k.cjs');
19
19
  var alias = require('@rollup/plugin-alias');
20
20
  var pluginBabel = require('@rollup/plugin-babel');
21
21
  var commonjs = require('@rollup/plugin-commonjs');
@@ -27,7 +27,8 @@ var esbuild = require('rollup-plugin-esbuild');
27
27
  require('esbuild-register/dist/node');
28
28
  require('pkg-up');
29
29
  require('find-config');
30
- require('./logger-c-JGqYo_.cjs');
30
+ require('@sanity/browserslist-config');
31
+ require('./logger-L4V-Be7d.cjs');
31
32
  require('zod');
32
33
  require('prompts');
33
34
 
@@ -21199,8 +21200,8 @@ function requireLib () {
21199
21200
  PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
21200
21201
  PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
21201
21202
  };
21202
- const _excluded$1 = ["toMessage"],
21203
- _excluded2$1 = ["message"];
21203
+ const _excluded = ["toMessage"],
21204
+ _excluded2 = ["message"];
21204
21205
  function defineHidden(obj, key, value) {
21205
21206
  Object.defineProperty(obj, key, {
21206
21207
  enumerable: false,
@@ -21212,11 +21213,8 @@ function requireLib () {
21212
21213
  let {
21213
21214
  toMessage
21214
21215
  } = _ref,
21215
- properties = _objectWithoutPropertiesLoose(_ref, _excluded$1);
21216
- return function constructor({
21217
- loc,
21218
- details
21219
- }) {
21216
+ properties = _objectWithoutPropertiesLoose(_ref, _excluded);
21217
+ return function constructor(loc, details) {
21220
21218
  const error = new SyntaxError();
21221
21219
  Object.assign(error, properties, {
21222
21220
  loc,
@@ -21234,10 +21232,7 @@ function requireLib () {
21234
21232
  column,
21235
21233
  index
21236
21234
  } = (_overrides$loc = overrides.loc) != null ? _overrides$loc : loc;
21237
- return constructor({
21238
- loc: new Position(line, column, index),
21239
- details: Object.assign({}, details, overrides.details)
21240
- });
21235
+ return constructor(new Position(line, column, index), Object.assign({}, details, overrides.details));
21241
21236
  });
21242
21237
  defineHidden(error, "details", details);
21243
21238
  Object.defineProperty(error, "message", {
@@ -21272,7 +21267,7 @@ function requireLib () {
21272
21267
  {
21273
21268
  message
21274
21269
  } = _ref2,
21275
- rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);
21270
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
21276
21271
  const toMessage = typeof message === "string" ? () => message : message;
21277
21272
  ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
21278
21273
  code: "BABEL_PARSER_SYNTAX_ERROR",
@@ -21517,13 +21512,9 @@ function requireLib () {
21517
21512
  }
21518
21513
  toAssignableObjectExpressionProp(prop, isLast, isLHS) {
21519
21514
  if (prop.kind === "get" || prop.kind === "set") {
21520
- this.raise(Errors.PatternHasAccessor, {
21521
- at: prop.key
21522
- });
21515
+ this.raise(Errors.PatternHasAccessor, prop.key);
21523
21516
  } else if (prop.method) {
21524
- this.raise(Errors.PatternHasMethod, {
21525
- at: prop.key
21526
- });
21517
+ this.raise(Errors.PatternHasMethod, prop.key);
21527
21518
  } else {
21528
21519
  super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
21529
21520
  }
@@ -22259,9 +22250,9 @@ function requireLib () {
22259
22250
  }
22260
22251
  class Scope {
22261
22252
  constructor(flags) {
22262
- this.var = new Set();
22263
- this.lexical = new Set();
22264
- this.functions = new Set();
22253
+ this.flags = 0;
22254
+ this.names = new Map();
22255
+ this.firstLexicalName = "";
22265
22256
  this.flags = flags;
22266
22257
  }
22267
22258
  }
@@ -22329,11 +22320,16 @@ function requireLib () {
22329
22320
  let scope = this.currentScope();
22330
22321
  if (bindingType & 8 || bindingType & 16) {
22331
22322
  this.checkRedeclarationInScope(scope, name, bindingType, loc);
22323
+ let type = scope.names.get(name) || 0;
22332
22324
  if (bindingType & 16) {
22333
- scope.functions.add(name);
22325
+ type = type | 4;
22334
22326
  } else {
22335
- scope.lexical.add(name);
22327
+ if (!scope.firstLexicalName) {
22328
+ scope.firstLexicalName = name;
22329
+ }
22330
+ type = type | 2;
22336
22331
  }
22332
+ scope.names.set(name, type);
22337
22333
  if (bindingType & 8) {
22338
22334
  this.maybeExportDefined(scope, name);
22339
22335
  }
@@ -22341,7 +22337,7 @@ function requireLib () {
22341
22337
  for (let i = this.scopeStack.length - 1; i >= 0; --i) {
22342
22338
  scope = this.scopeStack[i];
22343
22339
  this.checkRedeclarationInScope(scope, name, bindingType, loc);
22344
- scope.var.add(name);
22340
+ scope.names.set(name, (scope.names.get(name) || 0) | 1);
22345
22341
  this.maybeExportDefined(scope, name);
22346
22342
  if (scope.flags & 387) break;
22347
22343
  }
@@ -22357,8 +22353,7 @@ function requireLib () {
22357
22353
  }
22358
22354
  checkRedeclarationInScope(scope, name, bindingType, loc) {
22359
22355
  if (this.isRedeclaredInScope(scope, name, bindingType)) {
22360
- this.parser.raise(Errors.VarRedeclaration, {
22361
- at: loc,
22356
+ this.parser.raise(Errors.VarRedeclaration, loc, {
22362
22357
  identifierName: name
22363
22358
  });
22364
22359
  }
@@ -22366,19 +22361,20 @@ function requireLib () {
22366
22361
  isRedeclaredInScope(scope, name, bindingType) {
22367
22362
  if (!(bindingType & 1)) return false;
22368
22363
  if (bindingType & 8) {
22369
- return scope.lexical.has(name) || scope.functions.has(name) || scope.var.has(name);
22364
+ return scope.names.has(name);
22370
22365
  }
22366
+ const type = scope.names.get(name);
22371
22367
  if (bindingType & 16) {
22372
- return scope.lexical.has(name) || !this.treatFunctionsAsVarInScope(scope) && scope.var.has(name);
22368
+ return (type & 2) > 0 || !this.treatFunctionsAsVarInScope(scope) && (type & 1) > 0;
22373
22369
  }
22374
- return scope.lexical.has(name) && !(scope.flags & 8 && scope.lexical.values().next().value === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.has(name);
22370
+ return (type & 2) > 0 && !(scope.flags & 8 && scope.firstLexicalName === name) || !this.treatFunctionsAsVarInScope(scope) && (type & 4) > 0;
22375
22371
  }
22376
22372
  checkLocalExport(id) {
22377
22373
  const {
22378
22374
  name
22379
22375
  } = id;
22380
22376
  const topLevelScope = this.scopeStack[0];
22381
- if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) && !topLevelScope.functions.has(name)) {
22377
+ if (!topLevelScope.names.has(name)) {
22382
22378
  this.undefinedExports.set(name, id.loc.start);
22383
22379
  }
22384
22380
  }
@@ -22428,8 +22424,9 @@ function requireLib () {
22428
22424
  }
22429
22425
  isRedeclaredInScope(scope, name, bindingType) {
22430
22426
  if (super.isRedeclaredInScope(scope, name, bindingType)) return true;
22431
- if (bindingType & 2048) {
22432
- return !scope.declareFunctions.has(name) && (scope.lexical.has(name) || scope.functions.has(name));
22427
+ if (bindingType & 2048 && !scope.declareFunctions.has(name)) {
22428
+ const type = scope.names.get(name);
22429
+ return (type & 4) > 0 || (type & 2) > 0;
22433
22430
  }
22434
22431
  return false;
22435
22432
  }
@@ -22502,7 +22499,12 @@ function requireLib () {
22502
22499
  class CommentsParser extends BaseParser {
22503
22500
  addComment(comment) {
22504
22501
  if (this.filename) comment.loc.filename = this.filename;
22505
- this.state.comments.push(comment);
22502
+ const {
22503
+ commentsLen
22504
+ } = this.state;
22505
+ if (this.comments.length != commentsLen) this.comments.length = commentsLen;
22506
+ this.comments.push(comment);
22507
+ this.state.commentsLen++;
22506
22508
  }
22507
22509
  processComment(node) {
22508
22510
  const {
@@ -22691,7 +22693,7 @@ function requireLib () {
22691
22693
  }
22692
22694
  class State {
22693
22695
  constructor() {
22694
- this.strict = void 0;
22696
+ this.flags = 1024;
22695
22697
  this.curLine = void 0;
22696
22698
  this.lineStart = void 0;
22697
22699
  this.startLoc = void 0;
@@ -22700,21 +22702,12 @@ function requireLib () {
22700
22702
  this.potentialArrowAt = -1;
22701
22703
  this.noArrowAt = [];
22702
22704
  this.noArrowParamsConversionAt = [];
22703
- this.maybeInArrowParameters = false;
22704
- this.inType = false;
22705
- this.noAnonFunctionType = false;
22706
- this.hasFlowComment = false;
22707
- this.isAmbientContext = false;
22708
- this.inAbstractClass = false;
22709
- this.inDisallowConditionalTypesContext = false;
22710
22705
  this.topicContext = {
22711
22706
  maxNumOfResolvableTopics: 0,
22712
22707
  maxTopicIndex: null
22713
22708
  };
22714
- this.soloAwait = false;
22715
- this.inFSharpPipelineDirectBody = false;
22716
22709
  this.labels = [];
22717
- this.comments = [];
22710
+ this.commentsLen = 0;
22718
22711
  this.commentStack = [];
22719
22712
  this.pos = 0;
22720
22713
  this.type = 139;
@@ -22723,14 +22716,21 @@ function requireLib () {
22723
22716
  this.end = 0;
22724
22717
  this.lastTokEndLoc = null;
22725
22718
  this.lastTokStartLoc = null;
22726
- this.lastTokStart = 0;
22727
22719
  this.context = [types.brace];
22728
- this.canStartJSXElement = true;
22729
- this.containsEsc = false;
22730
22720
  this.firstInvalidTemplateEscapePos = null;
22731
22721
  this.strictErrors = new Map();
22732
22722
  this.tokensLength = 0;
22733
22723
  }
22724
+ get strict() {
22725
+ return (this.flags & 1) > 0;
22726
+ }
22727
+ set strict(value) {
22728
+ if (value) {
22729
+ this.flags |= 1;
22730
+ } else {
22731
+ this.flags &= ~1;
22732
+ }
22733
+ }
22734
22734
  init({
22735
22735
  strictMode,
22736
22736
  sourceType,
@@ -22742,20 +22742,145 @@ function requireLib () {
22742
22742
  this.lineStart = -startColumn;
22743
22743
  this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
22744
22744
  }
22745
+ get maybeInArrowParameters() {
22746
+ return (this.flags & 2) > 0;
22747
+ }
22748
+ set maybeInArrowParameters(value) {
22749
+ if (value) {
22750
+ this.flags |= 2;
22751
+ } else {
22752
+ this.flags &= ~2;
22753
+ }
22754
+ }
22755
+ get inType() {
22756
+ return (this.flags & 4) > 0;
22757
+ }
22758
+ set inType(value) {
22759
+ if (value) {
22760
+ this.flags |= 4;
22761
+ } else {
22762
+ this.flags &= ~4;
22763
+ }
22764
+ }
22765
+ get noAnonFunctionType() {
22766
+ return (this.flags & 8) > 0;
22767
+ }
22768
+ set noAnonFunctionType(value) {
22769
+ if (value) {
22770
+ this.flags |= 8;
22771
+ } else {
22772
+ this.flags &= ~8;
22773
+ }
22774
+ }
22775
+ get hasFlowComment() {
22776
+ return (this.flags & 16) > 0;
22777
+ }
22778
+ set hasFlowComment(value) {
22779
+ if (value) {
22780
+ this.flags |= 16;
22781
+ } else {
22782
+ this.flags &= ~16;
22783
+ }
22784
+ }
22785
+ get isAmbientContext() {
22786
+ return (this.flags & 32) > 0;
22787
+ }
22788
+ set isAmbientContext(value) {
22789
+ if (value) {
22790
+ this.flags |= 32;
22791
+ } else {
22792
+ this.flags &= ~32;
22793
+ }
22794
+ }
22795
+ get inAbstractClass() {
22796
+ return (this.flags & 64) > 0;
22797
+ }
22798
+ set inAbstractClass(value) {
22799
+ if (value) {
22800
+ this.flags |= 64;
22801
+ } else {
22802
+ this.flags &= ~64;
22803
+ }
22804
+ }
22805
+ get inDisallowConditionalTypesContext() {
22806
+ return (this.flags & 128) > 0;
22807
+ }
22808
+ set inDisallowConditionalTypesContext(value) {
22809
+ if (value) {
22810
+ this.flags |= 128;
22811
+ } else {
22812
+ this.flags &= ~128;
22813
+ }
22814
+ }
22815
+ get soloAwait() {
22816
+ return (this.flags & 256) > 0;
22817
+ }
22818
+ set soloAwait(value) {
22819
+ if (value) {
22820
+ this.flags |= 256;
22821
+ } else {
22822
+ this.flags &= ~256;
22823
+ }
22824
+ }
22825
+ get inFSharpPipelineDirectBody() {
22826
+ return (this.flags & 512) > 0;
22827
+ }
22828
+ set inFSharpPipelineDirectBody(value) {
22829
+ if (value) {
22830
+ this.flags |= 512;
22831
+ } else {
22832
+ this.flags &= ~512;
22833
+ }
22834
+ }
22835
+ get canStartJSXElement() {
22836
+ return (this.flags & 1024) > 0;
22837
+ }
22838
+ set canStartJSXElement(value) {
22839
+ if (value) {
22840
+ this.flags |= 1024;
22841
+ } else {
22842
+ this.flags &= ~1024;
22843
+ }
22844
+ }
22845
+ get containsEsc() {
22846
+ return (this.flags & 2048) > 0;
22847
+ }
22848
+ set containsEsc(value) {
22849
+ if (value) {
22850
+ this.flags |= 2048;
22851
+ } else {
22852
+ this.flags &= ~2048;
22853
+ }
22854
+ }
22745
22855
  curPosition() {
22746
22856
  return new Position(this.curLine, this.pos - this.lineStart, this.pos);
22747
22857
  }
22748
- clone(skipArrays) {
22858
+ clone() {
22749
22859
  const state = new State();
22750
- const keys = Object.keys(this);
22751
- for (let i = 0, length = keys.length; i < length; i++) {
22752
- const key = keys[i];
22753
- let val = this[key];
22754
- if (!skipArrays && Array.isArray(val)) {
22755
- val = val.slice();
22756
- }
22757
- state[key] = val;
22758
- }
22860
+ state.flags = this.flags;
22861
+ state.curLine = this.curLine;
22862
+ state.lineStart = this.lineStart;
22863
+ state.startLoc = this.startLoc;
22864
+ state.endLoc = this.endLoc;
22865
+ state.errors = this.errors.slice();
22866
+ state.potentialArrowAt = this.potentialArrowAt;
22867
+ state.noArrowAt = this.noArrowAt.slice();
22868
+ state.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice();
22869
+ state.topicContext = this.topicContext;
22870
+ state.labels = this.labels.slice();
22871
+ state.commentsLen = this.commentsLen;
22872
+ state.commentStack = this.commentStack.slice();
22873
+ state.pos = this.pos;
22874
+ state.type = this.type;
22875
+ state.value = this.value;
22876
+ state.start = this.start;
22877
+ state.end = this.end;
22878
+ state.lastTokEndLoc = this.lastTokEndLoc;
22879
+ state.lastTokStartLoc = this.lastTokStartLoc;
22880
+ state.context = this.context.slice();
22881
+ state.firstInvalidTemplateEscapePos = this.firstInvalidTemplateEscapePos;
22882
+ state.strictErrors = this.strictErrors;
22883
+ state.tokensLength = this.tokensLength;
22759
22884
  return state;
22760
22885
  }
22761
22886
  }
@@ -23044,8 +23169,6 @@ function requireLib () {
23044
23169
  pos
23045
23170
  };
23046
23171
  }
23047
- const _excluded = ["at"],
23048
- _excluded2 = ["at"];
23049
23172
  function buildPosition(pos, lineStart, curLine) {
23050
23173
  return new Position(curLine, pos - lineStart, pos);
23051
23174
  }
@@ -23067,8 +23190,7 @@ function requireLib () {
23067
23190
  this.errorHandlers_readInt = {
23068
23191
  invalidDigit: (pos, lineStart, curLine, radix) => {
23069
23192
  if (!this.options.errorRecovery) return false;
23070
- this.raise(Errors.InvalidDigit, {
23071
- at: buildPosition(pos, lineStart, curLine),
23193
+ this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
23072
23194
  radix
23073
23195
  });
23074
23196
  return true;
@@ -23082,28 +23204,23 @@ function requireLib () {
23082
23204
  });
23083
23205
  this.errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, {
23084
23206
  strictNumericEscape: (pos, lineStart, curLine) => {
23085
- this.recordStrictModeErrors(Errors.StrictNumericEscape, {
23086
- at: buildPosition(pos, lineStart, curLine)
23087
- });
23207
+ this.recordStrictModeErrors(Errors.StrictNumericEscape, buildPosition(pos, lineStart, curLine));
23088
23208
  },
23089
23209
  unterminated: (pos, lineStart, curLine) => {
23090
- throw this.raise(Errors.UnterminatedString, {
23091
- at: buildPosition(pos - 1, lineStart, curLine)
23092
- });
23210
+ throw this.raise(Errors.UnterminatedString, buildPosition(pos - 1, lineStart, curLine));
23093
23211
  }
23094
23212
  });
23095
23213
  this.errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, {
23096
23214
  strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
23097
23215
  unterminated: (pos, lineStart, curLine) => {
23098
- throw this.raise(Errors.UnterminatedTemplate, {
23099
- at: buildPosition(pos, lineStart, curLine)
23100
- });
23216
+ throw this.raise(Errors.UnterminatedTemplate, buildPosition(pos, lineStart, curLine));
23101
23217
  }
23102
23218
  });
23103
23219
  this.state = new State();
23104
23220
  this.state.init(options);
23105
23221
  this.input = input;
23106
23222
  this.length = input.length;
23223
+ this.comments = [];
23107
23224
  this.isLookahead = false;
23108
23225
  }
23109
23226
  pushToken(token) {
@@ -23116,7 +23233,6 @@ function requireLib () {
23116
23233
  if (this.options.tokens) {
23117
23234
  this.pushToken(new Token(this.state));
23118
23235
  }
23119
- this.state.lastTokStart = this.state.start;
23120
23236
  this.state.lastTokEndLoc = this.state.endLoc;
23121
23237
  this.state.lastTokStartLoc = this.state.startLoc;
23122
23238
  this.nextToken();
@@ -23191,9 +23307,7 @@ function requireLib () {
23191
23307
  setStrict(strict) {
23192
23308
  this.state.strict = strict;
23193
23309
  if (strict) {
23194
- this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, {
23195
- at
23196
- }));
23310
+ this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, at));
23197
23311
  this.state.strictErrors.clear();
23198
23312
  }
23199
23313
  }
@@ -23216,9 +23330,7 @@ function requireLib () {
23216
23330
  const start = this.state.pos;
23217
23331
  const end = this.input.indexOf(commentEnd, start + 2);
23218
23332
  if (end === -1) {
23219
- throw this.raise(Errors.UnterminatedComment, {
23220
- at: this.state.curPosition()
23221
- });
23333
+ throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
23222
23334
  }
23223
23335
  this.state.pos = end + commentEnd.length;
23224
23336
  lineBreakG.lastIndex = start + 2;
@@ -23370,16 +23482,12 @@ function requireLib () {
23370
23482
  const nextPos = this.state.pos + 1;
23371
23483
  const next = this.codePointAtPos(nextPos);
23372
23484
  if (next >= 48 && next <= 57) {
23373
- throw this.raise(Errors.UnexpectedDigitAfterHash, {
23374
- at: this.state.curPosition()
23375
- });
23485
+ throw this.raise(Errors.UnexpectedDigitAfterHash, this.state.curPosition());
23376
23486
  }
23377
23487
  if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) {
23378
23488
  this.expectPlugin("recordAndTuple");
23379
23489
  if (this.getPluginOption("recordAndTuple", "syntaxType") === "bar") {
23380
- throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, {
23381
- at: this.state.curPosition()
23382
- });
23490
+ throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, this.state.curPosition());
23383
23491
  }
23384
23492
  this.state.pos += 2;
23385
23493
  if (next === 123) {
@@ -23464,9 +23572,7 @@ function requireLib () {
23464
23572
  }
23465
23573
  if (this.hasPlugin("recordAndTuple") && next === 125) {
23466
23574
  if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
23467
- throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, {
23468
- at: this.state.curPosition()
23469
- });
23575
+ throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
23470
23576
  }
23471
23577
  this.state.pos += 2;
23472
23578
  this.finishToken(9);
@@ -23474,9 +23580,7 @@ function requireLib () {
23474
23580
  }
23475
23581
  if (this.hasPlugin("recordAndTuple") && next === 93) {
23476
23582
  if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
23477
- throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, {
23478
- at: this.state.curPosition()
23479
- });
23583
+ throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
23480
23584
  }
23481
23585
  this.state.pos += 2;
23482
23586
  this.finishToken(4);
@@ -23622,9 +23726,7 @@ function requireLib () {
23622
23726
  case 91:
23623
23727
  if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
23624
23728
  if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
23625
- throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, {
23626
- at: this.state.curPosition()
23627
- });
23729
+ throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
23628
23730
  }
23629
23731
  this.state.pos += 2;
23630
23732
  this.finishToken(2);
@@ -23640,9 +23742,7 @@ function requireLib () {
23640
23742
  case 123:
23641
23743
  if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
23642
23744
  if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
23643
- throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, {
23644
- at: this.state.curPosition()
23645
- });
23745
+ throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
23646
23746
  }
23647
23747
  this.state.pos += 2;
23648
23748
  this.finishToken(6);
@@ -23746,8 +23846,7 @@ function requireLib () {
23746
23846
  return;
23747
23847
  }
23748
23848
  }
23749
- throw this.raise(Errors.InvalidOrUnexpectedToken, {
23750
- at: this.state.curPosition(),
23849
+ throw this.raise(Errors.InvalidOrUnexpectedToken, this.state.curPosition(), {
23751
23850
  unexpected: String.fromCodePoint(code)
23752
23851
  });
23753
23852
  }
@@ -23765,15 +23864,11 @@ function requireLib () {
23765
23864
  } = this.state;
23766
23865
  for (;; ++pos) {
23767
23866
  if (pos >= this.length) {
23768
- throw this.raise(Errors.UnterminatedRegExp, {
23769
- at: createPositionWithColumnOffset(startLoc, 1)
23770
- });
23867
+ throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
23771
23868
  }
23772
23869
  const ch = this.input.charCodeAt(pos);
23773
23870
  if (isNewLine(ch)) {
23774
- throw this.raise(Errors.UnterminatedRegExp, {
23775
- at: createPositionWithColumnOffset(startLoc, 1)
23776
- });
23871
+ throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
23777
23872
  }
23778
23873
  if (escaped) {
23779
23874
  escaped = false;
@@ -23798,26 +23893,18 @@ function requireLib () {
23798
23893
  if (VALID_REGEX_FLAGS.has(cp)) {
23799
23894
  if (cp === 118) {
23800
23895
  if (mods.includes("u")) {
23801
- this.raise(Errors.IncompatibleRegExpUVFlags, {
23802
- at: nextPos()
23803
- });
23896
+ this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
23804
23897
  }
23805
23898
  } else if (cp === 117) {
23806
23899
  if (mods.includes("v")) {
23807
- this.raise(Errors.IncompatibleRegExpUVFlags, {
23808
- at: nextPos()
23809
- });
23900
+ this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
23810
23901
  }
23811
23902
  }
23812
23903
  if (mods.includes(char)) {
23813
- this.raise(Errors.DuplicateRegExpFlags, {
23814
- at: nextPos()
23815
- });
23904
+ this.raise(Errors.DuplicateRegExpFlags, nextPos());
23816
23905
  }
23817
23906
  } else if (isIdentifierChar(cp) || cp === 92) {
23818
- this.raise(Errors.MalformedRegExpFlags, {
23819
- at: nextPos()
23820
- });
23907
+ this.raise(Errors.MalformedRegExpFlags, nextPos());
23821
23908
  } else {
23822
23909
  break;
23823
23910
  }
@@ -23844,8 +23931,7 @@ function requireLib () {
23844
23931
  this.state.pos += 2;
23845
23932
  const val = this.readInt(radix);
23846
23933
  if (val == null) {
23847
- this.raise(Errors.InvalidDigit, {
23848
- at: createPositionWithColumnOffset(startLoc, 2),
23934
+ this.raise(Errors.InvalidDigit, createPositionWithColumnOffset(startLoc, 2), {
23849
23935
  radix
23850
23936
  });
23851
23937
  }
@@ -23854,14 +23940,10 @@ function requireLib () {
23854
23940
  ++this.state.pos;
23855
23941
  isBigInt = true;
23856
23942
  } else if (next === 109) {
23857
- throw this.raise(Errors.InvalidDecimal, {
23858
- at: startLoc
23859
- });
23943
+ throw this.raise(Errors.InvalidDecimal, startLoc);
23860
23944
  }
23861
23945
  if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
23862
- throw this.raise(Errors.NumberIdentifier, {
23863
- at: this.state.curPosition()
23864
- });
23946
+ throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
23865
23947
  }
23866
23948
  if (isBigInt) {
23867
23949
  const str = this.input.slice(startLoc.index, this.state.pos).replace(/[_n]/g, "");
@@ -23879,22 +23961,16 @@ function requireLib () {
23879
23961
  let hasExponent = false;
23880
23962
  let isOctal = false;
23881
23963
  if (!startsWithDot && this.readInt(10) === null) {
23882
- this.raise(Errors.InvalidNumber, {
23883
- at: this.state.curPosition()
23884
- });
23964
+ this.raise(Errors.InvalidNumber, this.state.curPosition());
23885
23965
  }
23886
23966
  const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
23887
23967
  if (hasLeadingZero) {
23888
23968
  const integer = this.input.slice(start, this.state.pos);
23889
- this.recordStrictModeErrors(Errors.StrictOctalLiteral, {
23890
- at: startLoc
23891
- });
23969
+ this.recordStrictModeErrors(Errors.StrictOctalLiteral, startLoc);
23892
23970
  if (!this.state.strict) {
23893
23971
  const underscorePos = integer.indexOf("_");
23894
23972
  if (underscorePos > 0) {
23895
- this.raise(Errors.ZeroDigitNumericSeparator, {
23896
- at: createPositionWithColumnOffset(startLoc, underscorePos)
23897
- });
23973
+ this.raise(Errors.ZeroDigitNumericSeparator, createPositionWithColumnOffset(startLoc, underscorePos));
23898
23974
  }
23899
23975
  }
23900
23976
  isOctal = hasLeadingZero && !/[89]/.test(integer);
@@ -23912,9 +23988,7 @@ function requireLib () {
23912
23988
  ++this.state.pos;
23913
23989
  }
23914
23990
  if (this.readInt(10) === null) {
23915
- this.raise(Errors.InvalidOrMissingExponent, {
23916
- at: startLoc
23917
- });
23991
+ this.raise(Errors.InvalidOrMissingExponent, startLoc);
23918
23992
  }
23919
23993
  isFloat = true;
23920
23994
  hasExponent = true;
@@ -23922,9 +23996,7 @@ function requireLib () {
23922
23996
  }
23923
23997
  if (next === 110) {
23924
23998
  if (isFloat || hasLeadingZero) {
23925
- this.raise(Errors.InvalidBigIntLiteral, {
23926
- at: startLoc
23927
- });
23999
+ this.raise(Errors.InvalidBigIntLiteral, startLoc);
23928
24000
  }
23929
24001
  ++this.state.pos;
23930
24002
  isBigInt = true;
@@ -23932,17 +24004,13 @@ function requireLib () {
23932
24004
  if (next === 109) {
23933
24005
  this.expectPlugin("decimal", this.state.curPosition());
23934
24006
  if (hasExponent || hasLeadingZero) {
23935
- this.raise(Errors.InvalidDecimal, {
23936
- at: startLoc
23937
- });
24007
+ this.raise(Errors.InvalidDecimal, startLoc);
23938
24008
  }
23939
24009
  ++this.state.pos;
23940
24010
  isDecimal = true;
23941
24011
  }
23942
24012
  if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
23943
- throw this.raise(Errors.NumberIdentifier, {
23944
- at: this.state.curPosition()
23945
- });
24013
+ throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
23946
24014
  }
23947
24015
  const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
23948
24016
  if (isBigInt) {
@@ -24005,14 +24073,10 @@ function requireLib () {
24005
24073
  this.finishToken(25, firstInvalidLoc ? null : opening + str + "${");
24006
24074
  }
24007
24075
  }
24008
- recordStrictModeErrors(toParseError, {
24009
- at
24010
- }) {
24076
+ recordStrictModeErrors(toParseError, at) {
24011
24077
  const index = at.index;
24012
24078
  if (this.state.strict && !this.state.strictErrors.has(index)) {
24013
- this.raise(toParseError, {
24014
- at
24015
- });
24079
+ this.raise(toParseError, at);
24016
24080
  } else {
24017
24081
  this.state.strictErrors.set(index, [toParseError, at]);
24018
24082
  }
@@ -24035,9 +24099,7 @@ function requireLib () {
24035
24099
  const escStart = this.state.curPosition();
24036
24100
  const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar;
24037
24101
  if (this.input.charCodeAt(++this.state.pos) !== 117) {
24038
- this.raise(Errors.MissingUnicodeEscape, {
24039
- at: this.state.curPosition()
24040
- });
24102
+ this.raise(Errors.MissingUnicodeEscape, this.state.curPosition());
24041
24103
  chunkStart = this.state.pos - 1;
24042
24104
  continue;
24043
24105
  }
@@ -24045,9 +24107,7 @@ function requireLib () {
24045
24107
  const esc = this.readCodePoint(true);
24046
24108
  if (esc !== null) {
24047
24109
  if (!identifierCheck(esc)) {
24048
- this.raise(Errors.EscapedCharNotAnIdentifier, {
24049
- at: escStart
24050
- });
24110
+ this.raise(Errors.EscapedCharNotAnIdentifier, escStart);
24051
24111
  }
24052
24112
  word += String.fromCodePoint(esc);
24053
24113
  }
@@ -24072,75 +24132,55 @@ function requireLib () {
24072
24132
  type
24073
24133
  } = this.state;
24074
24134
  if (tokenIsKeyword(type) && this.state.containsEsc) {
24075
- this.raise(Errors.InvalidEscapedReservedWord, {
24076
- at: this.state.startLoc,
24135
+ this.raise(Errors.InvalidEscapedReservedWord, this.state.startLoc, {
24077
24136
  reservedWord: tokenLabelName(type)
24078
24137
  });
24079
24138
  }
24080
24139
  }
24081
- raise(toParseError, raiseProperties) {
24082
- const {
24083
- at
24084
- } = raiseProperties,
24085
- details = _objectWithoutPropertiesLoose(raiseProperties, _excluded);
24140
+ raise(toParseError, at, details = {}) {
24086
24141
  const loc = at instanceof Position ? at : at.loc.start;
24087
- const error = toParseError({
24088
- loc,
24089
- details
24090
- });
24142
+ const error = toParseError(loc, details);
24091
24143
  if (!this.options.errorRecovery) throw error;
24092
24144
  if (!this.isLookahead) this.state.errors.push(error);
24093
24145
  return error;
24094
24146
  }
24095
- raiseOverwrite(toParseError, raiseProperties) {
24096
- const {
24097
- at
24098
- } = raiseProperties,
24099
- details = _objectWithoutPropertiesLoose(raiseProperties, _excluded2);
24147
+ raiseOverwrite(toParseError, at, details = {}) {
24100
24148
  const loc = at instanceof Position ? at : at.loc.start;
24101
24149
  const pos = loc.index;
24102
24150
  const errors = this.state.errors;
24103
24151
  for (let i = errors.length - 1; i >= 0; i--) {
24104
24152
  const error = errors[i];
24105
24153
  if (error.loc.index === pos) {
24106
- return errors[i] = toParseError({
24107
- loc,
24108
- details
24109
- });
24154
+ return errors[i] = toParseError(loc, details);
24110
24155
  }
24111
24156
  if (error.loc.index < pos) break;
24112
24157
  }
24113
- return this.raise(toParseError, raiseProperties);
24158
+ return this.raise(toParseError, at, details);
24114
24159
  }
24115
24160
  updateContext(prevType) {}
24116
24161
  unexpected(loc, type) {
24117
- throw this.raise(Errors.UnexpectedToken, {
24118
- expected: type ? tokenLabelName(type) : null,
24119
- at: loc != null ? loc : this.state.startLoc
24162
+ throw this.raise(Errors.UnexpectedToken, loc != null ? loc : this.state.startLoc, {
24163
+ expected: type ? tokenLabelName(type) : null
24120
24164
  });
24121
24165
  }
24122
24166
  expectPlugin(pluginName, loc) {
24123
24167
  if (this.hasPlugin(pluginName)) {
24124
24168
  return true;
24125
24169
  }
24126
- throw this.raise(Errors.MissingPlugin, {
24127
- at: loc != null ? loc : this.state.startLoc,
24170
+ throw this.raise(Errors.MissingPlugin, loc != null ? loc : this.state.startLoc, {
24128
24171
  missingPlugin: [pluginName]
24129
24172
  });
24130
24173
  }
24131
24174
  expectOnePlugin(pluginNames) {
24132
24175
  if (!pluginNames.some(name => this.hasPlugin(name))) {
24133
- throw this.raise(Errors.MissingOneOfPlugins, {
24134
- at: this.state.startLoc,
24176
+ throw this.raise(Errors.MissingOneOfPlugins, this.state.startLoc, {
24135
24177
  missingPlugin: pluginNames
24136
24178
  });
24137
24179
  }
24138
24180
  }
24139
24181
  errorBuilder(error) {
24140
24182
  return (pos, lineStart, curLine) => {
24141
- this.raise(error, {
24142
- at: buildPosition(pos, lineStart, curLine)
24143
- });
24183
+ this.raise(error, buildPosition(pos, lineStart, curLine));
24144
24184
  };
24145
24185
  }
24146
24186
  }
@@ -24173,8 +24213,7 @@ function requireLib () {
24173
24213
  current.undefinedPrivateNames.set(name, loc);
24174
24214
  }
24175
24215
  } else {
24176
- this.parser.raise(Errors.InvalidPrivateFieldResolution, {
24177
- at: loc,
24216
+ this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
24178
24217
  identifierName: name
24179
24218
  });
24180
24219
  }
@@ -24201,8 +24240,7 @@ function requireLib () {
24201
24240
  }
24202
24241
  }
24203
24242
  if (redefined) {
24204
- this.parser.raise(Errors.PrivateNameRedeclaration, {
24205
- at: loc,
24243
+ this.parser.raise(Errors.PrivateNameRedeclaration, loc, {
24206
24244
  identifierName: name
24207
24245
  });
24208
24246
  }
@@ -24217,8 +24255,7 @@ function requireLib () {
24217
24255
  if (classScope) {
24218
24256
  classScope.undefinedPrivateNames.set(name, loc);
24219
24257
  } else {
24220
- this.parser.raise(Errors.InvalidPrivateFieldResolution, {
24221
- at: loc,
24258
+ this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
24222
24259
  identifierName: name
24223
24260
  });
24224
24261
  }
@@ -24240,9 +24277,7 @@ function requireLib () {
24240
24277
  super(type);
24241
24278
  this.declarationErrors = new Map();
24242
24279
  }
24243
- recordDeclarationError(ParsingErrorClass, {
24244
- at
24245
- }) {
24280
+ recordDeclarationError(ParsingErrorClass, at) {
24246
24281
  const index = at.index;
24247
24282
  this.declarationErrors.set(index, [ParsingErrorClass, at]);
24248
24283
  }
@@ -24265,12 +24300,8 @@ function requireLib () {
24265
24300
  exit() {
24266
24301
  this.stack.pop();
24267
24302
  }
24268
- recordParameterInitializerError(toParseError, {
24269
- at: node
24270
- }) {
24271
- const origin = {
24272
- at: node.loc.start
24273
- };
24303
+ recordParameterInitializerError(toParseError, node) {
24304
+ const origin = node.loc.start;
24274
24305
  const {
24275
24306
  stack
24276
24307
  } = this;
@@ -24286,16 +24317,12 @@ function requireLib () {
24286
24317
  }
24287
24318
  this.parser.raise(toParseError, origin);
24288
24319
  }
24289
- recordArrowParameterBindingError(error, {
24290
- at: node
24291
- }) {
24320
+ recordArrowParameterBindingError(error, node) {
24292
24321
  const {
24293
24322
  stack
24294
24323
  } = this;
24295
24324
  const scope = stack[stack.length - 1];
24296
- const origin = {
24297
- at: node.loc.start
24298
- };
24325
+ const origin = node.loc.start;
24299
24326
  if (scope.isCertainlyParameterDeclaration()) {
24300
24327
  this.parser.raise(error, origin);
24301
24328
  } else if (scope.canBeArrowParameterDeclaration()) {
@@ -24304,9 +24331,7 @@ function requireLib () {
24304
24331
  return;
24305
24332
  }
24306
24333
  }
24307
- recordAsyncArrowParametersError({
24308
- at
24309
- }) {
24334
+ recordAsyncArrowParametersError(at) {
24310
24335
  const {
24311
24336
  stack
24312
24337
  } = this;
@@ -24314,9 +24339,7 @@ function requireLib () {
24314
24339
  let scope = stack[i];
24315
24340
  while (scope.canBeArrowParameterDeclaration()) {
24316
24341
  if (scope.type === 2) {
24317
- scope.recordDeclarationError(Errors.AwaitBindingIdentifier, {
24318
- at
24319
- });
24342
+ scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at);
24320
24343
  }
24321
24344
  scope = stack[--i];
24322
24345
  }
@@ -24328,9 +24351,7 @@ function requireLib () {
24328
24351
  const currentScope = stack[stack.length - 1];
24329
24352
  if (!currentScope.canBeArrowParameterDeclaration()) return;
24330
24353
  currentScope.iterateErrors(([toParseError, loc]) => {
24331
- this.parser.raise(toParseError, {
24332
- at: loc
24333
- });
24354
+ this.parser.raise(toParseError, loc);
24334
24355
  let i = stack.length - 2;
24335
24356
  let scope = stack[i];
24336
24357
  while (scope.canBeArrowParameterDeclaration()) {
@@ -24419,9 +24440,7 @@ function requireLib () {
24419
24440
  expectContextual(token, toParseError) {
24420
24441
  if (!this.eatContextual(token)) {
24421
24442
  if (toParseError != null) {
24422
- throw this.raise(toParseError, {
24423
- at: this.state.startLoc
24424
- });
24443
+ throw this.raise(toParseError, this.state.startLoc);
24425
24444
  }
24426
24445
  this.unexpected(null, token);
24427
24446
  }
@@ -24441,9 +24460,7 @@ function requireLib () {
24441
24460
  }
24442
24461
  semicolon(allowAsi = true) {
24443
24462
  if (allowAsi ? this.isLineTerminator() : this.eat(13)) return;
24444
- this.raise(Errors.MissingSemicolon, {
24445
- at: this.state.lastTokEndLoc
24446
- });
24463
+ this.raise(Errors.MissingSemicolon, this.state.lastTokEndLoc);
24447
24464
  }
24448
24465
  expect(type, loc) {
24449
24466
  this.eat(type) || this.unexpected(loc, type);
@@ -24513,19 +24530,13 @@ function requireLib () {
24513
24530
  return hasErrors;
24514
24531
  }
24515
24532
  if (shorthandAssignLoc != null) {
24516
- this.raise(Errors.InvalidCoverInitializedName, {
24517
- at: shorthandAssignLoc
24518
- });
24533
+ this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
24519
24534
  }
24520
24535
  if (doubleProtoLoc != null) {
24521
- this.raise(Errors.DuplicateProto, {
24522
- at: doubleProtoLoc
24523
- });
24536
+ this.raise(Errors.DuplicateProto, doubleProtoLoc);
24524
24537
  }
24525
24538
  if (privateKeyLoc != null) {
24526
- this.raise(Errors.UnexpectedPrivateField, {
24527
- at: privateKeyLoc
24528
- });
24539
+ this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
24529
24540
  }
24530
24541
  if (optionalParametersLoc != null) {
24531
24542
  this.unexpected(optionalParametersLoc);
@@ -24678,7 +24689,8 @@ function requireLib () {
24678
24689
  }
24679
24690
  class NodeUtils extends UtilParser {
24680
24691
  startNode() {
24681
- return new Node(this, this.state.start, this.state.startLoc);
24692
+ const loc = this.state.startLoc;
24693
+ return new Node(this, loc.index, loc);
24682
24694
  }
24683
24695
  startNodeAt(loc) {
24684
24696
  return new Node(this, loc.index, loc);
@@ -24874,10 +24886,8 @@ function requireLib () {
24874
24886
  const moduloLoc = this.state.startLoc;
24875
24887
  this.next();
24876
24888
  this.expectContextual(110);
24877
- if (this.state.lastTokStart > moduloLoc.index + 1) {
24878
- this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, {
24879
- at: moduloLoc
24880
- });
24889
+ if (this.state.lastTokStartLoc.index > moduloLoc.index + 1) {
24890
+ this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, moduloLoc);
24881
24891
  }
24882
24892
  if (this.eat(10)) {
24883
24893
  node.value = super.parseExpression();
@@ -24946,9 +24956,7 @@ function requireLib () {
24946
24956
  return this.flowParseDeclareModuleExports(node);
24947
24957
  } else {
24948
24958
  if (insideModule) {
24949
- this.raise(FlowErrors.NestedDeclareModule, {
24950
- at: this.state.lastTokStartLoc
24951
- });
24959
+ this.raise(FlowErrors.NestedDeclareModule, this.state.lastTokStartLoc);
24952
24960
  }
24953
24961
  return this.flowParseDeclareModule(node);
24954
24962
  }
@@ -24986,9 +24994,7 @@ function requireLib () {
24986
24994
  if (this.match(83)) {
24987
24995
  this.next();
24988
24996
  if (!this.isContextual(130) && !this.match(87)) {
24989
- this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, {
24990
- at: this.state.lastTokStartLoc
24991
- });
24997
+ this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc);
24992
24998
  }
24993
24999
  super.parseImport(bodyNode);
24994
25000
  } else {
@@ -25005,21 +25011,15 @@ function requireLib () {
25005
25011
  body.forEach(bodyElement => {
25006
25012
  if (isEsModuleType(bodyElement)) {
25007
25013
  if (kind === "CommonJS") {
25008
- this.raise(FlowErrors.AmbiguousDeclareModuleKind, {
25009
- at: bodyElement
25010
- });
25014
+ this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
25011
25015
  }
25012
25016
  kind = "ES";
25013
25017
  } else if (bodyElement.type === "DeclareModuleExports") {
25014
25018
  if (hasModuleExport) {
25015
- this.raise(FlowErrors.DuplicateDeclareModuleExports, {
25016
- at: bodyElement
25017
- });
25019
+ this.raise(FlowErrors.DuplicateDeclareModuleExports, bodyElement);
25018
25020
  }
25019
25021
  if (kind === "ES") {
25020
- this.raise(FlowErrors.AmbiguousDeclareModuleKind, {
25021
- at: bodyElement
25022
- });
25022
+ this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
25023
25023
  }
25024
25024
  kind = "CommonJS";
25025
25025
  hasModuleExport = true;
@@ -25042,8 +25042,7 @@ function requireLib () {
25042
25042
  } else {
25043
25043
  if (this.match(75) || this.isLet() || (this.isContextual(130) || this.isContextual(129)) && !insideModule) {
25044
25044
  const label = this.state.value;
25045
- throw this.raise(FlowErrors.UnsupportedDeclareExportKind, {
25046
- at: this.state.startLoc,
25045
+ throw this.raise(FlowErrors.UnsupportedDeclareExportKind, this.state.startLoc, {
25047
25046
  unsupportedExportKind: label,
25048
25047
  suggestion: exportSuggestions[label]
25049
25048
  });
@@ -25141,15 +25140,12 @@ function requireLib () {
25141
25140
  }
25142
25141
  checkNotUnderscore(word) {
25143
25142
  if (word === "_") {
25144
- this.raise(FlowErrors.UnexpectedReservedUnderscore, {
25145
- at: this.state.startLoc
25146
- });
25143
+ this.raise(FlowErrors.UnexpectedReservedUnderscore, this.state.startLoc);
25147
25144
  }
25148
25145
  }
25149
25146
  checkReservedType(word, startLoc, declaration) {
25150
25147
  if (!reservedTypes.has(word)) return;
25151
- this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, {
25152
- at: startLoc,
25148
+ this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, startLoc, {
25153
25149
  reservedType: word
25154
25150
  });
25155
25151
  }
@@ -25202,9 +25198,7 @@ function requireLib () {
25202
25198
  node.default = this.flowParseType();
25203
25199
  } else {
25204
25200
  if (requireDefault) {
25205
- this.raise(FlowErrors.MissingTypeParamDefault, {
25206
- at: nodeStartLoc
25207
- });
25201
+ this.raise(FlowErrors.MissingTypeParamDefault, nodeStartLoc);
25208
25202
  }
25209
25203
  }
25210
25204
  return this.finishNode(node, "TypeParameter");
@@ -25444,9 +25438,7 @@ function requireLib () {
25444
25438
  }
25445
25439
  this.flowObjectTypeSemicolon();
25446
25440
  if (inexactStartLoc && !this.match(8) && !this.match(9)) {
25447
- this.raise(FlowErrors.UnexpectedExplicitInexactInObject, {
25448
- at: inexactStartLoc
25449
- });
25441
+ this.raise(FlowErrors.UnexpectedExplicitInexactInObject, inexactStartLoc);
25450
25442
  }
25451
25443
  }
25452
25444
  this.expect(endDelim);
@@ -25462,33 +25454,23 @@ function requireLib () {
25462
25454
  const isInexactToken = this.match(12) || this.match(13) || this.match(8) || this.match(9);
25463
25455
  if (isInexactToken) {
25464
25456
  if (!allowSpread) {
25465
- this.raise(FlowErrors.InexactInsideNonObject, {
25466
- at: this.state.lastTokStartLoc
25467
- });
25457
+ this.raise(FlowErrors.InexactInsideNonObject, this.state.lastTokStartLoc);
25468
25458
  } else if (!allowInexact) {
25469
- this.raise(FlowErrors.InexactInsideExact, {
25470
- at: this.state.lastTokStartLoc
25471
- });
25459
+ this.raise(FlowErrors.InexactInsideExact, this.state.lastTokStartLoc);
25472
25460
  }
25473
25461
  if (variance) {
25474
- this.raise(FlowErrors.InexactVariance, {
25475
- at: variance
25476
- });
25462
+ this.raise(FlowErrors.InexactVariance, variance);
25477
25463
  }
25478
25464
  return null;
25479
25465
  }
25480
25466
  if (!allowSpread) {
25481
- this.raise(FlowErrors.UnexpectedSpreadType, {
25482
- at: this.state.lastTokStartLoc
25483
- });
25467
+ this.raise(FlowErrors.UnexpectedSpreadType, this.state.lastTokStartLoc);
25484
25468
  }
25485
25469
  if (protoStartLoc != null) {
25486
25470
  this.unexpected(protoStartLoc);
25487
25471
  }
25488
25472
  if (variance) {
25489
- this.raise(FlowErrors.SpreadVariance, {
25490
- at: variance
25491
- });
25473
+ this.raise(FlowErrors.SpreadVariance, variance);
25492
25474
  }
25493
25475
  node.argument = this.flowParseType();
25494
25476
  return this.finishNode(node, "ObjectTypeSpreadProperty");
@@ -25511,9 +25493,7 @@ function requireLib () {
25511
25493
  this.flowCheckGetterSetterParams(node);
25512
25494
  }
25513
25495
  if (!allowSpread && node.key.name === "constructor" && node.value.this) {
25514
- this.raise(FlowErrors.ThisParamBannedInConstructor, {
25515
- at: node.value.this
25516
- });
25496
+ this.raise(FlowErrors.ThisParamBannedInConstructor, node.value.this);
25517
25497
  }
25518
25498
  } else {
25519
25499
  if (kind !== "init") this.unexpected();
@@ -25532,19 +25512,13 @@ function requireLib () {
25532
25512
  const paramCount = property.kind === "get" ? 0 : 1;
25533
25513
  const length = property.value.params.length + (property.value.rest ? 1 : 0);
25534
25514
  if (property.value.this) {
25535
- this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, {
25536
- at: property.value.this
25537
- });
25515
+ this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, property.value.this);
25538
25516
  }
25539
25517
  if (length !== paramCount) {
25540
- this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, {
25541
- at: property
25542
- });
25518
+ this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, property);
25543
25519
  }
25544
25520
  if (property.kind === "set" && property.value.rest) {
25545
- this.raise(Errors.BadSetterRestParameter, {
25546
- at: property
25547
- });
25521
+ this.raise(Errors.BadSetterRestParameter, property);
25548
25522
  }
25549
25523
  }
25550
25524
  flowObjectTypeSemicolon() {
@@ -25600,17 +25574,13 @@ function requireLib () {
25600
25574
  const isThis = this.state.type === 78;
25601
25575
  if (lh.type === 14 || lh.type === 17) {
25602
25576
  if (isThis && !first) {
25603
- this.raise(FlowErrors.ThisParamMustBeFirst, {
25604
- at: node
25605
- });
25577
+ this.raise(FlowErrors.ThisParamMustBeFirst, node);
25606
25578
  }
25607
25579
  name = this.parseIdentifier(isThis);
25608
25580
  if (this.eat(17)) {
25609
25581
  optional = true;
25610
25582
  if (isThis) {
25611
- this.raise(FlowErrors.ThisParamMayNotBeOptional, {
25612
- at: node
25613
- });
25583
+ this.raise(FlowErrors.ThisParamMayNotBeOptional, node);
25614
25584
  }
25615
25585
  }
25616
25586
  typeAnnotation = this.flowParseTypeInitialiser();
@@ -25766,9 +25736,7 @@ function requireLib () {
25766
25736
  if (this.match(135)) {
25767
25737
  return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
25768
25738
  }
25769
- throw this.raise(FlowErrors.UnexpectedSubtractionOperand, {
25770
- at: this.state.startLoc
25771
- });
25739
+ throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
25772
25740
  }
25773
25741
  this.unexpected();
25774
25742
  return;
@@ -26032,9 +26000,7 @@ function requireLib () {
26032
26000
  [valid, invalid] = this.getArrowLikeExpressions(consequent);
26033
26001
  }
26034
26002
  if (failed && valid.length > 1) {
26035
- this.raise(FlowErrors.AmbiguousConditionalArrow, {
26036
- at: state.startLoc
26037
- });
26003
+ this.raise(FlowErrors.AmbiguousConditionalArrow, state.startLoc);
26038
26004
  }
26039
26005
  if (failed && valid.length === 1) {
26040
26006
  this.state = state;
@@ -26195,13 +26161,9 @@ function requireLib () {
26195
26161
  super.parseClassMember(classBody, member, state);
26196
26162
  if (member.declare) {
26197
26163
  if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") {
26198
- this.raise(FlowErrors.DeclareClassElement, {
26199
- at: startLoc
26200
- });
26164
+ this.raise(FlowErrors.DeclareClassElement, startLoc);
26201
26165
  } else if (member.value) {
26202
- this.raise(FlowErrors.DeclareClassFieldInitializer, {
26203
- at: member.value
26204
- });
26166
+ this.raise(FlowErrors.DeclareClassFieldInitializer, member.value);
26205
26167
  }
26206
26168
  }
26207
26169
  }
@@ -26212,8 +26174,7 @@ function requireLib () {
26212
26174
  const word = super.readWord1();
26213
26175
  const fullWord = "@@" + word;
26214
26176
  if (!this.isIterator(word) || !this.state.inType) {
26215
- this.raise(Errors.InvalidIdentifier, {
26216
- at: this.state.curPosition(),
26177
+ this.raise(Errors.InvalidIdentifier, this.state.curPosition(), {
26217
26178
  identifierName: fullWord
26218
26179
  });
26219
26180
  }
@@ -26265,9 +26226,7 @@ function requireLib () {
26265
26226
  var _expr$extra;
26266
26227
  const expr = exprList[i];
26267
26228
  if (expr && expr.type === "TypeCastExpression" && !((_expr$extra = expr.extra) != null && _expr$extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr)) {
26268
- this.raise(FlowErrors.TypeCastInPattern, {
26269
- at: expr.typeAnnotation
26270
- });
26229
+ this.raise(FlowErrors.TypeCastInPattern, expr.typeAnnotation);
26271
26230
  }
26272
26231
  }
26273
26232
  return exprList;
@@ -26315,16 +26274,12 @@ function requireLib () {
26315
26274
  if (method.params && isConstructor) {
26316
26275
  const params = method.params;
26317
26276
  if (params.length > 0 && this.isThisParam(params[0])) {
26318
- this.raise(FlowErrors.ThisParamBannedInConstructor, {
26319
- at: method
26320
- });
26277
+ this.raise(FlowErrors.ThisParamBannedInConstructor, method);
26321
26278
  }
26322
26279
  } else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
26323
26280
  const params = method.value.params;
26324
26281
  if (params.length > 0 && this.isThisParam(params[0])) {
26325
- this.raise(FlowErrors.ThisParamBannedInConstructor, {
26326
- at: method
26327
- });
26282
+ this.raise(FlowErrors.ThisParamBannedInConstructor, method);
26328
26283
  }
26329
26284
  }
26330
26285
  }
@@ -26364,13 +26319,9 @@ function requireLib () {
26364
26319
  if (params.length > 0) {
26365
26320
  const param = params[0];
26366
26321
  if (this.isThisParam(param) && method.kind === "get") {
26367
- this.raise(FlowErrors.GetterMayNotHaveThisParam, {
26368
- at: param
26369
- });
26322
+ this.raise(FlowErrors.GetterMayNotHaveThisParam, param);
26370
26323
  } else if (this.isThisParam(param)) {
26371
- this.raise(FlowErrors.SetterMayNotHaveThisParam, {
26372
- at: param
26373
- });
26324
+ this.raise(FlowErrors.SetterMayNotHaveThisParam, param);
26374
26325
  }
26375
26326
  }
26376
26327
  }
@@ -26396,28 +26347,20 @@ function requireLib () {
26396
26347
  parseAssignableListItemTypes(param) {
26397
26348
  if (this.eat(17)) {
26398
26349
  if (param.type !== "Identifier") {
26399
- this.raise(FlowErrors.PatternIsOptional, {
26400
- at: param
26401
- });
26350
+ this.raise(FlowErrors.PatternIsOptional, param);
26402
26351
  }
26403
26352
  if (this.isThisParam(param)) {
26404
- this.raise(FlowErrors.ThisParamMayNotBeOptional, {
26405
- at: param
26406
- });
26353
+ this.raise(FlowErrors.ThisParamMayNotBeOptional, param);
26407
26354
  }
26408
26355
  param.optional = true;
26409
26356
  }
26410
26357
  if (this.match(14)) {
26411
26358
  param.typeAnnotation = this.flowParseTypeAnnotation();
26412
26359
  } else if (this.isThisParam(param)) {
26413
- this.raise(FlowErrors.ThisParamAnnotationRequired, {
26414
- at: param
26415
- });
26360
+ this.raise(FlowErrors.ThisParamAnnotationRequired, param);
26416
26361
  }
26417
26362
  if (this.match(29) && this.isThisParam(param)) {
26418
- this.raise(FlowErrors.ThisParamNoDefault, {
26419
- at: param
26420
- });
26363
+ this.raise(FlowErrors.ThisParamNoDefault, param);
26421
26364
  }
26422
26365
  this.resetEndLocation(param);
26423
26366
  return param;
@@ -26425,18 +26368,14 @@ function requireLib () {
26425
26368
  parseMaybeDefault(startLoc, left) {
26426
26369
  const node = super.parseMaybeDefault(startLoc, left);
26427
26370
  if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
26428
- this.raise(FlowErrors.TypeBeforeInitializer, {
26429
- at: node.typeAnnotation
26430
- });
26371
+ this.raise(FlowErrors.TypeBeforeInitializer, node.typeAnnotation);
26431
26372
  }
26432
26373
  return node;
26433
26374
  }
26434
26375
  checkImportReflection(node) {
26435
26376
  super.checkImportReflection(node);
26436
26377
  if (node.module && node.importKind !== "value") {
26437
- this.raise(FlowErrors.ImportReflectionHasImportType, {
26438
- at: node.specifiers[0].loc.start
26439
- });
26378
+ this.raise(FlowErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
26440
26379
  }
26441
26380
  }
26442
26381
  parseImportSpecifierLocal(node, specifier, type) {
@@ -26492,8 +26431,7 @@ function requireLib () {
26492
26431
  specifier.importKind = specifierTypeKind;
26493
26432
  } else {
26494
26433
  if (importedIsString) {
26495
- throw this.raise(Errors.ImportBindingIsString, {
26496
- at: specifier,
26434
+ throw this.raise(Errors.ImportBindingIsString, specifier, {
26497
26435
  importName: firstIdent.value
26498
26436
  });
26499
26437
  }
@@ -26509,9 +26447,7 @@ function requireLib () {
26509
26447
  }
26510
26448
  const specifierIsTypeImport = hasTypeImportKind(specifier);
26511
26449
  if (isInTypeOnlyImport && specifierIsTypeImport) {
26512
- this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, {
26513
- at: specifier
26514
- });
26450
+ this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, specifier);
26515
26451
  }
26516
26452
  if (isInTypeOnlyImport || specifierIsTypeImport) {
26517
26453
  this.checkReservedType(specifier.local.name, specifier.local.loc.start, true);
@@ -26594,9 +26530,7 @@ function requireLib () {
26594
26530
  if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
26595
26531
  if (!arrow.error && !arrow.aborted) {
26596
26532
  if (arrow.node.async) {
26597
- this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, {
26598
- at: typeParameters
26599
- });
26533
+ this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, typeParameters);
26600
26534
  }
26601
26535
  return arrow.node;
26602
26536
  }
@@ -26612,9 +26546,7 @@ function requireLib () {
26612
26546
  }
26613
26547
  if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
26614
26548
  if (arrow.thrown) throw arrow.error;
26615
- throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, {
26616
- at: typeParameters
26617
- });
26549
+ throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, typeParameters);
26618
26550
  }
26619
26551
  return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
26620
26552
  }
@@ -26652,9 +26584,7 @@ function requireLib () {
26652
26584
  }
26653
26585
  for (let i = 0; i < node.params.length; i++) {
26654
26586
  if (this.isThisParam(node.params[i]) && i > 0) {
26655
- this.raise(FlowErrors.ThisParamMustBeFirst, {
26656
- at: node.params[i]
26657
- });
26587
+ this.raise(FlowErrors.ThisParamMustBeFirst, node.params[i]);
26658
26588
  }
26659
26589
  }
26660
26590
  super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
@@ -26756,18 +26686,14 @@ function requireLib () {
26756
26686
  parseTopLevel(file, program) {
26757
26687
  const fileNode = super.parseTopLevel(file, program);
26758
26688
  if (this.state.hasFlowComment) {
26759
- this.raise(FlowErrors.UnterminatedFlowComment, {
26760
- at: this.state.curPosition()
26761
- });
26689
+ this.raise(FlowErrors.UnterminatedFlowComment, this.state.curPosition());
26762
26690
  }
26763
26691
  return fileNode;
26764
26692
  }
26765
26693
  skipBlockComment() {
26766
26694
  if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
26767
26695
  if (this.state.hasFlowComment) {
26768
- throw this.raise(FlowErrors.NestedFlowComment, {
26769
- at: this.state.startLoc
26770
- });
26696
+ throw this.raise(FlowErrors.NestedFlowComment, this.state.startLoc);
26771
26697
  }
26772
26698
  this.hasFlowCommentCompletion();
26773
26699
  const commentSkip = this.skipFlowComment();
@@ -26803,43 +26729,26 @@ function requireLib () {
26803
26729
  hasFlowCommentCompletion() {
26804
26730
  const end = this.input.indexOf("*/", this.state.pos);
26805
26731
  if (end === -1) {
26806
- throw this.raise(Errors.UnterminatedComment, {
26807
- at: this.state.curPosition()
26808
- });
26732
+ throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
26809
26733
  }
26810
26734
  }
26811
26735
  flowEnumErrorBooleanMemberNotInitialized(loc, {
26812
26736
  enumName,
26813
26737
  memberName
26814
26738
  }) {
26815
- this.raise(FlowErrors.EnumBooleanMemberNotInitialized, {
26816
- at: loc,
26739
+ this.raise(FlowErrors.EnumBooleanMemberNotInitialized, loc, {
26817
26740
  memberName,
26818
26741
  enumName
26819
26742
  });
26820
26743
  }
26821
26744
  flowEnumErrorInvalidMemberInitializer(loc, enumContext) {
26822
- return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, Object.assign({
26823
- at: loc
26824
- }, enumContext));
26745
+ return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, loc, enumContext);
26825
26746
  }
26826
- flowEnumErrorNumberMemberNotInitialized(loc, {
26827
- enumName,
26828
- memberName
26829
- }) {
26830
- this.raise(FlowErrors.EnumNumberMemberNotInitialized, {
26831
- at: loc,
26832
- enumName,
26833
- memberName
26834
- });
26747
+ flowEnumErrorNumberMemberNotInitialized(loc, details) {
26748
+ this.raise(FlowErrors.EnumNumberMemberNotInitialized, loc, details);
26835
26749
  }
26836
- flowEnumErrorStringMemberInconsistentlyInitialized(node, {
26837
- enumName
26838
- }) {
26839
- this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, {
26840
- at: node,
26841
- enumName
26842
- });
26750
+ flowEnumErrorStringMemberInconsistentlyInitialized(node, details) {
26751
+ this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, node, details);
26843
26752
  }
26844
26753
  flowEnumMemberInit() {
26845
26754
  const startLoc = this.state.startLoc;
@@ -26948,16 +26857,14 @@ function requireLib () {
26948
26857
  continue;
26949
26858
  }
26950
26859
  if (/^[a-z]/.test(memberName)) {
26951
- this.raise(FlowErrors.EnumInvalidMemberName, {
26952
- at: id,
26860
+ this.raise(FlowErrors.EnumInvalidMemberName, id, {
26953
26861
  memberName,
26954
26862
  suggestion: memberName[0].toUpperCase() + memberName.slice(1),
26955
26863
  enumName
26956
26864
  });
26957
26865
  }
26958
26866
  if (seenNames.has(memberName)) {
26959
- this.raise(FlowErrors.EnumDuplicateMemberName, {
26960
- at: id,
26867
+ this.raise(FlowErrors.EnumDuplicateMemberName, id, {
26961
26868
  memberName,
26962
26869
  enumName
26963
26870
  });
@@ -27046,8 +26953,7 @@ function requireLib () {
27046
26953
  }) {
27047
26954
  if (!this.eatContextual(102)) return null;
27048
26955
  if (!tokenIsIdentifier(this.state.type)) {
27049
- throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, {
27050
- at: this.state.startLoc,
26956
+ throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, {
27051
26957
  enumName
27052
26958
  });
27053
26959
  }
@@ -27056,8 +26962,7 @@ function requireLib () {
27056
26962
  } = this.state;
27057
26963
  this.next();
27058
26964
  if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") {
27059
- this.raise(FlowErrors.EnumInvalidExplicitType, {
27060
- at: this.state.startLoc,
26965
+ this.raise(FlowErrors.EnumInvalidExplicitType, this.state.startLoc, {
27061
26966
  enumName,
27062
26967
  invalidEnumType: value
27063
26968
  });
@@ -27142,8 +27047,7 @@ function requireLib () {
27142
27047
  this.expect(8);
27143
27048
  return this.finishNode(node, "EnumNumberBody");
27144
27049
  } else {
27145
- this.raise(FlowErrors.EnumInconsistentMemberValues, {
27146
- at: nameLoc,
27050
+ this.raise(FlowErrors.EnumInconsistentMemberValues, nameLoc, {
27147
27051
  enumName
27148
27052
  });
27149
27053
  return empty();
@@ -27461,9 +27365,7 @@ function requireLib () {
27461
27365
  let chunkStart = this.state.pos;
27462
27366
  for (;;) {
27463
27367
  if (this.state.pos >= this.length) {
27464
- throw this.raise(JsxErrors.UnterminatedJsxContent, {
27465
- at: this.state.startLoc
27466
- });
27368
+ throw this.raise(JsxErrors.UnterminatedJsxContent, this.state.startLoc);
27467
27369
  }
27468
27370
  const ch = this.input.charCodeAt(this.state.pos);
27469
27371
  switch (ch) {
@@ -27518,9 +27420,7 @@ function requireLib () {
27518
27420
  let chunkStart = ++this.state.pos;
27519
27421
  for (;;) {
27520
27422
  if (this.state.pos >= this.length) {
27521
- throw this.raise(Errors.UnterminatedString, {
27522
- at: this.state.startLoc
27523
- });
27423
+ throw this.raise(Errors.UnterminatedString, this.state.startLoc);
27524
27424
  }
27525
27425
  const ch = this.input.charCodeAt(this.state.pos);
27526
27426
  if (ch === quote) break;
@@ -27623,18 +27523,14 @@ function requireLib () {
27623
27523
  this.next();
27624
27524
  node = this.jsxParseExpressionContainer(node, types.j_oTag);
27625
27525
  if (node.expression.type === "JSXEmptyExpression") {
27626
- this.raise(JsxErrors.AttributeIsEmpty, {
27627
- at: node
27628
- });
27526
+ this.raise(JsxErrors.AttributeIsEmpty, node);
27629
27527
  }
27630
27528
  return node;
27631
27529
  case 142:
27632
27530
  case 133:
27633
27531
  return this.parseExprAtom();
27634
27532
  default:
27635
- throw this.raise(JsxErrors.UnsupportedJsxValue, {
27636
- at: this.state.startLoc
27637
- });
27533
+ throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
27638
27534
  }
27639
27535
  }
27640
27536
  jsxParseEmptyExpression() {
@@ -27741,18 +27637,14 @@ function requireLib () {
27741
27637
  }
27742
27638
  }
27743
27639
  if (isFragment(openingElement) && !isFragment(closingElement) && closingElement !== null) {
27744
- this.raise(JsxErrors.MissingClosingTagFragment, {
27745
- at: closingElement
27746
- });
27640
+ this.raise(JsxErrors.MissingClosingTagFragment, closingElement);
27747
27641
  } else if (!isFragment(openingElement) && isFragment(closingElement)) {
27748
- this.raise(JsxErrors.MissingClosingTagElement, {
27749
- at: closingElement,
27642
+ this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
27750
27643
  openingTagName: getQualifiedJSXName(openingElement.name)
27751
27644
  });
27752
27645
  } else if (!isFragment(openingElement) && !isFragment(closingElement)) {
27753
27646
  if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
27754
- this.raise(JsxErrors.MissingClosingTagElement, {
27755
- at: closingElement,
27647
+ this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
27756
27648
  openingTagName: getQualifiedJSXName(openingElement.name)
27757
27649
  });
27758
27650
  }
@@ -27767,9 +27659,7 @@ function requireLib () {
27767
27659
  }
27768
27660
  node.children = children;
27769
27661
  if (this.match(47)) {
27770
- throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, {
27771
- at: this.state.startLoc
27772
- });
27662
+ throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, this.state.startLoc);
27773
27663
  }
27774
27664
  return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
27775
27665
  }
@@ -27855,11 +27745,7 @@ function requireLib () {
27855
27745
  class TypeScriptScope extends Scope {
27856
27746
  constructor(...args) {
27857
27747
  super(...args);
27858
- this.types = new Set();
27859
- this.enums = new Set();
27860
- this.constEnums = new Set();
27861
- this.classes = new Set();
27862
- this.exportOnlyBindings = new Set();
27748
+ this.tsNames = new Map();
27863
27749
  }
27864
27750
  }
27865
27751
  class TypeScriptScopeHandler extends ScopeHandler {
@@ -27899,8 +27785,7 @@ function requireLib () {
27899
27785
  declareName(name, bindingType, loc) {
27900
27786
  if (bindingType & 4096) {
27901
27787
  if (this.hasImport(name, true)) {
27902
- this.parser.raise(Errors.VarRedeclaration, {
27903
- at: loc,
27788
+ this.parser.raise(Errors.VarRedeclaration, loc, {
27904
27789
  identifierName: name
27905
27790
  });
27906
27791
  }
@@ -27908,9 +27793,10 @@ function requireLib () {
27908
27793
  return;
27909
27794
  }
27910
27795
  const scope = this.currentScope();
27796
+ let type = scope.tsNames.get(name) || 0;
27911
27797
  if (bindingType & 1024) {
27912
27798
  this.maybeExportDefined(scope, name);
27913
- scope.exportOnlyBindings.add(name);
27799
+ scope.tsNames.set(name, type | 16);
27914
27800
  return;
27915
27801
  }
27916
27802
  super.declareName(name, bindingType, loc);
@@ -27919,31 +27805,37 @@ function requireLib () {
27919
27805
  this.checkRedeclarationInScope(scope, name, bindingType, loc);
27920
27806
  this.maybeExportDefined(scope, name);
27921
27807
  }
27922
- scope.types.add(name);
27808
+ type = type | 1;
27809
+ }
27810
+ if (bindingType & 256) {
27811
+ type = type | 2;
27923
27812
  }
27924
- if (bindingType & 256) scope.enums.add(name);
27925
27813
  if (bindingType & 512) {
27926
- scope.constEnums.add(name);
27814
+ type = type | 4;
27927
27815
  }
27928
- if (bindingType & 128) scope.classes.add(name);
27816
+ if (bindingType & 128) {
27817
+ type = type | 8;
27818
+ }
27819
+ if (type) scope.tsNames.set(name, type);
27929
27820
  }
27930
27821
  isRedeclaredInScope(scope, name, bindingType) {
27931
- if (scope.enums.has(name)) {
27822
+ const type = scope.tsNames.get(name);
27823
+ if ((type & 2) > 0) {
27932
27824
  if (bindingType & 256) {
27933
27825
  const isConst = !!(bindingType & 512);
27934
- const wasConst = scope.constEnums.has(name);
27826
+ const wasConst = (type & 4) > 0;
27935
27827
  return isConst !== wasConst;
27936
27828
  }
27937
27829
  return true;
27938
27830
  }
27939
- if (bindingType & 128 && scope.classes.has(name)) {
27940
- if (scope.lexical.has(name)) {
27831
+ if (bindingType & 128 && (type & 8) > 0) {
27832
+ if (scope.names.get(name) & 2) {
27941
27833
  return !!(bindingType & 1);
27942
27834
  } else {
27943
27835
  return false;
27944
27836
  }
27945
27837
  }
27946
- if (bindingType & 2 && scope.types.has(name)) {
27838
+ if (bindingType & 2 && (type & 1) > 0) {
27947
27839
  return true;
27948
27840
  }
27949
27841
  return super.isRedeclaredInScope(scope, name, bindingType);
@@ -27956,7 +27848,10 @@ function requireLib () {
27956
27848
  const len = this.scopeStack.length;
27957
27849
  for (let i = len - 1; i >= 0; i--) {
27958
27850
  const scope = this.scopeStack[i];
27959
- if (scope.types.has(name) || scope.exportOnlyBindings.has(name)) return;
27851
+ const type = scope.tsNames.get(name);
27852
+ if ((type & 1) > 0 || (type & 16) > 0) {
27853
+ return;
27854
+ }
27960
27855
  }
27961
27856
  super.checkLocalExport(id);
27962
27857
  }
@@ -27973,18 +27868,12 @@ function requireLib () {
27973
27868
  parenthesized = unwrapParenthesizedExpression(node);
27974
27869
  if (isLHS) {
27975
27870
  if (parenthesized.type === "Identifier") {
27976
- this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, {
27977
- at: node
27978
- });
27871
+ this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, node);
27979
27872
  } else if (parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) {
27980
- this.raise(Errors.InvalidParenthesizedAssignment, {
27981
- at: node
27982
- });
27873
+ this.raise(Errors.InvalidParenthesizedAssignment, node);
27983
27874
  }
27984
27875
  } else {
27985
- this.raise(Errors.InvalidParenthesizedAssignment, {
27986
- at: node
27987
- });
27876
+ this.raise(Errors.InvalidParenthesizedAssignment, node);
27988
27877
  }
27989
27878
  }
27990
27879
  switch (node.type) {
@@ -28002,9 +27891,7 @@ function requireLib () {
28002
27891
  const isLast = i === last;
28003
27892
  this.toAssignableObjectExpressionProp(prop, isLast, isLHS);
28004
27893
  if (isLast && prop.type === "RestElement" && (_node$extra2 = node.extra) != null && _node$extra2.trailingCommaLoc) {
28005
- this.raise(Errors.RestTrailingComma, {
28006
- at: node.extra.trailingCommaLoc
28007
- });
27894
+ this.raise(Errors.RestTrailingComma, node.extra.trailingCommaLoc);
28008
27895
  }
28009
27896
  }
28010
27897
  break;
@@ -28030,9 +27917,7 @@ function requireLib () {
28030
27917
  break;
28031
27918
  case "AssignmentExpression":
28032
27919
  if (node.operator !== "=") {
28033
- this.raise(Errors.MissingEqInAssignment, {
28034
- at: node.left.loc.end
28035
- });
27920
+ this.raise(Errors.MissingEqInAssignment, node.left.loc.end);
28036
27921
  }
28037
27922
  node.type = "AssignmentPattern";
28038
27923
  delete node.operator;
@@ -28045,18 +27930,14 @@ function requireLib () {
28045
27930
  }
28046
27931
  toAssignableObjectExpressionProp(prop, isLast, isLHS) {
28047
27932
  if (prop.type === "ObjectMethod") {
28048
- this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, {
28049
- at: prop.key
28050
- });
27933
+ this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, prop.key);
28051
27934
  } else if (prop.type === "SpreadElement") {
28052
27935
  prop.type = "RestElement";
28053
27936
  const arg = prop.argument;
28054
27937
  this.checkToRestConversion(arg, false);
28055
27938
  this.toAssignable(arg, isLHS);
28056
27939
  if (!isLast) {
28057
- this.raise(Errors.RestTrailingComma, {
28058
- at: prop
28059
- });
27940
+ this.raise(Errors.RestTrailingComma, prop);
28060
27941
  }
28061
27942
  } else {
28062
27943
  this.toAssignable(prop, isLHS);
@@ -28077,13 +27958,9 @@ function requireLib () {
28077
27958
  }
28078
27959
  if (elt.type === "RestElement") {
28079
27960
  if (i < end) {
28080
- this.raise(Errors.RestTrailingComma, {
28081
- at: elt
28082
- });
27961
+ this.raise(Errors.RestTrailingComma, elt);
28083
27962
  } else if (trailingCommaLoc) {
28084
- this.raise(Errors.RestTrailingComma, {
28085
- at: trailingCommaLoc
28086
- });
27963
+ this.raise(Errors.RestTrailingComma, trailingCommaLoc);
28087
27964
  }
28088
27965
  }
28089
27966
  }
@@ -28180,9 +28057,7 @@ function requireLib () {
28180
28057
  } else {
28181
28058
  const decorators = [];
28182
28059
  if (this.match(26) && this.hasPlugin("decorators")) {
28183
- this.raise(Errors.UnsupportedParameterDecorator, {
28184
- at: this.state.startLoc
28185
- });
28060
+ this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc);
28186
28061
  }
28187
28062
  while (this.match(26)) {
28188
28063
  decorators.push(this.parseDecorator());
@@ -28266,16 +28141,13 @@ function requireLib () {
28266
28141
  if (isOptionalMemberExpression) {
28267
28142
  this.expectPlugin("optionalChainingAssign", expression.loc.start);
28268
28143
  if (ancestor.type !== "AssignmentExpression") {
28269
- this.raise(Errors.InvalidLhsOptionalChaining, {
28270
- at: expression,
28144
+ this.raise(Errors.InvalidLhsOptionalChaining, expression, {
28271
28145
  ancestor
28272
28146
  });
28273
28147
  }
28274
28148
  }
28275
28149
  if (binding !== 64) {
28276
- this.raise(Errors.InvalidPropertyBindingPattern, {
28277
- at: expression
28278
- });
28150
+ this.raise(Errors.InvalidPropertyBindingPattern, expression);
28279
28151
  }
28280
28152
  return;
28281
28153
  }
@@ -28286,9 +28158,7 @@ function requireLib () {
28286
28158
  } = expression;
28287
28159
  if (checkClashes) {
28288
28160
  if (checkClashes.has(name)) {
28289
- this.raise(Errors.ParamDupe, {
28290
- at: expression
28291
- });
28161
+ this.raise(Errors.ParamDupe, expression);
28292
28162
  } else {
28293
28163
  checkClashes.add(name);
28294
28164
  }
@@ -28299,8 +28169,7 @@ function requireLib () {
28299
28169
  if (validity === true) return;
28300
28170
  if (validity === false) {
28301
28171
  const ParseErrorClass = binding === 64 ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
28302
- this.raise(ParseErrorClass, {
28303
- at: expression,
28172
+ this.raise(ParseErrorClass, expression, {
28304
28173
  ancestor
28305
28174
  });
28306
28175
  return;
@@ -28324,21 +28193,17 @@ function requireLib () {
28324
28193
  checkIdentifier(at, bindingType, strictModeChanged = false) {
28325
28194
  if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
28326
28195
  if (bindingType === 64) {
28327
- this.raise(Errors.StrictEvalArguments, {
28328
- at,
28196
+ this.raise(Errors.StrictEvalArguments, at, {
28329
28197
  referenceName: at.name
28330
28198
  });
28331
28199
  } else {
28332
- this.raise(Errors.StrictEvalArgumentsBinding, {
28333
- at,
28200
+ this.raise(Errors.StrictEvalArgumentsBinding, at, {
28334
28201
  bindingName: at.name
28335
28202
  });
28336
28203
  }
28337
28204
  }
28338
28205
  if (bindingType & 8192 && at.name === "let") {
28339
- this.raise(Errors.LetInLexicalBinding, {
28340
- at
28341
- });
28206
+ this.raise(Errors.LetInLexicalBinding, at);
28342
28207
  }
28343
28208
  if (!(bindingType & 64)) {
28344
28209
  this.declareNameFromIdentifier(at, bindingType);
@@ -28359,18 +28224,14 @@ function requireLib () {
28359
28224
  case "ObjectExpression":
28360
28225
  if (allowPattern) break;
28361
28226
  default:
28362
- this.raise(Errors.InvalidRestAssignmentPattern, {
28363
- at: node
28364
- });
28227
+ this.raise(Errors.InvalidRestAssignmentPattern, node);
28365
28228
  }
28366
28229
  }
28367
28230
  checkCommaAfterRest(close) {
28368
28231
  if (!this.match(12)) {
28369
28232
  return false;
28370
28233
  }
28371
- this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, {
28372
- at: this.state.startLoc
28373
- });
28234
+ this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, this.state.startLoc);
28374
28235
  return true;
28375
28236
  }
28376
28237
  }
@@ -28566,16 +28427,14 @@ function requireLib () {
28566
28427
  }, modified) {
28567
28428
  const enforceOrder = (loc, modifier, before, after) => {
28568
28429
  if (modifier === before && modified[after]) {
28569
- this.raise(TSErrors.InvalidModifiersOrder, {
28570
- at: loc,
28430
+ this.raise(TSErrors.InvalidModifiersOrder, loc, {
28571
28431
  orderedModifiers: [before, after]
28572
28432
  });
28573
28433
  }
28574
28434
  };
28575
28435
  const incompatible = (loc, modifier, mod1, mod2) => {
28576
28436
  if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) {
28577
- this.raise(TSErrors.IncompatibleModifiers, {
28578
- at: loc,
28437
+ this.raise(TSErrors.IncompatibleModifiers, loc, {
28579
28438
  modifiers: [mod1, mod2]
28580
28439
  });
28581
28440
  }
@@ -28588,8 +28447,7 @@ function requireLib () {
28588
28447
  if (!modifier) break;
28589
28448
  if (tsIsAccessModifier(modifier)) {
28590
28449
  if (modified.accessibility) {
28591
- this.raise(TSErrors.DuplicateAccessibilityModifier, {
28592
- at: startLoc,
28450
+ this.raise(TSErrors.DuplicateAccessibilityModifier, startLoc, {
28593
28451
  modifier
28594
28452
  });
28595
28453
  } else {
@@ -28600,8 +28458,7 @@ function requireLib () {
28600
28458
  }
28601
28459
  } else if (tsIsVarianceAnnotations(modifier)) {
28602
28460
  if (modified[modifier]) {
28603
- this.raise(TSErrors.DuplicateModifier, {
28604
- at: startLoc,
28461
+ this.raise(TSErrors.DuplicateModifier, startLoc, {
28605
28462
  modifier
28606
28463
  });
28607
28464
  }
@@ -28609,8 +28466,7 @@ function requireLib () {
28609
28466
  enforceOrder(startLoc, modifier, "in", "out");
28610
28467
  } else {
28611
28468
  if (Object.hasOwnProperty.call(modified, modifier)) {
28612
- this.raise(TSErrors.DuplicateModifier, {
28613
- at: startLoc,
28469
+ this.raise(TSErrors.DuplicateModifier, startLoc, {
28614
28470
  modifier
28615
28471
  });
28616
28472
  } else {
@@ -28624,8 +28480,7 @@ function requireLib () {
28624
28480
  modified[modifier] = true;
28625
28481
  }
28626
28482
  if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
28627
- this.raise(errorTemplate, {
28628
- at: startLoc,
28483
+ this.raise(errorTemplate, startLoc, {
28629
28484
  modifier
28630
28485
  });
28631
28486
  }
@@ -28668,7 +28523,7 @@ function requireLib () {
28668
28523
  }
28669
28524
  result.push(element);
28670
28525
  if (this.eat(12)) {
28671
- trailingCommaPos = this.state.lastTokStart;
28526
+ trailingCommaPos = this.state.lastTokStartLoc.index;
28672
28527
  continue;
28673
28528
  }
28674
28529
  if (this.tsIsListTerminator(kind)) {
@@ -28705,9 +28560,7 @@ function requireLib () {
28705
28560
  this.expect(83);
28706
28561
  this.expect(10);
28707
28562
  if (!this.match(133)) {
28708
- this.raise(TSErrors.UnsupportedImportTypeArgument, {
28709
- at: this.state.startLoc
28710
- });
28563
+ this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
28711
28564
  }
28712
28565
  node.argument = super.parseExprAtom();
28713
28566
  this.expect(11);
@@ -28788,9 +28641,7 @@ function requireLib () {
28788
28641
  };
28789
28642
  node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
28790
28643
  if (node.params.length === 0) {
28791
- this.raise(TSErrors.EmptyTypeParameters, {
28792
- at: node
28793
- });
28644
+ this.raise(TSErrors.EmptyTypeParameters, node);
28794
28645
  }
28795
28646
  if (refTrailingCommaPos.value !== -1) {
28796
28647
  this.addExtra(node, "trailingComma", refTrailingCommaPos.value);
@@ -28817,8 +28668,7 @@ function requireLib () {
28817
28668
  type
28818
28669
  } = pattern;
28819
28670
  if (type === "AssignmentPattern" || type === "TSParameterProperty") {
28820
- this.raise(TSErrors.UnsupportedSignatureParameterKind, {
28821
- at: pattern,
28671
+ this.raise(TSErrors.UnsupportedSignatureParameterKind, pattern, {
28822
28672
  type
28823
28673
  });
28824
28674
  }
@@ -28863,15 +28713,11 @@ function requireLib () {
28863
28713
  const nodeAny = node;
28864
28714
  if (this.match(10) || this.match(47)) {
28865
28715
  if (readonly) {
28866
- this.raise(TSErrors.ReadonlyForMethodSignature, {
28867
- at: node
28868
- });
28716
+ this.raise(TSErrors.ReadonlyForMethodSignature, node);
28869
28717
  }
28870
28718
  const method = nodeAny;
28871
28719
  if (method.kind && this.match(47)) {
28872
- this.raise(TSErrors.AccesorCannotHaveTypeParameters, {
28873
- at: this.state.curPosition()
28874
- });
28720
+ this.raise(TSErrors.AccesorCannotHaveTypeParameters, this.state.curPosition());
28875
28721
  }
28876
28722
  this.tsFillSignature(14, method);
28877
28723
  this.tsParseTypeMemberSemicolon();
@@ -28879,42 +28725,28 @@ function requireLib () {
28879
28725
  const returnTypeKey = "typeAnnotation";
28880
28726
  if (method.kind === "get") {
28881
28727
  if (method[paramsKey].length > 0) {
28882
- this.raise(Errors.BadGetterArity, {
28883
- at: this.state.curPosition()
28884
- });
28728
+ this.raise(Errors.BadGetterArity, this.state.curPosition());
28885
28729
  if (this.isThisParam(method[paramsKey][0])) {
28886
- this.raise(TSErrors.AccesorCannotDeclareThisParameter, {
28887
- at: this.state.curPosition()
28888
- });
28730
+ this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition());
28889
28731
  }
28890
28732
  }
28891
28733
  } else if (method.kind === "set") {
28892
28734
  if (method[paramsKey].length !== 1) {
28893
- this.raise(Errors.BadSetterArity, {
28894
- at: this.state.curPosition()
28895
- });
28735
+ this.raise(Errors.BadSetterArity, this.state.curPosition());
28896
28736
  } else {
28897
28737
  const firstParameter = method[paramsKey][0];
28898
28738
  if (this.isThisParam(firstParameter)) {
28899
- this.raise(TSErrors.AccesorCannotDeclareThisParameter, {
28900
- at: this.state.curPosition()
28901
- });
28739
+ this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition());
28902
28740
  }
28903
28741
  if (firstParameter.type === "Identifier" && firstParameter.optional) {
28904
- this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, {
28905
- at: this.state.curPosition()
28906
- });
28742
+ this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, this.state.curPosition());
28907
28743
  }
28908
28744
  if (firstParameter.type === "RestElement") {
28909
- this.raise(TSErrors.SetAccesorCannotHaveRestParameter, {
28910
- at: this.state.curPosition()
28911
- });
28745
+ this.raise(TSErrors.SetAccesorCannotHaveRestParameter, this.state.curPosition());
28912
28746
  }
28913
28747
  }
28914
28748
  if (method[returnTypeKey]) {
28915
- this.raise(TSErrors.SetAccesorCannotHaveReturnType, {
28916
- at: method[returnTypeKey]
28917
- });
28749
+ this.raise(TSErrors.SetAccesorCannotHaveReturnType, method[returnTypeKey]);
28918
28750
  }
28919
28751
  } else {
28920
28752
  method.kind = "method";
@@ -29029,9 +28861,7 @@ function requireLib () {
29029
28861
  type
29030
28862
  } = elementNode;
29031
28863
  if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) {
29032
- this.raise(TSErrors.OptionalTypeBeforeRequired, {
29033
- at: elementNode
29034
- });
28864
+ this.raise(TSErrors.OptionalTypeBeforeRequired, elementNode);
29035
28865
  }
29036
28866
  seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
29037
28867
  });
@@ -29084,16 +28914,12 @@ function requireLib () {
29084
28914
  labeledNode.elementType = type;
29085
28915
  if (this.eat(17)) {
29086
28916
  labeledNode.optional = true;
29087
- this.raise(TSErrors.TupleOptionalAfterType, {
29088
- at: this.state.lastTokStartLoc
29089
- });
28917
+ this.raise(TSErrors.TupleOptionalAfterType, this.state.lastTokStartLoc);
29090
28918
  }
29091
28919
  } else {
29092
28920
  labeledNode = this.startNodeAtNode(type);
29093
28921
  labeledNode.optional = optional;
29094
- this.raise(TSErrors.InvalidTupleMemberLabel, {
29095
- at: type
29096
- });
28922
+ this.raise(TSErrors.InvalidTupleMemberLabel, type);
29097
28923
  labeledNode.label = type;
29098
28924
  labeledNode.elementType = this.tsParseType();
29099
28925
  }
@@ -29246,9 +29072,7 @@ function requireLib () {
29246
29072
  case "TSArrayType":
29247
29073
  return;
29248
29074
  default:
29249
- this.raise(TSErrors.UnexpectedReadonly, {
29250
- at: node
29251
- });
29075
+ this.raise(TSErrors.UnexpectedReadonly, node);
29252
29076
  }
29253
29077
  }
29254
29078
  tsParseInferType() {
@@ -29416,8 +29240,7 @@ function requireLib () {
29416
29240
  return false;
29417
29241
  }
29418
29242
  if (containsEsc) {
29419
- this.raise(Errors.InvalidEscapedReservedWord, {
29420
- at: this.state.lastTokStartLoc,
29243
+ this.raise(Errors.InvalidEscapedReservedWord, this.state.lastTokStartLoc, {
29421
29244
  reservedWord: "asserts"
29422
29245
  });
29423
29246
  }
@@ -29461,9 +29284,7 @@ function requireLib () {
29461
29284
  }
29462
29285
  tsParseTypeAssertion() {
29463
29286
  if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
29464
- this.raise(TSErrors.ReservedTypeAssertion, {
29465
- at: this.state.startLoc
29466
- });
29287
+ this.raise(TSErrors.ReservedTypeAssertion, this.state.startLoc);
29467
29288
  }
29468
29289
  const node = this.startNode();
29469
29290
  node.typeAnnotation = this.tsInType(() => {
@@ -29485,8 +29306,7 @@ function requireLib () {
29485
29306
  return this.finishNode(node, "TSExpressionWithTypeArguments");
29486
29307
  });
29487
29308
  if (!delimitedList.length) {
29488
- this.raise(TSErrors.EmptyHeritageClauseType, {
29489
- at: originalStartLoc,
29309
+ this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
29490
29310
  token
29491
29311
  });
29492
29312
  }
@@ -29501,9 +29321,7 @@ function requireLib () {
29501
29321
  this.checkIdentifier(node.id, 130);
29502
29322
  } else {
29503
29323
  node.id = null;
29504
- this.raise(TSErrors.MissingInterfaceName, {
29505
- at: this.state.startLoc
29506
- });
29324
+ this.raise(TSErrors.MissingInterfaceName, this.state.startLoc);
29507
29325
  }
29508
29326
  node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);
29509
29327
  if (this.eat(81)) {
@@ -29655,9 +29473,7 @@ function requireLib () {
29655
29473
  this.expect(29);
29656
29474
  const moduleReference = this.tsParseModuleReference();
29657
29475
  if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") {
29658
- this.raise(TSErrors.ImportAliasHasImportType, {
29659
- at: moduleReference
29660
- });
29476
+ this.raise(TSErrors.ImportAliasHasImportType, moduleReference);
29661
29477
  }
29662
29478
  node.moduleReference = moduleReference;
29663
29479
  this.semicolon();
@@ -29843,9 +29659,7 @@ function requireLib () {
29843
29659
  return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
29844
29660
  }));
29845
29661
  if (node.params.length === 0) {
29846
- this.raise(TSErrors.EmptyTypeArguments, {
29847
- at: node
29848
- });
29662
+ this.raise(TSErrors.EmptyTypeArguments, node);
29849
29663
  } else if (!this.state.inType && this.curContext() === types.brace) {
29850
29664
  this.reScan_lt_gt();
29851
29665
  }
@@ -29869,9 +29683,7 @@ function requireLib () {
29869
29683
  const override = modified.override;
29870
29684
  const readonly = modified.readonly;
29871
29685
  if (!(flags & 4) && (accessibility || readonly || override)) {
29872
- this.raise(TSErrors.UnexpectedParameterModifier, {
29873
- at: startLoc
29874
- });
29686
+ this.raise(TSErrors.UnexpectedParameterModifier, startLoc);
29875
29687
  }
29876
29688
  const left = this.parseMaybeDefault();
29877
29689
  this.parseAssignableListItemTypes(left, flags);
@@ -29885,9 +29697,7 @@ function requireLib () {
29885
29697
  if (readonly) pp.readonly = readonly;
29886
29698
  if (override) pp.override = override;
29887
29699
  if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
29888
- this.raise(TSErrors.UnsupportedParameterPropertyKind, {
29889
- at: pp
29890
- });
29700
+ this.raise(TSErrors.UnsupportedParameterPropertyKind, pp);
29891
29701
  }
29892
29702
  pp.parameter = elt;
29893
29703
  return this.finishNode(pp, "TSParameterProperty");
@@ -29903,9 +29713,7 @@ function requireLib () {
29903
29713
  tsDisallowOptionalPattern(node) {
29904
29714
  for (const param of node.params) {
29905
29715
  if (param.type !== "Identifier" && param.optional && !this.state.isAmbientContext) {
29906
- this.raise(TSErrors.PatternIsOptional, {
29907
- at: param
29908
- });
29716
+ this.raise(TSErrors.PatternIsOptional, param);
29909
29717
  }
29910
29718
  }
29911
29719
  }
@@ -29922,9 +29730,7 @@ function requireLib () {
29922
29730
  return this.finishNode(node, bodilessType);
29923
29731
  }
29924
29732
  if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) {
29925
- this.raise(TSErrors.DeclareFunctionHasImplementation, {
29926
- at: node
29927
- });
29733
+ this.raise(TSErrors.DeclareFunctionHasImplementation, node);
29928
29734
  if (node.declare) {
29929
29735
  return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
29930
29736
  }
@@ -29942,9 +29748,7 @@ function requireLib () {
29942
29748
  tsCheckForInvalidTypeCasts(items) {
29943
29749
  items.forEach(node => {
29944
29750
  if ((node == null ? void 0 : node.type) === "TSTypeCastExpression") {
29945
- this.raise(TSErrors.UnexpectedTypeAnnotation, {
29946
- at: node.typeAnnotation
29947
- });
29751
+ this.raise(TSErrors.UnexpectedTypeAnnotation, node.typeAnnotation);
29948
29752
  }
29949
29753
  });
29950
29754
  }
@@ -30021,9 +29825,7 @@ function requireLib () {
30021
29825
  }
30022
29826
  if (result) {
30023
29827
  if (result.type === "TSInstantiationExpression" && (this.match(16) || this.match(18) && this.lookaheadCharCode() !== 40)) {
30024
- this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, {
30025
- at: this.state.startLoc
30026
- });
29828
+ this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, this.state.startLoc);
30027
29829
  }
30028
29830
  return result;
30029
29831
  }
@@ -30050,8 +29852,7 @@ function requireLib () {
30050
29852
  this.next();
30051
29853
  if (this.match(75)) {
30052
29854
  if (isSatisfies) {
30053
- this.raise(Errors.UnexpectedKeyword, {
30054
- at: this.state.startLoc,
29855
+ this.raise(Errors.UnexpectedKeyword, this.state.startLoc, {
30055
29856
  keyword: "const"
30056
29857
  });
30057
29858
  }
@@ -30073,9 +29874,7 @@ function requireLib () {
30073
29874
  checkImportReflection(node) {
30074
29875
  super.checkImportReflection(node);
30075
29876
  if (node.module && node.importKind !== "value") {
30076
- this.raise(TSErrors.ImportReflectionHasImportType, {
30077
- at: node.specifiers[0].loc.start
30078
- });
29877
+ this.raise(TSErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
30079
29878
  }
30080
29879
  }
30081
29880
  checkDuplicateExports() {}
@@ -30115,9 +29914,7 @@ function requireLib () {
30115
29914
  importNode = super.parseImport(node);
30116
29915
  }
30117
29916
  if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
30118
- this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, {
30119
- at: importNode
30120
- });
29917
+ this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, importNode);
30121
29918
  }
30122
29919
  return importNode;
30123
29920
  }
@@ -30175,13 +29972,9 @@ function requireLib () {
30175
29972
  } of declaration.declarations) {
30176
29973
  if (!init) continue;
30177
29974
  if (kind !== "const" || !!id.typeAnnotation) {
30178
- this.raise(TSErrors.InitializerNotAllowedInAmbientContext, {
30179
- at: init
30180
- });
29975
+ this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init);
30181
29976
  } else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) {
30182
- this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, {
30183
- at: init
30184
- });
29977
+ this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, init);
30185
29978
  }
30186
29979
  }
30187
29980
  return declaration;
@@ -30230,9 +30023,7 @@ function requireLib () {
30230
30023
  this.next();
30231
30024
  this.next();
30232
30025
  if (this.tsHasSomeModifiers(member, modifiers)) {
30233
- this.raise(TSErrors.StaticBlockCannotHaveModifier, {
30234
- at: this.state.curPosition()
30235
- });
30026
+ this.raise(TSErrors.StaticBlockCannotHaveModifier, this.state.curPosition());
30236
30027
  }
30237
30028
  super.parseClassStaticBlock(classBody, member);
30238
30029
  } else {
@@ -30250,38 +30041,27 @@ function requireLib () {
30250
30041
  if (idx) {
30251
30042
  classBody.body.push(idx);
30252
30043
  if (member.abstract) {
30253
- this.raise(TSErrors.IndexSignatureHasAbstract, {
30254
- at: member
30255
- });
30044
+ this.raise(TSErrors.IndexSignatureHasAbstract, member);
30256
30045
  }
30257
30046
  if (member.accessibility) {
30258
- this.raise(TSErrors.IndexSignatureHasAccessibility, {
30259
- at: member,
30047
+ this.raise(TSErrors.IndexSignatureHasAccessibility, member, {
30260
30048
  modifier: member.accessibility
30261
30049
  });
30262
30050
  }
30263
30051
  if (member.declare) {
30264
- this.raise(TSErrors.IndexSignatureHasDeclare, {
30265
- at: member
30266
- });
30052
+ this.raise(TSErrors.IndexSignatureHasDeclare, member);
30267
30053
  }
30268
30054
  if (member.override) {
30269
- this.raise(TSErrors.IndexSignatureHasOverride, {
30270
- at: member
30271
- });
30055
+ this.raise(TSErrors.IndexSignatureHasOverride, member);
30272
30056
  }
30273
30057
  return;
30274
30058
  }
30275
30059
  if (!this.state.inAbstractClass && member.abstract) {
30276
- this.raise(TSErrors.NonAbstractClassHasAbstractMethod, {
30277
- at: member
30278
- });
30060
+ this.raise(TSErrors.NonAbstractClassHasAbstractMethod, member);
30279
30061
  }
30280
30062
  if (member.override) {
30281
30063
  if (!state.hadSuperClass) {
30282
- this.raise(TSErrors.OverrideNotInSubClass, {
30283
- at: member
30284
- });
30064
+ this.raise(TSErrors.OverrideNotInSubClass, member);
30285
30065
  }
30286
30066
  }
30287
30067
  super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
@@ -30290,14 +30070,10 @@ function requireLib () {
30290
30070
  const optional = this.eat(17);
30291
30071
  if (optional) methodOrProp.optional = true;
30292
30072
  if (methodOrProp.readonly && this.match(10)) {
30293
- this.raise(TSErrors.ClassMethodHasReadonly, {
30294
- at: methodOrProp
30295
- });
30073
+ this.raise(TSErrors.ClassMethodHasReadonly, methodOrProp);
30296
30074
  }
30297
30075
  if (methodOrProp.declare && this.match(10)) {
30298
- this.raise(TSErrors.ClassMethodHasDeclare, {
30299
- at: methodOrProp
30300
- });
30076
+ this.raise(TSErrors.ClassMethodHasDeclare, methodOrProp);
30301
30077
  }
30302
30078
  }
30303
30079
  parseExpressionStatement(node, expr, decorators) {
@@ -30343,9 +30119,7 @@ function requireLib () {
30343
30119
  const startLoc = this.state.startLoc;
30344
30120
  const isDeclare = this.eatContextual(125);
30345
30121
  if (isDeclare && (this.isContextual(125) || !this.shouldParseExportDeclaration())) {
30346
- throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, {
30347
- at: this.state.startLoc
30348
- });
30122
+ throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
30349
30123
  }
30350
30124
  const isIdentifier = tokenIsIdentifier(this.state.type);
30351
30125
  const declaration = isIdentifier && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
@@ -30381,16 +30155,13 @@ function requireLib () {
30381
30155
  parseClassProperty(node) {
30382
30156
  this.parseClassPropertyAnnotation(node);
30383
30157
  if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(29)) {
30384
- this.raise(TSErrors.DeclareClassFieldHasInitializer, {
30385
- at: this.state.startLoc
30386
- });
30158
+ this.raise(TSErrors.DeclareClassFieldHasInitializer, this.state.startLoc);
30387
30159
  }
30388
30160
  if (node.abstract && this.match(29)) {
30389
30161
  const {
30390
30162
  key
30391
30163
  } = node;
30392
- this.raise(TSErrors.AbstractPropertyHasInitializer, {
30393
- at: this.state.startLoc,
30164
+ this.raise(TSErrors.AbstractPropertyHasInitializer, this.state.startLoc, {
30394
30165
  propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
30395
30166
  });
30396
30167
  }
@@ -30398,13 +30169,10 @@ function requireLib () {
30398
30169
  }
30399
30170
  parseClassPrivateProperty(node) {
30400
30171
  if (node.abstract) {
30401
- this.raise(TSErrors.PrivateElementHasAbstract, {
30402
- at: node
30403
- });
30172
+ this.raise(TSErrors.PrivateElementHasAbstract, node);
30404
30173
  }
30405
30174
  if (node.accessibility) {
30406
- this.raise(TSErrors.PrivateElementHasAccessibility, {
30407
- at: node,
30175
+ this.raise(TSErrors.PrivateElementHasAccessibility, node, {
30408
30176
  modifier: node.accessibility
30409
30177
  });
30410
30178
  }
@@ -30414,26 +30182,21 @@ function requireLib () {
30414
30182
  parseClassAccessorProperty(node) {
30415
30183
  this.parseClassPropertyAnnotation(node);
30416
30184
  if (node.optional) {
30417
- this.raise(TSErrors.AccessorCannotBeOptional, {
30418
- at: node
30419
- });
30185
+ this.raise(TSErrors.AccessorCannotBeOptional, node);
30420
30186
  }
30421
30187
  return super.parseClassAccessorProperty(node);
30422
30188
  }
30423
30189
  pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
30424
30190
  const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
30425
30191
  if (typeParameters && isConstructor) {
30426
- this.raise(TSErrors.ConstructorHasTypeParameters, {
30427
- at: typeParameters
30428
- });
30192
+ this.raise(TSErrors.ConstructorHasTypeParameters, typeParameters);
30429
30193
  }
30430
30194
  const {
30431
30195
  declare = false,
30432
30196
  kind
30433
30197
  } = method;
30434
30198
  if (declare && (kind === "get" || kind === "set")) {
30435
- this.raise(TSErrors.DeclareAccessor, {
30436
- at: method,
30199
+ this.raise(TSErrors.DeclareAccessor, method, {
30437
30200
  kind
30438
30201
  });
30439
30202
  }
@@ -30548,9 +30311,7 @@ function requireLib () {
30548
30311
  reportReservedArrowTypeParam(node) {
30549
30312
  var _node$extra;
30550
30313
  if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra = node.extra) != null && _node$extra.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
30551
- this.raise(TSErrors.ReservedArrowTypeParam, {
30552
- at: node
30553
- });
30314
+ this.raise(TSErrors.ReservedArrowTypeParam, node);
30554
30315
  }
30555
30316
  }
30556
30317
  parseMaybeUnary(refExpressionErrors, sawUnary) {
@@ -30604,13 +30365,9 @@ function requireLib () {
30604
30365
  case "TSNonNullExpression":
30605
30366
  case "TSTypeAssertion":
30606
30367
  if (isLHS) {
30607
- this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, {
30608
- at: node
30609
- });
30368
+ this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, node);
30610
30369
  } else {
30611
- this.raise(TSErrors.UnexpectedTypeCastInParameter, {
30612
- at: node
30613
- });
30370
+ this.raise(TSErrors.UnexpectedTypeCastInParameter, node);
30614
30371
  }
30615
30372
  this.toAssignable(node.expression, isLHS);
30616
30373
  break;
@@ -30691,9 +30448,7 @@ function requireLib () {
30691
30448
  parseMaybeDefault(startLoc, left) {
30692
30449
  const node = super.parseMaybeDefault(startLoc, left);
30693
30450
  if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
30694
- this.raise(TSErrors.TypeAnnotationAfterAssign, {
30695
- at: node.typeAnnotation
30696
- });
30451
+ this.raise(TSErrors.TypeAnnotationAfterAssign, node.typeAnnotation);
30697
30452
  }
30698
30453
  return node;
30699
30454
  }
@@ -30807,9 +30562,7 @@ function requireLib () {
30807
30562
  } else if (this.isContextual(129)) {
30808
30563
  if (!this.hasFollowingLineBreak()) {
30809
30564
  node.abstract = true;
30810
- this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, {
30811
- at: node
30812
- });
30565
+ this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, node);
30813
30566
  return this.tsParseInterfaceDeclaration(node);
30814
30567
  }
30815
30568
  } else {
@@ -30824,8 +30577,7 @@ function requireLib () {
30824
30577
  const {
30825
30578
  key
30826
30579
  } = method;
30827
- this.raise(TSErrors.AbstractMethodHasImplementation, {
30828
- at: method,
30580
+ this.raise(TSErrors.AbstractMethodHasImplementation, method, {
30829
30581
  methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
30830
30582
  });
30831
30583
  }
@@ -30907,9 +30659,7 @@ function requireLib () {
30907
30659
  }
30908
30660
  }
30909
30661
  if (hasTypeSpecifier && isInTypeOnlyImportExport) {
30910
- this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, {
30911
- at: loc
30912
- });
30662
+ this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, loc);
30913
30663
  }
30914
30664
  node[leftOfAsKey] = leftOfAs;
30915
30665
  node[rightOfAsKey] = rightOfAs;
@@ -31096,9 +30846,7 @@ function requireLib () {
31096
30846
  node.body = this.finishPlaceholder(placeholder, "ClassBody");
31097
30847
  return this.finishNode(node, type);
31098
30848
  } else {
31099
- throw this.raise(PlaceholderErrors.ClassNameIsRequired, {
31100
- at: this.state.startLoc
31101
- });
30849
+ throw this.raise(PlaceholderErrors.ClassNameIsRequired, this.state.startLoc);
31102
30850
  }
31103
30851
  } else {
31104
30852
  this.parseClassId(node, isStatement, optionalId);
@@ -31176,9 +30924,7 @@ function requireLib () {
31176
30924
  }
31177
30925
  assertNoSpace() {
31178
30926
  if (this.state.start > this.state.lastTokEndLoc.index) {
31179
- this.raise(PlaceholderErrors.UnexpectedSpace, {
31180
- at: this.state.lastTokEndLoc
31181
- });
30927
+ this.raise(PlaceholderErrors.UnexpectedSpace, this.state.lastTokEndLoc);
31182
30928
  }
31183
30929
  }
31184
30930
  };
@@ -31367,9 +31113,7 @@ function requireLib () {
31367
31113
  const name = key.type === "Identifier" ? key.name : key.value;
31368
31114
  if (name === "__proto__") {
31369
31115
  if (isRecord) {
31370
- this.raise(Errors.RecordNoProto, {
31371
- at: key
31372
- });
31116
+ this.raise(Errors.RecordNoProto, key);
31373
31117
  return;
31374
31118
  }
31375
31119
  if (protoRef.used) {
@@ -31378,9 +31122,7 @@ function requireLib () {
31378
31122
  refExpressionErrors.doubleProtoLoc = key.loc.start;
31379
31123
  }
31380
31124
  } else {
31381
- this.raise(Errors.DuplicateProto, {
31382
- at: key
31383
- });
31125
+ this.raise(Errors.DuplicateProto, key);
31384
31126
  }
31385
31127
  }
31386
31128
  protoRef.used = true;
@@ -31397,7 +31139,7 @@ function requireLib () {
31397
31139
  this.unexpected();
31398
31140
  }
31399
31141
  this.finalizeRemainingComments();
31400
- expr.comments = this.state.comments;
31142
+ expr.comments = this.comments;
31401
31143
  expr.errors = this.state.errors;
31402
31144
  if (this.options.tokens) {
31403
31145
  expr.tokens = this.tokens;
@@ -31530,8 +31272,7 @@ function requireLib () {
31530
31272
  if (this.isPrivateName(left)) {
31531
31273
  const value = this.getPrivateNameSV(left);
31532
31274
  if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) {
31533
- this.raise(Errors.PrivateInExpectedIn, {
31534
- at: left,
31275
+ this.raise(Errors.PrivateInExpectedIn, left, {
31535
31276
  identifierName: value
31536
31277
  });
31537
31278
  }
@@ -31561,18 +31302,14 @@ function requireLib () {
31561
31302
  proposal: "minimal"
31562
31303
  }])) {
31563
31304
  if (this.state.type === 96 && this.prodParam.hasAwait) {
31564
- throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, {
31565
- at: this.state.startLoc
31566
- });
31305
+ throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, this.state.startLoc);
31567
31306
  }
31568
31307
  }
31569
31308
  node.right = this.parseExprOpRightExpr(op, prec);
31570
31309
  const finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
31571
31310
  const nextOp = this.state.type;
31572
31311
  if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) {
31573
- throw this.raise(Errors.MixingCoalesceWithLogical, {
31574
- at: this.state.startLoc
31575
- });
31312
+ throw this.raise(Errors.MixingCoalesceWithLogical, this.state.startLoc);
31576
31313
  }
31577
31314
  return this.parseExprOp(finishedNode, leftStartLoc, minPrec);
31578
31315
  }
@@ -31591,9 +31328,7 @@ function requireLib () {
31591
31328
  case "smart":
31592
31329
  return this.withTopicBindingContext(() => {
31593
31330
  if (this.prodParam.hasYield && this.isContextual(108)) {
31594
- throw this.raise(Errors.PipeBodyIsTighter, {
31595
- at: this.state.startLoc
31596
- });
31331
+ throw this.raise(Errors.PipeBodyIsTighter, this.state.startLoc);
31597
31332
  }
31598
31333
  return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startLoc);
31599
31334
  });
@@ -31618,23 +31353,18 @@ function requireLib () {
31618
31353
  const body = this.parseMaybeAssign();
31619
31354
  const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);
31620
31355
  if (requiredParentheses && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) {
31621
- this.raise(Errors.PipeUnparenthesizedBody, {
31622
- at: startLoc,
31356
+ this.raise(Errors.PipeUnparenthesizedBody, startLoc, {
31623
31357
  type: body.type
31624
31358
  });
31625
31359
  }
31626
31360
  if (!this.topicReferenceWasUsedInCurrentContext()) {
31627
- this.raise(Errors.PipeTopicUnused, {
31628
- at: startLoc
31629
- });
31361
+ this.raise(Errors.PipeTopicUnused, startLoc);
31630
31362
  }
31631
31363
  return body;
31632
31364
  }
31633
31365
  checkExponentialAfterUnary(node) {
31634
31366
  if (this.match(57)) {
31635
- this.raise(Errors.UnexpectedTokenUnaryExponentiation, {
31636
- at: node.argument
31637
- });
31367
+ this.raise(Errors.UnexpectedTokenUnaryExponentiation, node.argument);
31638
31368
  }
31639
31369
  }
31640
31370
  parseMaybeUnary(refExpressionErrors, sawUnary) {
@@ -31661,13 +31391,9 @@ function requireLib () {
31661
31391
  if (this.state.strict && isDelete) {
31662
31392
  const arg = node.argument;
31663
31393
  if (arg.type === "Identifier") {
31664
- this.raise(Errors.StrictDelete, {
31665
- at: node
31666
- });
31394
+ this.raise(Errors.StrictDelete, node);
31667
31395
  } else if (this.hasPropertyAsPrivateName(arg)) {
31668
- this.raise(Errors.DeletePrivateField, {
31669
- at: node
31670
- });
31396
+ this.raise(Errors.DeletePrivateField, node);
31671
31397
  }
31672
31398
  }
31673
31399
  if (!update) {
@@ -31684,9 +31410,7 @@ function requireLib () {
31684
31410
  } = this.state;
31685
31411
  const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54);
31686
31412
  if (startsExpr && !this.isAmbiguousAwait()) {
31687
- this.raiseOverwrite(Errors.AwaitNotInAsyncContext, {
31688
- at: startLoc
31689
- });
31413
+ this.raiseOverwrite(Errors.AwaitNotInAsyncContext, startLoc);
31690
31414
  return this.parseAwait(startLoc);
31691
31415
  }
31692
31416
  }
@@ -31748,9 +31472,7 @@ function requireLib () {
31748
31472
  let optional = false;
31749
31473
  if (type === 18) {
31750
31474
  if (noCalls) {
31751
- this.raise(Errors.OptionalChainingNoNew, {
31752
- at: this.state.startLoc
31753
- });
31475
+ this.raise(Errors.OptionalChainingNoNew, this.state.startLoc);
31754
31476
  if (this.lookaheadCharCode() === 40) {
31755
31477
  state.stop = true;
31756
31478
  return base;
@@ -31780,9 +31502,7 @@ function requireLib () {
31780
31502
  this.expect(3);
31781
31503
  } else if (this.match(138)) {
31782
31504
  if (base.type === "Super") {
31783
- this.raise(Errors.SuperPrivateField, {
31784
- at: startLoc
31785
- });
31505
+ this.raise(Errors.SuperPrivateField, startLoc);
31786
31506
  }
31787
31507
  this.classScope.usePrivateName(this.state.value, this.state.startLoc);
31788
31508
  node.property = this.parsePrivateName();
@@ -31852,9 +31572,7 @@ function requireLib () {
31852
31572
  node.tag = base;
31853
31573
  node.quasi = this.parseTemplate(true);
31854
31574
  if (state.optionalChainMember) {
31855
- this.raise(Errors.OptionalChainingNoTemplate, {
31856
- at: startLoc
31857
- });
31575
+ this.raise(Errors.OptionalChainingNoTemplate, startLoc);
31858
31576
  }
31859
31577
  return this.finishNode(node, "TaggedTemplateExpression");
31860
31578
  }
@@ -31876,16 +31594,13 @@ function requireLib () {
31876
31594
  }
31877
31595
  }
31878
31596
  if (node.arguments.length === 0 || node.arguments.length > 2) {
31879
- this.raise(Errors.ImportCallArity, {
31880
- at: node,
31597
+ this.raise(Errors.ImportCallArity, node, {
31881
31598
  maxArgumentCount: this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? 2 : 1
31882
31599
  });
31883
31600
  } else {
31884
31601
  for (const arg of node.arguments) {
31885
31602
  if (arg.type === "SpreadElement") {
31886
- this.raise(Errors.ImportCallSpreadArgument, {
31887
- at: arg
31888
- });
31603
+ this.raise(Errors.ImportCallSpreadArgument, arg);
31889
31604
  }
31890
31605
  }
31891
31606
  }
@@ -31904,9 +31619,7 @@ function requireLib () {
31904
31619
  this.expect(12);
31905
31620
  if (this.match(close)) {
31906
31621
  if (dynamicImport && !this.hasPlugin("importAttributes") && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) {
31907
- this.raise(Errors.ImportCallArgumentTrailingComma, {
31908
- at: this.state.lastTokStartLoc
31909
- });
31622
+ this.raise(Errors.ImportCallArgumentTrailingComma, this.state.lastTokStartLoc);
31910
31623
  }
31911
31624
  if (nodeForExtra) {
31912
31625
  this.addTrailingCommaExtraToNode(nodeForExtra);
@@ -31962,9 +31675,7 @@ function requireLib () {
31962
31675
  return this.finishNode(node, "Import");
31963
31676
  }
31964
31677
  } else {
31965
- this.raise(Errors.UnsupportedImport, {
31966
- at: this.state.lastTokStartLoc
31967
- });
31678
+ this.raise(Errors.UnsupportedImport, this.state.lastTokStartLoc);
31968
31679
  return this.finishNode(node, "Import");
31969
31680
  }
31970
31681
  case 78:
@@ -32038,15 +31749,12 @@ function requireLib () {
32038
31749
  if (callee.type === "MemberExpression") {
32039
31750
  return this.finishNode(node, "BindExpression");
32040
31751
  } else {
32041
- throw this.raise(Errors.UnsupportedBind, {
32042
- at: callee
32043
- });
31752
+ throw this.raise(Errors.UnsupportedBind, callee);
32044
31753
  }
32045
31754
  }
32046
31755
  case 138:
32047
31756
  {
32048
- this.raise(Errors.PrivateInExpectedIn, {
32049
- at: this.state.startLoc,
31757
+ this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, {
32050
31758
  identifierName: this.state.value
32051
31759
  });
32052
31760
  return this.parsePrivateName();
@@ -32146,15 +31854,12 @@ function requireLib () {
32146
31854
  if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
32147
31855
  const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" : "TopicReference";
32148
31856
  if (!this.topicReferenceIsAllowedInCurrentContext()) {
32149
- this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, {
32150
- at: startLoc
32151
- });
31857
+ this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, startLoc);
32152
31858
  }
32153
31859
  this.registerTopicReference();
32154
31860
  return this.finishNode(node, nodeType);
32155
31861
  } else {
32156
- throw this.raise(Errors.PipeTopicUnconfiguredToken, {
32157
- at: startLoc,
31862
+ throw this.raise(Errors.PipeTopicUnconfiguredToken, startLoc, {
32158
31863
  token: tokenLabelName(tokenType)
32159
31864
  });
32160
31865
  }
@@ -32170,9 +31875,7 @@ function requireLib () {
32170
31875
  case "smart":
32171
31876
  return tokenType === 27;
32172
31877
  default:
32173
- throw this.raise(Errors.PipeTopicRequiresHackPipes, {
32174
- at: startLoc
32175
- });
31878
+ throw this.raise(Errors.PipeTopicRequiresHackPipes, startLoc);
32176
31879
  }
32177
31880
  }
32178
31881
  parseAsyncArrowUnaryFunction(node) {
@@ -32180,9 +31883,7 @@ function requireLib () {
32180
31883
  const params = [this.parseIdentifier()];
32181
31884
  this.prodParam.exit();
32182
31885
  if (this.hasPrecedingLineBreak()) {
32183
- this.raise(Errors.LineTerminatorBeforeArrow, {
32184
- at: this.state.curPosition()
32185
- });
31886
+ this.raise(Errors.LineTerminatorBeforeArrow, this.state.curPosition());
32186
31887
  }
32187
31888
  this.expect(19);
32188
31889
  return this.parseArrowExpression(node, params, true);
@@ -32210,18 +31911,12 @@ function requireLib () {
32210
31911
  const node = this.startNode();
32211
31912
  this.next();
32212
31913
  if (this.match(10) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod) {
32213
- this.raise(Errors.SuperNotAllowed, {
32214
- at: node
32215
- });
31914
+ this.raise(Errors.SuperNotAllowed, node);
32216
31915
  } else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) {
32217
- this.raise(Errors.UnexpectedSuper, {
32218
- at: node
32219
- });
31916
+ this.raise(Errors.UnexpectedSuper, node);
32220
31917
  }
32221
31918
  if (!this.match(10) && !this.match(0) && !this.match(16)) {
32222
- this.raise(Errors.UnsupportedSuper, {
32223
- at: node
32224
- });
31919
+ this.raise(Errors.UnsupportedSuper, node);
32225
31920
  }
32226
31921
  return this.finishNode(node, "Super");
32227
31922
  }
@@ -32253,8 +31948,7 @@ function requireLib () {
32253
31948
  const containsEsc = this.state.containsEsc;
32254
31949
  node.property = this.parseIdentifier(true);
32255
31950
  if (node.property.name !== propertyName || containsEsc) {
32256
- this.raise(Errors.UnsupportedMetaProperty, {
32257
- at: node.property,
31951
+ this.raise(Errors.UnsupportedMetaProperty, node.property, {
32258
31952
  target: meta.name,
32259
31953
  onlyValidPropertyName: propertyName
32260
31954
  });
@@ -32266,9 +31960,7 @@ function requireLib () {
32266
31960
  this.next();
32267
31961
  if (this.isContextual(101)) {
32268
31962
  if (!this.inModule) {
32269
- this.raise(Errors.ImportMetaOutsideModule, {
32270
- at: id
32271
- });
31963
+ this.raise(Errors.ImportMetaOutsideModule, id);
32272
31964
  }
32273
31965
  this.sawUnambiguousESM = true;
32274
31966
  } else if (this.isContextual(105) || this.isContextual(97)) {
@@ -32276,8 +31968,7 @@ function requireLib () {
32276
31968
  if (!isSource) this.unexpected();
32277
31969
  this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
32278
31970
  if (!this.options.createImportExpressions) {
32279
- throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, {
32280
- at: this.state.startLoc,
31971
+ throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, {
32281
31972
  phase: this.state.value
32282
31973
  });
32283
31974
  }
@@ -32423,9 +32114,7 @@ function requireLib () {
32423
32114
  this.next();
32424
32115
  const metaProp = this.parseMetaProperty(node, meta, "target");
32425
32116
  if (!this.scope.inNonArrowFunction && !this.scope.inClass && !this.options.allowNewTargetOutsideFunction) {
32426
- this.raise(Errors.UnexpectedNewTarget, {
32427
- at: metaProp
32428
- });
32117
+ this.raise(Errors.UnexpectedNewTarget, metaProp);
32429
32118
  }
32430
32119
  return metaProp;
32431
32120
  }
@@ -32447,9 +32136,7 @@ function requireLib () {
32447
32136
  const callee = this.parseNoCallExpr();
32448
32137
  node.callee = callee;
32449
32138
  if (isImport && (callee.type === "Import" || callee.type === "ImportExpression")) {
32450
- this.raise(Errors.ImportCallNotNewExpression, {
32451
- at: callee
32452
- });
32139
+ this.raise(Errors.ImportCallNotNewExpression, callee);
32453
32140
  }
32454
32141
  }
32455
32142
  parseTemplateElement(isTagged) {
@@ -32463,9 +32150,7 @@ function requireLib () {
32463
32150
  const elem = this.startNodeAt(createPositionWithColumnOffset(startLoc, 1));
32464
32151
  if (value === null) {
32465
32152
  if (!isTagged) {
32466
- this.raise(Errors.InvalidEscapeSequenceTemplate, {
32467
- at: createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1)
32468
- });
32153
+ this.raise(Errors.InvalidEscapeSequenceTemplate, createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1));
32469
32154
  }
32470
32155
  }
32471
32156
  const isTail = this.match(24);
@@ -32525,9 +32210,7 @@ function requireLib () {
32525
32210
  this.checkProto(prop, isRecord, propHash, refExpressionErrors);
32526
32211
  }
32527
32212
  if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
32528
- this.raise(Errors.InvalidRecordProperty, {
32529
- at: prop
32530
- });
32213
+ this.raise(Errors.InvalidRecordProperty, prop);
32531
32214
  }
32532
32215
  if (prop.shorthand) {
32533
32216
  this.addExtra(prop, "shorthand", true);
@@ -32545,7 +32228,7 @@ function requireLib () {
32545
32228
  return this.finishNode(node, type);
32546
32229
  }
32547
32230
  addTrailingCommaExtraToNode(node) {
32548
- this.addExtra(node, "trailingComma", this.state.lastTokStart);
32231
+ this.addExtra(node, "trailingComma", this.state.lastTokStartLoc.index);
32549
32232
  this.addExtra(node, "trailingCommaLoc", this.state.lastTokStartLoc, false);
32550
32233
  }
32551
32234
  maybeAsyncOrAccessorProp(prop) {
@@ -32555,9 +32238,7 @@ function requireLib () {
32555
32238
  let decorators = [];
32556
32239
  if (this.match(26)) {
32557
32240
  if (this.hasPlugin("decorators")) {
32558
- this.raise(Errors.UnsupportedPropertyDecorator, {
32559
- at: this.state.startLoc
32560
- });
32241
+ this.raise(Errors.UnsupportedPropertyDecorator, this.state.startLoc);
32561
32242
  }
32562
32243
  while (this.match(26)) {
32563
32244
  decorators.push(this.parseDecorator());
@@ -32597,8 +32278,7 @@ function requireLib () {
32597
32278
  prop.kind = keyName;
32598
32279
  if (this.match(55)) {
32599
32280
  isGenerator = true;
32600
- this.raise(Errors.AccessorIsGenerator, {
32601
- at: this.state.curPosition(),
32281
+ this.raise(Errors.AccessorIsGenerator, this.state.curPosition(), {
32602
32282
  kind: keyName
32603
32283
  });
32604
32284
  this.next();
@@ -32619,14 +32299,10 @@ function requireLib () {
32619
32299
  const paramCount = this.getGetterSetterExpectedParamCount(method);
32620
32300
  const params = this.getObjectOrClassMethodParams(method);
32621
32301
  if (params.length !== paramCount) {
32622
- this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, {
32623
- at: method
32624
- });
32302
+ this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, method);
32625
32303
  }
32626
32304
  if (method.kind === "set" && ((_params = params[params.length - 1]) == null ? void 0 : _params.type) === "RestElement") {
32627
- this.raise(Errors.BadSetterRestParameter, {
32628
- at: method
32629
- });
32305
+ this.raise(Errors.BadSetterRestParameter, method);
32630
32306
  }
32631
32307
  }
32632
32308
  parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
@@ -32659,9 +32335,7 @@ function requireLib () {
32659
32335
  refExpressionErrors.shorthandAssignLoc = shorthandAssignLoc;
32660
32336
  }
32661
32337
  } else {
32662
- this.raise(Errors.InvalidCoverInitializedName, {
32663
- at: shorthandAssignLoc
32664
- });
32338
+ this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
32665
32339
  }
32666
32340
  prop.value = this.parseMaybeDefault(startLoc, cloneIdentifier(prop.key));
32667
32341
  } else {
@@ -32711,9 +32385,7 @@ function requireLib () {
32711
32385
  refExpressionErrors.privateKeyLoc = privateKeyLoc;
32712
32386
  }
32713
32387
  } else {
32714
- this.raise(Errors.UnexpectedPrivateField, {
32715
- at: privateKeyLoc
32716
- });
32388
+ this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
32717
32389
  }
32718
32390
  key = this.parsePrivateName();
32719
32391
  break;
@@ -32799,9 +32471,7 @@ function requireLib () {
32799
32471
  node.body = this.parseBlock(true, false, hasStrictModeDirective => {
32800
32472
  const nonSimple = !this.isSimpleParamList(node.params);
32801
32473
  if (hasStrictModeDirective && nonSimple) {
32802
- this.raise(Errors.IllegalLanguageModeDirective, {
32803
- at: (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node
32804
- });
32474
+ this.raise(Errors.IllegalLanguageModeDirective, (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node);
32805
32475
  }
32806
32476
  const strictModeChanged = !oldStrict && this.state.strict;
32807
32477
  this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
@@ -32861,8 +32531,7 @@ function requireLib () {
32861
32531
  let elt;
32862
32532
  if (this.match(12)) {
32863
32533
  if (!allowEmpty) {
32864
- this.raise(Errors.UnexpectedToken, {
32865
- at: this.state.curPosition(),
32534
+ this.raise(Errors.UnexpectedToken, this.state.curPosition(), {
32866
32535
  unexpected: ","
32867
32536
  });
32868
32537
  }
@@ -32873,9 +32542,7 @@ function requireLib () {
32873
32542
  } else if (this.match(17)) {
32874
32543
  this.expectPlugin("partialApplication");
32875
32544
  if (!allowPlaceholder) {
32876
- this.raise(Errors.UnexpectedArgumentPlaceholder, {
32877
- at: this.state.startLoc
32878
- });
32545
+ this.raise(Errors.UnexpectedArgumentPlaceholder, this.state.startLoc);
32879
32546
  }
32880
32547
  const node = this.startNode();
32881
32548
  this.next();
@@ -32925,47 +32592,35 @@ function requireLib () {
32925
32592
  return;
32926
32593
  }
32927
32594
  if (checkKeywords && isKeyword(word)) {
32928
- this.raise(Errors.UnexpectedKeyword, {
32929
- at: startLoc,
32595
+ this.raise(Errors.UnexpectedKeyword, startLoc, {
32930
32596
  keyword: word
32931
32597
  });
32932
32598
  return;
32933
32599
  }
32934
32600
  const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord;
32935
32601
  if (reservedTest(word, this.inModule)) {
32936
- this.raise(Errors.UnexpectedReservedWord, {
32937
- at: startLoc,
32602
+ this.raise(Errors.UnexpectedReservedWord, startLoc, {
32938
32603
  reservedWord: word
32939
32604
  });
32940
32605
  return;
32941
32606
  } else if (word === "yield") {
32942
32607
  if (this.prodParam.hasYield) {
32943
- this.raise(Errors.YieldBindingIdentifier, {
32944
- at: startLoc
32945
- });
32608
+ this.raise(Errors.YieldBindingIdentifier, startLoc);
32946
32609
  return;
32947
32610
  }
32948
32611
  } else if (word === "await") {
32949
32612
  if (this.prodParam.hasAwait) {
32950
- this.raise(Errors.AwaitBindingIdentifier, {
32951
- at: startLoc
32952
- });
32613
+ this.raise(Errors.AwaitBindingIdentifier, startLoc);
32953
32614
  return;
32954
32615
  }
32955
32616
  if (this.scope.inStaticBlock) {
32956
- this.raise(Errors.AwaitBindingIdentifierInStaticBlock, {
32957
- at: startLoc
32958
- });
32617
+ this.raise(Errors.AwaitBindingIdentifierInStaticBlock, startLoc);
32959
32618
  return;
32960
32619
  }
32961
- this.expressionScope.recordAsyncArrowParametersError({
32962
- at: startLoc
32963
- });
32620
+ this.expressionScope.recordAsyncArrowParametersError(startLoc);
32964
32621
  } else if (word === "arguments") {
32965
32622
  if (this.scope.inClassAndNotInNonArrowFunction) {
32966
- this.raise(Errors.ArgumentsInClass, {
32967
- at: startLoc
32968
- });
32623
+ this.raise(Errors.ArgumentsInClass, startLoc);
32969
32624
  return;
32970
32625
  }
32971
32626
  }
@@ -32979,13 +32634,9 @@ function requireLib () {
32979
32634
  }
32980
32635
  parseAwait(startLoc) {
32981
32636
  const node = this.startNodeAt(startLoc);
32982
- this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, {
32983
- at: node
32984
- });
32637
+ this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, node);
32985
32638
  if (this.eat(55)) {
32986
- this.raise(Errors.ObsoleteAwaitStar, {
32987
- at: node
32988
- });
32639
+ this.raise(Errors.ObsoleteAwaitStar, node);
32989
32640
  }
32990
32641
  if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) {
32991
32642
  if (this.isAmbiguousAwait()) {
@@ -33008,9 +32659,7 @@ function requireLib () {
33008
32659
  }
33009
32660
  parseYield() {
33010
32661
  const node = this.startNode();
33011
- this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, {
33012
- at: node
33013
- });
32662
+ this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, node);
33014
32663
  this.next();
33015
32664
  let delegating = false;
33016
32665
  let argument = null;
@@ -33055,9 +32704,7 @@ function requireLib () {
33055
32704
  proposal: "smart"
33056
32705
  }])) {
33057
32706
  if (left.type === "SequenceExpression") {
33058
- this.raise(Errors.PipelineHeadSequenceExpression, {
33059
- at: leftStartLoc
33060
- });
32707
+ this.raise(Errors.PipelineHeadSequenceExpression, leftStartLoc);
33061
32708
  }
33062
32709
  }
33063
32710
  }
@@ -33085,14 +32732,10 @@ function requireLib () {
33085
32732
  }
33086
32733
  checkSmartPipeTopicBodyEarlyErrors(startLoc) {
33087
32734
  if (this.match(19)) {
33088
- throw this.raise(Errors.PipelineBodyNoArrow, {
33089
- at: this.state.startLoc
33090
- });
32735
+ throw this.raise(Errors.PipelineBodyNoArrow, this.state.startLoc);
33091
32736
  }
33092
32737
  if (!this.topicReferenceWasUsedInCurrentContext()) {
33093
- this.raise(Errors.PipelineTopicUnused, {
33094
- at: startLoc
33095
- });
32738
+ this.raise(Errors.PipelineTopicUnused, startLoc);
33096
32739
  }
33097
32740
  }
33098
32741
  withTopicBindingContext(callback) {
@@ -33199,10 +32842,10 @@ function requireLib () {
33199
32842
  parsePropertyNamePrefixOperator(prop) {}
33200
32843
  }
33201
32844
  const loopLabel = {
33202
- kind: "loop"
32845
+ kind: 1
33203
32846
  },
33204
32847
  switchLabel = {
33205
- kind: "switch"
32848
+ kind: 2
33206
32849
  };
33207
32850
  const loneSurrogate = /[\uD800-\uDFFF]/u;
33208
32851
  const keywordRelationalOperator = /in(?:stanceof)?/y;
@@ -33316,7 +32959,7 @@ function requireLib () {
33316
32959
  class StatementParser extends ExpressionParser {
33317
32960
  parseTopLevel(file, program) {
33318
32961
  file.program = this.parseProgram(program);
33319
- file.comments = this.state.comments;
32962
+ file.comments = this.comments;
33320
32963
  if (this.options.tokens) {
33321
32964
  file.tokens = babel7CompatTokens(this.tokens, this.input);
33322
32965
  }
@@ -33328,8 +32971,7 @@ function requireLib () {
33328
32971
  this.parseBlockBody(program, true, true, end);
33329
32972
  if (this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
33330
32973
  for (const [localName, at] of Array.from(this.scope.undefinedExports)) {
33331
- this.raise(Errors.ModuleExportUndefined, {
33332
- at,
32974
+ this.raise(Errors.ModuleExportUndefined, at, {
33333
32975
  localName
33334
32976
  });
33335
32977
  }
@@ -33471,9 +33113,7 @@ function requireLib () {
33471
33113
  case 68:
33472
33114
  if (this.lookaheadCharCode() === 46) break;
33473
33115
  if (!allowFunctionDeclaration) {
33474
- this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, {
33475
- at: this.state.startLoc
33476
- });
33116
+ this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, this.state.startLoc);
33477
33117
  }
33478
33118
  return this.parseFunctionStatement(node, false, !allowDeclaration && allowFunctionDeclaration);
33479
33119
  case 80:
@@ -33492,13 +33132,9 @@ function requireLib () {
33492
33132
  case 96:
33493
33133
  if (!this.state.containsEsc && this.startsAwaitUsing()) {
33494
33134
  if (!this.isAwaitAllowed()) {
33495
- this.raise(Errors.AwaitUsingNotInAsyncContext, {
33496
- at: node
33497
- });
33135
+ this.raise(Errors.AwaitUsingNotInAsyncContext, node);
33498
33136
  } else if (!allowDeclaration) {
33499
- this.raise(Errors.UnexpectedLexicalDeclaration, {
33500
- at: node
33501
- });
33137
+ this.raise(Errors.UnexpectedLexicalDeclaration, node);
33502
33138
  }
33503
33139
  this.next();
33504
33140
  return this.parseVarStatement(node, "await using");
@@ -33510,13 +33146,9 @@ function requireLib () {
33510
33146
  }
33511
33147
  this.expectPlugin("explicitResourceManagement");
33512
33148
  if (!this.scope.inModule && this.scope.inTopLevel) {
33513
- this.raise(Errors.UnexpectedUsingDeclaration, {
33514
- at: this.state.startLoc
33515
- });
33149
+ this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
33516
33150
  } else if (!allowDeclaration) {
33517
- this.raise(Errors.UnexpectedLexicalDeclaration, {
33518
- at: this.state.startLoc
33519
- });
33151
+ this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
33520
33152
  }
33521
33153
  return this.parseVarStatement(node, "using");
33522
33154
  case 100:
@@ -33536,9 +33168,7 @@ function requireLib () {
33536
33168
  case 75:
33537
33169
  {
33538
33170
  if (!allowDeclaration) {
33539
- this.raise(Errors.UnexpectedLexicalDeclaration, {
33540
- at: this.state.startLoc
33541
- });
33171
+ this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
33542
33172
  }
33543
33173
  }
33544
33174
  case 74:
@@ -33564,9 +33194,7 @@ function requireLib () {
33564
33194
  case 82:
33565
33195
  {
33566
33196
  if (!this.options.allowImportExportEverywhere && !topLevel) {
33567
- this.raise(Errors.UnexpectedImportExport, {
33568
- at: this.state.startLoc
33569
- });
33197
+ this.raise(Errors.UnexpectedImportExport, this.state.startLoc);
33570
33198
  }
33571
33199
  this.next();
33572
33200
  let result;
@@ -33588,9 +33216,7 @@ function requireLib () {
33588
33216
  {
33589
33217
  if (this.isAsyncFunction()) {
33590
33218
  if (!allowDeclaration) {
33591
- this.raise(Errors.AsyncFunctionInSingleStatementContext, {
33592
- at: this.state.startLoc
33593
- });
33219
+ this.raise(Errors.AsyncFunctionInSingleStatementContext, this.state.startLoc);
33594
33220
  }
33595
33221
  this.next();
33596
33222
  return this.parseFunctionStatement(node, true, !allowDeclaration && allowFunctionDeclaration);
@@ -33607,9 +33233,7 @@ function requireLib () {
33607
33233
  }
33608
33234
  assertModuleNodeAllowed(node) {
33609
33235
  if (!this.options.allowImportExportEverywhere && !this.inModule) {
33610
- this.raise(Errors.ImportOutsideModule, {
33611
- at: node
33612
- });
33236
+ this.raise(Errors.ImportOutsideModule, node);
33613
33237
  }
33614
33238
  }
33615
33239
  decoratorsEnabledBeforeExport() {
@@ -33620,9 +33244,7 @@ function requireLib () {
33620
33244
  if (maybeDecorators) {
33621
33245
  if (classNode.decorators && classNode.decorators.length > 0) {
33622
33246
  if (typeof this.getPluginOption("decorators", "decoratorsBeforeExport") !== "boolean") {
33623
- this.raise(Errors.DecoratorsBeforeAfterExport, {
33624
- at: classNode.decorators[0]
33625
- });
33247
+ this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
33626
33248
  }
33627
33249
  classNode.decorators.unshift(...maybeDecorators);
33628
33250
  } else {
@@ -33646,14 +33268,10 @@ function requireLib () {
33646
33268
  this.unexpected();
33647
33269
  }
33648
33270
  if (!this.decoratorsEnabledBeforeExport()) {
33649
- this.raise(Errors.DecoratorExportClass, {
33650
- at: this.state.startLoc
33651
- });
33271
+ this.raise(Errors.DecoratorExportClass, this.state.startLoc);
33652
33272
  }
33653
33273
  } else if (!this.canHaveLeadingDecorator()) {
33654
- throw this.raise(Errors.UnexpectedLeadingDecorator, {
33655
- at: this.state.startLoc
33656
- });
33274
+ throw this.raise(Errors.UnexpectedLeadingDecorator, this.state.startLoc);
33657
33275
  }
33658
33276
  return decorators;
33659
33277
  }
@@ -33673,9 +33291,7 @@ function requireLib () {
33673
33291
  const paramsStartLoc = this.state.startLoc;
33674
33292
  node.expression = this.parseMaybeDecoratorArguments(expr);
33675
33293
  if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
33676
- this.raise(Errors.DecoratorArgumentsOutsideParentheses, {
33677
- at: paramsStartLoc
33678
- });
33294
+ this.raise(Errors.DecoratorArgumentsOutsideParentheses, paramsStartLoc);
33679
33295
  }
33680
33296
  } else {
33681
33297
  expr = this.parseIdentifier(false);
@@ -33724,14 +33340,15 @@ function requireLib () {
33724
33340
  for (i = 0; i < this.state.labels.length; ++i) {
33725
33341
  const lab = this.state.labels[i];
33726
33342
  if (node.label == null || lab.name === node.label.name) {
33727
- if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
33343
+ if (lab.kind != null && (isBreak || lab.kind === 1)) {
33344
+ break;
33345
+ }
33728
33346
  if (node.label && isBreak) break;
33729
33347
  }
33730
33348
  }
33731
33349
  if (i === this.state.labels.length) {
33732
33350
  const type = isBreak ? "BreakStatement" : "ContinueStatement";
33733
- this.raise(Errors.IllegalBreakContinue, {
33734
- at: node,
33351
+ this.raise(Errors.IllegalBreakContinue, node, {
33735
33352
  type
33736
33353
  });
33737
33354
  }
@@ -33783,9 +33400,7 @@ function requireLib () {
33783
33400
  if (startsWithAwaitUsing) {
33784
33401
  kind = "await using";
33785
33402
  if (!this.isAwaitAllowed()) {
33786
- this.raise(Errors.AwaitUsingNotInAsyncContext, {
33787
- at: this.state.startLoc
33788
- });
33403
+ this.raise(Errors.AwaitUsingNotInAsyncContext, this.state.startLoc);
33789
33404
  }
33790
33405
  this.next();
33791
33406
  } else {
@@ -33796,9 +33411,7 @@ function requireLib () {
33796
33411
  const init = this.finishNode(initNode, "VariableDeclaration");
33797
33412
  const isForIn = this.match(58);
33798
33413
  if (isForIn && starsWithUsingDeclaration) {
33799
- this.raise(Errors.ForInUsing, {
33800
- at: init
33801
- });
33414
+ this.raise(Errors.ForInUsing, init);
33802
33415
  }
33803
33416
  if ((isForIn || this.isContextual(102)) && init.declarations.length === 1) {
33804
33417
  return this.parseForIn(node, init, awaitAt);
@@ -33815,14 +33428,10 @@ function requireLib () {
33815
33428
  const isForOf = this.isContextual(102);
33816
33429
  if (isForOf) {
33817
33430
  if (startsWithLet) {
33818
- this.raise(Errors.ForOfLet, {
33819
- at: init
33820
- });
33431
+ this.raise(Errors.ForOfLet, init);
33821
33432
  }
33822
33433
  if (awaitAt === null && startsWithAsync && init.type === "Identifier") {
33823
- this.raise(Errors.ForOfAsync, {
33824
- at: init
33825
- });
33434
+ this.raise(Errors.ForOfAsync, init);
33826
33435
  }
33827
33436
  }
33828
33437
  if (isForOf || this.match(58)) {
@@ -33856,9 +33465,7 @@ function requireLib () {
33856
33465
  }
33857
33466
  parseReturnStatement(node) {
33858
33467
  if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) {
33859
- this.raise(Errors.IllegalReturn, {
33860
- at: this.state.startLoc
33861
- });
33468
+ this.raise(Errors.IllegalReturn, this.state.startLoc);
33862
33469
  }
33863
33470
  this.next();
33864
33471
  if (this.isLineTerminator()) {
@@ -33888,9 +33495,7 @@ function requireLib () {
33888
33495
  cur.test = this.parseExpression();
33889
33496
  } else {
33890
33497
  if (sawDefault) {
33891
- this.raise(Errors.MultipleDefaultsInSwitch, {
33892
- at: this.state.lastTokStartLoc
33893
- });
33498
+ this.raise(Errors.MultipleDefaultsInSwitch, this.state.lastTokStartLoc);
33894
33499
  }
33895
33500
  sawDefault = true;
33896
33501
  cur.test = null;
@@ -33913,9 +33518,7 @@ function requireLib () {
33913
33518
  parseThrowStatement(node) {
33914
33519
  this.next();
33915
33520
  if (this.hasPrecedingLineBreak()) {
33916
- this.raise(Errors.NewlineAfterThrow, {
33917
- at: this.state.lastTokEndLoc
33918
- });
33521
+ this.raise(Errors.NewlineAfterThrow, this.state.lastTokEndLoc);
33919
33522
  }
33920
33523
  node.argument = this.parseExpression();
33921
33524
  this.semicolon();
@@ -33953,9 +33556,7 @@ function requireLib () {
33953
33556
  }
33954
33557
  node.finalizer = this.eat(67) ? this.parseBlock() : null;
33955
33558
  if (!node.handler && !node.finalizer) {
33956
- this.raise(Errors.NoCatchOrFinally, {
33957
- at: node
33958
- });
33559
+ this.raise(Errors.NoCatchOrFinally, node);
33959
33560
  }
33960
33561
  return this.finishNode(node, "TryStatement");
33961
33562
  }
@@ -33975,9 +33576,7 @@ function requireLib () {
33975
33576
  }
33976
33577
  parseWithStatement(node) {
33977
33578
  if (this.state.strict) {
33978
- this.raise(Errors.StrictWith, {
33979
- at: this.state.startLoc
33980
- });
33579
+ this.raise(Errors.StrictWith, this.state.startLoc);
33981
33580
  }
33982
33581
  this.next();
33983
33582
  node.object = this.parseHeaderExpression();
@@ -33991,13 +33590,12 @@ function requireLib () {
33991
33590
  parseLabeledStatement(node, maybeName, expr, flags) {
33992
33591
  for (const label of this.state.labels) {
33993
33592
  if (label.name === maybeName) {
33994
- this.raise(Errors.LabelRedeclaration, {
33995
- at: expr,
33593
+ this.raise(Errors.LabelRedeclaration, expr, {
33996
33594
  labelName: maybeName
33997
33595
  });
33998
33596
  }
33999
33597
  }
34000
- const kind = tokenIsLoop(this.state.type) ? "loop" : this.match(71) ? "switch" : null;
33598
+ const kind = tokenIsLoop(this.state.type) ? 1 : this.match(71) ? 2 : null;
34001
33599
  for (let i = this.state.labels.length - 1; i >= 0; i--) {
34002
33600
  const label = this.state.labels[i];
34003
33601
  if (label.statementStart === node.start) {
@@ -34093,14 +33691,12 @@ function requireLib () {
34093
33691
  node.await = awaitAt !== null;
34094
33692
  }
34095
33693
  if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || !this.options.annexB || this.state.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) {
34096
- this.raise(Errors.ForInOfLoopInitializer, {
34097
- at: init,
33694
+ this.raise(Errors.ForInOfLoopInitializer, init, {
34098
33695
  type: isForIn ? "ForInStatement" : "ForOfStatement"
34099
33696
  });
34100
33697
  }
34101
33698
  if (init.type === "AssignmentPattern") {
34102
- this.raise(Errors.InvalidLhs, {
34103
- at: init,
33699
+ this.raise(Errors.InvalidLhs, init, {
34104
33700
  ancestor: {
34105
33701
  type: "ForStatement"
34106
33702
  }
@@ -34123,13 +33719,11 @@ function requireLib () {
34123
33719
  decl.init = !this.eat(29) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
34124
33720
  if (decl.init === null && !allowMissingInitializer) {
34125
33721
  if (decl.id.type !== "Identifier" && !(isFor && (this.match(58) || this.isContextual(102)))) {
34126
- this.raise(Errors.DeclarationMissingInitializer, {
34127
- at: this.state.lastTokEndLoc,
33722
+ this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
34128
33723
  kind: "destructuring"
34129
33724
  });
34130
33725
  } else if (kind === "const" && !(this.match(58) || this.isContextual(102))) {
34131
- this.raise(Errors.DeclarationMissingInitializer, {
34132
- at: this.state.lastTokEndLoc,
33726
+ this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
34133
33727
  kind: "const"
34134
33728
  });
34135
33729
  }
@@ -34160,9 +33754,7 @@ function requireLib () {
34160
33754
  this.initFunction(node, isAsync);
34161
33755
  if (this.match(55)) {
34162
33756
  if (hangingDeclaration) {
34163
- this.raise(Errors.GeneratorInSingleStatementContext, {
34164
- at: this.state.startLoc
34165
- });
33757
+ this.raise(Errors.GeneratorInSingleStatementContext, this.state.startLoc);
34166
33758
  }
34167
33759
  this.next();
34168
33760
  node.generator = true;
@@ -34234,9 +33826,7 @@ function requireLib () {
34234
33826
  while (!this.match(8)) {
34235
33827
  if (this.eat(13)) {
34236
33828
  if (decorators.length > 0) {
34237
- throw this.raise(Errors.DecoratorSemicolon, {
34238
- at: this.state.lastTokEndLoc
34239
- });
33829
+ throw this.raise(Errors.DecoratorSemicolon, this.state.lastTokEndLoc);
34240
33830
  }
34241
33831
  continue;
34242
33832
  }
@@ -34252,18 +33842,14 @@ function requireLib () {
34252
33842
  }
34253
33843
  this.parseClassMember(classBody, member, state);
34254
33844
  if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
34255
- this.raise(Errors.DecoratorConstructor, {
34256
- at: member
34257
- });
33845
+ this.raise(Errors.DecoratorConstructor, member);
34258
33846
  }
34259
33847
  }
34260
33848
  });
34261
33849
  this.state.strict = oldStrict;
34262
33850
  this.next();
34263
33851
  if (decorators.length) {
34264
- throw this.raise(Errors.TrailingDecorator, {
34265
- at: this.state.startLoc
34266
- });
33852
+ throw this.raise(Errors.TrailingDecorator, this.state.startLoc);
34267
33853
  }
34268
33854
  this.classScope.exit();
34269
33855
  return this.finishNode(classBody, "ClassBody");
@@ -34321,9 +33907,7 @@ function requireLib () {
34321
33907
  return;
34322
33908
  }
34323
33909
  if (this.isNonstaticConstructor(publicMethod)) {
34324
- this.raise(Errors.ConstructorIsGenerator, {
34325
- at: publicMethod.key
34326
- });
33910
+ this.raise(Errors.ConstructorIsGenerator, publicMethod.key);
34327
33911
  }
34328
33912
  this.pushClassMethod(classBody, publicMethod, true, false, false, false);
34329
33913
  return;
@@ -34344,14 +33928,10 @@ function requireLib () {
34344
33928
  if (isConstructor) {
34345
33929
  publicMethod.kind = "constructor";
34346
33930
  if (state.hadConstructor && !this.hasPlugin("typescript")) {
34347
- this.raise(Errors.DuplicateConstructor, {
34348
- at: key
34349
- });
33931
+ this.raise(Errors.DuplicateConstructor, key);
34350
33932
  }
34351
33933
  if (isConstructor && this.hasPlugin("typescript") && member.override) {
34352
- this.raise(Errors.OverrideOnConstructor, {
34353
- at: key
34354
- });
33934
+ this.raise(Errors.OverrideOnConstructor, key);
34355
33935
  }
34356
33936
  state.hadConstructor = true;
34357
33937
  allowsDirectSuper = state.hadSuperClass;
@@ -34377,9 +33957,7 @@ function requireLib () {
34377
33957
  this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
34378
33958
  } else {
34379
33959
  if (this.isNonstaticConstructor(publicMethod)) {
34380
- this.raise(Errors.ConstructorIsAsync, {
34381
- at: publicMethod.key
34382
- });
33960
+ this.raise(Errors.ConstructorIsAsync, publicMethod.key);
34383
33961
  }
34384
33962
  this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
34385
33963
  }
@@ -34392,9 +33970,7 @@ function requireLib () {
34392
33970
  this.pushClassPrivateMethod(classBody, privateMethod, false, false);
34393
33971
  } else {
34394
33972
  if (this.isNonstaticConstructor(publicMethod)) {
34395
- this.raise(Errors.ConstructorIsAccessor, {
34396
- at: publicMethod.key
34397
- });
33973
+ this.raise(Errors.ConstructorIsAccessor, publicMethod.key);
34398
33974
  }
34399
33975
  this.pushClassMethod(classBody, publicMethod, false, false, false, false);
34400
33976
  }
@@ -34421,15 +33997,11 @@ function requireLib () {
34421
33997
  value
34422
33998
  } = this.state;
34423
33999
  if ((type === 132 || type === 133) && member.static && value === "prototype") {
34424
- this.raise(Errors.StaticPrototype, {
34425
- at: this.state.startLoc
34426
- });
34000
+ this.raise(Errors.StaticPrototype, this.state.startLoc);
34427
34001
  }
34428
34002
  if (type === 138) {
34429
34003
  if (value === "constructor") {
34430
- this.raise(Errors.ConstructorClassPrivateField, {
34431
- at: this.state.startLoc
34432
- });
34004
+ this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
34433
34005
  }
34434
34006
  const key = this.parsePrivateName();
34435
34007
  member.key = key;
@@ -34450,16 +34022,12 @@ function requireLib () {
34450
34022
  this.state.labels = oldLabels;
34451
34023
  classBody.body.push(this.finishNode(member, "StaticBlock"));
34452
34024
  if ((_member$decorators = member.decorators) != null && _member$decorators.length) {
34453
- this.raise(Errors.DecoratorStaticBlock, {
34454
- at: member
34455
- });
34025
+ this.raise(Errors.DecoratorStaticBlock, member);
34456
34026
  }
34457
34027
  }
34458
34028
  pushClassProperty(classBody, prop) {
34459
34029
  if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) {
34460
- this.raise(Errors.ConstructorClassField, {
34461
- at: prop.key
34462
- });
34030
+ this.raise(Errors.ConstructorClassField, prop.key);
34463
34031
  }
34464
34032
  classBody.body.push(this.parseClassProperty(prop));
34465
34033
  }
@@ -34472,9 +34040,7 @@ function requireLib () {
34472
34040
  if (!isPrivate && !prop.computed) {
34473
34041
  const key = prop.key;
34474
34042
  if (key.name === "constructor" || key.value === "constructor") {
34475
- this.raise(Errors.ConstructorClassField, {
34476
- at: key
34477
- });
34043
+ this.raise(Errors.ConstructorClassField, key);
34478
34044
  }
34479
34045
  }
34480
34046
  const node = this.parseClassAccessorProperty(prop);
@@ -34530,9 +34096,7 @@ function requireLib () {
34530
34096
  if (optionalId || !isStatement) {
34531
34097
  node.id = null;
34532
34098
  } else {
34533
- throw this.raise(Errors.MissingClassName, {
34534
- at: this.state.startLoc
34535
- });
34099
+ throw this.raise(Errors.MissingClassName, this.state.startLoc);
34536
34100
  }
34537
34101
  }
34538
34102
  }
@@ -34550,9 +34114,7 @@ function requireLib () {
34550
34114
  if (hasStar && !hasNamespace) {
34551
34115
  if (hasDefault) this.unexpected();
34552
34116
  if (decorators) {
34553
- throw this.raise(Errors.UnsupportedDecoratorExport, {
34554
- at: node
34555
- });
34117
+ throw this.raise(Errors.UnsupportedDecoratorExport, node);
34556
34118
  }
34557
34119
  this.parseExportFrom(node, true);
34558
34120
  return this.finishNode(node, "ExportAllDeclaration");
@@ -34568,9 +34130,7 @@ function requireLib () {
34568
34130
  if (isFromRequired || hasSpecifiers) {
34569
34131
  hasDeclaration = false;
34570
34132
  if (decorators) {
34571
- throw this.raise(Errors.UnsupportedDecoratorExport, {
34572
- at: node
34573
- });
34133
+ throw this.raise(Errors.UnsupportedDecoratorExport, node);
34574
34134
  }
34575
34135
  this.parseExportFrom(node, isFromRequired);
34576
34136
  } else {
@@ -34583,9 +34143,7 @@ function requireLib () {
34583
34143
  if (((_node2$declaration = node2.declaration) == null ? void 0 : _node2$declaration.type) === "ClassDeclaration") {
34584
34144
  this.maybeTakeDecorators(decorators, node2.declaration, node2);
34585
34145
  } else if (decorators) {
34586
- throw this.raise(Errors.UnsupportedDecoratorExport, {
34587
- at: node
34588
- });
34146
+ throw this.raise(Errors.UnsupportedDecoratorExport, node);
34589
34147
  }
34590
34148
  return this.finishNode(node2, "ExportNamedDeclaration");
34591
34149
  }
@@ -34596,9 +34154,7 @@ function requireLib () {
34596
34154
  if (decl.type === "ClassDeclaration") {
34597
34155
  this.maybeTakeDecorators(decorators, decl, node2);
34598
34156
  } else if (decorators) {
34599
- throw this.raise(Errors.UnsupportedDecoratorExport, {
34600
- at: node
34601
- });
34157
+ throw this.raise(Errors.UnsupportedDecoratorExport, node);
34602
34158
  }
34603
34159
  this.checkExport(node2, true, true);
34604
34160
  return this.finishNode(node2, "ExportDefaultDeclaration");
@@ -34676,16 +34232,12 @@ function requireLib () {
34676
34232
  }
34677
34233
  if (this.match(26)) {
34678
34234
  if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
34679
- this.raise(Errors.DecoratorBeforeExport, {
34680
- at: this.state.startLoc
34681
- });
34235
+ this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
34682
34236
  }
34683
34237
  return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
34684
34238
  }
34685
34239
  if (this.match(75) || this.match(74) || this.isLet()) {
34686
- throw this.raise(Errors.UnsupportedDefaultExport, {
34687
- at: this.state.startLoc
34688
- });
34240
+ throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
34689
34241
  }
34690
34242
  const res = this.parseMaybeAssignAllowIn();
34691
34243
  this.semicolon();
@@ -34748,9 +34300,7 @@ function requireLib () {
34748
34300
  this.expectOnePlugin(["decorators", "decorators-legacy"]);
34749
34301
  if (this.hasPlugin("decorators")) {
34750
34302
  if (this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
34751
- this.raise(Errors.DecoratorBeforeExport, {
34752
- at: this.state.startLoc
34753
- });
34303
+ this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
34754
34304
  }
34755
34305
  return true;
34756
34306
  }
@@ -34766,9 +34316,7 @@ function requireLib () {
34766
34316
  var _declaration$extra;
34767
34317
  const declaration = node.declaration;
34768
34318
  if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) {
34769
- this.raise(Errors.ExportDefaultFromAsIdentifier, {
34770
- at: declaration
34771
- });
34319
+ this.raise(Errors.ExportDefaultFromAsIdentifier, declaration);
34772
34320
  }
34773
34321
  }
34774
34322
  } else if ((_node$specifiers = node.specifiers) != null && _node$specifiers.length) {
@@ -34783,8 +34331,7 @@ function requireLib () {
34783
34331
  local
34784
34332
  } = specifier;
34785
34333
  if (local.type !== "Identifier") {
34786
- this.raise(Errors.ExportBindingIsString, {
34787
- at: specifier,
34334
+ this.raise(Errors.ExportBindingIsString, specifier, {
34788
34335
  localName: local.value,
34789
34336
  exportName
34790
34337
  });
@@ -34831,12 +34378,9 @@ function requireLib () {
34831
34378
  checkDuplicateExports(node, exportName) {
34832
34379
  if (this.exportedIdentifiers.has(exportName)) {
34833
34380
  if (exportName === "default") {
34834
- this.raise(Errors.DuplicateDefaultExport, {
34835
- at: node
34836
- });
34381
+ this.raise(Errors.DuplicateDefaultExport, node);
34837
34382
  } else {
34838
- this.raise(Errors.DuplicateExport, {
34839
- at: node,
34383
+ this.raise(Errors.DuplicateExport, node, {
34840
34384
  exportName
34841
34385
  });
34842
34386
  }
@@ -34877,8 +34421,7 @@ function requireLib () {
34877
34421
  const result = this.parseStringLiteral(this.state.value);
34878
34422
  const surrogate = result.value.match(loneSurrogate);
34879
34423
  if (surrogate) {
34880
- this.raise(Errors.ModuleExportNameHasLoneSurrogate, {
34881
- at: result,
34424
+ this.raise(Errors.ModuleExportNameHasLoneSurrogate, result, {
34882
34425
  surrogateCharCode: surrogate[0].charCodeAt(0)
34883
34426
  });
34884
34427
  }
@@ -34904,27 +34447,19 @@ function requireLib () {
34904
34447
  const singleBindingType = specifiers.length === 1 ? specifiers[0].type : null;
34905
34448
  if (node.phase === "source") {
34906
34449
  if (singleBindingType !== "ImportDefaultSpecifier") {
34907
- this.raise(Errors.SourcePhaseImportRequiresDefault, {
34908
- at: specifiers[0].loc.start
34909
- });
34450
+ this.raise(Errors.SourcePhaseImportRequiresDefault, specifiers[0].loc.start);
34910
34451
  }
34911
34452
  } else if (node.phase === "defer") {
34912
34453
  if (singleBindingType !== "ImportNamespaceSpecifier") {
34913
- this.raise(Errors.DeferImportRequiresNamespace, {
34914
- at: specifiers[0].loc.start
34915
- });
34454
+ this.raise(Errors.DeferImportRequiresNamespace, specifiers[0].loc.start);
34916
34455
  }
34917
34456
  } else if (node.module) {
34918
34457
  var _node$assertions;
34919
34458
  if (singleBindingType !== "ImportDefaultSpecifier") {
34920
- this.raise(Errors.ImportReflectionNotBinding, {
34921
- at: specifiers[0].loc.start
34922
- });
34459
+ this.raise(Errors.ImportReflectionNotBinding, specifiers[0].loc.start);
34923
34460
  }
34924
34461
  if (((_node$assertions = node.assertions) == null ? void 0 : _node$assertions.length) > 0) {
34925
- this.raise(Errors.ImportReflectionHasAssertion, {
34926
- at: node.specifiers[0].loc.start
34927
- });
34462
+ this.raise(Errors.ImportReflectionHasAssertion, specifiers[0].loc.start);
34928
34463
  }
34929
34464
  }
34930
34465
  }
@@ -34946,9 +34481,7 @@ function requireLib () {
34946
34481
  }
34947
34482
  });
34948
34483
  if (nonDefaultNamedSpecifier !== undefined) {
34949
- this.raise(Errors.ImportJSONBindingNotDefault, {
34950
- at: nonDefaultNamedSpecifier.loc.start
34951
- });
34484
+ this.raise(Errors.ImportJSONBindingNotDefault, nonDefaultNamedSpecifier.loc.start);
34952
34485
  }
34953
34486
  }
34954
34487
  }
@@ -35055,8 +34588,7 @@ function requireLib () {
35055
34588
  const node = this.startNode();
35056
34589
  const keyName = this.state.value;
35057
34590
  if (attrNames.has(keyName)) {
35058
- this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
35059
- at: this.state.startLoc,
34591
+ this.raise(Errors.ModuleAttributesWithDuplicateKeys, this.state.startLoc, {
35060
34592
  key: keyName
35061
34593
  });
35062
34594
  }
@@ -35068,9 +34600,7 @@ function requireLib () {
35068
34600
  }
35069
34601
  this.expect(14);
35070
34602
  if (!this.match(133)) {
35071
- throw this.raise(Errors.ModuleAttributeInvalidValue, {
35072
- at: this.state.startLoc
35073
- });
34603
+ throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
35074
34604
  }
35075
34605
  node.value = this.parseStringLiteral(this.state.value);
35076
34606
  attrs.push(this.finishNode(node, "ImportAttribute"));
@@ -35085,22 +34615,17 @@ function requireLib () {
35085
34615
  const node = this.startNode();
35086
34616
  node.key = this.parseIdentifier(true);
35087
34617
  if (node.key.name !== "type") {
35088
- this.raise(Errors.ModuleAttributeDifferentFromType, {
35089
- at: node.key
35090
- });
34618
+ this.raise(Errors.ModuleAttributeDifferentFromType, node.key);
35091
34619
  }
35092
34620
  if (attributes.has(node.key.name)) {
35093
- this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
35094
- at: node.key,
34621
+ this.raise(Errors.ModuleAttributesWithDuplicateKeys, node.key, {
35095
34622
  key: node.key.name
35096
34623
  });
35097
34624
  }
35098
34625
  attributes.add(node.key.name);
35099
34626
  this.expect(14);
35100
34627
  if (!this.match(133)) {
35101
- throw this.raise(Errors.ModuleAttributeInvalidValue, {
35102
- at: this.state.startLoc
35103
- });
34628
+ throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
35104
34629
  }
35105
34630
  node.value = this.parseStringLiteral(this.state.value);
35106
34631
  attrs.push(this.finishNode(node, "ImportAttribute"));
@@ -35127,9 +34652,7 @@ function requireLib () {
35127
34652
  } else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
35128
34653
  if (this.hasPlugin("importAttributes")) {
35129
34654
  if (this.getPluginOption("importAttributes", "deprecatedAssertSyntax") !== true) {
35130
- this.raise(Errors.ImportAttributesUseAssert, {
35131
- at: this.state.startLoc
35132
- });
34655
+ this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
35133
34656
  }
35134
34657
  this.addExtra(node, "deprecatedAssertSyntax", true);
35135
34658
  } else {
@@ -35180,9 +34703,7 @@ function requireLib () {
35180
34703
  first = false;
35181
34704
  } else {
35182
34705
  if (this.eat(14)) {
35183
- throw this.raise(Errors.DestructureNamedImport, {
35184
- at: this.state.startLoc
35185
- });
34706
+ throw this.raise(Errors.DestructureNamedImport, this.state.startLoc);
35186
34707
  }
35187
34708
  this.expect(12);
35188
34709
  if (this.eat(8)) break;
@@ -35203,8 +34724,7 @@ function requireLib () {
35203
34724
  imported
35204
34725
  } = specifier;
35205
34726
  if (importedIsString) {
35206
- throw this.raise(Errors.ImportBindingIsString, {
35207
- at: specifier,
34727
+ throw this.raise(Errors.ImportBindingIsString, specifier, {
35208
34728
  importName: imported.value
35209
34729
  });
35210
34730
  }
@@ -35239,6 +34759,7 @@ function requireLib () {
35239
34759
  file.errors = null;
35240
34760
  this.parseTopLevel(file, program);
35241
34761
  file.errors = this.state.errors;
34762
+ file.comments.length = this.state.commentsLen;
35242
34763
  return file;
35243
34764
  }
35244
34765
  }
@@ -36035,4 +35556,4 @@ exports.getExtractMessagesConfig = getExtractMessagesConfig;
36035
35556
  exports.rollupTask = rollupTask;
36036
35557
  exports.rollupWatchTask = rollupWatchTask;
36037
35558
  exports.watchTaskHandlers = watchTaskHandlers;
36038
- //# sourceMappingURL=index-YSy1xob6.cjs.map
35559
+ //# sourceMappingURL=index-FaD5mo-6.cjs.map