@sanity/pkg-utils 4.1.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.
package/dist/index.js CHANGED
@@ -22046,8 +22046,8 @@ function requireLib () {
22046
22046
  PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
22047
22047
  PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
22048
22048
  };
22049
- const _excluded$1 = ["toMessage"],
22050
- _excluded2$1 = ["message"];
22049
+ const _excluded = ["toMessage"],
22050
+ _excluded2 = ["message"];
22051
22051
  function defineHidden(obj, key, value) {
22052
22052
  Object.defineProperty(obj, key, {
22053
22053
  enumerable: false,
@@ -22059,11 +22059,8 @@ function requireLib () {
22059
22059
  let {
22060
22060
  toMessage
22061
22061
  } = _ref,
22062
- properties = _objectWithoutPropertiesLoose(_ref, _excluded$1);
22063
- return function constructor({
22064
- loc,
22065
- details
22066
- }) {
22062
+ properties = _objectWithoutPropertiesLoose(_ref, _excluded);
22063
+ return function constructor(loc, details) {
22067
22064
  const error = new SyntaxError();
22068
22065
  Object.assign(error, properties, {
22069
22066
  loc,
@@ -22081,10 +22078,7 @@ function requireLib () {
22081
22078
  column,
22082
22079
  index
22083
22080
  } = (_overrides$loc = overrides.loc) != null ? _overrides$loc : loc;
22084
- return constructor({
22085
- loc: new Position(line, column, index),
22086
- details: Object.assign({}, details, overrides.details)
22087
- });
22081
+ return constructor(new Position(line, column, index), Object.assign({}, details, overrides.details));
22088
22082
  });
22089
22083
  defineHidden(error, "details", details);
22090
22084
  Object.defineProperty(error, "message", {
@@ -22119,7 +22113,7 @@ function requireLib () {
22119
22113
  {
22120
22114
  message
22121
22115
  } = _ref2,
22122
- rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);
22116
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
22123
22117
  const toMessage = typeof message === "string" ? () => message : message;
22124
22118
  ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
22125
22119
  code: "BABEL_PARSER_SYNTAX_ERROR",
@@ -22364,13 +22358,9 @@ function requireLib () {
22364
22358
  }
22365
22359
  toAssignableObjectExpressionProp(prop, isLast, isLHS) {
22366
22360
  if (prop.kind === "get" || prop.kind === "set") {
22367
- this.raise(Errors.PatternHasAccessor, {
22368
- at: prop.key
22369
- });
22361
+ this.raise(Errors.PatternHasAccessor, prop.key);
22370
22362
  } else if (prop.method) {
22371
- this.raise(Errors.PatternHasMethod, {
22372
- at: prop.key
22373
- });
22363
+ this.raise(Errors.PatternHasMethod, prop.key);
22374
22364
  } else {
22375
22365
  super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
22376
22366
  }
@@ -23106,9 +23096,9 @@ function requireLib () {
23106
23096
  }
23107
23097
  class Scope {
23108
23098
  constructor(flags) {
23109
- this.var = new Set();
23110
- this.lexical = new Set();
23111
- this.functions = new Set();
23099
+ this.flags = 0;
23100
+ this.names = new Map();
23101
+ this.firstLexicalName = "";
23112
23102
  this.flags = flags;
23113
23103
  }
23114
23104
  }
@@ -23176,11 +23166,16 @@ function requireLib () {
23176
23166
  let scope = this.currentScope();
23177
23167
  if (bindingType & 8 || bindingType & 16) {
23178
23168
  this.checkRedeclarationInScope(scope, name, bindingType, loc);
23169
+ let type = scope.names.get(name) || 0;
23179
23170
  if (bindingType & 16) {
23180
- scope.functions.add(name);
23171
+ type = type | 4;
23181
23172
  } else {
23182
- scope.lexical.add(name);
23173
+ if (!scope.firstLexicalName) {
23174
+ scope.firstLexicalName = name;
23175
+ }
23176
+ type = type | 2;
23183
23177
  }
23178
+ scope.names.set(name, type);
23184
23179
  if (bindingType & 8) {
23185
23180
  this.maybeExportDefined(scope, name);
23186
23181
  }
@@ -23188,7 +23183,7 @@ function requireLib () {
23188
23183
  for (let i = this.scopeStack.length - 1; i >= 0; --i) {
23189
23184
  scope = this.scopeStack[i];
23190
23185
  this.checkRedeclarationInScope(scope, name, bindingType, loc);
23191
- scope.var.add(name);
23186
+ scope.names.set(name, (scope.names.get(name) || 0) | 1);
23192
23187
  this.maybeExportDefined(scope, name);
23193
23188
  if (scope.flags & 387) break;
23194
23189
  }
@@ -23204,8 +23199,7 @@ function requireLib () {
23204
23199
  }
23205
23200
  checkRedeclarationInScope(scope, name, bindingType, loc) {
23206
23201
  if (this.isRedeclaredInScope(scope, name, bindingType)) {
23207
- this.parser.raise(Errors.VarRedeclaration, {
23208
- at: loc,
23202
+ this.parser.raise(Errors.VarRedeclaration, loc, {
23209
23203
  identifierName: name
23210
23204
  });
23211
23205
  }
@@ -23213,19 +23207,20 @@ function requireLib () {
23213
23207
  isRedeclaredInScope(scope, name, bindingType) {
23214
23208
  if (!(bindingType & 1)) return false;
23215
23209
  if (bindingType & 8) {
23216
- return scope.lexical.has(name) || scope.functions.has(name) || scope.var.has(name);
23210
+ return scope.names.has(name);
23217
23211
  }
23212
+ const type = scope.names.get(name);
23218
23213
  if (bindingType & 16) {
23219
- return scope.lexical.has(name) || !this.treatFunctionsAsVarInScope(scope) && scope.var.has(name);
23214
+ return (type & 2) > 0 || !this.treatFunctionsAsVarInScope(scope) && (type & 1) > 0;
23220
23215
  }
23221
- return scope.lexical.has(name) && !(scope.flags & 8 && scope.lexical.values().next().value === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.has(name);
23216
+ return (type & 2) > 0 && !(scope.flags & 8 && scope.firstLexicalName === name) || !this.treatFunctionsAsVarInScope(scope) && (type & 4) > 0;
23222
23217
  }
23223
23218
  checkLocalExport(id) {
23224
23219
  const {
23225
23220
  name
23226
23221
  } = id;
23227
23222
  const topLevelScope = this.scopeStack[0];
23228
- if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) && !topLevelScope.functions.has(name)) {
23223
+ if (!topLevelScope.names.has(name)) {
23229
23224
  this.undefinedExports.set(name, id.loc.start);
23230
23225
  }
23231
23226
  }
@@ -23275,8 +23270,9 @@ function requireLib () {
23275
23270
  }
23276
23271
  isRedeclaredInScope(scope, name, bindingType) {
23277
23272
  if (super.isRedeclaredInScope(scope, name, bindingType)) return true;
23278
- if (bindingType & 2048) {
23279
- return !scope.declareFunctions.has(name) && (scope.lexical.has(name) || scope.functions.has(name));
23273
+ if (bindingType & 2048 && !scope.declareFunctions.has(name)) {
23274
+ const type = scope.names.get(name);
23275
+ return (type & 4) > 0 || (type & 2) > 0;
23280
23276
  }
23281
23277
  return false;
23282
23278
  }
@@ -23349,7 +23345,12 @@ function requireLib () {
23349
23345
  class CommentsParser extends BaseParser {
23350
23346
  addComment(comment) {
23351
23347
  if (this.filename) comment.loc.filename = this.filename;
23352
- this.state.comments.push(comment);
23348
+ const {
23349
+ commentsLen
23350
+ } = this.state;
23351
+ if (this.comments.length != commentsLen) this.comments.length = commentsLen;
23352
+ this.comments.push(comment);
23353
+ this.state.commentsLen++;
23353
23354
  }
23354
23355
  processComment(node) {
23355
23356
  const {
@@ -23538,7 +23539,7 @@ function requireLib () {
23538
23539
  }
23539
23540
  class State {
23540
23541
  constructor() {
23541
- this.strict = void 0;
23542
+ this.flags = 1024;
23542
23543
  this.curLine = void 0;
23543
23544
  this.lineStart = void 0;
23544
23545
  this.startLoc = void 0;
@@ -23547,21 +23548,12 @@ function requireLib () {
23547
23548
  this.potentialArrowAt = -1;
23548
23549
  this.noArrowAt = [];
23549
23550
  this.noArrowParamsConversionAt = [];
23550
- this.maybeInArrowParameters = false;
23551
- this.inType = false;
23552
- this.noAnonFunctionType = false;
23553
- this.hasFlowComment = false;
23554
- this.isAmbientContext = false;
23555
- this.inAbstractClass = false;
23556
- this.inDisallowConditionalTypesContext = false;
23557
23551
  this.topicContext = {
23558
23552
  maxNumOfResolvableTopics: 0,
23559
23553
  maxTopicIndex: null
23560
23554
  };
23561
- this.soloAwait = false;
23562
- this.inFSharpPipelineDirectBody = false;
23563
23555
  this.labels = [];
23564
- this.comments = [];
23556
+ this.commentsLen = 0;
23565
23557
  this.commentStack = [];
23566
23558
  this.pos = 0;
23567
23559
  this.type = 139;
@@ -23570,14 +23562,21 @@ function requireLib () {
23570
23562
  this.end = 0;
23571
23563
  this.lastTokEndLoc = null;
23572
23564
  this.lastTokStartLoc = null;
23573
- this.lastTokStart = 0;
23574
23565
  this.context = [types.brace];
23575
- this.canStartJSXElement = true;
23576
- this.containsEsc = false;
23577
23566
  this.firstInvalidTemplateEscapePos = null;
23578
23567
  this.strictErrors = new Map();
23579
23568
  this.tokensLength = 0;
23580
23569
  }
23570
+ get strict() {
23571
+ return (this.flags & 1) > 0;
23572
+ }
23573
+ set strict(value) {
23574
+ if (value) {
23575
+ this.flags |= 1;
23576
+ } else {
23577
+ this.flags &= ~1;
23578
+ }
23579
+ }
23581
23580
  init({
23582
23581
  strictMode,
23583
23582
  sourceType,
@@ -23589,20 +23588,145 @@ function requireLib () {
23589
23588
  this.lineStart = -startColumn;
23590
23589
  this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
23591
23590
  }
23591
+ get maybeInArrowParameters() {
23592
+ return (this.flags & 2) > 0;
23593
+ }
23594
+ set maybeInArrowParameters(value) {
23595
+ if (value) {
23596
+ this.flags |= 2;
23597
+ } else {
23598
+ this.flags &= ~2;
23599
+ }
23600
+ }
23601
+ get inType() {
23602
+ return (this.flags & 4) > 0;
23603
+ }
23604
+ set inType(value) {
23605
+ if (value) {
23606
+ this.flags |= 4;
23607
+ } else {
23608
+ this.flags &= ~4;
23609
+ }
23610
+ }
23611
+ get noAnonFunctionType() {
23612
+ return (this.flags & 8) > 0;
23613
+ }
23614
+ set noAnonFunctionType(value) {
23615
+ if (value) {
23616
+ this.flags |= 8;
23617
+ } else {
23618
+ this.flags &= ~8;
23619
+ }
23620
+ }
23621
+ get hasFlowComment() {
23622
+ return (this.flags & 16) > 0;
23623
+ }
23624
+ set hasFlowComment(value) {
23625
+ if (value) {
23626
+ this.flags |= 16;
23627
+ } else {
23628
+ this.flags &= ~16;
23629
+ }
23630
+ }
23631
+ get isAmbientContext() {
23632
+ return (this.flags & 32) > 0;
23633
+ }
23634
+ set isAmbientContext(value) {
23635
+ if (value) {
23636
+ this.flags |= 32;
23637
+ } else {
23638
+ this.flags &= ~32;
23639
+ }
23640
+ }
23641
+ get inAbstractClass() {
23642
+ return (this.flags & 64) > 0;
23643
+ }
23644
+ set inAbstractClass(value) {
23645
+ if (value) {
23646
+ this.flags |= 64;
23647
+ } else {
23648
+ this.flags &= ~64;
23649
+ }
23650
+ }
23651
+ get inDisallowConditionalTypesContext() {
23652
+ return (this.flags & 128) > 0;
23653
+ }
23654
+ set inDisallowConditionalTypesContext(value) {
23655
+ if (value) {
23656
+ this.flags |= 128;
23657
+ } else {
23658
+ this.flags &= ~128;
23659
+ }
23660
+ }
23661
+ get soloAwait() {
23662
+ return (this.flags & 256) > 0;
23663
+ }
23664
+ set soloAwait(value) {
23665
+ if (value) {
23666
+ this.flags |= 256;
23667
+ } else {
23668
+ this.flags &= ~256;
23669
+ }
23670
+ }
23671
+ get inFSharpPipelineDirectBody() {
23672
+ return (this.flags & 512) > 0;
23673
+ }
23674
+ set inFSharpPipelineDirectBody(value) {
23675
+ if (value) {
23676
+ this.flags |= 512;
23677
+ } else {
23678
+ this.flags &= ~512;
23679
+ }
23680
+ }
23681
+ get canStartJSXElement() {
23682
+ return (this.flags & 1024) > 0;
23683
+ }
23684
+ set canStartJSXElement(value) {
23685
+ if (value) {
23686
+ this.flags |= 1024;
23687
+ } else {
23688
+ this.flags &= ~1024;
23689
+ }
23690
+ }
23691
+ get containsEsc() {
23692
+ return (this.flags & 2048) > 0;
23693
+ }
23694
+ set containsEsc(value) {
23695
+ if (value) {
23696
+ this.flags |= 2048;
23697
+ } else {
23698
+ this.flags &= ~2048;
23699
+ }
23700
+ }
23592
23701
  curPosition() {
23593
23702
  return new Position(this.curLine, this.pos - this.lineStart, this.pos);
23594
23703
  }
23595
- clone(skipArrays) {
23704
+ clone() {
23596
23705
  const state = new State();
23597
- const keys = Object.keys(this);
23598
- for (let i = 0, length = keys.length; i < length; i++) {
23599
- const key = keys[i];
23600
- let val = this[key];
23601
- if (!skipArrays && Array.isArray(val)) {
23602
- val = val.slice();
23603
- }
23604
- state[key] = val;
23605
- }
23706
+ state.flags = this.flags;
23707
+ state.curLine = this.curLine;
23708
+ state.lineStart = this.lineStart;
23709
+ state.startLoc = this.startLoc;
23710
+ state.endLoc = this.endLoc;
23711
+ state.errors = this.errors.slice();
23712
+ state.potentialArrowAt = this.potentialArrowAt;
23713
+ state.noArrowAt = this.noArrowAt.slice();
23714
+ state.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice();
23715
+ state.topicContext = this.topicContext;
23716
+ state.labels = this.labels.slice();
23717
+ state.commentsLen = this.commentsLen;
23718
+ state.commentStack = this.commentStack.slice();
23719
+ state.pos = this.pos;
23720
+ state.type = this.type;
23721
+ state.value = this.value;
23722
+ state.start = this.start;
23723
+ state.end = this.end;
23724
+ state.lastTokEndLoc = this.lastTokEndLoc;
23725
+ state.lastTokStartLoc = this.lastTokStartLoc;
23726
+ state.context = this.context.slice();
23727
+ state.firstInvalidTemplateEscapePos = this.firstInvalidTemplateEscapePos;
23728
+ state.strictErrors = this.strictErrors;
23729
+ state.tokensLength = this.tokensLength;
23606
23730
  return state;
23607
23731
  }
23608
23732
  }
@@ -23891,8 +24015,6 @@ function requireLib () {
23891
24015
  pos
23892
24016
  };
23893
24017
  }
23894
- const _excluded = ["at"],
23895
- _excluded2 = ["at"];
23896
24018
  function buildPosition(pos, lineStart, curLine) {
23897
24019
  return new Position(curLine, pos - lineStart, pos);
23898
24020
  }
@@ -23914,8 +24036,7 @@ function requireLib () {
23914
24036
  this.errorHandlers_readInt = {
23915
24037
  invalidDigit: (pos, lineStart, curLine, radix) => {
23916
24038
  if (!this.options.errorRecovery) return false;
23917
- this.raise(Errors.InvalidDigit, {
23918
- at: buildPosition(pos, lineStart, curLine),
24039
+ this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
23919
24040
  radix
23920
24041
  });
23921
24042
  return true;
@@ -23929,28 +24050,23 @@ function requireLib () {
23929
24050
  });
23930
24051
  this.errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, {
23931
24052
  strictNumericEscape: (pos, lineStart, curLine) => {
23932
- this.recordStrictModeErrors(Errors.StrictNumericEscape, {
23933
- at: buildPosition(pos, lineStart, curLine)
23934
- });
24053
+ this.recordStrictModeErrors(Errors.StrictNumericEscape, buildPosition(pos, lineStart, curLine));
23935
24054
  },
23936
24055
  unterminated: (pos, lineStart, curLine) => {
23937
- throw this.raise(Errors.UnterminatedString, {
23938
- at: buildPosition(pos - 1, lineStart, curLine)
23939
- });
24056
+ throw this.raise(Errors.UnterminatedString, buildPosition(pos - 1, lineStart, curLine));
23940
24057
  }
23941
24058
  });
23942
24059
  this.errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, {
23943
24060
  strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
23944
24061
  unterminated: (pos, lineStart, curLine) => {
23945
- throw this.raise(Errors.UnterminatedTemplate, {
23946
- at: buildPosition(pos, lineStart, curLine)
23947
- });
24062
+ throw this.raise(Errors.UnterminatedTemplate, buildPosition(pos, lineStart, curLine));
23948
24063
  }
23949
24064
  });
23950
24065
  this.state = new State();
23951
24066
  this.state.init(options);
23952
24067
  this.input = input;
23953
24068
  this.length = input.length;
24069
+ this.comments = [];
23954
24070
  this.isLookahead = false;
23955
24071
  }
23956
24072
  pushToken(token) {
@@ -23963,7 +24079,6 @@ function requireLib () {
23963
24079
  if (this.options.tokens) {
23964
24080
  this.pushToken(new Token(this.state));
23965
24081
  }
23966
- this.state.lastTokStart = this.state.start;
23967
24082
  this.state.lastTokEndLoc = this.state.endLoc;
23968
24083
  this.state.lastTokStartLoc = this.state.startLoc;
23969
24084
  this.nextToken();
@@ -24038,9 +24153,7 @@ function requireLib () {
24038
24153
  setStrict(strict) {
24039
24154
  this.state.strict = strict;
24040
24155
  if (strict) {
24041
- this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, {
24042
- at
24043
- }));
24156
+ this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, at));
24044
24157
  this.state.strictErrors.clear();
24045
24158
  }
24046
24159
  }
@@ -24063,9 +24176,7 @@ function requireLib () {
24063
24176
  const start = this.state.pos;
24064
24177
  const end = this.input.indexOf(commentEnd, start + 2);
24065
24178
  if (end === -1) {
24066
- throw this.raise(Errors.UnterminatedComment, {
24067
- at: this.state.curPosition()
24068
- });
24179
+ throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
24069
24180
  }
24070
24181
  this.state.pos = end + commentEnd.length;
24071
24182
  lineBreakG.lastIndex = start + 2;
@@ -24217,16 +24328,12 @@ function requireLib () {
24217
24328
  const nextPos = this.state.pos + 1;
24218
24329
  const next = this.codePointAtPos(nextPos);
24219
24330
  if (next >= 48 && next <= 57) {
24220
- throw this.raise(Errors.UnexpectedDigitAfterHash, {
24221
- at: this.state.curPosition()
24222
- });
24331
+ throw this.raise(Errors.UnexpectedDigitAfterHash, this.state.curPosition());
24223
24332
  }
24224
24333
  if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) {
24225
24334
  this.expectPlugin("recordAndTuple");
24226
24335
  if (this.getPluginOption("recordAndTuple", "syntaxType") === "bar") {
24227
- throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, {
24228
- at: this.state.curPosition()
24229
- });
24336
+ throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, this.state.curPosition());
24230
24337
  }
24231
24338
  this.state.pos += 2;
24232
24339
  if (next === 123) {
@@ -24311,9 +24418,7 @@ function requireLib () {
24311
24418
  }
24312
24419
  if (this.hasPlugin("recordAndTuple") && next === 125) {
24313
24420
  if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
24314
- throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, {
24315
- at: this.state.curPosition()
24316
- });
24421
+ throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
24317
24422
  }
24318
24423
  this.state.pos += 2;
24319
24424
  this.finishToken(9);
@@ -24321,9 +24426,7 @@ function requireLib () {
24321
24426
  }
24322
24427
  if (this.hasPlugin("recordAndTuple") && next === 93) {
24323
24428
  if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
24324
- throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, {
24325
- at: this.state.curPosition()
24326
- });
24429
+ throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
24327
24430
  }
24328
24431
  this.state.pos += 2;
24329
24432
  this.finishToken(4);
@@ -24469,9 +24572,7 @@ function requireLib () {
24469
24572
  case 91:
24470
24573
  if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
24471
24574
  if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
24472
- throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, {
24473
- at: this.state.curPosition()
24474
- });
24575
+ throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
24475
24576
  }
24476
24577
  this.state.pos += 2;
24477
24578
  this.finishToken(2);
@@ -24487,9 +24588,7 @@ function requireLib () {
24487
24588
  case 123:
24488
24589
  if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
24489
24590
  if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
24490
- throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, {
24491
- at: this.state.curPosition()
24492
- });
24591
+ throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
24493
24592
  }
24494
24593
  this.state.pos += 2;
24495
24594
  this.finishToken(6);
@@ -24593,8 +24692,7 @@ function requireLib () {
24593
24692
  return;
24594
24693
  }
24595
24694
  }
24596
- throw this.raise(Errors.InvalidOrUnexpectedToken, {
24597
- at: this.state.curPosition(),
24695
+ throw this.raise(Errors.InvalidOrUnexpectedToken, this.state.curPosition(), {
24598
24696
  unexpected: String.fromCodePoint(code)
24599
24697
  });
24600
24698
  }
@@ -24612,15 +24710,11 @@ function requireLib () {
24612
24710
  } = this.state;
24613
24711
  for (;; ++pos) {
24614
24712
  if (pos >= this.length) {
24615
- throw this.raise(Errors.UnterminatedRegExp, {
24616
- at: createPositionWithColumnOffset(startLoc, 1)
24617
- });
24713
+ throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
24618
24714
  }
24619
24715
  const ch = this.input.charCodeAt(pos);
24620
24716
  if (isNewLine(ch)) {
24621
- throw this.raise(Errors.UnterminatedRegExp, {
24622
- at: createPositionWithColumnOffset(startLoc, 1)
24623
- });
24717
+ throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
24624
24718
  }
24625
24719
  if (escaped) {
24626
24720
  escaped = false;
@@ -24645,26 +24739,18 @@ function requireLib () {
24645
24739
  if (VALID_REGEX_FLAGS.has(cp)) {
24646
24740
  if (cp === 118) {
24647
24741
  if (mods.includes("u")) {
24648
- this.raise(Errors.IncompatibleRegExpUVFlags, {
24649
- at: nextPos()
24650
- });
24742
+ this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
24651
24743
  }
24652
24744
  } else if (cp === 117) {
24653
24745
  if (mods.includes("v")) {
24654
- this.raise(Errors.IncompatibleRegExpUVFlags, {
24655
- at: nextPos()
24656
- });
24746
+ this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
24657
24747
  }
24658
24748
  }
24659
24749
  if (mods.includes(char)) {
24660
- this.raise(Errors.DuplicateRegExpFlags, {
24661
- at: nextPos()
24662
- });
24750
+ this.raise(Errors.DuplicateRegExpFlags, nextPos());
24663
24751
  }
24664
24752
  } else if (isIdentifierChar(cp) || cp === 92) {
24665
- this.raise(Errors.MalformedRegExpFlags, {
24666
- at: nextPos()
24667
- });
24753
+ this.raise(Errors.MalformedRegExpFlags, nextPos());
24668
24754
  } else {
24669
24755
  break;
24670
24756
  }
@@ -24691,8 +24777,7 @@ function requireLib () {
24691
24777
  this.state.pos += 2;
24692
24778
  const val = this.readInt(radix);
24693
24779
  if (val == null) {
24694
- this.raise(Errors.InvalidDigit, {
24695
- at: createPositionWithColumnOffset(startLoc, 2),
24780
+ this.raise(Errors.InvalidDigit, createPositionWithColumnOffset(startLoc, 2), {
24696
24781
  radix
24697
24782
  });
24698
24783
  }
@@ -24701,14 +24786,10 @@ function requireLib () {
24701
24786
  ++this.state.pos;
24702
24787
  isBigInt = true;
24703
24788
  } else if (next === 109) {
24704
- throw this.raise(Errors.InvalidDecimal, {
24705
- at: startLoc
24706
- });
24789
+ throw this.raise(Errors.InvalidDecimal, startLoc);
24707
24790
  }
24708
24791
  if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
24709
- throw this.raise(Errors.NumberIdentifier, {
24710
- at: this.state.curPosition()
24711
- });
24792
+ throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
24712
24793
  }
24713
24794
  if (isBigInt) {
24714
24795
  const str = this.input.slice(startLoc.index, this.state.pos).replace(/[_n]/g, "");
@@ -24726,22 +24807,16 @@ function requireLib () {
24726
24807
  let hasExponent = false;
24727
24808
  let isOctal = false;
24728
24809
  if (!startsWithDot && this.readInt(10) === null) {
24729
- this.raise(Errors.InvalidNumber, {
24730
- at: this.state.curPosition()
24731
- });
24810
+ this.raise(Errors.InvalidNumber, this.state.curPosition());
24732
24811
  }
24733
24812
  const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
24734
24813
  if (hasLeadingZero) {
24735
24814
  const integer = this.input.slice(start, this.state.pos);
24736
- this.recordStrictModeErrors(Errors.StrictOctalLiteral, {
24737
- at: startLoc
24738
- });
24815
+ this.recordStrictModeErrors(Errors.StrictOctalLiteral, startLoc);
24739
24816
  if (!this.state.strict) {
24740
24817
  const underscorePos = integer.indexOf("_");
24741
24818
  if (underscorePos > 0) {
24742
- this.raise(Errors.ZeroDigitNumericSeparator, {
24743
- at: createPositionWithColumnOffset(startLoc, underscorePos)
24744
- });
24819
+ this.raise(Errors.ZeroDigitNumericSeparator, createPositionWithColumnOffset(startLoc, underscorePos));
24745
24820
  }
24746
24821
  }
24747
24822
  isOctal = hasLeadingZero && !/[89]/.test(integer);
@@ -24759,9 +24834,7 @@ function requireLib () {
24759
24834
  ++this.state.pos;
24760
24835
  }
24761
24836
  if (this.readInt(10) === null) {
24762
- this.raise(Errors.InvalidOrMissingExponent, {
24763
- at: startLoc
24764
- });
24837
+ this.raise(Errors.InvalidOrMissingExponent, startLoc);
24765
24838
  }
24766
24839
  isFloat = true;
24767
24840
  hasExponent = true;
@@ -24769,9 +24842,7 @@ function requireLib () {
24769
24842
  }
24770
24843
  if (next === 110) {
24771
24844
  if (isFloat || hasLeadingZero) {
24772
- this.raise(Errors.InvalidBigIntLiteral, {
24773
- at: startLoc
24774
- });
24845
+ this.raise(Errors.InvalidBigIntLiteral, startLoc);
24775
24846
  }
24776
24847
  ++this.state.pos;
24777
24848
  isBigInt = true;
@@ -24779,17 +24850,13 @@ function requireLib () {
24779
24850
  if (next === 109) {
24780
24851
  this.expectPlugin("decimal", this.state.curPosition());
24781
24852
  if (hasExponent || hasLeadingZero) {
24782
- this.raise(Errors.InvalidDecimal, {
24783
- at: startLoc
24784
- });
24853
+ this.raise(Errors.InvalidDecimal, startLoc);
24785
24854
  }
24786
24855
  ++this.state.pos;
24787
24856
  isDecimal = true;
24788
24857
  }
24789
24858
  if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
24790
- throw this.raise(Errors.NumberIdentifier, {
24791
- at: this.state.curPosition()
24792
- });
24859
+ throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
24793
24860
  }
24794
24861
  const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
24795
24862
  if (isBigInt) {
@@ -24852,14 +24919,10 @@ function requireLib () {
24852
24919
  this.finishToken(25, firstInvalidLoc ? null : opening + str + "${");
24853
24920
  }
24854
24921
  }
24855
- recordStrictModeErrors(toParseError, {
24856
- at
24857
- }) {
24922
+ recordStrictModeErrors(toParseError, at) {
24858
24923
  const index = at.index;
24859
24924
  if (this.state.strict && !this.state.strictErrors.has(index)) {
24860
- this.raise(toParseError, {
24861
- at
24862
- });
24925
+ this.raise(toParseError, at);
24863
24926
  } else {
24864
24927
  this.state.strictErrors.set(index, [toParseError, at]);
24865
24928
  }
@@ -24882,9 +24945,7 @@ function requireLib () {
24882
24945
  const escStart = this.state.curPosition();
24883
24946
  const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar;
24884
24947
  if (this.input.charCodeAt(++this.state.pos) !== 117) {
24885
- this.raise(Errors.MissingUnicodeEscape, {
24886
- at: this.state.curPosition()
24887
- });
24948
+ this.raise(Errors.MissingUnicodeEscape, this.state.curPosition());
24888
24949
  chunkStart = this.state.pos - 1;
24889
24950
  continue;
24890
24951
  }
@@ -24892,9 +24953,7 @@ function requireLib () {
24892
24953
  const esc = this.readCodePoint(true);
24893
24954
  if (esc !== null) {
24894
24955
  if (!identifierCheck(esc)) {
24895
- this.raise(Errors.EscapedCharNotAnIdentifier, {
24896
- at: escStart
24897
- });
24956
+ this.raise(Errors.EscapedCharNotAnIdentifier, escStart);
24898
24957
  }
24899
24958
  word += String.fromCodePoint(esc);
24900
24959
  }
@@ -24919,75 +24978,55 @@ function requireLib () {
24919
24978
  type
24920
24979
  } = this.state;
24921
24980
  if (tokenIsKeyword(type) && this.state.containsEsc) {
24922
- this.raise(Errors.InvalidEscapedReservedWord, {
24923
- at: this.state.startLoc,
24981
+ this.raise(Errors.InvalidEscapedReservedWord, this.state.startLoc, {
24924
24982
  reservedWord: tokenLabelName(type)
24925
24983
  });
24926
24984
  }
24927
24985
  }
24928
- raise(toParseError, raiseProperties) {
24929
- const {
24930
- at
24931
- } = raiseProperties,
24932
- details = _objectWithoutPropertiesLoose(raiseProperties, _excluded);
24986
+ raise(toParseError, at, details = {}) {
24933
24987
  const loc = at instanceof Position ? at : at.loc.start;
24934
- const error = toParseError({
24935
- loc,
24936
- details
24937
- });
24988
+ const error = toParseError(loc, details);
24938
24989
  if (!this.options.errorRecovery) throw error;
24939
24990
  if (!this.isLookahead) this.state.errors.push(error);
24940
24991
  return error;
24941
24992
  }
24942
- raiseOverwrite(toParseError, raiseProperties) {
24943
- const {
24944
- at
24945
- } = raiseProperties,
24946
- details = _objectWithoutPropertiesLoose(raiseProperties, _excluded2);
24993
+ raiseOverwrite(toParseError, at, details = {}) {
24947
24994
  const loc = at instanceof Position ? at : at.loc.start;
24948
24995
  const pos = loc.index;
24949
24996
  const errors = this.state.errors;
24950
24997
  for (let i = errors.length - 1; i >= 0; i--) {
24951
24998
  const error = errors[i];
24952
24999
  if (error.loc.index === pos) {
24953
- return errors[i] = toParseError({
24954
- loc,
24955
- details
24956
- });
25000
+ return errors[i] = toParseError(loc, details);
24957
25001
  }
24958
25002
  if (error.loc.index < pos) break;
24959
25003
  }
24960
- return this.raise(toParseError, raiseProperties);
25004
+ return this.raise(toParseError, at, details);
24961
25005
  }
24962
25006
  updateContext(prevType) {}
24963
25007
  unexpected(loc, type) {
24964
- throw this.raise(Errors.UnexpectedToken, {
24965
- expected: type ? tokenLabelName(type) : null,
24966
- at: loc != null ? loc : this.state.startLoc
25008
+ throw this.raise(Errors.UnexpectedToken, loc != null ? loc : this.state.startLoc, {
25009
+ expected: type ? tokenLabelName(type) : null
24967
25010
  });
24968
25011
  }
24969
25012
  expectPlugin(pluginName, loc) {
24970
25013
  if (this.hasPlugin(pluginName)) {
24971
25014
  return true;
24972
25015
  }
24973
- throw this.raise(Errors.MissingPlugin, {
24974
- at: loc != null ? loc : this.state.startLoc,
25016
+ throw this.raise(Errors.MissingPlugin, loc != null ? loc : this.state.startLoc, {
24975
25017
  missingPlugin: [pluginName]
24976
25018
  });
24977
25019
  }
24978
25020
  expectOnePlugin(pluginNames) {
24979
25021
  if (!pluginNames.some(name => this.hasPlugin(name))) {
24980
- throw this.raise(Errors.MissingOneOfPlugins, {
24981
- at: this.state.startLoc,
25022
+ throw this.raise(Errors.MissingOneOfPlugins, this.state.startLoc, {
24982
25023
  missingPlugin: pluginNames
24983
25024
  });
24984
25025
  }
24985
25026
  }
24986
25027
  errorBuilder(error) {
24987
25028
  return (pos, lineStart, curLine) => {
24988
- this.raise(error, {
24989
- at: buildPosition(pos, lineStart, curLine)
24990
- });
25029
+ this.raise(error, buildPosition(pos, lineStart, curLine));
24991
25030
  };
24992
25031
  }
24993
25032
  }
@@ -25020,8 +25059,7 @@ function requireLib () {
25020
25059
  current.undefinedPrivateNames.set(name, loc);
25021
25060
  }
25022
25061
  } else {
25023
- this.parser.raise(Errors.InvalidPrivateFieldResolution, {
25024
- at: loc,
25062
+ this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
25025
25063
  identifierName: name
25026
25064
  });
25027
25065
  }
@@ -25048,8 +25086,7 @@ function requireLib () {
25048
25086
  }
25049
25087
  }
25050
25088
  if (redefined) {
25051
- this.parser.raise(Errors.PrivateNameRedeclaration, {
25052
- at: loc,
25089
+ this.parser.raise(Errors.PrivateNameRedeclaration, loc, {
25053
25090
  identifierName: name
25054
25091
  });
25055
25092
  }
@@ -25064,8 +25101,7 @@ function requireLib () {
25064
25101
  if (classScope) {
25065
25102
  classScope.undefinedPrivateNames.set(name, loc);
25066
25103
  } else {
25067
- this.parser.raise(Errors.InvalidPrivateFieldResolution, {
25068
- at: loc,
25104
+ this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
25069
25105
  identifierName: name
25070
25106
  });
25071
25107
  }
@@ -25087,9 +25123,7 @@ function requireLib () {
25087
25123
  super(type);
25088
25124
  this.declarationErrors = new Map();
25089
25125
  }
25090
- recordDeclarationError(ParsingErrorClass, {
25091
- at
25092
- }) {
25126
+ recordDeclarationError(ParsingErrorClass, at) {
25093
25127
  const index = at.index;
25094
25128
  this.declarationErrors.set(index, [ParsingErrorClass, at]);
25095
25129
  }
@@ -25112,12 +25146,8 @@ function requireLib () {
25112
25146
  exit() {
25113
25147
  this.stack.pop();
25114
25148
  }
25115
- recordParameterInitializerError(toParseError, {
25116
- at: node
25117
- }) {
25118
- const origin = {
25119
- at: node.loc.start
25120
- };
25149
+ recordParameterInitializerError(toParseError, node) {
25150
+ const origin = node.loc.start;
25121
25151
  const {
25122
25152
  stack
25123
25153
  } = this;
@@ -25133,16 +25163,12 @@ function requireLib () {
25133
25163
  }
25134
25164
  this.parser.raise(toParseError, origin);
25135
25165
  }
25136
- recordArrowParameterBindingError(error, {
25137
- at: node
25138
- }) {
25166
+ recordArrowParameterBindingError(error, node) {
25139
25167
  const {
25140
25168
  stack
25141
25169
  } = this;
25142
25170
  const scope = stack[stack.length - 1];
25143
- const origin = {
25144
- at: node.loc.start
25145
- };
25171
+ const origin = node.loc.start;
25146
25172
  if (scope.isCertainlyParameterDeclaration()) {
25147
25173
  this.parser.raise(error, origin);
25148
25174
  } else if (scope.canBeArrowParameterDeclaration()) {
@@ -25151,9 +25177,7 @@ function requireLib () {
25151
25177
  return;
25152
25178
  }
25153
25179
  }
25154
- recordAsyncArrowParametersError({
25155
- at
25156
- }) {
25180
+ recordAsyncArrowParametersError(at) {
25157
25181
  const {
25158
25182
  stack
25159
25183
  } = this;
@@ -25161,9 +25185,7 @@ function requireLib () {
25161
25185
  let scope = stack[i];
25162
25186
  while (scope.canBeArrowParameterDeclaration()) {
25163
25187
  if (scope.type === 2) {
25164
- scope.recordDeclarationError(Errors.AwaitBindingIdentifier, {
25165
- at
25166
- });
25188
+ scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at);
25167
25189
  }
25168
25190
  scope = stack[--i];
25169
25191
  }
@@ -25175,9 +25197,7 @@ function requireLib () {
25175
25197
  const currentScope = stack[stack.length - 1];
25176
25198
  if (!currentScope.canBeArrowParameterDeclaration()) return;
25177
25199
  currentScope.iterateErrors(([toParseError, loc]) => {
25178
- this.parser.raise(toParseError, {
25179
- at: loc
25180
- });
25200
+ this.parser.raise(toParseError, loc);
25181
25201
  let i = stack.length - 2;
25182
25202
  let scope = stack[i];
25183
25203
  while (scope.canBeArrowParameterDeclaration()) {
@@ -25266,9 +25286,7 @@ function requireLib () {
25266
25286
  expectContextual(token, toParseError) {
25267
25287
  if (!this.eatContextual(token)) {
25268
25288
  if (toParseError != null) {
25269
- throw this.raise(toParseError, {
25270
- at: this.state.startLoc
25271
- });
25289
+ throw this.raise(toParseError, this.state.startLoc);
25272
25290
  }
25273
25291
  this.unexpected(null, token);
25274
25292
  }
@@ -25288,9 +25306,7 @@ function requireLib () {
25288
25306
  }
25289
25307
  semicolon(allowAsi = true) {
25290
25308
  if (allowAsi ? this.isLineTerminator() : this.eat(13)) return;
25291
- this.raise(Errors.MissingSemicolon, {
25292
- at: this.state.lastTokEndLoc
25293
- });
25309
+ this.raise(Errors.MissingSemicolon, this.state.lastTokEndLoc);
25294
25310
  }
25295
25311
  expect(type, loc) {
25296
25312
  this.eat(type) || this.unexpected(loc, type);
@@ -25360,19 +25376,13 @@ function requireLib () {
25360
25376
  return hasErrors;
25361
25377
  }
25362
25378
  if (shorthandAssignLoc != null) {
25363
- this.raise(Errors.InvalidCoverInitializedName, {
25364
- at: shorthandAssignLoc
25365
- });
25379
+ this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
25366
25380
  }
25367
25381
  if (doubleProtoLoc != null) {
25368
- this.raise(Errors.DuplicateProto, {
25369
- at: doubleProtoLoc
25370
- });
25382
+ this.raise(Errors.DuplicateProto, doubleProtoLoc);
25371
25383
  }
25372
25384
  if (privateKeyLoc != null) {
25373
- this.raise(Errors.UnexpectedPrivateField, {
25374
- at: privateKeyLoc
25375
- });
25385
+ this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
25376
25386
  }
25377
25387
  if (optionalParametersLoc != null) {
25378
25388
  this.unexpected(optionalParametersLoc);
@@ -25525,7 +25535,8 @@ function requireLib () {
25525
25535
  }
25526
25536
  class NodeUtils extends UtilParser {
25527
25537
  startNode() {
25528
- return new Node(this, this.state.start, this.state.startLoc);
25538
+ const loc = this.state.startLoc;
25539
+ return new Node(this, loc.index, loc);
25529
25540
  }
25530
25541
  startNodeAt(loc) {
25531
25542
  return new Node(this, loc.index, loc);
@@ -25721,10 +25732,8 @@ function requireLib () {
25721
25732
  const moduloLoc = this.state.startLoc;
25722
25733
  this.next();
25723
25734
  this.expectContextual(110);
25724
- if (this.state.lastTokStart > moduloLoc.index + 1) {
25725
- this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, {
25726
- at: moduloLoc
25727
- });
25735
+ if (this.state.lastTokStartLoc.index > moduloLoc.index + 1) {
25736
+ this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, moduloLoc);
25728
25737
  }
25729
25738
  if (this.eat(10)) {
25730
25739
  node.value = super.parseExpression();
@@ -25793,9 +25802,7 @@ function requireLib () {
25793
25802
  return this.flowParseDeclareModuleExports(node);
25794
25803
  } else {
25795
25804
  if (insideModule) {
25796
- this.raise(FlowErrors.NestedDeclareModule, {
25797
- at: this.state.lastTokStartLoc
25798
- });
25805
+ this.raise(FlowErrors.NestedDeclareModule, this.state.lastTokStartLoc);
25799
25806
  }
25800
25807
  return this.flowParseDeclareModule(node);
25801
25808
  }
@@ -25833,9 +25840,7 @@ function requireLib () {
25833
25840
  if (this.match(83)) {
25834
25841
  this.next();
25835
25842
  if (!this.isContextual(130) && !this.match(87)) {
25836
- this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, {
25837
- at: this.state.lastTokStartLoc
25838
- });
25843
+ this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc);
25839
25844
  }
25840
25845
  super.parseImport(bodyNode);
25841
25846
  } else {
@@ -25852,21 +25857,15 @@ function requireLib () {
25852
25857
  body.forEach(bodyElement => {
25853
25858
  if (isEsModuleType(bodyElement)) {
25854
25859
  if (kind === "CommonJS") {
25855
- this.raise(FlowErrors.AmbiguousDeclareModuleKind, {
25856
- at: bodyElement
25857
- });
25860
+ this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
25858
25861
  }
25859
25862
  kind = "ES";
25860
25863
  } else if (bodyElement.type === "DeclareModuleExports") {
25861
25864
  if (hasModuleExport) {
25862
- this.raise(FlowErrors.DuplicateDeclareModuleExports, {
25863
- at: bodyElement
25864
- });
25865
+ this.raise(FlowErrors.DuplicateDeclareModuleExports, bodyElement);
25865
25866
  }
25866
25867
  if (kind === "ES") {
25867
- this.raise(FlowErrors.AmbiguousDeclareModuleKind, {
25868
- at: bodyElement
25869
- });
25868
+ this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
25870
25869
  }
25871
25870
  kind = "CommonJS";
25872
25871
  hasModuleExport = true;
@@ -25889,8 +25888,7 @@ function requireLib () {
25889
25888
  } else {
25890
25889
  if (this.match(75) || this.isLet() || (this.isContextual(130) || this.isContextual(129)) && !insideModule) {
25891
25890
  const label = this.state.value;
25892
- throw this.raise(FlowErrors.UnsupportedDeclareExportKind, {
25893
- at: this.state.startLoc,
25891
+ throw this.raise(FlowErrors.UnsupportedDeclareExportKind, this.state.startLoc, {
25894
25892
  unsupportedExportKind: label,
25895
25893
  suggestion: exportSuggestions[label]
25896
25894
  });
@@ -25988,15 +25986,12 @@ function requireLib () {
25988
25986
  }
25989
25987
  checkNotUnderscore(word) {
25990
25988
  if (word === "_") {
25991
- this.raise(FlowErrors.UnexpectedReservedUnderscore, {
25992
- at: this.state.startLoc
25993
- });
25989
+ this.raise(FlowErrors.UnexpectedReservedUnderscore, this.state.startLoc);
25994
25990
  }
25995
25991
  }
25996
25992
  checkReservedType(word, startLoc, declaration) {
25997
25993
  if (!reservedTypes.has(word)) return;
25998
- this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, {
25999
- at: startLoc,
25994
+ this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, startLoc, {
26000
25995
  reservedType: word
26001
25996
  });
26002
25997
  }
@@ -26049,9 +26044,7 @@ function requireLib () {
26049
26044
  node.default = this.flowParseType();
26050
26045
  } else {
26051
26046
  if (requireDefault) {
26052
- this.raise(FlowErrors.MissingTypeParamDefault, {
26053
- at: nodeStartLoc
26054
- });
26047
+ this.raise(FlowErrors.MissingTypeParamDefault, nodeStartLoc);
26055
26048
  }
26056
26049
  }
26057
26050
  return this.finishNode(node, "TypeParameter");
@@ -26291,9 +26284,7 @@ function requireLib () {
26291
26284
  }
26292
26285
  this.flowObjectTypeSemicolon();
26293
26286
  if (inexactStartLoc && !this.match(8) && !this.match(9)) {
26294
- this.raise(FlowErrors.UnexpectedExplicitInexactInObject, {
26295
- at: inexactStartLoc
26296
- });
26287
+ this.raise(FlowErrors.UnexpectedExplicitInexactInObject, inexactStartLoc);
26297
26288
  }
26298
26289
  }
26299
26290
  this.expect(endDelim);
@@ -26309,33 +26300,23 @@ function requireLib () {
26309
26300
  const isInexactToken = this.match(12) || this.match(13) || this.match(8) || this.match(9);
26310
26301
  if (isInexactToken) {
26311
26302
  if (!allowSpread) {
26312
- this.raise(FlowErrors.InexactInsideNonObject, {
26313
- at: this.state.lastTokStartLoc
26314
- });
26303
+ this.raise(FlowErrors.InexactInsideNonObject, this.state.lastTokStartLoc);
26315
26304
  } else if (!allowInexact) {
26316
- this.raise(FlowErrors.InexactInsideExact, {
26317
- at: this.state.lastTokStartLoc
26318
- });
26305
+ this.raise(FlowErrors.InexactInsideExact, this.state.lastTokStartLoc);
26319
26306
  }
26320
26307
  if (variance) {
26321
- this.raise(FlowErrors.InexactVariance, {
26322
- at: variance
26323
- });
26308
+ this.raise(FlowErrors.InexactVariance, variance);
26324
26309
  }
26325
26310
  return null;
26326
26311
  }
26327
26312
  if (!allowSpread) {
26328
- this.raise(FlowErrors.UnexpectedSpreadType, {
26329
- at: this.state.lastTokStartLoc
26330
- });
26313
+ this.raise(FlowErrors.UnexpectedSpreadType, this.state.lastTokStartLoc);
26331
26314
  }
26332
26315
  if (protoStartLoc != null) {
26333
26316
  this.unexpected(protoStartLoc);
26334
26317
  }
26335
26318
  if (variance) {
26336
- this.raise(FlowErrors.SpreadVariance, {
26337
- at: variance
26338
- });
26319
+ this.raise(FlowErrors.SpreadVariance, variance);
26339
26320
  }
26340
26321
  node.argument = this.flowParseType();
26341
26322
  return this.finishNode(node, "ObjectTypeSpreadProperty");
@@ -26358,9 +26339,7 @@ function requireLib () {
26358
26339
  this.flowCheckGetterSetterParams(node);
26359
26340
  }
26360
26341
  if (!allowSpread && node.key.name === "constructor" && node.value.this) {
26361
- this.raise(FlowErrors.ThisParamBannedInConstructor, {
26362
- at: node.value.this
26363
- });
26342
+ this.raise(FlowErrors.ThisParamBannedInConstructor, node.value.this);
26364
26343
  }
26365
26344
  } else {
26366
26345
  if (kind !== "init") this.unexpected();
@@ -26379,19 +26358,13 @@ function requireLib () {
26379
26358
  const paramCount = property.kind === "get" ? 0 : 1;
26380
26359
  const length = property.value.params.length + (property.value.rest ? 1 : 0);
26381
26360
  if (property.value.this) {
26382
- this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, {
26383
- at: property.value.this
26384
- });
26361
+ this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, property.value.this);
26385
26362
  }
26386
26363
  if (length !== paramCount) {
26387
- this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, {
26388
- at: property
26389
- });
26364
+ this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, property);
26390
26365
  }
26391
26366
  if (property.kind === "set" && property.value.rest) {
26392
- this.raise(Errors.BadSetterRestParameter, {
26393
- at: property
26394
- });
26367
+ this.raise(Errors.BadSetterRestParameter, property);
26395
26368
  }
26396
26369
  }
26397
26370
  flowObjectTypeSemicolon() {
@@ -26447,17 +26420,13 @@ function requireLib () {
26447
26420
  const isThis = this.state.type === 78;
26448
26421
  if (lh.type === 14 || lh.type === 17) {
26449
26422
  if (isThis && !first) {
26450
- this.raise(FlowErrors.ThisParamMustBeFirst, {
26451
- at: node
26452
- });
26423
+ this.raise(FlowErrors.ThisParamMustBeFirst, node);
26453
26424
  }
26454
26425
  name = this.parseIdentifier(isThis);
26455
26426
  if (this.eat(17)) {
26456
26427
  optional = true;
26457
26428
  if (isThis) {
26458
- this.raise(FlowErrors.ThisParamMayNotBeOptional, {
26459
- at: node
26460
- });
26429
+ this.raise(FlowErrors.ThisParamMayNotBeOptional, node);
26461
26430
  }
26462
26431
  }
26463
26432
  typeAnnotation = this.flowParseTypeInitialiser();
@@ -26613,9 +26582,7 @@ function requireLib () {
26613
26582
  if (this.match(135)) {
26614
26583
  return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
26615
26584
  }
26616
- throw this.raise(FlowErrors.UnexpectedSubtractionOperand, {
26617
- at: this.state.startLoc
26618
- });
26585
+ throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
26619
26586
  }
26620
26587
  this.unexpected();
26621
26588
  return;
@@ -26879,9 +26846,7 @@ function requireLib () {
26879
26846
  [valid, invalid] = this.getArrowLikeExpressions(consequent);
26880
26847
  }
26881
26848
  if (failed && valid.length > 1) {
26882
- this.raise(FlowErrors.AmbiguousConditionalArrow, {
26883
- at: state.startLoc
26884
- });
26849
+ this.raise(FlowErrors.AmbiguousConditionalArrow, state.startLoc);
26885
26850
  }
26886
26851
  if (failed && valid.length === 1) {
26887
26852
  this.state = state;
@@ -27042,13 +27007,9 @@ function requireLib () {
27042
27007
  super.parseClassMember(classBody, member, state);
27043
27008
  if (member.declare) {
27044
27009
  if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") {
27045
- this.raise(FlowErrors.DeclareClassElement, {
27046
- at: startLoc
27047
- });
27010
+ this.raise(FlowErrors.DeclareClassElement, startLoc);
27048
27011
  } else if (member.value) {
27049
- this.raise(FlowErrors.DeclareClassFieldInitializer, {
27050
- at: member.value
27051
- });
27012
+ this.raise(FlowErrors.DeclareClassFieldInitializer, member.value);
27052
27013
  }
27053
27014
  }
27054
27015
  }
@@ -27059,8 +27020,7 @@ function requireLib () {
27059
27020
  const word = super.readWord1();
27060
27021
  const fullWord = "@@" + word;
27061
27022
  if (!this.isIterator(word) || !this.state.inType) {
27062
- this.raise(Errors.InvalidIdentifier, {
27063
- at: this.state.curPosition(),
27023
+ this.raise(Errors.InvalidIdentifier, this.state.curPosition(), {
27064
27024
  identifierName: fullWord
27065
27025
  });
27066
27026
  }
@@ -27112,9 +27072,7 @@ function requireLib () {
27112
27072
  var _expr$extra;
27113
27073
  const expr = exprList[i];
27114
27074
  if (expr && expr.type === "TypeCastExpression" && !((_expr$extra = expr.extra) != null && _expr$extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr)) {
27115
- this.raise(FlowErrors.TypeCastInPattern, {
27116
- at: expr.typeAnnotation
27117
- });
27075
+ this.raise(FlowErrors.TypeCastInPattern, expr.typeAnnotation);
27118
27076
  }
27119
27077
  }
27120
27078
  return exprList;
@@ -27162,16 +27120,12 @@ function requireLib () {
27162
27120
  if (method.params && isConstructor) {
27163
27121
  const params = method.params;
27164
27122
  if (params.length > 0 && this.isThisParam(params[0])) {
27165
- this.raise(FlowErrors.ThisParamBannedInConstructor, {
27166
- at: method
27167
- });
27123
+ this.raise(FlowErrors.ThisParamBannedInConstructor, method);
27168
27124
  }
27169
27125
  } else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
27170
27126
  const params = method.value.params;
27171
27127
  if (params.length > 0 && this.isThisParam(params[0])) {
27172
- this.raise(FlowErrors.ThisParamBannedInConstructor, {
27173
- at: method
27174
- });
27128
+ this.raise(FlowErrors.ThisParamBannedInConstructor, method);
27175
27129
  }
27176
27130
  }
27177
27131
  }
@@ -27211,13 +27165,9 @@ function requireLib () {
27211
27165
  if (params.length > 0) {
27212
27166
  const param = params[0];
27213
27167
  if (this.isThisParam(param) && method.kind === "get") {
27214
- this.raise(FlowErrors.GetterMayNotHaveThisParam, {
27215
- at: param
27216
- });
27168
+ this.raise(FlowErrors.GetterMayNotHaveThisParam, param);
27217
27169
  } else if (this.isThisParam(param)) {
27218
- this.raise(FlowErrors.SetterMayNotHaveThisParam, {
27219
- at: param
27220
- });
27170
+ this.raise(FlowErrors.SetterMayNotHaveThisParam, param);
27221
27171
  }
27222
27172
  }
27223
27173
  }
@@ -27243,28 +27193,20 @@ function requireLib () {
27243
27193
  parseAssignableListItemTypes(param) {
27244
27194
  if (this.eat(17)) {
27245
27195
  if (param.type !== "Identifier") {
27246
- this.raise(FlowErrors.PatternIsOptional, {
27247
- at: param
27248
- });
27196
+ this.raise(FlowErrors.PatternIsOptional, param);
27249
27197
  }
27250
27198
  if (this.isThisParam(param)) {
27251
- this.raise(FlowErrors.ThisParamMayNotBeOptional, {
27252
- at: param
27253
- });
27199
+ this.raise(FlowErrors.ThisParamMayNotBeOptional, param);
27254
27200
  }
27255
27201
  param.optional = true;
27256
27202
  }
27257
27203
  if (this.match(14)) {
27258
27204
  param.typeAnnotation = this.flowParseTypeAnnotation();
27259
27205
  } else if (this.isThisParam(param)) {
27260
- this.raise(FlowErrors.ThisParamAnnotationRequired, {
27261
- at: param
27262
- });
27206
+ this.raise(FlowErrors.ThisParamAnnotationRequired, param);
27263
27207
  }
27264
27208
  if (this.match(29) && this.isThisParam(param)) {
27265
- this.raise(FlowErrors.ThisParamNoDefault, {
27266
- at: param
27267
- });
27209
+ this.raise(FlowErrors.ThisParamNoDefault, param);
27268
27210
  }
27269
27211
  this.resetEndLocation(param);
27270
27212
  return param;
@@ -27272,18 +27214,14 @@ function requireLib () {
27272
27214
  parseMaybeDefault(startLoc, left) {
27273
27215
  const node = super.parseMaybeDefault(startLoc, left);
27274
27216
  if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
27275
- this.raise(FlowErrors.TypeBeforeInitializer, {
27276
- at: node.typeAnnotation
27277
- });
27217
+ this.raise(FlowErrors.TypeBeforeInitializer, node.typeAnnotation);
27278
27218
  }
27279
27219
  return node;
27280
27220
  }
27281
27221
  checkImportReflection(node) {
27282
27222
  super.checkImportReflection(node);
27283
27223
  if (node.module && node.importKind !== "value") {
27284
- this.raise(FlowErrors.ImportReflectionHasImportType, {
27285
- at: node.specifiers[0].loc.start
27286
- });
27224
+ this.raise(FlowErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
27287
27225
  }
27288
27226
  }
27289
27227
  parseImportSpecifierLocal(node, specifier, type) {
@@ -27339,8 +27277,7 @@ function requireLib () {
27339
27277
  specifier.importKind = specifierTypeKind;
27340
27278
  } else {
27341
27279
  if (importedIsString) {
27342
- throw this.raise(Errors.ImportBindingIsString, {
27343
- at: specifier,
27280
+ throw this.raise(Errors.ImportBindingIsString, specifier, {
27344
27281
  importName: firstIdent.value
27345
27282
  });
27346
27283
  }
@@ -27356,9 +27293,7 @@ function requireLib () {
27356
27293
  }
27357
27294
  const specifierIsTypeImport = hasTypeImportKind(specifier);
27358
27295
  if (isInTypeOnlyImport && specifierIsTypeImport) {
27359
- this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, {
27360
- at: specifier
27361
- });
27296
+ this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, specifier);
27362
27297
  }
27363
27298
  if (isInTypeOnlyImport || specifierIsTypeImport) {
27364
27299
  this.checkReservedType(specifier.local.name, specifier.local.loc.start, true);
@@ -27441,9 +27376,7 @@ function requireLib () {
27441
27376
  if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
27442
27377
  if (!arrow.error && !arrow.aborted) {
27443
27378
  if (arrow.node.async) {
27444
- this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, {
27445
- at: typeParameters
27446
- });
27379
+ this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, typeParameters);
27447
27380
  }
27448
27381
  return arrow.node;
27449
27382
  }
@@ -27459,9 +27392,7 @@ function requireLib () {
27459
27392
  }
27460
27393
  if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
27461
27394
  if (arrow.thrown) throw arrow.error;
27462
- throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, {
27463
- at: typeParameters
27464
- });
27395
+ throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, typeParameters);
27465
27396
  }
27466
27397
  return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
27467
27398
  }
@@ -27499,9 +27430,7 @@ function requireLib () {
27499
27430
  }
27500
27431
  for (let i = 0; i < node.params.length; i++) {
27501
27432
  if (this.isThisParam(node.params[i]) && i > 0) {
27502
- this.raise(FlowErrors.ThisParamMustBeFirst, {
27503
- at: node.params[i]
27504
- });
27433
+ this.raise(FlowErrors.ThisParamMustBeFirst, node.params[i]);
27505
27434
  }
27506
27435
  }
27507
27436
  super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
@@ -27603,18 +27532,14 @@ function requireLib () {
27603
27532
  parseTopLevel(file, program) {
27604
27533
  const fileNode = super.parseTopLevel(file, program);
27605
27534
  if (this.state.hasFlowComment) {
27606
- this.raise(FlowErrors.UnterminatedFlowComment, {
27607
- at: this.state.curPosition()
27608
- });
27535
+ this.raise(FlowErrors.UnterminatedFlowComment, this.state.curPosition());
27609
27536
  }
27610
27537
  return fileNode;
27611
27538
  }
27612
27539
  skipBlockComment() {
27613
27540
  if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
27614
27541
  if (this.state.hasFlowComment) {
27615
- throw this.raise(FlowErrors.NestedFlowComment, {
27616
- at: this.state.startLoc
27617
- });
27542
+ throw this.raise(FlowErrors.NestedFlowComment, this.state.startLoc);
27618
27543
  }
27619
27544
  this.hasFlowCommentCompletion();
27620
27545
  const commentSkip = this.skipFlowComment();
@@ -27650,43 +27575,26 @@ function requireLib () {
27650
27575
  hasFlowCommentCompletion() {
27651
27576
  const end = this.input.indexOf("*/", this.state.pos);
27652
27577
  if (end === -1) {
27653
- throw this.raise(Errors.UnterminatedComment, {
27654
- at: this.state.curPosition()
27655
- });
27578
+ throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
27656
27579
  }
27657
27580
  }
27658
27581
  flowEnumErrorBooleanMemberNotInitialized(loc, {
27659
27582
  enumName,
27660
27583
  memberName
27661
27584
  }) {
27662
- this.raise(FlowErrors.EnumBooleanMemberNotInitialized, {
27663
- at: loc,
27585
+ this.raise(FlowErrors.EnumBooleanMemberNotInitialized, loc, {
27664
27586
  memberName,
27665
27587
  enumName
27666
27588
  });
27667
27589
  }
27668
27590
  flowEnumErrorInvalidMemberInitializer(loc, enumContext) {
27669
- return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, Object.assign({
27670
- at: loc
27671
- }, enumContext));
27591
+ return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, loc, enumContext);
27672
27592
  }
27673
- flowEnumErrorNumberMemberNotInitialized(loc, {
27674
- enumName,
27675
- memberName
27676
- }) {
27677
- this.raise(FlowErrors.EnumNumberMemberNotInitialized, {
27678
- at: loc,
27679
- enumName,
27680
- memberName
27681
- });
27593
+ flowEnumErrorNumberMemberNotInitialized(loc, details) {
27594
+ this.raise(FlowErrors.EnumNumberMemberNotInitialized, loc, details);
27682
27595
  }
27683
- flowEnumErrorStringMemberInconsistentlyInitialized(node, {
27684
- enumName
27685
- }) {
27686
- this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, {
27687
- at: node,
27688
- enumName
27689
- });
27596
+ flowEnumErrorStringMemberInconsistentlyInitialized(node, details) {
27597
+ this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, node, details);
27690
27598
  }
27691
27599
  flowEnumMemberInit() {
27692
27600
  const startLoc = this.state.startLoc;
@@ -27795,16 +27703,14 @@ function requireLib () {
27795
27703
  continue;
27796
27704
  }
27797
27705
  if (/^[a-z]/.test(memberName)) {
27798
- this.raise(FlowErrors.EnumInvalidMemberName, {
27799
- at: id,
27706
+ this.raise(FlowErrors.EnumInvalidMemberName, id, {
27800
27707
  memberName,
27801
27708
  suggestion: memberName[0].toUpperCase() + memberName.slice(1),
27802
27709
  enumName
27803
27710
  });
27804
27711
  }
27805
27712
  if (seenNames.has(memberName)) {
27806
- this.raise(FlowErrors.EnumDuplicateMemberName, {
27807
- at: id,
27713
+ this.raise(FlowErrors.EnumDuplicateMemberName, id, {
27808
27714
  memberName,
27809
27715
  enumName
27810
27716
  });
@@ -27893,8 +27799,7 @@ function requireLib () {
27893
27799
  }) {
27894
27800
  if (!this.eatContextual(102)) return null;
27895
27801
  if (!tokenIsIdentifier(this.state.type)) {
27896
- throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, {
27897
- at: this.state.startLoc,
27802
+ throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, {
27898
27803
  enumName
27899
27804
  });
27900
27805
  }
@@ -27903,8 +27808,7 @@ function requireLib () {
27903
27808
  } = this.state;
27904
27809
  this.next();
27905
27810
  if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") {
27906
- this.raise(FlowErrors.EnumInvalidExplicitType, {
27907
- at: this.state.startLoc,
27811
+ this.raise(FlowErrors.EnumInvalidExplicitType, this.state.startLoc, {
27908
27812
  enumName,
27909
27813
  invalidEnumType: value
27910
27814
  });
@@ -27989,8 +27893,7 @@ function requireLib () {
27989
27893
  this.expect(8);
27990
27894
  return this.finishNode(node, "EnumNumberBody");
27991
27895
  } else {
27992
- this.raise(FlowErrors.EnumInconsistentMemberValues, {
27993
- at: nameLoc,
27896
+ this.raise(FlowErrors.EnumInconsistentMemberValues, nameLoc, {
27994
27897
  enumName
27995
27898
  });
27996
27899
  return empty();
@@ -28308,9 +28211,7 @@ function requireLib () {
28308
28211
  let chunkStart = this.state.pos;
28309
28212
  for (;;) {
28310
28213
  if (this.state.pos >= this.length) {
28311
- throw this.raise(JsxErrors.UnterminatedJsxContent, {
28312
- at: this.state.startLoc
28313
- });
28214
+ throw this.raise(JsxErrors.UnterminatedJsxContent, this.state.startLoc);
28314
28215
  }
28315
28216
  const ch = this.input.charCodeAt(this.state.pos);
28316
28217
  switch (ch) {
@@ -28365,9 +28266,7 @@ function requireLib () {
28365
28266
  let chunkStart = ++this.state.pos;
28366
28267
  for (;;) {
28367
28268
  if (this.state.pos >= this.length) {
28368
- throw this.raise(Errors.UnterminatedString, {
28369
- at: this.state.startLoc
28370
- });
28269
+ throw this.raise(Errors.UnterminatedString, this.state.startLoc);
28371
28270
  }
28372
28271
  const ch = this.input.charCodeAt(this.state.pos);
28373
28272
  if (ch === quote) break;
@@ -28470,18 +28369,14 @@ function requireLib () {
28470
28369
  this.next();
28471
28370
  node = this.jsxParseExpressionContainer(node, types.j_oTag);
28472
28371
  if (node.expression.type === "JSXEmptyExpression") {
28473
- this.raise(JsxErrors.AttributeIsEmpty, {
28474
- at: node
28475
- });
28372
+ this.raise(JsxErrors.AttributeIsEmpty, node);
28476
28373
  }
28477
28374
  return node;
28478
28375
  case 142:
28479
28376
  case 133:
28480
28377
  return this.parseExprAtom();
28481
28378
  default:
28482
- throw this.raise(JsxErrors.UnsupportedJsxValue, {
28483
- at: this.state.startLoc
28484
- });
28379
+ throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
28485
28380
  }
28486
28381
  }
28487
28382
  jsxParseEmptyExpression() {
@@ -28588,18 +28483,14 @@ function requireLib () {
28588
28483
  }
28589
28484
  }
28590
28485
  if (isFragment(openingElement) && !isFragment(closingElement) && closingElement !== null) {
28591
- this.raise(JsxErrors.MissingClosingTagFragment, {
28592
- at: closingElement
28593
- });
28486
+ this.raise(JsxErrors.MissingClosingTagFragment, closingElement);
28594
28487
  } else if (!isFragment(openingElement) && isFragment(closingElement)) {
28595
- this.raise(JsxErrors.MissingClosingTagElement, {
28596
- at: closingElement,
28488
+ this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
28597
28489
  openingTagName: getQualifiedJSXName(openingElement.name)
28598
28490
  });
28599
28491
  } else if (!isFragment(openingElement) && !isFragment(closingElement)) {
28600
28492
  if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
28601
- this.raise(JsxErrors.MissingClosingTagElement, {
28602
- at: closingElement,
28493
+ this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
28603
28494
  openingTagName: getQualifiedJSXName(openingElement.name)
28604
28495
  });
28605
28496
  }
@@ -28614,9 +28505,7 @@ function requireLib () {
28614
28505
  }
28615
28506
  node.children = children;
28616
28507
  if (this.match(47)) {
28617
- throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, {
28618
- at: this.state.startLoc
28619
- });
28508
+ throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, this.state.startLoc);
28620
28509
  }
28621
28510
  return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
28622
28511
  }
@@ -28702,11 +28591,7 @@ function requireLib () {
28702
28591
  class TypeScriptScope extends Scope {
28703
28592
  constructor(...args) {
28704
28593
  super(...args);
28705
- this.types = new Set();
28706
- this.enums = new Set();
28707
- this.constEnums = new Set();
28708
- this.classes = new Set();
28709
- this.exportOnlyBindings = new Set();
28594
+ this.tsNames = new Map();
28710
28595
  }
28711
28596
  }
28712
28597
  class TypeScriptScopeHandler extends ScopeHandler {
@@ -28746,8 +28631,7 @@ function requireLib () {
28746
28631
  declareName(name, bindingType, loc) {
28747
28632
  if (bindingType & 4096) {
28748
28633
  if (this.hasImport(name, true)) {
28749
- this.parser.raise(Errors.VarRedeclaration, {
28750
- at: loc,
28634
+ this.parser.raise(Errors.VarRedeclaration, loc, {
28751
28635
  identifierName: name
28752
28636
  });
28753
28637
  }
@@ -28755,9 +28639,10 @@ function requireLib () {
28755
28639
  return;
28756
28640
  }
28757
28641
  const scope = this.currentScope();
28642
+ let type = scope.tsNames.get(name) || 0;
28758
28643
  if (bindingType & 1024) {
28759
28644
  this.maybeExportDefined(scope, name);
28760
- scope.exportOnlyBindings.add(name);
28645
+ scope.tsNames.set(name, type | 16);
28761
28646
  return;
28762
28647
  }
28763
28648
  super.declareName(name, bindingType, loc);
@@ -28766,31 +28651,37 @@ function requireLib () {
28766
28651
  this.checkRedeclarationInScope(scope, name, bindingType, loc);
28767
28652
  this.maybeExportDefined(scope, name);
28768
28653
  }
28769
- scope.types.add(name);
28654
+ type = type | 1;
28655
+ }
28656
+ if (bindingType & 256) {
28657
+ type = type | 2;
28770
28658
  }
28771
- if (bindingType & 256) scope.enums.add(name);
28772
28659
  if (bindingType & 512) {
28773
- scope.constEnums.add(name);
28660
+ type = type | 4;
28774
28661
  }
28775
- if (bindingType & 128) scope.classes.add(name);
28662
+ if (bindingType & 128) {
28663
+ type = type | 8;
28664
+ }
28665
+ if (type) scope.tsNames.set(name, type);
28776
28666
  }
28777
28667
  isRedeclaredInScope(scope, name, bindingType) {
28778
- if (scope.enums.has(name)) {
28668
+ const type = scope.tsNames.get(name);
28669
+ if ((type & 2) > 0) {
28779
28670
  if (bindingType & 256) {
28780
28671
  const isConst = !!(bindingType & 512);
28781
- const wasConst = scope.constEnums.has(name);
28672
+ const wasConst = (type & 4) > 0;
28782
28673
  return isConst !== wasConst;
28783
28674
  }
28784
28675
  return true;
28785
28676
  }
28786
- if (bindingType & 128 && scope.classes.has(name)) {
28787
- if (scope.lexical.has(name)) {
28677
+ if (bindingType & 128 && (type & 8) > 0) {
28678
+ if (scope.names.get(name) & 2) {
28788
28679
  return !!(bindingType & 1);
28789
28680
  } else {
28790
28681
  return false;
28791
28682
  }
28792
28683
  }
28793
- if (bindingType & 2 && scope.types.has(name)) {
28684
+ if (bindingType & 2 && (type & 1) > 0) {
28794
28685
  return true;
28795
28686
  }
28796
28687
  return super.isRedeclaredInScope(scope, name, bindingType);
@@ -28803,7 +28694,10 @@ function requireLib () {
28803
28694
  const len = this.scopeStack.length;
28804
28695
  for (let i = len - 1; i >= 0; i--) {
28805
28696
  const scope = this.scopeStack[i];
28806
- if (scope.types.has(name) || scope.exportOnlyBindings.has(name)) return;
28697
+ const type = scope.tsNames.get(name);
28698
+ if ((type & 1) > 0 || (type & 16) > 0) {
28699
+ return;
28700
+ }
28807
28701
  }
28808
28702
  super.checkLocalExport(id);
28809
28703
  }
@@ -28820,18 +28714,12 @@ function requireLib () {
28820
28714
  parenthesized = unwrapParenthesizedExpression(node);
28821
28715
  if (isLHS) {
28822
28716
  if (parenthesized.type === "Identifier") {
28823
- this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, {
28824
- at: node
28825
- });
28717
+ this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, node);
28826
28718
  } else if (parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) {
28827
- this.raise(Errors.InvalidParenthesizedAssignment, {
28828
- at: node
28829
- });
28719
+ this.raise(Errors.InvalidParenthesizedAssignment, node);
28830
28720
  }
28831
28721
  } else {
28832
- this.raise(Errors.InvalidParenthesizedAssignment, {
28833
- at: node
28834
- });
28722
+ this.raise(Errors.InvalidParenthesizedAssignment, node);
28835
28723
  }
28836
28724
  }
28837
28725
  switch (node.type) {
@@ -28849,9 +28737,7 @@ function requireLib () {
28849
28737
  const isLast = i === last;
28850
28738
  this.toAssignableObjectExpressionProp(prop, isLast, isLHS);
28851
28739
  if (isLast && prop.type === "RestElement" && (_node$extra2 = node.extra) != null && _node$extra2.trailingCommaLoc) {
28852
- this.raise(Errors.RestTrailingComma, {
28853
- at: node.extra.trailingCommaLoc
28854
- });
28740
+ this.raise(Errors.RestTrailingComma, node.extra.trailingCommaLoc);
28855
28741
  }
28856
28742
  }
28857
28743
  break;
@@ -28877,9 +28763,7 @@ function requireLib () {
28877
28763
  break;
28878
28764
  case "AssignmentExpression":
28879
28765
  if (node.operator !== "=") {
28880
- this.raise(Errors.MissingEqInAssignment, {
28881
- at: node.left.loc.end
28882
- });
28766
+ this.raise(Errors.MissingEqInAssignment, node.left.loc.end);
28883
28767
  }
28884
28768
  node.type = "AssignmentPattern";
28885
28769
  delete node.operator;
@@ -28892,18 +28776,14 @@ function requireLib () {
28892
28776
  }
28893
28777
  toAssignableObjectExpressionProp(prop, isLast, isLHS) {
28894
28778
  if (prop.type === "ObjectMethod") {
28895
- this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, {
28896
- at: prop.key
28897
- });
28779
+ this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, prop.key);
28898
28780
  } else if (prop.type === "SpreadElement") {
28899
28781
  prop.type = "RestElement";
28900
28782
  const arg = prop.argument;
28901
28783
  this.checkToRestConversion(arg, false);
28902
28784
  this.toAssignable(arg, isLHS);
28903
28785
  if (!isLast) {
28904
- this.raise(Errors.RestTrailingComma, {
28905
- at: prop
28906
- });
28786
+ this.raise(Errors.RestTrailingComma, prop);
28907
28787
  }
28908
28788
  } else {
28909
28789
  this.toAssignable(prop, isLHS);
@@ -28924,13 +28804,9 @@ function requireLib () {
28924
28804
  }
28925
28805
  if (elt.type === "RestElement") {
28926
28806
  if (i < end) {
28927
- this.raise(Errors.RestTrailingComma, {
28928
- at: elt
28929
- });
28807
+ this.raise(Errors.RestTrailingComma, elt);
28930
28808
  } else if (trailingCommaLoc) {
28931
- this.raise(Errors.RestTrailingComma, {
28932
- at: trailingCommaLoc
28933
- });
28809
+ this.raise(Errors.RestTrailingComma, trailingCommaLoc);
28934
28810
  }
28935
28811
  }
28936
28812
  }
@@ -29027,9 +28903,7 @@ function requireLib () {
29027
28903
  } else {
29028
28904
  const decorators = [];
29029
28905
  if (this.match(26) && this.hasPlugin("decorators")) {
29030
- this.raise(Errors.UnsupportedParameterDecorator, {
29031
- at: this.state.startLoc
29032
- });
28906
+ this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc);
29033
28907
  }
29034
28908
  while (this.match(26)) {
29035
28909
  decorators.push(this.parseDecorator());
@@ -29113,16 +28987,13 @@ function requireLib () {
29113
28987
  if (isOptionalMemberExpression) {
29114
28988
  this.expectPlugin("optionalChainingAssign", expression.loc.start);
29115
28989
  if (ancestor.type !== "AssignmentExpression") {
29116
- this.raise(Errors.InvalidLhsOptionalChaining, {
29117
- at: expression,
28990
+ this.raise(Errors.InvalidLhsOptionalChaining, expression, {
29118
28991
  ancestor
29119
28992
  });
29120
28993
  }
29121
28994
  }
29122
28995
  if (binding !== 64) {
29123
- this.raise(Errors.InvalidPropertyBindingPattern, {
29124
- at: expression
29125
- });
28996
+ this.raise(Errors.InvalidPropertyBindingPattern, expression);
29126
28997
  }
29127
28998
  return;
29128
28999
  }
@@ -29133,9 +29004,7 @@ function requireLib () {
29133
29004
  } = expression;
29134
29005
  if (checkClashes) {
29135
29006
  if (checkClashes.has(name)) {
29136
- this.raise(Errors.ParamDupe, {
29137
- at: expression
29138
- });
29007
+ this.raise(Errors.ParamDupe, expression);
29139
29008
  } else {
29140
29009
  checkClashes.add(name);
29141
29010
  }
@@ -29146,8 +29015,7 @@ function requireLib () {
29146
29015
  if (validity === true) return;
29147
29016
  if (validity === false) {
29148
29017
  const ParseErrorClass = binding === 64 ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
29149
- this.raise(ParseErrorClass, {
29150
- at: expression,
29018
+ this.raise(ParseErrorClass, expression, {
29151
29019
  ancestor
29152
29020
  });
29153
29021
  return;
@@ -29171,21 +29039,17 @@ function requireLib () {
29171
29039
  checkIdentifier(at, bindingType, strictModeChanged = false) {
29172
29040
  if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
29173
29041
  if (bindingType === 64) {
29174
- this.raise(Errors.StrictEvalArguments, {
29175
- at,
29042
+ this.raise(Errors.StrictEvalArguments, at, {
29176
29043
  referenceName: at.name
29177
29044
  });
29178
29045
  } else {
29179
- this.raise(Errors.StrictEvalArgumentsBinding, {
29180
- at,
29046
+ this.raise(Errors.StrictEvalArgumentsBinding, at, {
29181
29047
  bindingName: at.name
29182
29048
  });
29183
29049
  }
29184
29050
  }
29185
29051
  if (bindingType & 8192 && at.name === "let") {
29186
- this.raise(Errors.LetInLexicalBinding, {
29187
- at
29188
- });
29052
+ this.raise(Errors.LetInLexicalBinding, at);
29189
29053
  }
29190
29054
  if (!(bindingType & 64)) {
29191
29055
  this.declareNameFromIdentifier(at, bindingType);
@@ -29206,18 +29070,14 @@ function requireLib () {
29206
29070
  case "ObjectExpression":
29207
29071
  if (allowPattern) break;
29208
29072
  default:
29209
- this.raise(Errors.InvalidRestAssignmentPattern, {
29210
- at: node
29211
- });
29073
+ this.raise(Errors.InvalidRestAssignmentPattern, node);
29212
29074
  }
29213
29075
  }
29214
29076
  checkCommaAfterRest(close) {
29215
29077
  if (!this.match(12)) {
29216
29078
  return false;
29217
29079
  }
29218
- this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, {
29219
- at: this.state.startLoc
29220
- });
29080
+ this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, this.state.startLoc);
29221
29081
  return true;
29222
29082
  }
29223
29083
  }
@@ -29413,16 +29273,14 @@ function requireLib () {
29413
29273
  }, modified) {
29414
29274
  const enforceOrder = (loc, modifier, before, after) => {
29415
29275
  if (modifier === before && modified[after]) {
29416
- this.raise(TSErrors.InvalidModifiersOrder, {
29417
- at: loc,
29276
+ this.raise(TSErrors.InvalidModifiersOrder, loc, {
29418
29277
  orderedModifiers: [before, after]
29419
29278
  });
29420
29279
  }
29421
29280
  };
29422
29281
  const incompatible = (loc, modifier, mod1, mod2) => {
29423
29282
  if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) {
29424
- this.raise(TSErrors.IncompatibleModifiers, {
29425
- at: loc,
29283
+ this.raise(TSErrors.IncompatibleModifiers, loc, {
29426
29284
  modifiers: [mod1, mod2]
29427
29285
  });
29428
29286
  }
@@ -29435,8 +29293,7 @@ function requireLib () {
29435
29293
  if (!modifier) break;
29436
29294
  if (tsIsAccessModifier(modifier)) {
29437
29295
  if (modified.accessibility) {
29438
- this.raise(TSErrors.DuplicateAccessibilityModifier, {
29439
- at: startLoc,
29296
+ this.raise(TSErrors.DuplicateAccessibilityModifier, startLoc, {
29440
29297
  modifier
29441
29298
  });
29442
29299
  } else {
@@ -29447,8 +29304,7 @@ function requireLib () {
29447
29304
  }
29448
29305
  } else if (tsIsVarianceAnnotations(modifier)) {
29449
29306
  if (modified[modifier]) {
29450
- this.raise(TSErrors.DuplicateModifier, {
29451
- at: startLoc,
29307
+ this.raise(TSErrors.DuplicateModifier, startLoc, {
29452
29308
  modifier
29453
29309
  });
29454
29310
  }
@@ -29456,8 +29312,7 @@ function requireLib () {
29456
29312
  enforceOrder(startLoc, modifier, "in", "out");
29457
29313
  } else {
29458
29314
  if (Object.hasOwnProperty.call(modified, modifier)) {
29459
- this.raise(TSErrors.DuplicateModifier, {
29460
- at: startLoc,
29315
+ this.raise(TSErrors.DuplicateModifier, startLoc, {
29461
29316
  modifier
29462
29317
  });
29463
29318
  } else {
@@ -29471,8 +29326,7 @@ function requireLib () {
29471
29326
  modified[modifier] = true;
29472
29327
  }
29473
29328
  if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
29474
- this.raise(errorTemplate, {
29475
- at: startLoc,
29329
+ this.raise(errorTemplate, startLoc, {
29476
29330
  modifier
29477
29331
  });
29478
29332
  }
@@ -29515,7 +29369,7 @@ function requireLib () {
29515
29369
  }
29516
29370
  result.push(element);
29517
29371
  if (this.eat(12)) {
29518
- trailingCommaPos = this.state.lastTokStart;
29372
+ trailingCommaPos = this.state.lastTokStartLoc.index;
29519
29373
  continue;
29520
29374
  }
29521
29375
  if (this.tsIsListTerminator(kind)) {
@@ -29552,9 +29406,7 @@ function requireLib () {
29552
29406
  this.expect(83);
29553
29407
  this.expect(10);
29554
29408
  if (!this.match(133)) {
29555
- this.raise(TSErrors.UnsupportedImportTypeArgument, {
29556
- at: this.state.startLoc
29557
- });
29409
+ this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
29558
29410
  }
29559
29411
  node.argument = super.parseExprAtom();
29560
29412
  this.expect(11);
@@ -29635,9 +29487,7 @@ function requireLib () {
29635
29487
  };
29636
29488
  node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
29637
29489
  if (node.params.length === 0) {
29638
- this.raise(TSErrors.EmptyTypeParameters, {
29639
- at: node
29640
- });
29490
+ this.raise(TSErrors.EmptyTypeParameters, node);
29641
29491
  }
29642
29492
  if (refTrailingCommaPos.value !== -1) {
29643
29493
  this.addExtra(node, "trailingComma", refTrailingCommaPos.value);
@@ -29664,8 +29514,7 @@ function requireLib () {
29664
29514
  type
29665
29515
  } = pattern;
29666
29516
  if (type === "AssignmentPattern" || type === "TSParameterProperty") {
29667
- this.raise(TSErrors.UnsupportedSignatureParameterKind, {
29668
- at: pattern,
29517
+ this.raise(TSErrors.UnsupportedSignatureParameterKind, pattern, {
29669
29518
  type
29670
29519
  });
29671
29520
  }
@@ -29710,15 +29559,11 @@ function requireLib () {
29710
29559
  const nodeAny = node;
29711
29560
  if (this.match(10) || this.match(47)) {
29712
29561
  if (readonly) {
29713
- this.raise(TSErrors.ReadonlyForMethodSignature, {
29714
- at: node
29715
- });
29562
+ this.raise(TSErrors.ReadonlyForMethodSignature, node);
29716
29563
  }
29717
29564
  const method = nodeAny;
29718
29565
  if (method.kind && this.match(47)) {
29719
- this.raise(TSErrors.AccesorCannotHaveTypeParameters, {
29720
- at: this.state.curPosition()
29721
- });
29566
+ this.raise(TSErrors.AccesorCannotHaveTypeParameters, this.state.curPosition());
29722
29567
  }
29723
29568
  this.tsFillSignature(14, method);
29724
29569
  this.tsParseTypeMemberSemicolon();
@@ -29726,42 +29571,28 @@ function requireLib () {
29726
29571
  const returnTypeKey = "typeAnnotation";
29727
29572
  if (method.kind === "get") {
29728
29573
  if (method[paramsKey].length > 0) {
29729
- this.raise(Errors.BadGetterArity, {
29730
- at: this.state.curPosition()
29731
- });
29574
+ this.raise(Errors.BadGetterArity, this.state.curPosition());
29732
29575
  if (this.isThisParam(method[paramsKey][0])) {
29733
- this.raise(TSErrors.AccesorCannotDeclareThisParameter, {
29734
- at: this.state.curPosition()
29735
- });
29576
+ this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition());
29736
29577
  }
29737
29578
  }
29738
29579
  } else if (method.kind === "set") {
29739
29580
  if (method[paramsKey].length !== 1) {
29740
- this.raise(Errors.BadSetterArity, {
29741
- at: this.state.curPosition()
29742
- });
29581
+ this.raise(Errors.BadSetterArity, this.state.curPosition());
29743
29582
  } else {
29744
29583
  const firstParameter = method[paramsKey][0];
29745
29584
  if (this.isThisParam(firstParameter)) {
29746
- this.raise(TSErrors.AccesorCannotDeclareThisParameter, {
29747
- at: this.state.curPosition()
29748
- });
29585
+ this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition());
29749
29586
  }
29750
29587
  if (firstParameter.type === "Identifier" && firstParameter.optional) {
29751
- this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, {
29752
- at: this.state.curPosition()
29753
- });
29588
+ this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, this.state.curPosition());
29754
29589
  }
29755
29590
  if (firstParameter.type === "RestElement") {
29756
- this.raise(TSErrors.SetAccesorCannotHaveRestParameter, {
29757
- at: this.state.curPosition()
29758
- });
29591
+ this.raise(TSErrors.SetAccesorCannotHaveRestParameter, this.state.curPosition());
29759
29592
  }
29760
29593
  }
29761
29594
  if (method[returnTypeKey]) {
29762
- this.raise(TSErrors.SetAccesorCannotHaveReturnType, {
29763
- at: method[returnTypeKey]
29764
- });
29595
+ this.raise(TSErrors.SetAccesorCannotHaveReturnType, method[returnTypeKey]);
29765
29596
  }
29766
29597
  } else {
29767
29598
  method.kind = "method";
@@ -29876,9 +29707,7 @@ function requireLib () {
29876
29707
  type
29877
29708
  } = elementNode;
29878
29709
  if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) {
29879
- this.raise(TSErrors.OptionalTypeBeforeRequired, {
29880
- at: elementNode
29881
- });
29710
+ this.raise(TSErrors.OptionalTypeBeforeRequired, elementNode);
29882
29711
  }
29883
29712
  seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
29884
29713
  });
@@ -29931,16 +29760,12 @@ function requireLib () {
29931
29760
  labeledNode.elementType = type;
29932
29761
  if (this.eat(17)) {
29933
29762
  labeledNode.optional = true;
29934
- this.raise(TSErrors.TupleOptionalAfterType, {
29935
- at: this.state.lastTokStartLoc
29936
- });
29763
+ this.raise(TSErrors.TupleOptionalAfterType, this.state.lastTokStartLoc);
29937
29764
  }
29938
29765
  } else {
29939
29766
  labeledNode = this.startNodeAtNode(type);
29940
29767
  labeledNode.optional = optional;
29941
- this.raise(TSErrors.InvalidTupleMemberLabel, {
29942
- at: type
29943
- });
29768
+ this.raise(TSErrors.InvalidTupleMemberLabel, type);
29944
29769
  labeledNode.label = type;
29945
29770
  labeledNode.elementType = this.tsParseType();
29946
29771
  }
@@ -30093,9 +29918,7 @@ function requireLib () {
30093
29918
  case "TSArrayType":
30094
29919
  return;
30095
29920
  default:
30096
- this.raise(TSErrors.UnexpectedReadonly, {
30097
- at: node
30098
- });
29921
+ this.raise(TSErrors.UnexpectedReadonly, node);
30099
29922
  }
30100
29923
  }
30101
29924
  tsParseInferType() {
@@ -30263,8 +30086,7 @@ function requireLib () {
30263
30086
  return false;
30264
30087
  }
30265
30088
  if (containsEsc) {
30266
- this.raise(Errors.InvalidEscapedReservedWord, {
30267
- at: this.state.lastTokStartLoc,
30089
+ this.raise(Errors.InvalidEscapedReservedWord, this.state.lastTokStartLoc, {
30268
30090
  reservedWord: "asserts"
30269
30091
  });
30270
30092
  }
@@ -30308,9 +30130,7 @@ function requireLib () {
30308
30130
  }
30309
30131
  tsParseTypeAssertion() {
30310
30132
  if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
30311
- this.raise(TSErrors.ReservedTypeAssertion, {
30312
- at: this.state.startLoc
30313
- });
30133
+ this.raise(TSErrors.ReservedTypeAssertion, this.state.startLoc);
30314
30134
  }
30315
30135
  const node = this.startNode();
30316
30136
  node.typeAnnotation = this.tsInType(() => {
@@ -30332,8 +30152,7 @@ function requireLib () {
30332
30152
  return this.finishNode(node, "TSExpressionWithTypeArguments");
30333
30153
  });
30334
30154
  if (!delimitedList.length) {
30335
- this.raise(TSErrors.EmptyHeritageClauseType, {
30336
- at: originalStartLoc,
30155
+ this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
30337
30156
  token
30338
30157
  });
30339
30158
  }
@@ -30348,9 +30167,7 @@ function requireLib () {
30348
30167
  this.checkIdentifier(node.id, 130);
30349
30168
  } else {
30350
30169
  node.id = null;
30351
- this.raise(TSErrors.MissingInterfaceName, {
30352
- at: this.state.startLoc
30353
- });
30170
+ this.raise(TSErrors.MissingInterfaceName, this.state.startLoc);
30354
30171
  }
30355
30172
  node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);
30356
30173
  if (this.eat(81)) {
@@ -30502,9 +30319,7 @@ function requireLib () {
30502
30319
  this.expect(29);
30503
30320
  const moduleReference = this.tsParseModuleReference();
30504
30321
  if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") {
30505
- this.raise(TSErrors.ImportAliasHasImportType, {
30506
- at: moduleReference
30507
- });
30322
+ this.raise(TSErrors.ImportAliasHasImportType, moduleReference);
30508
30323
  }
30509
30324
  node.moduleReference = moduleReference;
30510
30325
  this.semicolon();
@@ -30690,9 +30505,7 @@ function requireLib () {
30690
30505
  return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
30691
30506
  }));
30692
30507
  if (node.params.length === 0) {
30693
- this.raise(TSErrors.EmptyTypeArguments, {
30694
- at: node
30695
- });
30508
+ this.raise(TSErrors.EmptyTypeArguments, node);
30696
30509
  } else if (!this.state.inType && this.curContext() === types.brace) {
30697
30510
  this.reScan_lt_gt();
30698
30511
  }
@@ -30716,9 +30529,7 @@ function requireLib () {
30716
30529
  const override = modified.override;
30717
30530
  const readonly = modified.readonly;
30718
30531
  if (!(flags & 4) && (accessibility || readonly || override)) {
30719
- this.raise(TSErrors.UnexpectedParameterModifier, {
30720
- at: startLoc
30721
- });
30532
+ this.raise(TSErrors.UnexpectedParameterModifier, startLoc);
30722
30533
  }
30723
30534
  const left = this.parseMaybeDefault();
30724
30535
  this.parseAssignableListItemTypes(left, flags);
@@ -30732,9 +30543,7 @@ function requireLib () {
30732
30543
  if (readonly) pp.readonly = readonly;
30733
30544
  if (override) pp.override = override;
30734
30545
  if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
30735
- this.raise(TSErrors.UnsupportedParameterPropertyKind, {
30736
- at: pp
30737
- });
30546
+ this.raise(TSErrors.UnsupportedParameterPropertyKind, pp);
30738
30547
  }
30739
30548
  pp.parameter = elt;
30740
30549
  return this.finishNode(pp, "TSParameterProperty");
@@ -30750,9 +30559,7 @@ function requireLib () {
30750
30559
  tsDisallowOptionalPattern(node) {
30751
30560
  for (const param of node.params) {
30752
30561
  if (param.type !== "Identifier" && param.optional && !this.state.isAmbientContext) {
30753
- this.raise(TSErrors.PatternIsOptional, {
30754
- at: param
30755
- });
30562
+ this.raise(TSErrors.PatternIsOptional, param);
30756
30563
  }
30757
30564
  }
30758
30565
  }
@@ -30769,9 +30576,7 @@ function requireLib () {
30769
30576
  return this.finishNode(node, bodilessType);
30770
30577
  }
30771
30578
  if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) {
30772
- this.raise(TSErrors.DeclareFunctionHasImplementation, {
30773
- at: node
30774
- });
30579
+ this.raise(TSErrors.DeclareFunctionHasImplementation, node);
30775
30580
  if (node.declare) {
30776
30581
  return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
30777
30582
  }
@@ -30789,9 +30594,7 @@ function requireLib () {
30789
30594
  tsCheckForInvalidTypeCasts(items) {
30790
30595
  items.forEach(node => {
30791
30596
  if ((node == null ? void 0 : node.type) === "TSTypeCastExpression") {
30792
- this.raise(TSErrors.UnexpectedTypeAnnotation, {
30793
- at: node.typeAnnotation
30794
- });
30597
+ this.raise(TSErrors.UnexpectedTypeAnnotation, node.typeAnnotation);
30795
30598
  }
30796
30599
  });
30797
30600
  }
@@ -30868,9 +30671,7 @@ function requireLib () {
30868
30671
  }
30869
30672
  if (result) {
30870
30673
  if (result.type === "TSInstantiationExpression" && (this.match(16) || this.match(18) && this.lookaheadCharCode() !== 40)) {
30871
- this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, {
30872
- at: this.state.startLoc
30873
- });
30674
+ this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, this.state.startLoc);
30874
30675
  }
30875
30676
  return result;
30876
30677
  }
@@ -30897,8 +30698,7 @@ function requireLib () {
30897
30698
  this.next();
30898
30699
  if (this.match(75)) {
30899
30700
  if (isSatisfies) {
30900
- this.raise(Errors.UnexpectedKeyword, {
30901
- at: this.state.startLoc,
30701
+ this.raise(Errors.UnexpectedKeyword, this.state.startLoc, {
30902
30702
  keyword: "const"
30903
30703
  });
30904
30704
  }
@@ -30920,9 +30720,7 @@ function requireLib () {
30920
30720
  checkImportReflection(node) {
30921
30721
  super.checkImportReflection(node);
30922
30722
  if (node.module && node.importKind !== "value") {
30923
- this.raise(TSErrors.ImportReflectionHasImportType, {
30924
- at: node.specifiers[0].loc.start
30925
- });
30723
+ this.raise(TSErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
30926
30724
  }
30927
30725
  }
30928
30726
  checkDuplicateExports() {}
@@ -30962,9 +30760,7 @@ function requireLib () {
30962
30760
  importNode = super.parseImport(node);
30963
30761
  }
30964
30762
  if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
30965
- this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, {
30966
- at: importNode
30967
- });
30763
+ this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, importNode);
30968
30764
  }
30969
30765
  return importNode;
30970
30766
  }
@@ -31022,13 +30818,9 @@ function requireLib () {
31022
30818
  } of declaration.declarations) {
31023
30819
  if (!init) continue;
31024
30820
  if (kind !== "const" || !!id.typeAnnotation) {
31025
- this.raise(TSErrors.InitializerNotAllowedInAmbientContext, {
31026
- at: init
31027
- });
30821
+ this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init);
31028
30822
  } else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) {
31029
- this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, {
31030
- at: init
31031
- });
30823
+ this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, init);
31032
30824
  }
31033
30825
  }
31034
30826
  return declaration;
@@ -31077,9 +30869,7 @@ function requireLib () {
31077
30869
  this.next();
31078
30870
  this.next();
31079
30871
  if (this.tsHasSomeModifiers(member, modifiers)) {
31080
- this.raise(TSErrors.StaticBlockCannotHaveModifier, {
31081
- at: this.state.curPosition()
31082
- });
30872
+ this.raise(TSErrors.StaticBlockCannotHaveModifier, this.state.curPosition());
31083
30873
  }
31084
30874
  super.parseClassStaticBlock(classBody, member);
31085
30875
  } else {
@@ -31097,38 +30887,27 @@ function requireLib () {
31097
30887
  if (idx) {
31098
30888
  classBody.body.push(idx);
31099
30889
  if (member.abstract) {
31100
- this.raise(TSErrors.IndexSignatureHasAbstract, {
31101
- at: member
31102
- });
30890
+ this.raise(TSErrors.IndexSignatureHasAbstract, member);
31103
30891
  }
31104
30892
  if (member.accessibility) {
31105
- this.raise(TSErrors.IndexSignatureHasAccessibility, {
31106
- at: member,
30893
+ this.raise(TSErrors.IndexSignatureHasAccessibility, member, {
31107
30894
  modifier: member.accessibility
31108
30895
  });
31109
30896
  }
31110
30897
  if (member.declare) {
31111
- this.raise(TSErrors.IndexSignatureHasDeclare, {
31112
- at: member
31113
- });
30898
+ this.raise(TSErrors.IndexSignatureHasDeclare, member);
31114
30899
  }
31115
30900
  if (member.override) {
31116
- this.raise(TSErrors.IndexSignatureHasOverride, {
31117
- at: member
31118
- });
30901
+ this.raise(TSErrors.IndexSignatureHasOverride, member);
31119
30902
  }
31120
30903
  return;
31121
30904
  }
31122
30905
  if (!this.state.inAbstractClass && member.abstract) {
31123
- this.raise(TSErrors.NonAbstractClassHasAbstractMethod, {
31124
- at: member
31125
- });
30906
+ this.raise(TSErrors.NonAbstractClassHasAbstractMethod, member);
31126
30907
  }
31127
30908
  if (member.override) {
31128
30909
  if (!state.hadSuperClass) {
31129
- this.raise(TSErrors.OverrideNotInSubClass, {
31130
- at: member
31131
- });
30910
+ this.raise(TSErrors.OverrideNotInSubClass, member);
31132
30911
  }
31133
30912
  }
31134
30913
  super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
@@ -31137,14 +30916,10 @@ function requireLib () {
31137
30916
  const optional = this.eat(17);
31138
30917
  if (optional) methodOrProp.optional = true;
31139
30918
  if (methodOrProp.readonly && this.match(10)) {
31140
- this.raise(TSErrors.ClassMethodHasReadonly, {
31141
- at: methodOrProp
31142
- });
30919
+ this.raise(TSErrors.ClassMethodHasReadonly, methodOrProp);
31143
30920
  }
31144
30921
  if (methodOrProp.declare && this.match(10)) {
31145
- this.raise(TSErrors.ClassMethodHasDeclare, {
31146
- at: methodOrProp
31147
- });
30922
+ this.raise(TSErrors.ClassMethodHasDeclare, methodOrProp);
31148
30923
  }
31149
30924
  }
31150
30925
  parseExpressionStatement(node, expr, decorators) {
@@ -31190,9 +30965,7 @@ function requireLib () {
31190
30965
  const startLoc = this.state.startLoc;
31191
30966
  const isDeclare = this.eatContextual(125);
31192
30967
  if (isDeclare && (this.isContextual(125) || !this.shouldParseExportDeclaration())) {
31193
- throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, {
31194
- at: this.state.startLoc
31195
- });
30968
+ throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
31196
30969
  }
31197
30970
  const isIdentifier = tokenIsIdentifier(this.state.type);
31198
30971
  const declaration = isIdentifier && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
@@ -31228,16 +31001,13 @@ function requireLib () {
31228
31001
  parseClassProperty(node) {
31229
31002
  this.parseClassPropertyAnnotation(node);
31230
31003
  if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(29)) {
31231
- this.raise(TSErrors.DeclareClassFieldHasInitializer, {
31232
- at: this.state.startLoc
31233
- });
31004
+ this.raise(TSErrors.DeclareClassFieldHasInitializer, this.state.startLoc);
31234
31005
  }
31235
31006
  if (node.abstract && this.match(29)) {
31236
31007
  const {
31237
31008
  key
31238
31009
  } = node;
31239
- this.raise(TSErrors.AbstractPropertyHasInitializer, {
31240
- at: this.state.startLoc,
31010
+ this.raise(TSErrors.AbstractPropertyHasInitializer, this.state.startLoc, {
31241
31011
  propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
31242
31012
  });
31243
31013
  }
@@ -31245,13 +31015,10 @@ function requireLib () {
31245
31015
  }
31246
31016
  parseClassPrivateProperty(node) {
31247
31017
  if (node.abstract) {
31248
- this.raise(TSErrors.PrivateElementHasAbstract, {
31249
- at: node
31250
- });
31018
+ this.raise(TSErrors.PrivateElementHasAbstract, node);
31251
31019
  }
31252
31020
  if (node.accessibility) {
31253
- this.raise(TSErrors.PrivateElementHasAccessibility, {
31254
- at: node,
31021
+ this.raise(TSErrors.PrivateElementHasAccessibility, node, {
31255
31022
  modifier: node.accessibility
31256
31023
  });
31257
31024
  }
@@ -31261,26 +31028,21 @@ function requireLib () {
31261
31028
  parseClassAccessorProperty(node) {
31262
31029
  this.parseClassPropertyAnnotation(node);
31263
31030
  if (node.optional) {
31264
- this.raise(TSErrors.AccessorCannotBeOptional, {
31265
- at: node
31266
- });
31031
+ this.raise(TSErrors.AccessorCannotBeOptional, node);
31267
31032
  }
31268
31033
  return super.parseClassAccessorProperty(node);
31269
31034
  }
31270
31035
  pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
31271
31036
  const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
31272
31037
  if (typeParameters && isConstructor) {
31273
- this.raise(TSErrors.ConstructorHasTypeParameters, {
31274
- at: typeParameters
31275
- });
31038
+ this.raise(TSErrors.ConstructorHasTypeParameters, typeParameters);
31276
31039
  }
31277
31040
  const {
31278
31041
  declare = false,
31279
31042
  kind
31280
31043
  } = method;
31281
31044
  if (declare && (kind === "get" || kind === "set")) {
31282
- this.raise(TSErrors.DeclareAccessor, {
31283
- at: method,
31045
+ this.raise(TSErrors.DeclareAccessor, method, {
31284
31046
  kind
31285
31047
  });
31286
31048
  }
@@ -31395,9 +31157,7 @@ function requireLib () {
31395
31157
  reportReservedArrowTypeParam(node) {
31396
31158
  var _node$extra;
31397
31159
  if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra = node.extra) != null && _node$extra.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
31398
- this.raise(TSErrors.ReservedArrowTypeParam, {
31399
- at: node
31400
- });
31160
+ this.raise(TSErrors.ReservedArrowTypeParam, node);
31401
31161
  }
31402
31162
  }
31403
31163
  parseMaybeUnary(refExpressionErrors, sawUnary) {
@@ -31451,13 +31211,9 @@ function requireLib () {
31451
31211
  case "TSNonNullExpression":
31452
31212
  case "TSTypeAssertion":
31453
31213
  if (isLHS) {
31454
- this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, {
31455
- at: node
31456
- });
31214
+ this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, node);
31457
31215
  } else {
31458
- this.raise(TSErrors.UnexpectedTypeCastInParameter, {
31459
- at: node
31460
- });
31216
+ this.raise(TSErrors.UnexpectedTypeCastInParameter, node);
31461
31217
  }
31462
31218
  this.toAssignable(node.expression, isLHS);
31463
31219
  break;
@@ -31538,9 +31294,7 @@ function requireLib () {
31538
31294
  parseMaybeDefault(startLoc, left) {
31539
31295
  const node = super.parseMaybeDefault(startLoc, left);
31540
31296
  if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
31541
- this.raise(TSErrors.TypeAnnotationAfterAssign, {
31542
- at: node.typeAnnotation
31543
- });
31297
+ this.raise(TSErrors.TypeAnnotationAfterAssign, node.typeAnnotation);
31544
31298
  }
31545
31299
  return node;
31546
31300
  }
@@ -31654,9 +31408,7 @@ function requireLib () {
31654
31408
  } else if (this.isContextual(129)) {
31655
31409
  if (!this.hasFollowingLineBreak()) {
31656
31410
  node.abstract = true;
31657
- this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, {
31658
- at: node
31659
- });
31411
+ this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, node);
31660
31412
  return this.tsParseInterfaceDeclaration(node);
31661
31413
  }
31662
31414
  } else {
@@ -31671,8 +31423,7 @@ function requireLib () {
31671
31423
  const {
31672
31424
  key
31673
31425
  } = method;
31674
- this.raise(TSErrors.AbstractMethodHasImplementation, {
31675
- at: method,
31426
+ this.raise(TSErrors.AbstractMethodHasImplementation, method, {
31676
31427
  methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
31677
31428
  });
31678
31429
  }
@@ -31754,9 +31505,7 @@ function requireLib () {
31754
31505
  }
31755
31506
  }
31756
31507
  if (hasTypeSpecifier && isInTypeOnlyImportExport) {
31757
- this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, {
31758
- at: loc
31759
- });
31508
+ this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, loc);
31760
31509
  }
31761
31510
  node[leftOfAsKey] = leftOfAs;
31762
31511
  node[rightOfAsKey] = rightOfAs;
@@ -31943,9 +31692,7 @@ function requireLib () {
31943
31692
  node.body = this.finishPlaceholder(placeholder, "ClassBody");
31944
31693
  return this.finishNode(node, type);
31945
31694
  } else {
31946
- throw this.raise(PlaceholderErrors.ClassNameIsRequired, {
31947
- at: this.state.startLoc
31948
- });
31695
+ throw this.raise(PlaceholderErrors.ClassNameIsRequired, this.state.startLoc);
31949
31696
  }
31950
31697
  } else {
31951
31698
  this.parseClassId(node, isStatement, optionalId);
@@ -32023,9 +31770,7 @@ function requireLib () {
32023
31770
  }
32024
31771
  assertNoSpace() {
32025
31772
  if (this.state.start > this.state.lastTokEndLoc.index) {
32026
- this.raise(PlaceholderErrors.UnexpectedSpace, {
32027
- at: this.state.lastTokEndLoc
32028
- });
31773
+ this.raise(PlaceholderErrors.UnexpectedSpace, this.state.lastTokEndLoc);
32029
31774
  }
32030
31775
  }
32031
31776
  };
@@ -32214,9 +31959,7 @@ function requireLib () {
32214
31959
  const name = key.type === "Identifier" ? key.name : key.value;
32215
31960
  if (name === "__proto__") {
32216
31961
  if (isRecord) {
32217
- this.raise(Errors.RecordNoProto, {
32218
- at: key
32219
- });
31962
+ this.raise(Errors.RecordNoProto, key);
32220
31963
  return;
32221
31964
  }
32222
31965
  if (protoRef.used) {
@@ -32225,9 +31968,7 @@ function requireLib () {
32225
31968
  refExpressionErrors.doubleProtoLoc = key.loc.start;
32226
31969
  }
32227
31970
  } else {
32228
- this.raise(Errors.DuplicateProto, {
32229
- at: key
32230
- });
31971
+ this.raise(Errors.DuplicateProto, key);
32231
31972
  }
32232
31973
  }
32233
31974
  protoRef.used = true;
@@ -32244,7 +31985,7 @@ function requireLib () {
32244
31985
  this.unexpected();
32245
31986
  }
32246
31987
  this.finalizeRemainingComments();
32247
- expr.comments = this.state.comments;
31988
+ expr.comments = this.comments;
32248
31989
  expr.errors = this.state.errors;
32249
31990
  if (this.options.tokens) {
32250
31991
  expr.tokens = this.tokens;
@@ -32377,8 +32118,7 @@ function requireLib () {
32377
32118
  if (this.isPrivateName(left)) {
32378
32119
  const value = this.getPrivateNameSV(left);
32379
32120
  if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) {
32380
- this.raise(Errors.PrivateInExpectedIn, {
32381
- at: left,
32121
+ this.raise(Errors.PrivateInExpectedIn, left, {
32382
32122
  identifierName: value
32383
32123
  });
32384
32124
  }
@@ -32408,18 +32148,14 @@ function requireLib () {
32408
32148
  proposal: "minimal"
32409
32149
  }])) {
32410
32150
  if (this.state.type === 96 && this.prodParam.hasAwait) {
32411
- throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, {
32412
- at: this.state.startLoc
32413
- });
32151
+ throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, this.state.startLoc);
32414
32152
  }
32415
32153
  }
32416
32154
  node.right = this.parseExprOpRightExpr(op, prec);
32417
32155
  const finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
32418
32156
  const nextOp = this.state.type;
32419
32157
  if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) {
32420
- throw this.raise(Errors.MixingCoalesceWithLogical, {
32421
- at: this.state.startLoc
32422
- });
32158
+ throw this.raise(Errors.MixingCoalesceWithLogical, this.state.startLoc);
32423
32159
  }
32424
32160
  return this.parseExprOp(finishedNode, leftStartLoc, minPrec);
32425
32161
  }
@@ -32438,9 +32174,7 @@ function requireLib () {
32438
32174
  case "smart":
32439
32175
  return this.withTopicBindingContext(() => {
32440
32176
  if (this.prodParam.hasYield && this.isContextual(108)) {
32441
- throw this.raise(Errors.PipeBodyIsTighter, {
32442
- at: this.state.startLoc
32443
- });
32177
+ throw this.raise(Errors.PipeBodyIsTighter, this.state.startLoc);
32444
32178
  }
32445
32179
  return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startLoc);
32446
32180
  });
@@ -32465,23 +32199,18 @@ function requireLib () {
32465
32199
  const body = this.parseMaybeAssign();
32466
32200
  const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);
32467
32201
  if (requiredParentheses && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) {
32468
- this.raise(Errors.PipeUnparenthesizedBody, {
32469
- at: startLoc,
32202
+ this.raise(Errors.PipeUnparenthesizedBody, startLoc, {
32470
32203
  type: body.type
32471
32204
  });
32472
32205
  }
32473
32206
  if (!this.topicReferenceWasUsedInCurrentContext()) {
32474
- this.raise(Errors.PipeTopicUnused, {
32475
- at: startLoc
32476
- });
32207
+ this.raise(Errors.PipeTopicUnused, startLoc);
32477
32208
  }
32478
32209
  return body;
32479
32210
  }
32480
32211
  checkExponentialAfterUnary(node) {
32481
32212
  if (this.match(57)) {
32482
- this.raise(Errors.UnexpectedTokenUnaryExponentiation, {
32483
- at: node.argument
32484
- });
32213
+ this.raise(Errors.UnexpectedTokenUnaryExponentiation, node.argument);
32485
32214
  }
32486
32215
  }
32487
32216
  parseMaybeUnary(refExpressionErrors, sawUnary) {
@@ -32508,13 +32237,9 @@ function requireLib () {
32508
32237
  if (this.state.strict && isDelete) {
32509
32238
  const arg = node.argument;
32510
32239
  if (arg.type === "Identifier") {
32511
- this.raise(Errors.StrictDelete, {
32512
- at: node
32513
- });
32240
+ this.raise(Errors.StrictDelete, node);
32514
32241
  } else if (this.hasPropertyAsPrivateName(arg)) {
32515
- this.raise(Errors.DeletePrivateField, {
32516
- at: node
32517
- });
32242
+ this.raise(Errors.DeletePrivateField, node);
32518
32243
  }
32519
32244
  }
32520
32245
  if (!update) {
@@ -32531,9 +32256,7 @@ function requireLib () {
32531
32256
  } = this.state;
32532
32257
  const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54);
32533
32258
  if (startsExpr && !this.isAmbiguousAwait()) {
32534
- this.raiseOverwrite(Errors.AwaitNotInAsyncContext, {
32535
- at: startLoc
32536
- });
32259
+ this.raiseOverwrite(Errors.AwaitNotInAsyncContext, startLoc);
32537
32260
  return this.parseAwait(startLoc);
32538
32261
  }
32539
32262
  }
@@ -32595,9 +32318,7 @@ function requireLib () {
32595
32318
  let optional = false;
32596
32319
  if (type === 18) {
32597
32320
  if (noCalls) {
32598
- this.raise(Errors.OptionalChainingNoNew, {
32599
- at: this.state.startLoc
32600
- });
32321
+ this.raise(Errors.OptionalChainingNoNew, this.state.startLoc);
32601
32322
  if (this.lookaheadCharCode() === 40) {
32602
32323
  state.stop = true;
32603
32324
  return base;
@@ -32627,9 +32348,7 @@ function requireLib () {
32627
32348
  this.expect(3);
32628
32349
  } else if (this.match(138)) {
32629
32350
  if (base.type === "Super") {
32630
- this.raise(Errors.SuperPrivateField, {
32631
- at: startLoc
32632
- });
32351
+ this.raise(Errors.SuperPrivateField, startLoc);
32633
32352
  }
32634
32353
  this.classScope.usePrivateName(this.state.value, this.state.startLoc);
32635
32354
  node.property = this.parsePrivateName();
@@ -32699,9 +32418,7 @@ function requireLib () {
32699
32418
  node.tag = base;
32700
32419
  node.quasi = this.parseTemplate(true);
32701
32420
  if (state.optionalChainMember) {
32702
- this.raise(Errors.OptionalChainingNoTemplate, {
32703
- at: startLoc
32704
- });
32421
+ this.raise(Errors.OptionalChainingNoTemplate, startLoc);
32705
32422
  }
32706
32423
  return this.finishNode(node, "TaggedTemplateExpression");
32707
32424
  }
@@ -32723,16 +32440,13 @@ function requireLib () {
32723
32440
  }
32724
32441
  }
32725
32442
  if (node.arguments.length === 0 || node.arguments.length > 2) {
32726
- this.raise(Errors.ImportCallArity, {
32727
- at: node,
32443
+ this.raise(Errors.ImportCallArity, node, {
32728
32444
  maxArgumentCount: this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? 2 : 1
32729
32445
  });
32730
32446
  } else {
32731
32447
  for (const arg of node.arguments) {
32732
32448
  if (arg.type === "SpreadElement") {
32733
- this.raise(Errors.ImportCallSpreadArgument, {
32734
- at: arg
32735
- });
32449
+ this.raise(Errors.ImportCallSpreadArgument, arg);
32736
32450
  }
32737
32451
  }
32738
32452
  }
@@ -32751,9 +32465,7 @@ function requireLib () {
32751
32465
  this.expect(12);
32752
32466
  if (this.match(close)) {
32753
32467
  if (dynamicImport && !this.hasPlugin("importAttributes") && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) {
32754
- this.raise(Errors.ImportCallArgumentTrailingComma, {
32755
- at: this.state.lastTokStartLoc
32756
- });
32468
+ this.raise(Errors.ImportCallArgumentTrailingComma, this.state.lastTokStartLoc);
32757
32469
  }
32758
32470
  if (nodeForExtra) {
32759
32471
  this.addTrailingCommaExtraToNode(nodeForExtra);
@@ -32809,9 +32521,7 @@ function requireLib () {
32809
32521
  return this.finishNode(node, "Import");
32810
32522
  }
32811
32523
  } else {
32812
- this.raise(Errors.UnsupportedImport, {
32813
- at: this.state.lastTokStartLoc
32814
- });
32524
+ this.raise(Errors.UnsupportedImport, this.state.lastTokStartLoc);
32815
32525
  return this.finishNode(node, "Import");
32816
32526
  }
32817
32527
  case 78:
@@ -32885,15 +32595,12 @@ function requireLib () {
32885
32595
  if (callee.type === "MemberExpression") {
32886
32596
  return this.finishNode(node, "BindExpression");
32887
32597
  } else {
32888
- throw this.raise(Errors.UnsupportedBind, {
32889
- at: callee
32890
- });
32598
+ throw this.raise(Errors.UnsupportedBind, callee);
32891
32599
  }
32892
32600
  }
32893
32601
  case 138:
32894
32602
  {
32895
- this.raise(Errors.PrivateInExpectedIn, {
32896
- at: this.state.startLoc,
32603
+ this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, {
32897
32604
  identifierName: this.state.value
32898
32605
  });
32899
32606
  return this.parsePrivateName();
@@ -32993,15 +32700,12 @@ function requireLib () {
32993
32700
  if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
32994
32701
  const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" : "TopicReference";
32995
32702
  if (!this.topicReferenceIsAllowedInCurrentContext()) {
32996
- this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, {
32997
- at: startLoc
32998
- });
32703
+ this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, startLoc);
32999
32704
  }
33000
32705
  this.registerTopicReference();
33001
32706
  return this.finishNode(node, nodeType);
33002
32707
  } else {
33003
- throw this.raise(Errors.PipeTopicUnconfiguredToken, {
33004
- at: startLoc,
32708
+ throw this.raise(Errors.PipeTopicUnconfiguredToken, startLoc, {
33005
32709
  token: tokenLabelName(tokenType)
33006
32710
  });
33007
32711
  }
@@ -33017,9 +32721,7 @@ function requireLib () {
33017
32721
  case "smart":
33018
32722
  return tokenType === 27;
33019
32723
  default:
33020
- throw this.raise(Errors.PipeTopicRequiresHackPipes, {
33021
- at: startLoc
33022
- });
32724
+ throw this.raise(Errors.PipeTopicRequiresHackPipes, startLoc);
33023
32725
  }
33024
32726
  }
33025
32727
  parseAsyncArrowUnaryFunction(node) {
@@ -33027,9 +32729,7 @@ function requireLib () {
33027
32729
  const params = [this.parseIdentifier()];
33028
32730
  this.prodParam.exit();
33029
32731
  if (this.hasPrecedingLineBreak()) {
33030
- this.raise(Errors.LineTerminatorBeforeArrow, {
33031
- at: this.state.curPosition()
33032
- });
32732
+ this.raise(Errors.LineTerminatorBeforeArrow, this.state.curPosition());
33033
32733
  }
33034
32734
  this.expect(19);
33035
32735
  return this.parseArrowExpression(node, params, true);
@@ -33057,18 +32757,12 @@ function requireLib () {
33057
32757
  const node = this.startNode();
33058
32758
  this.next();
33059
32759
  if (this.match(10) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod) {
33060
- this.raise(Errors.SuperNotAllowed, {
33061
- at: node
33062
- });
32760
+ this.raise(Errors.SuperNotAllowed, node);
33063
32761
  } else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) {
33064
- this.raise(Errors.UnexpectedSuper, {
33065
- at: node
33066
- });
32762
+ this.raise(Errors.UnexpectedSuper, node);
33067
32763
  }
33068
32764
  if (!this.match(10) && !this.match(0) && !this.match(16)) {
33069
- this.raise(Errors.UnsupportedSuper, {
33070
- at: node
33071
- });
32765
+ this.raise(Errors.UnsupportedSuper, node);
33072
32766
  }
33073
32767
  return this.finishNode(node, "Super");
33074
32768
  }
@@ -33100,8 +32794,7 @@ function requireLib () {
33100
32794
  const containsEsc = this.state.containsEsc;
33101
32795
  node.property = this.parseIdentifier(true);
33102
32796
  if (node.property.name !== propertyName || containsEsc) {
33103
- this.raise(Errors.UnsupportedMetaProperty, {
33104
- at: node.property,
32797
+ this.raise(Errors.UnsupportedMetaProperty, node.property, {
33105
32798
  target: meta.name,
33106
32799
  onlyValidPropertyName: propertyName
33107
32800
  });
@@ -33113,9 +32806,7 @@ function requireLib () {
33113
32806
  this.next();
33114
32807
  if (this.isContextual(101)) {
33115
32808
  if (!this.inModule) {
33116
- this.raise(Errors.ImportMetaOutsideModule, {
33117
- at: id
33118
- });
32809
+ this.raise(Errors.ImportMetaOutsideModule, id);
33119
32810
  }
33120
32811
  this.sawUnambiguousESM = true;
33121
32812
  } else if (this.isContextual(105) || this.isContextual(97)) {
@@ -33123,8 +32814,7 @@ function requireLib () {
33123
32814
  if (!isSource) this.unexpected();
33124
32815
  this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
33125
32816
  if (!this.options.createImportExpressions) {
33126
- throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, {
33127
- at: this.state.startLoc,
32817
+ throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, {
33128
32818
  phase: this.state.value
33129
32819
  });
33130
32820
  }
@@ -33270,9 +32960,7 @@ function requireLib () {
33270
32960
  this.next();
33271
32961
  const metaProp = this.parseMetaProperty(node, meta, "target");
33272
32962
  if (!this.scope.inNonArrowFunction && !this.scope.inClass && !this.options.allowNewTargetOutsideFunction) {
33273
- this.raise(Errors.UnexpectedNewTarget, {
33274
- at: metaProp
33275
- });
32963
+ this.raise(Errors.UnexpectedNewTarget, metaProp);
33276
32964
  }
33277
32965
  return metaProp;
33278
32966
  }
@@ -33294,9 +32982,7 @@ function requireLib () {
33294
32982
  const callee = this.parseNoCallExpr();
33295
32983
  node.callee = callee;
33296
32984
  if (isImport && (callee.type === "Import" || callee.type === "ImportExpression")) {
33297
- this.raise(Errors.ImportCallNotNewExpression, {
33298
- at: callee
33299
- });
32985
+ this.raise(Errors.ImportCallNotNewExpression, callee);
33300
32986
  }
33301
32987
  }
33302
32988
  parseTemplateElement(isTagged) {
@@ -33310,9 +32996,7 @@ function requireLib () {
33310
32996
  const elem = this.startNodeAt(createPositionWithColumnOffset(startLoc, 1));
33311
32997
  if (value === null) {
33312
32998
  if (!isTagged) {
33313
- this.raise(Errors.InvalidEscapeSequenceTemplate, {
33314
- at: createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1)
33315
- });
32999
+ this.raise(Errors.InvalidEscapeSequenceTemplate, createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1));
33316
33000
  }
33317
33001
  }
33318
33002
  const isTail = this.match(24);
@@ -33372,9 +33056,7 @@ function requireLib () {
33372
33056
  this.checkProto(prop, isRecord, propHash, refExpressionErrors);
33373
33057
  }
33374
33058
  if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
33375
- this.raise(Errors.InvalidRecordProperty, {
33376
- at: prop
33377
- });
33059
+ this.raise(Errors.InvalidRecordProperty, prop);
33378
33060
  }
33379
33061
  if (prop.shorthand) {
33380
33062
  this.addExtra(prop, "shorthand", true);
@@ -33392,7 +33074,7 @@ function requireLib () {
33392
33074
  return this.finishNode(node, type);
33393
33075
  }
33394
33076
  addTrailingCommaExtraToNode(node) {
33395
- this.addExtra(node, "trailingComma", this.state.lastTokStart);
33077
+ this.addExtra(node, "trailingComma", this.state.lastTokStartLoc.index);
33396
33078
  this.addExtra(node, "trailingCommaLoc", this.state.lastTokStartLoc, false);
33397
33079
  }
33398
33080
  maybeAsyncOrAccessorProp(prop) {
@@ -33402,9 +33084,7 @@ function requireLib () {
33402
33084
  let decorators = [];
33403
33085
  if (this.match(26)) {
33404
33086
  if (this.hasPlugin("decorators")) {
33405
- this.raise(Errors.UnsupportedPropertyDecorator, {
33406
- at: this.state.startLoc
33407
- });
33087
+ this.raise(Errors.UnsupportedPropertyDecorator, this.state.startLoc);
33408
33088
  }
33409
33089
  while (this.match(26)) {
33410
33090
  decorators.push(this.parseDecorator());
@@ -33444,8 +33124,7 @@ function requireLib () {
33444
33124
  prop.kind = keyName;
33445
33125
  if (this.match(55)) {
33446
33126
  isGenerator = true;
33447
- this.raise(Errors.AccessorIsGenerator, {
33448
- at: this.state.curPosition(),
33127
+ this.raise(Errors.AccessorIsGenerator, this.state.curPosition(), {
33449
33128
  kind: keyName
33450
33129
  });
33451
33130
  this.next();
@@ -33466,14 +33145,10 @@ function requireLib () {
33466
33145
  const paramCount = this.getGetterSetterExpectedParamCount(method);
33467
33146
  const params = this.getObjectOrClassMethodParams(method);
33468
33147
  if (params.length !== paramCount) {
33469
- this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, {
33470
- at: method
33471
- });
33148
+ this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, method);
33472
33149
  }
33473
33150
  if (method.kind === "set" && ((_params = params[params.length - 1]) == null ? void 0 : _params.type) === "RestElement") {
33474
- this.raise(Errors.BadSetterRestParameter, {
33475
- at: method
33476
- });
33151
+ this.raise(Errors.BadSetterRestParameter, method);
33477
33152
  }
33478
33153
  }
33479
33154
  parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
@@ -33506,9 +33181,7 @@ function requireLib () {
33506
33181
  refExpressionErrors.shorthandAssignLoc = shorthandAssignLoc;
33507
33182
  }
33508
33183
  } else {
33509
- this.raise(Errors.InvalidCoverInitializedName, {
33510
- at: shorthandAssignLoc
33511
- });
33184
+ this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
33512
33185
  }
33513
33186
  prop.value = this.parseMaybeDefault(startLoc, cloneIdentifier(prop.key));
33514
33187
  } else {
@@ -33558,9 +33231,7 @@ function requireLib () {
33558
33231
  refExpressionErrors.privateKeyLoc = privateKeyLoc;
33559
33232
  }
33560
33233
  } else {
33561
- this.raise(Errors.UnexpectedPrivateField, {
33562
- at: privateKeyLoc
33563
- });
33234
+ this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
33564
33235
  }
33565
33236
  key = this.parsePrivateName();
33566
33237
  break;
@@ -33646,9 +33317,7 @@ function requireLib () {
33646
33317
  node.body = this.parseBlock(true, false, hasStrictModeDirective => {
33647
33318
  const nonSimple = !this.isSimpleParamList(node.params);
33648
33319
  if (hasStrictModeDirective && nonSimple) {
33649
- this.raise(Errors.IllegalLanguageModeDirective, {
33650
- at: (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node
33651
- });
33320
+ this.raise(Errors.IllegalLanguageModeDirective, (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node);
33652
33321
  }
33653
33322
  const strictModeChanged = !oldStrict && this.state.strict;
33654
33323
  this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
@@ -33708,8 +33377,7 @@ function requireLib () {
33708
33377
  let elt;
33709
33378
  if (this.match(12)) {
33710
33379
  if (!allowEmpty) {
33711
- this.raise(Errors.UnexpectedToken, {
33712
- at: this.state.curPosition(),
33380
+ this.raise(Errors.UnexpectedToken, this.state.curPosition(), {
33713
33381
  unexpected: ","
33714
33382
  });
33715
33383
  }
@@ -33720,9 +33388,7 @@ function requireLib () {
33720
33388
  } else if (this.match(17)) {
33721
33389
  this.expectPlugin("partialApplication");
33722
33390
  if (!allowPlaceholder) {
33723
- this.raise(Errors.UnexpectedArgumentPlaceholder, {
33724
- at: this.state.startLoc
33725
- });
33391
+ this.raise(Errors.UnexpectedArgumentPlaceholder, this.state.startLoc);
33726
33392
  }
33727
33393
  const node = this.startNode();
33728
33394
  this.next();
@@ -33772,47 +33438,35 @@ function requireLib () {
33772
33438
  return;
33773
33439
  }
33774
33440
  if (checkKeywords && isKeyword(word)) {
33775
- this.raise(Errors.UnexpectedKeyword, {
33776
- at: startLoc,
33441
+ this.raise(Errors.UnexpectedKeyword, startLoc, {
33777
33442
  keyword: word
33778
33443
  });
33779
33444
  return;
33780
33445
  }
33781
33446
  const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord;
33782
33447
  if (reservedTest(word, this.inModule)) {
33783
- this.raise(Errors.UnexpectedReservedWord, {
33784
- at: startLoc,
33448
+ this.raise(Errors.UnexpectedReservedWord, startLoc, {
33785
33449
  reservedWord: word
33786
33450
  });
33787
33451
  return;
33788
33452
  } else if (word === "yield") {
33789
33453
  if (this.prodParam.hasYield) {
33790
- this.raise(Errors.YieldBindingIdentifier, {
33791
- at: startLoc
33792
- });
33454
+ this.raise(Errors.YieldBindingIdentifier, startLoc);
33793
33455
  return;
33794
33456
  }
33795
33457
  } else if (word === "await") {
33796
33458
  if (this.prodParam.hasAwait) {
33797
- this.raise(Errors.AwaitBindingIdentifier, {
33798
- at: startLoc
33799
- });
33459
+ this.raise(Errors.AwaitBindingIdentifier, startLoc);
33800
33460
  return;
33801
33461
  }
33802
33462
  if (this.scope.inStaticBlock) {
33803
- this.raise(Errors.AwaitBindingIdentifierInStaticBlock, {
33804
- at: startLoc
33805
- });
33463
+ this.raise(Errors.AwaitBindingIdentifierInStaticBlock, startLoc);
33806
33464
  return;
33807
33465
  }
33808
- this.expressionScope.recordAsyncArrowParametersError({
33809
- at: startLoc
33810
- });
33466
+ this.expressionScope.recordAsyncArrowParametersError(startLoc);
33811
33467
  } else if (word === "arguments") {
33812
33468
  if (this.scope.inClassAndNotInNonArrowFunction) {
33813
- this.raise(Errors.ArgumentsInClass, {
33814
- at: startLoc
33815
- });
33469
+ this.raise(Errors.ArgumentsInClass, startLoc);
33816
33470
  return;
33817
33471
  }
33818
33472
  }
@@ -33826,13 +33480,9 @@ function requireLib () {
33826
33480
  }
33827
33481
  parseAwait(startLoc) {
33828
33482
  const node = this.startNodeAt(startLoc);
33829
- this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, {
33830
- at: node
33831
- });
33483
+ this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, node);
33832
33484
  if (this.eat(55)) {
33833
- this.raise(Errors.ObsoleteAwaitStar, {
33834
- at: node
33835
- });
33485
+ this.raise(Errors.ObsoleteAwaitStar, node);
33836
33486
  }
33837
33487
  if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) {
33838
33488
  if (this.isAmbiguousAwait()) {
@@ -33855,9 +33505,7 @@ function requireLib () {
33855
33505
  }
33856
33506
  parseYield() {
33857
33507
  const node = this.startNode();
33858
- this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, {
33859
- at: node
33860
- });
33508
+ this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, node);
33861
33509
  this.next();
33862
33510
  let delegating = false;
33863
33511
  let argument = null;
@@ -33902,9 +33550,7 @@ function requireLib () {
33902
33550
  proposal: "smart"
33903
33551
  }])) {
33904
33552
  if (left.type === "SequenceExpression") {
33905
- this.raise(Errors.PipelineHeadSequenceExpression, {
33906
- at: leftStartLoc
33907
- });
33553
+ this.raise(Errors.PipelineHeadSequenceExpression, leftStartLoc);
33908
33554
  }
33909
33555
  }
33910
33556
  }
@@ -33932,14 +33578,10 @@ function requireLib () {
33932
33578
  }
33933
33579
  checkSmartPipeTopicBodyEarlyErrors(startLoc) {
33934
33580
  if (this.match(19)) {
33935
- throw this.raise(Errors.PipelineBodyNoArrow, {
33936
- at: this.state.startLoc
33937
- });
33581
+ throw this.raise(Errors.PipelineBodyNoArrow, this.state.startLoc);
33938
33582
  }
33939
33583
  if (!this.topicReferenceWasUsedInCurrentContext()) {
33940
- this.raise(Errors.PipelineTopicUnused, {
33941
- at: startLoc
33942
- });
33584
+ this.raise(Errors.PipelineTopicUnused, startLoc);
33943
33585
  }
33944
33586
  }
33945
33587
  withTopicBindingContext(callback) {
@@ -34046,10 +33688,10 @@ function requireLib () {
34046
33688
  parsePropertyNamePrefixOperator(prop) {}
34047
33689
  }
34048
33690
  const loopLabel = {
34049
- kind: "loop"
33691
+ kind: 1
34050
33692
  },
34051
33693
  switchLabel = {
34052
- kind: "switch"
33694
+ kind: 2
34053
33695
  };
34054
33696
  const loneSurrogate = /[\uD800-\uDFFF]/u;
34055
33697
  const keywordRelationalOperator = /in(?:stanceof)?/y;
@@ -34163,7 +33805,7 @@ function requireLib () {
34163
33805
  class StatementParser extends ExpressionParser {
34164
33806
  parseTopLevel(file, program) {
34165
33807
  file.program = this.parseProgram(program);
34166
- file.comments = this.state.comments;
33808
+ file.comments = this.comments;
34167
33809
  if (this.options.tokens) {
34168
33810
  file.tokens = babel7CompatTokens(this.tokens, this.input);
34169
33811
  }
@@ -34175,8 +33817,7 @@ function requireLib () {
34175
33817
  this.parseBlockBody(program, true, true, end);
34176
33818
  if (this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
34177
33819
  for (const [localName, at] of Array.from(this.scope.undefinedExports)) {
34178
- this.raise(Errors.ModuleExportUndefined, {
34179
- at,
33820
+ this.raise(Errors.ModuleExportUndefined, at, {
34180
33821
  localName
34181
33822
  });
34182
33823
  }
@@ -34318,9 +33959,7 @@ function requireLib () {
34318
33959
  case 68:
34319
33960
  if (this.lookaheadCharCode() === 46) break;
34320
33961
  if (!allowFunctionDeclaration) {
34321
- this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, {
34322
- at: this.state.startLoc
34323
- });
33962
+ this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, this.state.startLoc);
34324
33963
  }
34325
33964
  return this.parseFunctionStatement(node, false, !allowDeclaration && allowFunctionDeclaration);
34326
33965
  case 80:
@@ -34339,13 +33978,9 @@ function requireLib () {
34339
33978
  case 96:
34340
33979
  if (!this.state.containsEsc && this.startsAwaitUsing()) {
34341
33980
  if (!this.isAwaitAllowed()) {
34342
- this.raise(Errors.AwaitUsingNotInAsyncContext, {
34343
- at: node
34344
- });
33981
+ this.raise(Errors.AwaitUsingNotInAsyncContext, node);
34345
33982
  } else if (!allowDeclaration) {
34346
- this.raise(Errors.UnexpectedLexicalDeclaration, {
34347
- at: node
34348
- });
33983
+ this.raise(Errors.UnexpectedLexicalDeclaration, node);
34349
33984
  }
34350
33985
  this.next();
34351
33986
  return this.parseVarStatement(node, "await using");
@@ -34357,13 +33992,9 @@ function requireLib () {
34357
33992
  }
34358
33993
  this.expectPlugin("explicitResourceManagement");
34359
33994
  if (!this.scope.inModule && this.scope.inTopLevel) {
34360
- this.raise(Errors.UnexpectedUsingDeclaration, {
34361
- at: this.state.startLoc
34362
- });
33995
+ this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
34363
33996
  } else if (!allowDeclaration) {
34364
- this.raise(Errors.UnexpectedLexicalDeclaration, {
34365
- at: this.state.startLoc
34366
- });
33997
+ this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
34367
33998
  }
34368
33999
  return this.parseVarStatement(node, "using");
34369
34000
  case 100:
@@ -34383,9 +34014,7 @@ function requireLib () {
34383
34014
  case 75:
34384
34015
  {
34385
34016
  if (!allowDeclaration) {
34386
- this.raise(Errors.UnexpectedLexicalDeclaration, {
34387
- at: this.state.startLoc
34388
- });
34017
+ this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
34389
34018
  }
34390
34019
  }
34391
34020
  case 74:
@@ -34411,9 +34040,7 @@ function requireLib () {
34411
34040
  case 82:
34412
34041
  {
34413
34042
  if (!this.options.allowImportExportEverywhere && !topLevel) {
34414
- this.raise(Errors.UnexpectedImportExport, {
34415
- at: this.state.startLoc
34416
- });
34043
+ this.raise(Errors.UnexpectedImportExport, this.state.startLoc);
34417
34044
  }
34418
34045
  this.next();
34419
34046
  let result;
@@ -34435,9 +34062,7 @@ function requireLib () {
34435
34062
  {
34436
34063
  if (this.isAsyncFunction()) {
34437
34064
  if (!allowDeclaration) {
34438
- this.raise(Errors.AsyncFunctionInSingleStatementContext, {
34439
- at: this.state.startLoc
34440
- });
34065
+ this.raise(Errors.AsyncFunctionInSingleStatementContext, this.state.startLoc);
34441
34066
  }
34442
34067
  this.next();
34443
34068
  return this.parseFunctionStatement(node, true, !allowDeclaration && allowFunctionDeclaration);
@@ -34454,9 +34079,7 @@ function requireLib () {
34454
34079
  }
34455
34080
  assertModuleNodeAllowed(node) {
34456
34081
  if (!this.options.allowImportExportEverywhere && !this.inModule) {
34457
- this.raise(Errors.ImportOutsideModule, {
34458
- at: node
34459
- });
34082
+ this.raise(Errors.ImportOutsideModule, node);
34460
34083
  }
34461
34084
  }
34462
34085
  decoratorsEnabledBeforeExport() {
@@ -34467,9 +34090,7 @@ function requireLib () {
34467
34090
  if (maybeDecorators) {
34468
34091
  if (classNode.decorators && classNode.decorators.length > 0) {
34469
34092
  if (typeof this.getPluginOption("decorators", "decoratorsBeforeExport") !== "boolean") {
34470
- this.raise(Errors.DecoratorsBeforeAfterExport, {
34471
- at: classNode.decorators[0]
34472
- });
34093
+ this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
34473
34094
  }
34474
34095
  classNode.decorators.unshift(...maybeDecorators);
34475
34096
  } else {
@@ -34493,14 +34114,10 @@ function requireLib () {
34493
34114
  this.unexpected();
34494
34115
  }
34495
34116
  if (!this.decoratorsEnabledBeforeExport()) {
34496
- this.raise(Errors.DecoratorExportClass, {
34497
- at: this.state.startLoc
34498
- });
34117
+ this.raise(Errors.DecoratorExportClass, this.state.startLoc);
34499
34118
  }
34500
34119
  } else if (!this.canHaveLeadingDecorator()) {
34501
- throw this.raise(Errors.UnexpectedLeadingDecorator, {
34502
- at: this.state.startLoc
34503
- });
34120
+ throw this.raise(Errors.UnexpectedLeadingDecorator, this.state.startLoc);
34504
34121
  }
34505
34122
  return decorators;
34506
34123
  }
@@ -34520,9 +34137,7 @@ function requireLib () {
34520
34137
  const paramsStartLoc = this.state.startLoc;
34521
34138
  node.expression = this.parseMaybeDecoratorArguments(expr);
34522
34139
  if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
34523
- this.raise(Errors.DecoratorArgumentsOutsideParentheses, {
34524
- at: paramsStartLoc
34525
- });
34140
+ this.raise(Errors.DecoratorArgumentsOutsideParentheses, paramsStartLoc);
34526
34141
  }
34527
34142
  } else {
34528
34143
  expr = this.parseIdentifier(false);
@@ -34571,14 +34186,15 @@ function requireLib () {
34571
34186
  for (i = 0; i < this.state.labels.length; ++i) {
34572
34187
  const lab = this.state.labels[i];
34573
34188
  if (node.label == null || lab.name === node.label.name) {
34574
- if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
34189
+ if (lab.kind != null && (isBreak || lab.kind === 1)) {
34190
+ break;
34191
+ }
34575
34192
  if (node.label && isBreak) break;
34576
34193
  }
34577
34194
  }
34578
34195
  if (i === this.state.labels.length) {
34579
34196
  const type = isBreak ? "BreakStatement" : "ContinueStatement";
34580
- this.raise(Errors.IllegalBreakContinue, {
34581
- at: node,
34197
+ this.raise(Errors.IllegalBreakContinue, node, {
34582
34198
  type
34583
34199
  });
34584
34200
  }
@@ -34630,9 +34246,7 @@ function requireLib () {
34630
34246
  if (startsWithAwaitUsing) {
34631
34247
  kind = "await using";
34632
34248
  if (!this.isAwaitAllowed()) {
34633
- this.raise(Errors.AwaitUsingNotInAsyncContext, {
34634
- at: this.state.startLoc
34635
- });
34249
+ this.raise(Errors.AwaitUsingNotInAsyncContext, this.state.startLoc);
34636
34250
  }
34637
34251
  this.next();
34638
34252
  } else {
@@ -34643,9 +34257,7 @@ function requireLib () {
34643
34257
  const init = this.finishNode(initNode, "VariableDeclaration");
34644
34258
  const isForIn = this.match(58);
34645
34259
  if (isForIn && starsWithUsingDeclaration) {
34646
- this.raise(Errors.ForInUsing, {
34647
- at: init
34648
- });
34260
+ this.raise(Errors.ForInUsing, init);
34649
34261
  }
34650
34262
  if ((isForIn || this.isContextual(102)) && init.declarations.length === 1) {
34651
34263
  return this.parseForIn(node, init, awaitAt);
@@ -34662,14 +34274,10 @@ function requireLib () {
34662
34274
  const isForOf = this.isContextual(102);
34663
34275
  if (isForOf) {
34664
34276
  if (startsWithLet) {
34665
- this.raise(Errors.ForOfLet, {
34666
- at: init
34667
- });
34277
+ this.raise(Errors.ForOfLet, init);
34668
34278
  }
34669
34279
  if (awaitAt === null && startsWithAsync && init.type === "Identifier") {
34670
- this.raise(Errors.ForOfAsync, {
34671
- at: init
34672
- });
34280
+ this.raise(Errors.ForOfAsync, init);
34673
34281
  }
34674
34282
  }
34675
34283
  if (isForOf || this.match(58)) {
@@ -34703,9 +34311,7 @@ function requireLib () {
34703
34311
  }
34704
34312
  parseReturnStatement(node) {
34705
34313
  if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) {
34706
- this.raise(Errors.IllegalReturn, {
34707
- at: this.state.startLoc
34708
- });
34314
+ this.raise(Errors.IllegalReturn, this.state.startLoc);
34709
34315
  }
34710
34316
  this.next();
34711
34317
  if (this.isLineTerminator()) {
@@ -34735,9 +34341,7 @@ function requireLib () {
34735
34341
  cur.test = this.parseExpression();
34736
34342
  } else {
34737
34343
  if (sawDefault) {
34738
- this.raise(Errors.MultipleDefaultsInSwitch, {
34739
- at: this.state.lastTokStartLoc
34740
- });
34344
+ this.raise(Errors.MultipleDefaultsInSwitch, this.state.lastTokStartLoc);
34741
34345
  }
34742
34346
  sawDefault = true;
34743
34347
  cur.test = null;
@@ -34760,9 +34364,7 @@ function requireLib () {
34760
34364
  parseThrowStatement(node) {
34761
34365
  this.next();
34762
34366
  if (this.hasPrecedingLineBreak()) {
34763
- this.raise(Errors.NewlineAfterThrow, {
34764
- at: this.state.lastTokEndLoc
34765
- });
34367
+ this.raise(Errors.NewlineAfterThrow, this.state.lastTokEndLoc);
34766
34368
  }
34767
34369
  node.argument = this.parseExpression();
34768
34370
  this.semicolon();
@@ -34800,9 +34402,7 @@ function requireLib () {
34800
34402
  }
34801
34403
  node.finalizer = this.eat(67) ? this.parseBlock() : null;
34802
34404
  if (!node.handler && !node.finalizer) {
34803
- this.raise(Errors.NoCatchOrFinally, {
34804
- at: node
34805
- });
34405
+ this.raise(Errors.NoCatchOrFinally, node);
34806
34406
  }
34807
34407
  return this.finishNode(node, "TryStatement");
34808
34408
  }
@@ -34822,9 +34422,7 @@ function requireLib () {
34822
34422
  }
34823
34423
  parseWithStatement(node) {
34824
34424
  if (this.state.strict) {
34825
- this.raise(Errors.StrictWith, {
34826
- at: this.state.startLoc
34827
- });
34425
+ this.raise(Errors.StrictWith, this.state.startLoc);
34828
34426
  }
34829
34427
  this.next();
34830
34428
  node.object = this.parseHeaderExpression();
@@ -34838,13 +34436,12 @@ function requireLib () {
34838
34436
  parseLabeledStatement(node, maybeName, expr, flags) {
34839
34437
  for (const label of this.state.labels) {
34840
34438
  if (label.name === maybeName) {
34841
- this.raise(Errors.LabelRedeclaration, {
34842
- at: expr,
34439
+ this.raise(Errors.LabelRedeclaration, expr, {
34843
34440
  labelName: maybeName
34844
34441
  });
34845
34442
  }
34846
34443
  }
34847
- const kind = tokenIsLoop(this.state.type) ? "loop" : this.match(71) ? "switch" : null;
34444
+ const kind = tokenIsLoop(this.state.type) ? 1 : this.match(71) ? 2 : null;
34848
34445
  for (let i = this.state.labels.length - 1; i >= 0; i--) {
34849
34446
  const label = this.state.labels[i];
34850
34447
  if (label.statementStart === node.start) {
@@ -34940,14 +34537,12 @@ function requireLib () {
34940
34537
  node.await = awaitAt !== null;
34941
34538
  }
34942
34539
  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")) {
34943
- this.raise(Errors.ForInOfLoopInitializer, {
34944
- at: init,
34540
+ this.raise(Errors.ForInOfLoopInitializer, init, {
34945
34541
  type: isForIn ? "ForInStatement" : "ForOfStatement"
34946
34542
  });
34947
34543
  }
34948
34544
  if (init.type === "AssignmentPattern") {
34949
- this.raise(Errors.InvalidLhs, {
34950
- at: init,
34545
+ this.raise(Errors.InvalidLhs, init, {
34951
34546
  ancestor: {
34952
34547
  type: "ForStatement"
34953
34548
  }
@@ -34970,13 +34565,11 @@ function requireLib () {
34970
34565
  decl.init = !this.eat(29) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
34971
34566
  if (decl.init === null && !allowMissingInitializer) {
34972
34567
  if (decl.id.type !== "Identifier" && !(isFor && (this.match(58) || this.isContextual(102)))) {
34973
- this.raise(Errors.DeclarationMissingInitializer, {
34974
- at: this.state.lastTokEndLoc,
34568
+ this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
34975
34569
  kind: "destructuring"
34976
34570
  });
34977
34571
  } else if (kind === "const" && !(this.match(58) || this.isContextual(102))) {
34978
- this.raise(Errors.DeclarationMissingInitializer, {
34979
- at: this.state.lastTokEndLoc,
34572
+ this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
34980
34573
  kind: "const"
34981
34574
  });
34982
34575
  }
@@ -35007,9 +34600,7 @@ function requireLib () {
35007
34600
  this.initFunction(node, isAsync);
35008
34601
  if (this.match(55)) {
35009
34602
  if (hangingDeclaration) {
35010
- this.raise(Errors.GeneratorInSingleStatementContext, {
35011
- at: this.state.startLoc
35012
- });
34603
+ this.raise(Errors.GeneratorInSingleStatementContext, this.state.startLoc);
35013
34604
  }
35014
34605
  this.next();
35015
34606
  node.generator = true;
@@ -35081,9 +34672,7 @@ function requireLib () {
35081
34672
  while (!this.match(8)) {
35082
34673
  if (this.eat(13)) {
35083
34674
  if (decorators.length > 0) {
35084
- throw this.raise(Errors.DecoratorSemicolon, {
35085
- at: this.state.lastTokEndLoc
35086
- });
34675
+ throw this.raise(Errors.DecoratorSemicolon, this.state.lastTokEndLoc);
35087
34676
  }
35088
34677
  continue;
35089
34678
  }
@@ -35099,18 +34688,14 @@ function requireLib () {
35099
34688
  }
35100
34689
  this.parseClassMember(classBody, member, state);
35101
34690
  if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
35102
- this.raise(Errors.DecoratorConstructor, {
35103
- at: member
35104
- });
34691
+ this.raise(Errors.DecoratorConstructor, member);
35105
34692
  }
35106
34693
  }
35107
34694
  });
35108
34695
  this.state.strict = oldStrict;
35109
34696
  this.next();
35110
34697
  if (decorators.length) {
35111
- throw this.raise(Errors.TrailingDecorator, {
35112
- at: this.state.startLoc
35113
- });
34698
+ throw this.raise(Errors.TrailingDecorator, this.state.startLoc);
35114
34699
  }
35115
34700
  this.classScope.exit();
35116
34701
  return this.finishNode(classBody, "ClassBody");
@@ -35168,9 +34753,7 @@ function requireLib () {
35168
34753
  return;
35169
34754
  }
35170
34755
  if (this.isNonstaticConstructor(publicMethod)) {
35171
- this.raise(Errors.ConstructorIsGenerator, {
35172
- at: publicMethod.key
35173
- });
34756
+ this.raise(Errors.ConstructorIsGenerator, publicMethod.key);
35174
34757
  }
35175
34758
  this.pushClassMethod(classBody, publicMethod, true, false, false, false);
35176
34759
  return;
@@ -35191,14 +34774,10 @@ function requireLib () {
35191
34774
  if (isConstructor) {
35192
34775
  publicMethod.kind = "constructor";
35193
34776
  if (state.hadConstructor && !this.hasPlugin("typescript")) {
35194
- this.raise(Errors.DuplicateConstructor, {
35195
- at: key
35196
- });
34777
+ this.raise(Errors.DuplicateConstructor, key);
35197
34778
  }
35198
34779
  if (isConstructor && this.hasPlugin("typescript") && member.override) {
35199
- this.raise(Errors.OverrideOnConstructor, {
35200
- at: key
35201
- });
34780
+ this.raise(Errors.OverrideOnConstructor, key);
35202
34781
  }
35203
34782
  state.hadConstructor = true;
35204
34783
  allowsDirectSuper = state.hadSuperClass;
@@ -35224,9 +34803,7 @@ function requireLib () {
35224
34803
  this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
35225
34804
  } else {
35226
34805
  if (this.isNonstaticConstructor(publicMethod)) {
35227
- this.raise(Errors.ConstructorIsAsync, {
35228
- at: publicMethod.key
35229
- });
34806
+ this.raise(Errors.ConstructorIsAsync, publicMethod.key);
35230
34807
  }
35231
34808
  this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
35232
34809
  }
@@ -35239,9 +34816,7 @@ function requireLib () {
35239
34816
  this.pushClassPrivateMethod(classBody, privateMethod, false, false);
35240
34817
  } else {
35241
34818
  if (this.isNonstaticConstructor(publicMethod)) {
35242
- this.raise(Errors.ConstructorIsAccessor, {
35243
- at: publicMethod.key
35244
- });
34819
+ this.raise(Errors.ConstructorIsAccessor, publicMethod.key);
35245
34820
  }
35246
34821
  this.pushClassMethod(classBody, publicMethod, false, false, false, false);
35247
34822
  }
@@ -35268,15 +34843,11 @@ function requireLib () {
35268
34843
  value
35269
34844
  } = this.state;
35270
34845
  if ((type === 132 || type === 133) && member.static && value === "prototype") {
35271
- this.raise(Errors.StaticPrototype, {
35272
- at: this.state.startLoc
35273
- });
34846
+ this.raise(Errors.StaticPrototype, this.state.startLoc);
35274
34847
  }
35275
34848
  if (type === 138) {
35276
34849
  if (value === "constructor") {
35277
- this.raise(Errors.ConstructorClassPrivateField, {
35278
- at: this.state.startLoc
35279
- });
34850
+ this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
35280
34851
  }
35281
34852
  const key = this.parsePrivateName();
35282
34853
  member.key = key;
@@ -35297,16 +34868,12 @@ function requireLib () {
35297
34868
  this.state.labels = oldLabels;
35298
34869
  classBody.body.push(this.finishNode(member, "StaticBlock"));
35299
34870
  if ((_member$decorators = member.decorators) != null && _member$decorators.length) {
35300
- this.raise(Errors.DecoratorStaticBlock, {
35301
- at: member
35302
- });
34871
+ this.raise(Errors.DecoratorStaticBlock, member);
35303
34872
  }
35304
34873
  }
35305
34874
  pushClassProperty(classBody, prop) {
35306
34875
  if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) {
35307
- this.raise(Errors.ConstructorClassField, {
35308
- at: prop.key
35309
- });
34876
+ this.raise(Errors.ConstructorClassField, prop.key);
35310
34877
  }
35311
34878
  classBody.body.push(this.parseClassProperty(prop));
35312
34879
  }
@@ -35319,9 +34886,7 @@ function requireLib () {
35319
34886
  if (!isPrivate && !prop.computed) {
35320
34887
  const key = prop.key;
35321
34888
  if (key.name === "constructor" || key.value === "constructor") {
35322
- this.raise(Errors.ConstructorClassField, {
35323
- at: key
35324
- });
34889
+ this.raise(Errors.ConstructorClassField, key);
35325
34890
  }
35326
34891
  }
35327
34892
  const node = this.parseClassAccessorProperty(prop);
@@ -35377,9 +34942,7 @@ function requireLib () {
35377
34942
  if (optionalId || !isStatement) {
35378
34943
  node.id = null;
35379
34944
  } else {
35380
- throw this.raise(Errors.MissingClassName, {
35381
- at: this.state.startLoc
35382
- });
34945
+ throw this.raise(Errors.MissingClassName, this.state.startLoc);
35383
34946
  }
35384
34947
  }
35385
34948
  }
@@ -35397,9 +34960,7 @@ function requireLib () {
35397
34960
  if (hasStar && !hasNamespace) {
35398
34961
  if (hasDefault) this.unexpected();
35399
34962
  if (decorators) {
35400
- throw this.raise(Errors.UnsupportedDecoratorExport, {
35401
- at: node
35402
- });
34963
+ throw this.raise(Errors.UnsupportedDecoratorExport, node);
35403
34964
  }
35404
34965
  this.parseExportFrom(node, true);
35405
34966
  return this.finishNode(node, "ExportAllDeclaration");
@@ -35415,9 +34976,7 @@ function requireLib () {
35415
34976
  if (isFromRequired || hasSpecifiers) {
35416
34977
  hasDeclaration = false;
35417
34978
  if (decorators) {
35418
- throw this.raise(Errors.UnsupportedDecoratorExport, {
35419
- at: node
35420
- });
34979
+ throw this.raise(Errors.UnsupportedDecoratorExport, node);
35421
34980
  }
35422
34981
  this.parseExportFrom(node, isFromRequired);
35423
34982
  } else {
@@ -35430,9 +34989,7 @@ function requireLib () {
35430
34989
  if (((_node2$declaration = node2.declaration) == null ? void 0 : _node2$declaration.type) === "ClassDeclaration") {
35431
34990
  this.maybeTakeDecorators(decorators, node2.declaration, node2);
35432
34991
  } else if (decorators) {
35433
- throw this.raise(Errors.UnsupportedDecoratorExport, {
35434
- at: node
35435
- });
34992
+ throw this.raise(Errors.UnsupportedDecoratorExport, node);
35436
34993
  }
35437
34994
  return this.finishNode(node2, "ExportNamedDeclaration");
35438
34995
  }
@@ -35443,9 +35000,7 @@ function requireLib () {
35443
35000
  if (decl.type === "ClassDeclaration") {
35444
35001
  this.maybeTakeDecorators(decorators, decl, node2);
35445
35002
  } else if (decorators) {
35446
- throw this.raise(Errors.UnsupportedDecoratorExport, {
35447
- at: node
35448
- });
35003
+ throw this.raise(Errors.UnsupportedDecoratorExport, node);
35449
35004
  }
35450
35005
  this.checkExport(node2, true, true);
35451
35006
  return this.finishNode(node2, "ExportDefaultDeclaration");
@@ -35523,16 +35078,12 @@ function requireLib () {
35523
35078
  }
35524
35079
  if (this.match(26)) {
35525
35080
  if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
35526
- this.raise(Errors.DecoratorBeforeExport, {
35527
- at: this.state.startLoc
35528
- });
35081
+ this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
35529
35082
  }
35530
35083
  return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
35531
35084
  }
35532
35085
  if (this.match(75) || this.match(74) || this.isLet()) {
35533
- throw this.raise(Errors.UnsupportedDefaultExport, {
35534
- at: this.state.startLoc
35535
- });
35086
+ throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
35536
35087
  }
35537
35088
  const res = this.parseMaybeAssignAllowIn();
35538
35089
  this.semicolon();
@@ -35595,9 +35146,7 @@ function requireLib () {
35595
35146
  this.expectOnePlugin(["decorators", "decorators-legacy"]);
35596
35147
  if (this.hasPlugin("decorators")) {
35597
35148
  if (this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
35598
- this.raise(Errors.DecoratorBeforeExport, {
35599
- at: this.state.startLoc
35600
- });
35149
+ this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
35601
35150
  }
35602
35151
  return true;
35603
35152
  }
@@ -35613,9 +35162,7 @@ function requireLib () {
35613
35162
  var _declaration$extra;
35614
35163
  const declaration = node.declaration;
35615
35164
  if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) {
35616
- this.raise(Errors.ExportDefaultFromAsIdentifier, {
35617
- at: declaration
35618
- });
35165
+ this.raise(Errors.ExportDefaultFromAsIdentifier, declaration);
35619
35166
  }
35620
35167
  }
35621
35168
  } else if ((_node$specifiers = node.specifiers) != null && _node$specifiers.length) {
@@ -35630,8 +35177,7 @@ function requireLib () {
35630
35177
  local
35631
35178
  } = specifier;
35632
35179
  if (local.type !== "Identifier") {
35633
- this.raise(Errors.ExportBindingIsString, {
35634
- at: specifier,
35180
+ this.raise(Errors.ExportBindingIsString, specifier, {
35635
35181
  localName: local.value,
35636
35182
  exportName
35637
35183
  });
@@ -35678,12 +35224,9 @@ function requireLib () {
35678
35224
  checkDuplicateExports(node, exportName) {
35679
35225
  if (this.exportedIdentifiers.has(exportName)) {
35680
35226
  if (exportName === "default") {
35681
- this.raise(Errors.DuplicateDefaultExport, {
35682
- at: node
35683
- });
35227
+ this.raise(Errors.DuplicateDefaultExport, node);
35684
35228
  } else {
35685
- this.raise(Errors.DuplicateExport, {
35686
- at: node,
35229
+ this.raise(Errors.DuplicateExport, node, {
35687
35230
  exportName
35688
35231
  });
35689
35232
  }
@@ -35724,8 +35267,7 @@ function requireLib () {
35724
35267
  const result = this.parseStringLiteral(this.state.value);
35725
35268
  const surrogate = result.value.match(loneSurrogate);
35726
35269
  if (surrogate) {
35727
- this.raise(Errors.ModuleExportNameHasLoneSurrogate, {
35728
- at: result,
35270
+ this.raise(Errors.ModuleExportNameHasLoneSurrogate, result, {
35729
35271
  surrogateCharCode: surrogate[0].charCodeAt(0)
35730
35272
  });
35731
35273
  }
@@ -35751,27 +35293,19 @@ function requireLib () {
35751
35293
  const singleBindingType = specifiers.length === 1 ? specifiers[0].type : null;
35752
35294
  if (node.phase === "source") {
35753
35295
  if (singleBindingType !== "ImportDefaultSpecifier") {
35754
- this.raise(Errors.SourcePhaseImportRequiresDefault, {
35755
- at: specifiers[0].loc.start
35756
- });
35296
+ this.raise(Errors.SourcePhaseImportRequiresDefault, specifiers[0].loc.start);
35757
35297
  }
35758
35298
  } else if (node.phase === "defer") {
35759
35299
  if (singleBindingType !== "ImportNamespaceSpecifier") {
35760
- this.raise(Errors.DeferImportRequiresNamespace, {
35761
- at: specifiers[0].loc.start
35762
- });
35300
+ this.raise(Errors.DeferImportRequiresNamespace, specifiers[0].loc.start);
35763
35301
  }
35764
35302
  } else if (node.module) {
35765
35303
  var _node$assertions;
35766
35304
  if (singleBindingType !== "ImportDefaultSpecifier") {
35767
- this.raise(Errors.ImportReflectionNotBinding, {
35768
- at: specifiers[0].loc.start
35769
- });
35305
+ this.raise(Errors.ImportReflectionNotBinding, specifiers[0].loc.start);
35770
35306
  }
35771
35307
  if (((_node$assertions = node.assertions) == null ? void 0 : _node$assertions.length) > 0) {
35772
- this.raise(Errors.ImportReflectionHasAssertion, {
35773
- at: node.specifiers[0].loc.start
35774
- });
35308
+ this.raise(Errors.ImportReflectionHasAssertion, specifiers[0].loc.start);
35775
35309
  }
35776
35310
  }
35777
35311
  }
@@ -35793,9 +35327,7 @@ function requireLib () {
35793
35327
  }
35794
35328
  });
35795
35329
  if (nonDefaultNamedSpecifier !== undefined) {
35796
- this.raise(Errors.ImportJSONBindingNotDefault, {
35797
- at: nonDefaultNamedSpecifier.loc.start
35798
- });
35330
+ this.raise(Errors.ImportJSONBindingNotDefault, nonDefaultNamedSpecifier.loc.start);
35799
35331
  }
35800
35332
  }
35801
35333
  }
@@ -35902,8 +35434,7 @@ function requireLib () {
35902
35434
  const node = this.startNode();
35903
35435
  const keyName = this.state.value;
35904
35436
  if (attrNames.has(keyName)) {
35905
- this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
35906
- at: this.state.startLoc,
35437
+ this.raise(Errors.ModuleAttributesWithDuplicateKeys, this.state.startLoc, {
35907
35438
  key: keyName
35908
35439
  });
35909
35440
  }
@@ -35915,9 +35446,7 @@ function requireLib () {
35915
35446
  }
35916
35447
  this.expect(14);
35917
35448
  if (!this.match(133)) {
35918
- throw this.raise(Errors.ModuleAttributeInvalidValue, {
35919
- at: this.state.startLoc
35920
- });
35449
+ throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
35921
35450
  }
35922
35451
  node.value = this.parseStringLiteral(this.state.value);
35923
35452
  attrs.push(this.finishNode(node, "ImportAttribute"));
@@ -35932,22 +35461,17 @@ function requireLib () {
35932
35461
  const node = this.startNode();
35933
35462
  node.key = this.parseIdentifier(true);
35934
35463
  if (node.key.name !== "type") {
35935
- this.raise(Errors.ModuleAttributeDifferentFromType, {
35936
- at: node.key
35937
- });
35464
+ this.raise(Errors.ModuleAttributeDifferentFromType, node.key);
35938
35465
  }
35939
35466
  if (attributes.has(node.key.name)) {
35940
- this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
35941
- at: node.key,
35467
+ this.raise(Errors.ModuleAttributesWithDuplicateKeys, node.key, {
35942
35468
  key: node.key.name
35943
35469
  });
35944
35470
  }
35945
35471
  attributes.add(node.key.name);
35946
35472
  this.expect(14);
35947
35473
  if (!this.match(133)) {
35948
- throw this.raise(Errors.ModuleAttributeInvalidValue, {
35949
- at: this.state.startLoc
35950
- });
35474
+ throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
35951
35475
  }
35952
35476
  node.value = this.parseStringLiteral(this.state.value);
35953
35477
  attrs.push(this.finishNode(node, "ImportAttribute"));
@@ -35974,9 +35498,7 @@ function requireLib () {
35974
35498
  } else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
35975
35499
  if (this.hasPlugin("importAttributes")) {
35976
35500
  if (this.getPluginOption("importAttributes", "deprecatedAssertSyntax") !== true) {
35977
- this.raise(Errors.ImportAttributesUseAssert, {
35978
- at: this.state.startLoc
35979
- });
35501
+ this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
35980
35502
  }
35981
35503
  this.addExtra(node, "deprecatedAssertSyntax", true);
35982
35504
  } else {
@@ -36027,9 +35549,7 @@ function requireLib () {
36027
35549
  first = false;
36028
35550
  } else {
36029
35551
  if (this.eat(14)) {
36030
- throw this.raise(Errors.DestructureNamedImport, {
36031
- at: this.state.startLoc
36032
- });
35552
+ throw this.raise(Errors.DestructureNamedImport, this.state.startLoc);
36033
35553
  }
36034
35554
  this.expect(12);
36035
35555
  if (this.eat(8)) break;
@@ -36050,8 +35570,7 @@ function requireLib () {
36050
35570
  imported
36051
35571
  } = specifier;
36052
35572
  if (importedIsString) {
36053
- throw this.raise(Errors.ImportBindingIsString, {
36054
- at: specifier,
35573
+ throw this.raise(Errors.ImportBindingIsString, specifier, {
36055
35574
  importName: imported.value
36056
35575
  });
36057
35576
  }
@@ -36086,6 +35605,7 @@ function requireLib () {
36086
35605
  file.errors = null;
36087
35606
  this.parseTopLevel(file, program);
36088
35607
  file.errors = this.state.errors;
35608
+ file.comments.length = this.state.commentsLen;
36089
35609
  return file;
36090
35610
  }
36091
35611
  }