@sanity/pkg-utils 4.0.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/_chunks/{build-xtvcN4rn.cjs → build-AuLlgQCD.cjs} +5 -4
  2. package/dist/_chunks/{build-xtvcN4rn.cjs.map → build-AuLlgQCD.cjs.map} +1 -1
  3. package/dist/_chunks/{buildAction-lOl6hAY8.cjs → buildAction-aKVmXTPP.cjs} +2 -2
  4. package/dist/_chunks/{buildAction-lOl6hAY8.cjs.map → buildAction-aKVmXTPP.cjs.map} +1 -1
  5. package/dist/_chunks/{check-5On74q2h.cjs → check-j5YR3hUi.cjs} +4 -3
  6. package/dist/_chunks/check-j5YR3hUi.cjs.map +1 -0
  7. package/dist/_chunks/{checkAction-RYG9-Wqo.cjs → checkAction-AD9RJftD.cjs} +2 -2
  8. package/dist/_chunks/{checkAction-RYG9-Wqo.cjs.map → checkAction-AD9RJftD.cjs.map} +1 -1
  9. package/dist/_chunks/{consoleSpy-bV4ZI2h8.cjs → consoleSpy-HqQIfX7k.cjs} +112 -73
  10. package/dist/_chunks/consoleSpy-HqQIfX7k.cjs.map +1 -0
  11. package/dist/_chunks/{index-YSy1xob6.cjs → index-FaD5mo-6.cjs} +558 -1037
  12. package/dist/_chunks/index-FaD5mo-6.cjs.map +1 -0
  13. package/dist/_chunks/{init-tT7f7xkO.cjs → init-9DSt45GN.cjs} +3 -2
  14. package/dist/_chunks/{init-tT7f7xkO.cjs.map → init-9DSt45GN.cjs.map} +1 -1
  15. package/dist/_chunks/{initAction-zkJJWu4U.cjs → initAction-sChm6v2i.cjs} +2 -2
  16. package/dist/_chunks/{initAction-zkJJWu4U.cjs.map → initAction-sChm6v2i.cjs.map} +1 -1
  17. package/dist/_chunks/{logger-c-JGqYo_.cjs → logger-L4V-Be7d.cjs} +2 -2
  18. package/dist/_chunks/logger-L4V-Be7d.cjs.map +1 -0
  19. package/dist/_chunks/{watch-Mo2KRBJf.cjs → watch-fXO97GL2.cjs} +5 -4
  20. package/dist/_chunks/{watch-Mo2KRBJf.cjs.map → watch-fXO97GL2.cjs.map} +1 -1
  21. package/dist/_chunks/{watchAction-7JsrPTEX.cjs → watchAction-SAJ1nU-a.cjs} +2 -2
  22. package/dist/_chunks/{watchAction-7JsrPTEX.cjs.map → watchAction-SAJ1nU-a.cjs.map} +1 -1
  23. package/dist/cli.cjs +5 -5
  24. package/dist/index.cjs +7 -7
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +662 -1104
  27. package/dist/index.js.map +1 -1
  28. package/package.json +13 -10
  29. package/src/node/core/defaults.ts +3 -6
  30. package/src/node/core/pkg/types.ts +1 -1
  31. package/src/node/core/pkg/validatePkg.ts +1 -1
  32. package/src/node/resolveBrowserTarget.ts +10 -28
  33. package/src/node/resolveBuildContext.ts +13 -2
  34. package/src/node/resolveNodeTarget.ts +2 -8
  35. package/dist/_chunks/check-5On74q2h.cjs.map +0 -1
  36. package/dist/_chunks/consoleSpy-bV4ZI2h8.cjs.map +0 -1
  37. package/dist/_chunks/index-YSy1xob6.cjs.map +0 -1
  38. package/dist/_chunks/logger-c-JGqYo_.cjs.map +0 -1
  39. package/src/node/resolveBrowserslistVersions.ts +0 -60
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import path$1, { relative, resolve, dirname } from 'path';
3
3
  import pkgUp from 'pkg-up';
4
4
  import findConfig from 'find-config';
5
5
  import fs$1, { statSync } from 'fs';
6
+ import config from '@sanity/browserslist-config';
6
7
  import fs, { writeFile, readFile, readdir, lstat } from 'fs/promises';
7
8
  import { z, ZodError } from 'zod';
8
9
  import chalk from 'chalk';
@@ -101,12 +102,7 @@ function resolveConfigProperty(prop, initialValue) {
101
102
  return prop;
102
103
  }
103
104
 
104
- const DEFAULT_BROWSERSLIST_QUERY = [
105
- "> 0.2% and supports es6-module and supports es6-module-dynamic-import",
106
- "not dead",
107
- "not IE 11",
108
- "maintained node versions"
109
- ];
105
+ const DEFAULT_BROWSERSLIST_QUERY = config;
110
106
 
111
107
  function isRecord(value) {
112
108
  return Boolean(value) && !Array.isArray(value) && typeof value === "object";
@@ -156,7 +152,7 @@ const pkgSchema = z.object({
156
152
  ])
157
153
  )
158
154
  ),
159
- browserslist: z.optional(z.array(z.string()))
155
+ browserslist: z.optional(z.union([z.string(), z.array(z.string())]))
160
156
  });
161
157
  function validatePkg(input) {
162
158
  return pkgSchema.parse(input);
@@ -517,6 +513,99 @@ function createLogger() {
517
513
  };
518
514
  }
519
515
 
516
+ // convert the browserslist field in package.json to
517
+ // esbuild compatible array of browsers
518
+ function browserslistToEsbuild(browserslistConfig, options = {}) {
519
+ if (!browserslistConfig) {
520
+ // the path from where the script is run
521
+ const path = process.cwd();
522
+
523
+ // read config if none is passed
524
+ browserslistConfig = browserslist.loadConfig({ path, ...options });
525
+ }
526
+
527
+ const SUPPORTED_ESBUILD_TARGETS = [
528
+ 'es',
529
+ 'chrome',
530
+ 'edge',
531
+ 'firefox',
532
+ 'ios',
533
+ 'node',
534
+ 'safari',
535
+ 'opera',
536
+ 'ie',
537
+ ];
538
+
539
+ // https://github.com/eBay/browserslist-config/issues/16#issuecomment-863870093
540
+ const UNSUPPORTED = ['android 4'];
541
+
542
+ const replaces = {
543
+ ios_saf: 'ios',
544
+ android: 'chrome',
545
+ };
546
+
547
+ const separator = ' ';
548
+
549
+ return (
550
+ browserslist(browserslistConfig, options)
551
+ // filter out the unsupported ones
552
+ .filter((b) => !UNSUPPORTED.some((u) => b.startsWith(u)))
553
+ // replaces safari TP with latest safari version
554
+ .map((b) => {
555
+ if (b === 'safari TP') {
556
+ return browserslist('last 1 safari version')[0]
557
+ }
558
+
559
+ return b
560
+ })
561
+ // transform into ['chrome', '88']
562
+ .map((b) => b.split(separator))
563
+ // replace the similar browser
564
+ .map((b) => {
565
+ if (replaces[b[0]]) {
566
+ b[0] = replaces[b[0]];
567
+ }
568
+
569
+ return b
570
+ })
571
+ // 11.0-12.0 --> 11.0
572
+ .map((b) => {
573
+ if (b[1].includes('-')) {
574
+ b[1] = b[1].slice(0, b[1].indexOf('-'));
575
+ }
576
+
577
+ return b
578
+ })
579
+ // 11.0 --> 11
580
+ .map((b) => {
581
+ if (b[1].endsWith('.0')) {
582
+ b[1] = b[1].slice(0, -2);
583
+ }
584
+
585
+ return b
586
+ })
587
+ // removes invalid versions that will break esbuild
588
+ // https://github.com/evanw/esbuild/blob/35c0d65b9d4f29a26176404d2890d1b499634e9f/compat-table/src/caniuse.ts#L119-L122
589
+ .filter((b) => /^\d+(\.\d+)*$/.test(b[1]))
590
+ // only get the targets supported by esbuild
591
+ .filter((b) => SUPPORTED_ESBUILD_TARGETS.includes(b[0]))
592
+ // only get the oldest version, assuming that the older version
593
+ // is last in the array
594
+ .reduce((acc, b) => {
595
+ const existingIndex = acc.findIndex((br) => br[0] === b[0]);
596
+
597
+ if (existingIndex !== -1) {
598
+ acc[existingIndex][1] = b[1];
599
+ } else {
600
+ acc.push(b);
601
+ }
602
+ return acc
603
+ }, [])
604
+ // remove separator
605
+ .map((b) => b.join(''))
606
+ )
607
+ }
608
+
520
609
  function pathContains(containerPath, itemPath) {
521
610
  return !path$1.relative(containerPath, itemPath).startsWith("..");
522
611
  }
@@ -544,65 +633,10 @@ function findCommonDirPath(filePaths) {
544
633
  return ret;
545
634
  }
546
635
 
547
- function sortAsNumber(a, b) {
548
- const aVersion = Number(a);
549
- const bVersion = Number(b);
550
- return aVersion - bVersion;
551
- }
552
- function resolveBrowserslistVersions(query) {
553
- const result = browserslist(query);
554
- const entries = result.map((key) => {
555
- const [name, version] = key.split(" ");
556
- return { name, version: version.split("-")[0].split(".")[0] };
557
- });
558
- const andChr = entries.filter((b) => b.name === "and_chr");
559
- const andFf = entries.filter((b) => b.name === "and_ff");
560
- const chrome = entries.filter((b) => b.name === "chrome");
561
- const edge = entries.filter((b) => b.name === "edge");
562
- const ff = entries.filter((b) => b.name === "firefox");
563
- const iosSaf = entries.filter((b) => b.name === "ios_saf");
564
- const saf = entries.filter((b) => b.name === "safari");
565
- const opera = entries.filter((b) => b.name === "opera");
566
- const node = entries.filter((b) => b.name === "node");
567
- const versions = {
568
- chrome: andChr.concat(chrome).map((b) => b.version),
569
- ff: andFf.concat(ff).map((b) => b.version),
570
- edge: edge.map((b) => b.version),
571
- iosSaf: iosSaf.map((b) => b.version),
572
- saf: saf.map((b) => b.version),
573
- opera: opera.map((b) => b.version),
574
- node: node.map((b) => b.version)
575
- };
576
- versions.chrome.sort(sortAsNumber);
577
- versions.ff.sort(sortAsNumber);
578
- versions.edge.sort(sortAsNumber);
579
- versions.iosSaf.sort(sortAsNumber);
580
- versions.saf.sort(sortAsNumber);
581
- versions.opera.sort(sortAsNumber);
582
- versions.node.sort(sortAsNumber);
583
- return versions;
584
- }
585
-
586
636
  function resolveBrowserTarget(versions) {
587
- const target = [];
588
- if (versions.chrome.length) {
589
- target.push(`chrome${versions.chrome[0]}`);
590
- }
591
- if (versions.ff.length) {
592
- target.push(`firefox${versions.ff[0]}`);
593
- }
594
- if (versions.edge.length) {
595
- target.push(`edge${versions.edge[0]}`);
596
- }
597
- if (versions.iosSaf.length) {
598
- target.push(`ios${versions.iosSaf[0]}`);
599
- }
600
- if (versions.saf.length) {
601
- target.push(`safari${versions.saf[0]}`);
602
- }
603
- if (versions.opera.length) {
604
- target.push(`opera${versions.opera[0]}`);
605
- }
637
+ const target = versions.filter(
638
+ (version) => version.startsWith("chrome") || version.startsWith("edge") || version.startsWith("firefox") || version.startsWith("ios") || version.startsWith("safari") || version.startsWith("opera")
639
+ );
606
640
  if (target.length === 0) {
607
641
  return void 0;
608
642
  }
@@ -610,10 +644,7 @@ function resolveBrowserTarget(versions) {
610
644
  }
611
645
 
612
646
  function resolveNodeTarget(versions) {
613
- const target = [];
614
- if (versions.node.length) {
615
- target.push(`node${versions.node[0]}`);
616
- }
647
+ const target = versions.filter((version) => version.startsWith("node"));
617
648
  if (target.length === 0) {
618
649
  return void 0;
619
650
  }
@@ -632,7 +663,14 @@ async function resolveBuildContext(options) {
632
663
  tsconfig: tsconfigPath
633
664
  } = options;
634
665
  const tsconfig = await loadTSConfig({ cwd, tsconfigPath });
635
- const targetVersions = resolveBrowserslistVersions(pkg.browserslist || DEFAULT_BROWSERSLIST_QUERY);
666
+ let browserslist = pkg.browserslist;
667
+ if (!browserslist) {
668
+ logger.warn(
669
+ 'Could not detect a `browserslist` property in `package.json`, using default configuration. Add `"browserslist": "extends @sanity/browserslist-config"` to silence this warning.'
670
+ );
671
+ browserslist = DEFAULT_BROWSERSLIST_QUERY;
672
+ }
673
+ const targetVersions = browserslistToEsbuild(browserslist);
636
674
  const nodeTarget = resolveNodeTarget(targetVersions);
637
675
  const webTarget = resolveBrowserTarget(targetVersions);
638
676
  if (!nodeTarget) {
@@ -22008,8 +22046,8 @@ function requireLib () {
22008
22046
  PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
22009
22047
  PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
22010
22048
  };
22011
- const _excluded$1 = ["toMessage"],
22012
- _excluded2$1 = ["message"];
22049
+ const _excluded = ["toMessage"],
22050
+ _excluded2 = ["message"];
22013
22051
  function defineHidden(obj, key, value) {
22014
22052
  Object.defineProperty(obj, key, {
22015
22053
  enumerable: false,
@@ -22021,11 +22059,8 @@ function requireLib () {
22021
22059
  let {
22022
22060
  toMessage
22023
22061
  } = _ref,
22024
- properties = _objectWithoutPropertiesLoose(_ref, _excluded$1);
22025
- return function constructor({
22026
- loc,
22027
- details
22028
- }) {
22062
+ properties = _objectWithoutPropertiesLoose(_ref, _excluded);
22063
+ return function constructor(loc, details) {
22029
22064
  const error = new SyntaxError();
22030
22065
  Object.assign(error, properties, {
22031
22066
  loc,
@@ -22043,10 +22078,7 @@ function requireLib () {
22043
22078
  column,
22044
22079
  index
22045
22080
  } = (_overrides$loc = overrides.loc) != null ? _overrides$loc : loc;
22046
- return constructor({
22047
- loc: new Position(line, column, index),
22048
- details: Object.assign({}, details, overrides.details)
22049
- });
22081
+ return constructor(new Position(line, column, index), Object.assign({}, details, overrides.details));
22050
22082
  });
22051
22083
  defineHidden(error, "details", details);
22052
22084
  Object.defineProperty(error, "message", {
@@ -22081,7 +22113,7 @@ function requireLib () {
22081
22113
  {
22082
22114
  message
22083
22115
  } = _ref2,
22084
- rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);
22116
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
22085
22117
  const toMessage = typeof message === "string" ? () => message : message;
22086
22118
  ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
22087
22119
  code: "BABEL_PARSER_SYNTAX_ERROR",
@@ -22326,13 +22358,9 @@ function requireLib () {
22326
22358
  }
22327
22359
  toAssignableObjectExpressionProp(prop, isLast, isLHS) {
22328
22360
  if (prop.kind === "get" || prop.kind === "set") {
22329
- this.raise(Errors.PatternHasAccessor, {
22330
- at: prop.key
22331
- });
22361
+ this.raise(Errors.PatternHasAccessor, prop.key);
22332
22362
  } else if (prop.method) {
22333
- this.raise(Errors.PatternHasMethod, {
22334
- at: prop.key
22335
- });
22363
+ this.raise(Errors.PatternHasMethod, prop.key);
22336
22364
  } else {
22337
22365
  super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
22338
22366
  }
@@ -23068,9 +23096,9 @@ function requireLib () {
23068
23096
  }
23069
23097
  class Scope {
23070
23098
  constructor(flags) {
23071
- this.var = new Set();
23072
- this.lexical = new Set();
23073
- this.functions = new Set();
23099
+ this.flags = 0;
23100
+ this.names = new Map();
23101
+ this.firstLexicalName = "";
23074
23102
  this.flags = flags;
23075
23103
  }
23076
23104
  }
@@ -23138,11 +23166,16 @@ function requireLib () {
23138
23166
  let scope = this.currentScope();
23139
23167
  if (bindingType & 8 || bindingType & 16) {
23140
23168
  this.checkRedeclarationInScope(scope, name, bindingType, loc);
23169
+ let type = scope.names.get(name) || 0;
23141
23170
  if (bindingType & 16) {
23142
- scope.functions.add(name);
23171
+ type = type | 4;
23143
23172
  } else {
23144
- scope.lexical.add(name);
23173
+ if (!scope.firstLexicalName) {
23174
+ scope.firstLexicalName = name;
23175
+ }
23176
+ type = type | 2;
23145
23177
  }
23178
+ scope.names.set(name, type);
23146
23179
  if (bindingType & 8) {
23147
23180
  this.maybeExportDefined(scope, name);
23148
23181
  }
@@ -23150,7 +23183,7 @@ function requireLib () {
23150
23183
  for (let i = this.scopeStack.length - 1; i >= 0; --i) {
23151
23184
  scope = this.scopeStack[i];
23152
23185
  this.checkRedeclarationInScope(scope, name, bindingType, loc);
23153
- scope.var.add(name);
23186
+ scope.names.set(name, (scope.names.get(name) || 0) | 1);
23154
23187
  this.maybeExportDefined(scope, name);
23155
23188
  if (scope.flags & 387) break;
23156
23189
  }
@@ -23166,8 +23199,7 @@ function requireLib () {
23166
23199
  }
23167
23200
  checkRedeclarationInScope(scope, name, bindingType, loc) {
23168
23201
  if (this.isRedeclaredInScope(scope, name, bindingType)) {
23169
- this.parser.raise(Errors.VarRedeclaration, {
23170
- at: loc,
23202
+ this.parser.raise(Errors.VarRedeclaration, loc, {
23171
23203
  identifierName: name
23172
23204
  });
23173
23205
  }
@@ -23175,19 +23207,20 @@ function requireLib () {
23175
23207
  isRedeclaredInScope(scope, name, bindingType) {
23176
23208
  if (!(bindingType & 1)) return false;
23177
23209
  if (bindingType & 8) {
23178
- return scope.lexical.has(name) || scope.functions.has(name) || scope.var.has(name);
23210
+ return scope.names.has(name);
23179
23211
  }
23212
+ const type = scope.names.get(name);
23180
23213
  if (bindingType & 16) {
23181
- return scope.lexical.has(name) || !this.treatFunctionsAsVarInScope(scope) && scope.var.has(name);
23214
+ return (type & 2) > 0 || !this.treatFunctionsAsVarInScope(scope) && (type & 1) > 0;
23182
23215
  }
23183
- 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;
23184
23217
  }
23185
23218
  checkLocalExport(id) {
23186
23219
  const {
23187
23220
  name
23188
23221
  } = id;
23189
23222
  const topLevelScope = this.scopeStack[0];
23190
- if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) && !topLevelScope.functions.has(name)) {
23223
+ if (!topLevelScope.names.has(name)) {
23191
23224
  this.undefinedExports.set(name, id.loc.start);
23192
23225
  }
23193
23226
  }
@@ -23237,8 +23270,9 @@ function requireLib () {
23237
23270
  }
23238
23271
  isRedeclaredInScope(scope, name, bindingType) {
23239
23272
  if (super.isRedeclaredInScope(scope, name, bindingType)) return true;
23240
- if (bindingType & 2048) {
23241
- 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;
23242
23276
  }
23243
23277
  return false;
23244
23278
  }
@@ -23311,7 +23345,12 @@ function requireLib () {
23311
23345
  class CommentsParser extends BaseParser {
23312
23346
  addComment(comment) {
23313
23347
  if (this.filename) comment.loc.filename = this.filename;
23314
- 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++;
23315
23354
  }
23316
23355
  processComment(node) {
23317
23356
  const {
@@ -23500,7 +23539,7 @@ function requireLib () {
23500
23539
  }
23501
23540
  class State {
23502
23541
  constructor() {
23503
- this.strict = void 0;
23542
+ this.flags = 1024;
23504
23543
  this.curLine = void 0;
23505
23544
  this.lineStart = void 0;
23506
23545
  this.startLoc = void 0;
@@ -23509,21 +23548,12 @@ function requireLib () {
23509
23548
  this.potentialArrowAt = -1;
23510
23549
  this.noArrowAt = [];
23511
23550
  this.noArrowParamsConversionAt = [];
23512
- this.maybeInArrowParameters = false;
23513
- this.inType = false;
23514
- this.noAnonFunctionType = false;
23515
- this.hasFlowComment = false;
23516
- this.isAmbientContext = false;
23517
- this.inAbstractClass = false;
23518
- this.inDisallowConditionalTypesContext = false;
23519
23551
  this.topicContext = {
23520
23552
  maxNumOfResolvableTopics: 0,
23521
23553
  maxTopicIndex: null
23522
23554
  };
23523
- this.soloAwait = false;
23524
- this.inFSharpPipelineDirectBody = false;
23525
23555
  this.labels = [];
23526
- this.comments = [];
23556
+ this.commentsLen = 0;
23527
23557
  this.commentStack = [];
23528
23558
  this.pos = 0;
23529
23559
  this.type = 139;
@@ -23532,14 +23562,21 @@ function requireLib () {
23532
23562
  this.end = 0;
23533
23563
  this.lastTokEndLoc = null;
23534
23564
  this.lastTokStartLoc = null;
23535
- this.lastTokStart = 0;
23536
23565
  this.context = [types.brace];
23537
- this.canStartJSXElement = true;
23538
- this.containsEsc = false;
23539
23566
  this.firstInvalidTemplateEscapePos = null;
23540
23567
  this.strictErrors = new Map();
23541
23568
  this.tokensLength = 0;
23542
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
+ }
23543
23580
  init({
23544
23581
  strictMode,
23545
23582
  sourceType,
@@ -23551,20 +23588,145 @@ function requireLib () {
23551
23588
  this.lineStart = -startColumn;
23552
23589
  this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
23553
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
+ }
23554
23701
  curPosition() {
23555
23702
  return new Position(this.curLine, this.pos - this.lineStart, this.pos);
23556
23703
  }
23557
- clone(skipArrays) {
23704
+ clone() {
23558
23705
  const state = new State();
23559
- const keys = Object.keys(this);
23560
- for (let i = 0, length = keys.length; i < length; i++) {
23561
- const key = keys[i];
23562
- let val = this[key];
23563
- if (!skipArrays && Array.isArray(val)) {
23564
- val = val.slice();
23565
- }
23566
- state[key] = val;
23567
- }
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;
23568
23730
  return state;
23569
23731
  }
23570
23732
  }
@@ -23853,8 +24015,6 @@ function requireLib () {
23853
24015
  pos
23854
24016
  };
23855
24017
  }
23856
- const _excluded = ["at"],
23857
- _excluded2 = ["at"];
23858
24018
  function buildPosition(pos, lineStart, curLine) {
23859
24019
  return new Position(curLine, pos - lineStart, pos);
23860
24020
  }
@@ -23876,8 +24036,7 @@ function requireLib () {
23876
24036
  this.errorHandlers_readInt = {
23877
24037
  invalidDigit: (pos, lineStart, curLine, radix) => {
23878
24038
  if (!this.options.errorRecovery) return false;
23879
- this.raise(Errors.InvalidDigit, {
23880
- at: buildPosition(pos, lineStart, curLine),
24039
+ this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
23881
24040
  radix
23882
24041
  });
23883
24042
  return true;
@@ -23891,28 +24050,23 @@ function requireLib () {
23891
24050
  });
23892
24051
  this.errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, {
23893
24052
  strictNumericEscape: (pos, lineStart, curLine) => {
23894
- this.recordStrictModeErrors(Errors.StrictNumericEscape, {
23895
- at: buildPosition(pos, lineStart, curLine)
23896
- });
24053
+ this.recordStrictModeErrors(Errors.StrictNumericEscape, buildPosition(pos, lineStart, curLine));
23897
24054
  },
23898
24055
  unterminated: (pos, lineStart, curLine) => {
23899
- throw this.raise(Errors.UnterminatedString, {
23900
- at: buildPosition(pos - 1, lineStart, curLine)
23901
- });
24056
+ throw this.raise(Errors.UnterminatedString, buildPosition(pos - 1, lineStart, curLine));
23902
24057
  }
23903
24058
  });
23904
24059
  this.errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, {
23905
24060
  strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
23906
24061
  unterminated: (pos, lineStart, curLine) => {
23907
- throw this.raise(Errors.UnterminatedTemplate, {
23908
- at: buildPosition(pos, lineStart, curLine)
23909
- });
24062
+ throw this.raise(Errors.UnterminatedTemplate, buildPosition(pos, lineStart, curLine));
23910
24063
  }
23911
24064
  });
23912
24065
  this.state = new State();
23913
24066
  this.state.init(options);
23914
24067
  this.input = input;
23915
24068
  this.length = input.length;
24069
+ this.comments = [];
23916
24070
  this.isLookahead = false;
23917
24071
  }
23918
24072
  pushToken(token) {
@@ -23925,7 +24079,6 @@ function requireLib () {
23925
24079
  if (this.options.tokens) {
23926
24080
  this.pushToken(new Token(this.state));
23927
24081
  }
23928
- this.state.lastTokStart = this.state.start;
23929
24082
  this.state.lastTokEndLoc = this.state.endLoc;
23930
24083
  this.state.lastTokStartLoc = this.state.startLoc;
23931
24084
  this.nextToken();
@@ -24000,9 +24153,7 @@ function requireLib () {
24000
24153
  setStrict(strict) {
24001
24154
  this.state.strict = strict;
24002
24155
  if (strict) {
24003
- this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, {
24004
- at
24005
- }));
24156
+ this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, at));
24006
24157
  this.state.strictErrors.clear();
24007
24158
  }
24008
24159
  }
@@ -24025,9 +24176,7 @@ function requireLib () {
24025
24176
  const start = this.state.pos;
24026
24177
  const end = this.input.indexOf(commentEnd, start + 2);
24027
24178
  if (end === -1) {
24028
- throw this.raise(Errors.UnterminatedComment, {
24029
- at: this.state.curPosition()
24030
- });
24179
+ throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
24031
24180
  }
24032
24181
  this.state.pos = end + commentEnd.length;
24033
24182
  lineBreakG.lastIndex = start + 2;
@@ -24179,16 +24328,12 @@ function requireLib () {
24179
24328
  const nextPos = this.state.pos + 1;
24180
24329
  const next = this.codePointAtPos(nextPos);
24181
24330
  if (next >= 48 && next <= 57) {
24182
- throw this.raise(Errors.UnexpectedDigitAfterHash, {
24183
- at: this.state.curPosition()
24184
- });
24331
+ throw this.raise(Errors.UnexpectedDigitAfterHash, this.state.curPosition());
24185
24332
  }
24186
24333
  if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) {
24187
24334
  this.expectPlugin("recordAndTuple");
24188
24335
  if (this.getPluginOption("recordAndTuple", "syntaxType") === "bar") {
24189
- throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, {
24190
- at: this.state.curPosition()
24191
- });
24336
+ throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, this.state.curPosition());
24192
24337
  }
24193
24338
  this.state.pos += 2;
24194
24339
  if (next === 123) {
@@ -24273,9 +24418,7 @@ function requireLib () {
24273
24418
  }
24274
24419
  if (this.hasPlugin("recordAndTuple") && next === 125) {
24275
24420
  if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
24276
- throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, {
24277
- at: this.state.curPosition()
24278
- });
24421
+ throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
24279
24422
  }
24280
24423
  this.state.pos += 2;
24281
24424
  this.finishToken(9);
@@ -24283,9 +24426,7 @@ function requireLib () {
24283
24426
  }
24284
24427
  if (this.hasPlugin("recordAndTuple") && next === 93) {
24285
24428
  if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
24286
- throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, {
24287
- at: this.state.curPosition()
24288
- });
24429
+ throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
24289
24430
  }
24290
24431
  this.state.pos += 2;
24291
24432
  this.finishToken(4);
@@ -24431,9 +24572,7 @@ function requireLib () {
24431
24572
  case 91:
24432
24573
  if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
24433
24574
  if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
24434
- throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, {
24435
- at: this.state.curPosition()
24436
- });
24575
+ throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
24437
24576
  }
24438
24577
  this.state.pos += 2;
24439
24578
  this.finishToken(2);
@@ -24449,9 +24588,7 @@ function requireLib () {
24449
24588
  case 123:
24450
24589
  if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
24451
24590
  if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
24452
- throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, {
24453
- at: this.state.curPosition()
24454
- });
24591
+ throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
24455
24592
  }
24456
24593
  this.state.pos += 2;
24457
24594
  this.finishToken(6);
@@ -24555,8 +24692,7 @@ function requireLib () {
24555
24692
  return;
24556
24693
  }
24557
24694
  }
24558
- throw this.raise(Errors.InvalidOrUnexpectedToken, {
24559
- at: this.state.curPosition(),
24695
+ throw this.raise(Errors.InvalidOrUnexpectedToken, this.state.curPosition(), {
24560
24696
  unexpected: String.fromCodePoint(code)
24561
24697
  });
24562
24698
  }
@@ -24574,15 +24710,11 @@ function requireLib () {
24574
24710
  } = this.state;
24575
24711
  for (;; ++pos) {
24576
24712
  if (pos >= this.length) {
24577
- throw this.raise(Errors.UnterminatedRegExp, {
24578
- at: createPositionWithColumnOffset(startLoc, 1)
24579
- });
24713
+ throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
24580
24714
  }
24581
24715
  const ch = this.input.charCodeAt(pos);
24582
24716
  if (isNewLine(ch)) {
24583
- throw this.raise(Errors.UnterminatedRegExp, {
24584
- at: createPositionWithColumnOffset(startLoc, 1)
24585
- });
24717
+ throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
24586
24718
  }
24587
24719
  if (escaped) {
24588
24720
  escaped = false;
@@ -24607,26 +24739,18 @@ function requireLib () {
24607
24739
  if (VALID_REGEX_FLAGS.has(cp)) {
24608
24740
  if (cp === 118) {
24609
24741
  if (mods.includes("u")) {
24610
- this.raise(Errors.IncompatibleRegExpUVFlags, {
24611
- at: nextPos()
24612
- });
24742
+ this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
24613
24743
  }
24614
24744
  } else if (cp === 117) {
24615
24745
  if (mods.includes("v")) {
24616
- this.raise(Errors.IncompatibleRegExpUVFlags, {
24617
- at: nextPos()
24618
- });
24746
+ this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
24619
24747
  }
24620
24748
  }
24621
24749
  if (mods.includes(char)) {
24622
- this.raise(Errors.DuplicateRegExpFlags, {
24623
- at: nextPos()
24624
- });
24750
+ this.raise(Errors.DuplicateRegExpFlags, nextPos());
24625
24751
  }
24626
24752
  } else if (isIdentifierChar(cp) || cp === 92) {
24627
- this.raise(Errors.MalformedRegExpFlags, {
24628
- at: nextPos()
24629
- });
24753
+ this.raise(Errors.MalformedRegExpFlags, nextPos());
24630
24754
  } else {
24631
24755
  break;
24632
24756
  }
@@ -24653,8 +24777,7 @@ function requireLib () {
24653
24777
  this.state.pos += 2;
24654
24778
  const val = this.readInt(radix);
24655
24779
  if (val == null) {
24656
- this.raise(Errors.InvalidDigit, {
24657
- at: createPositionWithColumnOffset(startLoc, 2),
24780
+ this.raise(Errors.InvalidDigit, createPositionWithColumnOffset(startLoc, 2), {
24658
24781
  radix
24659
24782
  });
24660
24783
  }
@@ -24663,14 +24786,10 @@ function requireLib () {
24663
24786
  ++this.state.pos;
24664
24787
  isBigInt = true;
24665
24788
  } else if (next === 109) {
24666
- throw this.raise(Errors.InvalidDecimal, {
24667
- at: startLoc
24668
- });
24789
+ throw this.raise(Errors.InvalidDecimal, startLoc);
24669
24790
  }
24670
24791
  if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
24671
- throw this.raise(Errors.NumberIdentifier, {
24672
- at: this.state.curPosition()
24673
- });
24792
+ throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
24674
24793
  }
24675
24794
  if (isBigInt) {
24676
24795
  const str = this.input.slice(startLoc.index, this.state.pos).replace(/[_n]/g, "");
@@ -24688,22 +24807,16 @@ function requireLib () {
24688
24807
  let hasExponent = false;
24689
24808
  let isOctal = false;
24690
24809
  if (!startsWithDot && this.readInt(10) === null) {
24691
- this.raise(Errors.InvalidNumber, {
24692
- at: this.state.curPosition()
24693
- });
24810
+ this.raise(Errors.InvalidNumber, this.state.curPosition());
24694
24811
  }
24695
24812
  const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
24696
24813
  if (hasLeadingZero) {
24697
24814
  const integer = this.input.slice(start, this.state.pos);
24698
- this.recordStrictModeErrors(Errors.StrictOctalLiteral, {
24699
- at: startLoc
24700
- });
24815
+ this.recordStrictModeErrors(Errors.StrictOctalLiteral, startLoc);
24701
24816
  if (!this.state.strict) {
24702
24817
  const underscorePos = integer.indexOf("_");
24703
24818
  if (underscorePos > 0) {
24704
- this.raise(Errors.ZeroDigitNumericSeparator, {
24705
- at: createPositionWithColumnOffset(startLoc, underscorePos)
24706
- });
24819
+ this.raise(Errors.ZeroDigitNumericSeparator, createPositionWithColumnOffset(startLoc, underscorePos));
24707
24820
  }
24708
24821
  }
24709
24822
  isOctal = hasLeadingZero && !/[89]/.test(integer);
@@ -24721,9 +24834,7 @@ function requireLib () {
24721
24834
  ++this.state.pos;
24722
24835
  }
24723
24836
  if (this.readInt(10) === null) {
24724
- this.raise(Errors.InvalidOrMissingExponent, {
24725
- at: startLoc
24726
- });
24837
+ this.raise(Errors.InvalidOrMissingExponent, startLoc);
24727
24838
  }
24728
24839
  isFloat = true;
24729
24840
  hasExponent = true;
@@ -24731,9 +24842,7 @@ function requireLib () {
24731
24842
  }
24732
24843
  if (next === 110) {
24733
24844
  if (isFloat || hasLeadingZero) {
24734
- this.raise(Errors.InvalidBigIntLiteral, {
24735
- at: startLoc
24736
- });
24845
+ this.raise(Errors.InvalidBigIntLiteral, startLoc);
24737
24846
  }
24738
24847
  ++this.state.pos;
24739
24848
  isBigInt = true;
@@ -24741,17 +24850,13 @@ function requireLib () {
24741
24850
  if (next === 109) {
24742
24851
  this.expectPlugin("decimal", this.state.curPosition());
24743
24852
  if (hasExponent || hasLeadingZero) {
24744
- this.raise(Errors.InvalidDecimal, {
24745
- at: startLoc
24746
- });
24853
+ this.raise(Errors.InvalidDecimal, startLoc);
24747
24854
  }
24748
24855
  ++this.state.pos;
24749
24856
  isDecimal = true;
24750
24857
  }
24751
24858
  if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
24752
- throw this.raise(Errors.NumberIdentifier, {
24753
- at: this.state.curPosition()
24754
- });
24859
+ throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
24755
24860
  }
24756
24861
  const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
24757
24862
  if (isBigInt) {
@@ -24814,14 +24919,10 @@ function requireLib () {
24814
24919
  this.finishToken(25, firstInvalidLoc ? null : opening + str + "${");
24815
24920
  }
24816
24921
  }
24817
- recordStrictModeErrors(toParseError, {
24818
- at
24819
- }) {
24922
+ recordStrictModeErrors(toParseError, at) {
24820
24923
  const index = at.index;
24821
24924
  if (this.state.strict && !this.state.strictErrors.has(index)) {
24822
- this.raise(toParseError, {
24823
- at
24824
- });
24925
+ this.raise(toParseError, at);
24825
24926
  } else {
24826
24927
  this.state.strictErrors.set(index, [toParseError, at]);
24827
24928
  }
@@ -24844,9 +24945,7 @@ function requireLib () {
24844
24945
  const escStart = this.state.curPosition();
24845
24946
  const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar;
24846
24947
  if (this.input.charCodeAt(++this.state.pos) !== 117) {
24847
- this.raise(Errors.MissingUnicodeEscape, {
24848
- at: this.state.curPosition()
24849
- });
24948
+ this.raise(Errors.MissingUnicodeEscape, this.state.curPosition());
24850
24949
  chunkStart = this.state.pos - 1;
24851
24950
  continue;
24852
24951
  }
@@ -24854,9 +24953,7 @@ function requireLib () {
24854
24953
  const esc = this.readCodePoint(true);
24855
24954
  if (esc !== null) {
24856
24955
  if (!identifierCheck(esc)) {
24857
- this.raise(Errors.EscapedCharNotAnIdentifier, {
24858
- at: escStart
24859
- });
24956
+ this.raise(Errors.EscapedCharNotAnIdentifier, escStart);
24860
24957
  }
24861
24958
  word += String.fromCodePoint(esc);
24862
24959
  }
@@ -24881,75 +24978,55 @@ function requireLib () {
24881
24978
  type
24882
24979
  } = this.state;
24883
24980
  if (tokenIsKeyword(type) && this.state.containsEsc) {
24884
- this.raise(Errors.InvalidEscapedReservedWord, {
24885
- at: this.state.startLoc,
24981
+ this.raise(Errors.InvalidEscapedReservedWord, this.state.startLoc, {
24886
24982
  reservedWord: tokenLabelName(type)
24887
24983
  });
24888
24984
  }
24889
24985
  }
24890
- raise(toParseError, raiseProperties) {
24891
- const {
24892
- at
24893
- } = raiseProperties,
24894
- details = _objectWithoutPropertiesLoose(raiseProperties, _excluded);
24986
+ raise(toParseError, at, details = {}) {
24895
24987
  const loc = at instanceof Position ? at : at.loc.start;
24896
- const error = toParseError({
24897
- loc,
24898
- details
24899
- });
24988
+ const error = toParseError(loc, details);
24900
24989
  if (!this.options.errorRecovery) throw error;
24901
24990
  if (!this.isLookahead) this.state.errors.push(error);
24902
24991
  return error;
24903
24992
  }
24904
- raiseOverwrite(toParseError, raiseProperties) {
24905
- const {
24906
- at
24907
- } = raiseProperties,
24908
- details = _objectWithoutPropertiesLoose(raiseProperties, _excluded2);
24993
+ raiseOverwrite(toParseError, at, details = {}) {
24909
24994
  const loc = at instanceof Position ? at : at.loc.start;
24910
24995
  const pos = loc.index;
24911
24996
  const errors = this.state.errors;
24912
24997
  for (let i = errors.length - 1; i >= 0; i--) {
24913
24998
  const error = errors[i];
24914
24999
  if (error.loc.index === pos) {
24915
- return errors[i] = toParseError({
24916
- loc,
24917
- details
24918
- });
25000
+ return errors[i] = toParseError(loc, details);
24919
25001
  }
24920
25002
  if (error.loc.index < pos) break;
24921
25003
  }
24922
- return this.raise(toParseError, raiseProperties);
25004
+ return this.raise(toParseError, at, details);
24923
25005
  }
24924
25006
  updateContext(prevType) {}
24925
25007
  unexpected(loc, type) {
24926
- throw this.raise(Errors.UnexpectedToken, {
24927
- expected: type ? tokenLabelName(type) : null,
24928
- 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
24929
25010
  });
24930
25011
  }
24931
25012
  expectPlugin(pluginName, loc) {
24932
25013
  if (this.hasPlugin(pluginName)) {
24933
25014
  return true;
24934
25015
  }
24935
- throw this.raise(Errors.MissingPlugin, {
24936
- at: loc != null ? loc : this.state.startLoc,
25016
+ throw this.raise(Errors.MissingPlugin, loc != null ? loc : this.state.startLoc, {
24937
25017
  missingPlugin: [pluginName]
24938
25018
  });
24939
25019
  }
24940
25020
  expectOnePlugin(pluginNames) {
24941
25021
  if (!pluginNames.some(name => this.hasPlugin(name))) {
24942
- throw this.raise(Errors.MissingOneOfPlugins, {
24943
- at: this.state.startLoc,
25022
+ throw this.raise(Errors.MissingOneOfPlugins, this.state.startLoc, {
24944
25023
  missingPlugin: pluginNames
24945
25024
  });
24946
25025
  }
24947
25026
  }
24948
25027
  errorBuilder(error) {
24949
25028
  return (pos, lineStart, curLine) => {
24950
- this.raise(error, {
24951
- at: buildPosition(pos, lineStart, curLine)
24952
- });
25029
+ this.raise(error, buildPosition(pos, lineStart, curLine));
24953
25030
  };
24954
25031
  }
24955
25032
  }
@@ -24982,8 +25059,7 @@ function requireLib () {
24982
25059
  current.undefinedPrivateNames.set(name, loc);
24983
25060
  }
24984
25061
  } else {
24985
- this.parser.raise(Errors.InvalidPrivateFieldResolution, {
24986
- at: loc,
25062
+ this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
24987
25063
  identifierName: name
24988
25064
  });
24989
25065
  }
@@ -25010,8 +25086,7 @@ function requireLib () {
25010
25086
  }
25011
25087
  }
25012
25088
  if (redefined) {
25013
- this.parser.raise(Errors.PrivateNameRedeclaration, {
25014
- at: loc,
25089
+ this.parser.raise(Errors.PrivateNameRedeclaration, loc, {
25015
25090
  identifierName: name
25016
25091
  });
25017
25092
  }
@@ -25026,8 +25101,7 @@ function requireLib () {
25026
25101
  if (classScope) {
25027
25102
  classScope.undefinedPrivateNames.set(name, loc);
25028
25103
  } else {
25029
- this.parser.raise(Errors.InvalidPrivateFieldResolution, {
25030
- at: loc,
25104
+ this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
25031
25105
  identifierName: name
25032
25106
  });
25033
25107
  }
@@ -25049,9 +25123,7 @@ function requireLib () {
25049
25123
  super(type);
25050
25124
  this.declarationErrors = new Map();
25051
25125
  }
25052
- recordDeclarationError(ParsingErrorClass, {
25053
- at
25054
- }) {
25126
+ recordDeclarationError(ParsingErrorClass, at) {
25055
25127
  const index = at.index;
25056
25128
  this.declarationErrors.set(index, [ParsingErrorClass, at]);
25057
25129
  }
@@ -25074,12 +25146,8 @@ function requireLib () {
25074
25146
  exit() {
25075
25147
  this.stack.pop();
25076
25148
  }
25077
- recordParameterInitializerError(toParseError, {
25078
- at: node
25079
- }) {
25080
- const origin = {
25081
- at: node.loc.start
25082
- };
25149
+ recordParameterInitializerError(toParseError, node) {
25150
+ const origin = node.loc.start;
25083
25151
  const {
25084
25152
  stack
25085
25153
  } = this;
@@ -25095,16 +25163,12 @@ function requireLib () {
25095
25163
  }
25096
25164
  this.parser.raise(toParseError, origin);
25097
25165
  }
25098
- recordArrowParameterBindingError(error, {
25099
- at: node
25100
- }) {
25166
+ recordArrowParameterBindingError(error, node) {
25101
25167
  const {
25102
25168
  stack
25103
25169
  } = this;
25104
25170
  const scope = stack[stack.length - 1];
25105
- const origin = {
25106
- at: node.loc.start
25107
- };
25171
+ const origin = node.loc.start;
25108
25172
  if (scope.isCertainlyParameterDeclaration()) {
25109
25173
  this.parser.raise(error, origin);
25110
25174
  } else if (scope.canBeArrowParameterDeclaration()) {
@@ -25113,9 +25177,7 @@ function requireLib () {
25113
25177
  return;
25114
25178
  }
25115
25179
  }
25116
- recordAsyncArrowParametersError({
25117
- at
25118
- }) {
25180
+ recordAsyncArrowParametersError(at) {
25119
25181
  const {
25120
25182
  stack
25121
25183
  } = this;
@@ -25123,9 +25185,7 @@ function requireLib () {
25123
25185
  let scope = stack[i];
25124
25186
  while (scope.canBeArrowParameterDeclaration()) {
25125
25187
  if (scope.type === 2) {
25126
- scope.recordDeclarationError(Errors.AwaitBindingIdentifier, {
25127
- at
25128
- });
25188
+ scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at);
25129
25189
  }
25130
25190
  scope = stack[--i];
25131
25191
  }
@@ -25137,9 +25197,7 @@ function requireLib () {
25137
25197
  const currentScope = stack[stack.length - 1];
25138
25198
  if (!currentScope.canBeArrowParameterDeclaration()) return;
25139
25199
  currentScope.iterateErrors(([toParseError, loc]) => {
25140
- this.parser.raise(toParseError, {
25141
- at: loc
25142
- });
25200
+ this.parser.raise(toParseError, loc);
25143
25201
  let i = stack.length - 2;
25144
25202
  let scope = stack[i];
25145
25203
  while (scope.canBeArrowParameterDeclaration()) {
@@ -25228,9 +25286,7 @@ function requireLib () {
25228
25286
  expectContextual(token, toParseError) {
25229
25287
  if (!this.eatContextual(token)) {
25230
25288
  if (toParseError != null) {
25231
- throw this.raise(toParseError, {
25232
- at: this.state.startLoc
25233
- });
25289
+ throw this.raise(toParseError, this.state.startLoc);
25234
25290
  }
25235
25291
  this.unexpected(null, token);
25236
25292
  }
@@ -25250,9 +25306,7 @@ function requireLib () {
25250
25306
  }
25251
25307
  semicolon(allowAsi = true) {
25252
25308
  if (allowAsi ? this.isLineTerminator() : this.eat(13)) return;
25253
- this.raise(Errors.MissingSemicolon, {
25254
- at: this.state.lastTokEndLoc
25255
- });
25309
+ this.raise(Errors.MissingSemicolon, this.state.lastTokEndLoc);
25256
25310
  }
25257
25311
  expect(type, loc) {
25258
25312
  this.eat(type) || this.unexpected(loc, type);
@@ -25322,19 +25376,13 @@ function requireLib () {
25322
25376
  return hasErrors;
25323
25377
  }
25324
25378
  if (shorthandAssignLoc != null) {
25325
- this.raise(Errors.InvalidCoverInitializedName, {
25326
- at: shorthandAssignLoc
25327
- });
25379
+ this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
25328
25380
  }
25329
25381
  if (doubleProtoLoc != null) {
25330
- this.raise(Errors.DuplicateProto, {
25331
- at: doubleProtoLoc
25332
- });
25382
+ this.raise(Errors.DuplicateProto, doubleProtoLoc);
25333
25383
  }
25334
25384
  if (privateKeyLoc != null) {
25335
- this.raise(Errors.UnexpectedPrivateField, {
25336
- at: privateKeyLoc
25337
- });
25385
+ this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
25338
25386
  }
25339
25387
  if (optionalParametersLoc != null) {
25340
25388
  this.unexpected(optionalParametersLoc);
@@ -25487,7 +25535,8 @@ function requireLib () {
25487
25535
  }
25488
25536
  class NodeUtils extends UtilParser {
25489
25537
  startNode() {
25490
- return new Node(this, this.state.start, this.state.startLoc);
25538
+ const loc = this.state.startLoc;
25539
+ return new Node(this, loc.index, loc);
25491
25540
  }
25492
25541
  startNodeAt(loc) {
25493
25542
  return new Node(this, loc.index, loc);
@@ -25683,10 +25732,8 @@ function requireLib () {
25683
25732
  const moduloLoc = this.state.startLoc;
25684
25733
  this.next();
25685
25734
  this.expectContextual(110);
25686
- if (this.state.lastTokStart > moduloLoc.index + 1) {
25687
- this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, {
25688
- at: moduloLoc
25689
- });
25735
+ if (this.state.lastTokStartLoc.index > moduloLoc.index + 1) {
25736
+ this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, moduloLoc);
25690
25737
  }
25691
25738
  if (this.eat(10)) {
25692
25739
  node.value = super.parseExpression();
@@ -25755,9 +25802,7 @@ function requireLib () {
25755
25802
  return this.flowParseDeclareModuleExports(node);
25756
25803
  } else {
25757
25804
  if (insideModule) {
25758
- this.raise(FlowErrors.NestedDeclareModule, {
25759
- at: this.state.lastTokStartLoc
25760
- });
25805
+ this.raise(FlowErrors.NestedDeclareModule, this.state.lastTokStartLoc);
25761
25806
  }
25762
25807
  return this.flowParseDeclareModule(node);
25763
25808
  }
@@ -25795,9 +25840,7 @@ function requireLib () {
25795
25840
  if (this.match(83)) {
25796
25841
  this.next();
25797
25842
  if (!this.isContextual(130) && !this.match(87)) {
25798
- this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, {
25799
- at: this.state.lastTokStartLoc
25800
- });
25843
+ this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc);
25801
25844
  }
25802
25845
  super.parseImport(bodyNode);
25803
25846
  } else {
@@ -25814,21 +25857,15 @@ function requireLib () {
25814
25857
  body.forEach(bodyElement => {
25815
25858
  if (isEsModuleType(bodyElement)) {
25816
25859
  if (kind === "CommonJS") {
25817
- this.raise(FlowErrors.AmbiguousDeclareModuleKind, {
25818
- at: bodyElement
25819
- });
25860
+ this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
25820
25861
  }
25821
25862
  kind = "ES";
25822
25863
  } else if (bodyElement.type === "DeclareModuleExports") {
25823
25864
  if (hasModuleExport) {
25824
- this.raise(FlowErrors.DuplicateDeclareModuleExports, {
25825
- at: bodyElement
25826
- });
25865
+ this.raise(FlowErrors.DuplicateDeclareModuleExports, bodyElement);
25827
25866
  }
25828
25867
  if (kind === "ES") {
25829
- this.raise(FlowErrors.AmbiguousDeclareModuleKind, {
25830
- at: bodyElement
25831
- });
25868
+ this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
25832
25869
  }
25833
25870
  kind = "CommonJS";
25834
25871
  hasModuleExport = true;
@@ -25851,8 +25888,7 @@ function requireLib () {
25851
25888
  } else {
25852
25889
  if (this.match(75) || this.isLet() || (this.isContextual(130) || this.isContextual(129)) && !insideModule) {
25853
25890
  const label = this.state.value;
25854
- throw this.raise(FlowErrors.UnsupportedDeclareExportKind, {
25855
- at: this.state.startLoc,
25891
+ throw this.raise(FlowErrors.UnsupportedDeclareExportKind, this.state.startLoc, {
25856
25892
  unsupportedExportKind: label,
25857
25893
  suggestion: exportSuggestions[label]
25858
25894
  });
@@ -25950,15 +25986,12 @@ function requireLib () {
25950
25986
  }
25951
25987
  checkNotUnderscore(word) {
25952
25988
  if (word === "_") {
25953
- this.raise(FlowErrors.UnexpectedReservedUnderscore, {
25954
- at: this.state.startLoc
25955
- });
25989
+ this.raise(FlowErrors.UnexpectedReservedUnderscore, this.state.startLoc);
25956
25990
  }
25957
25991
  }
25958
25992
  checkReservedType(word, startLoc, declaration) {
25959
25993
  if (!reservedTypes.has(word)) return;
25960
- this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, {
25961
- at: startLoc,
25994
+ this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, startLoc, {
25962
25995
  reservedType: word
25963
25996
  });
25964
25997
  }
@@ -26011,9 +26044,7 @@ function requireLib () {
26011
26044
  node.default = this.flowParseType();
26012
26045
  } else {
26013
26046
  if (requireDefault) {
26014
- this.raise(FlowErrors.MissingTypeParamDefault, {
26015
- at: nodeStartLoc
26016
- });
26047
+ this.raise(FlowErrors.MissingTypeParamDefault, nodeStartLoc);
26017
26048
  }
26018
26049
  }
26019
26050
  return this.finishNode(node, "TypeParameter");
@@ -26253,9 +26284,7 @@ function requireLib () {
26253
26284
  }
26254
26285
  this.flowObjectTypeSemicolon();
26255
26286
  if (inexactStartLoc && !this.match(8) && !this.match(9)) {
26256
- this.raise(FlowErrors.UnexpectedExplicitInexactInObject, {
26257
- at: inexactStartLoc
26258
- });
26287
+ this.raise(FlowErrors.UnexpectedExplicitInexactInObject, inexactStartLoc);
26259
26288
  }
26260
26289
  }
26261
26290
  this.expect(endDelim);
@@ -26271,33 +26300,23 @@ function requireLib () {
26271
26300
  const isInexactToken = this.match(12) || this.match(13) || this.match(8) || this.match(9);
26272
26301
  if (isInexactToken) {
26273
26302
  if (!allowSpread) {
26274
- this.raise(FlowErrors.InexactInsideNonObject, {
26275
- at: this.state.lastTokStartLoc
26276
- });
26303
+ this.raise(FlowErrors.InexactInsideNonObject, this.state.lastTokStartLoc);
26277
26304
  } else if (!allowInexact) {
26278
- this.raise(FlowErrors.InexactInsideExact, {
26279
- at: this.state.lastTokStartLoc
26280
- });
26305
+ this.raise(FlowErrors.InexactInsideExact, this.state.lastTokStartLoc);
26281
26306
  }
26282
26307
  if (variance) {
26283
- this.raise(FlowErrors.InexactVariance, {
26284
- at: variance
26285
- });
26308
+ this.raise(FlowErrors.InexactVariance, variance);
26286
26309
  }
26287
26310
  return null;
26288
26311
  }
26289
26312
  if (!allowSpread) {
26290
- this.raise(FlowErrors.UnexpectedSpreadType, {
26291
- at: this.state.lastTokStartLoc
26292
- });
26313
+ this.raise(FlowErrors.UnexpectedSpreadType, this.state.lastTokStartLoc);
26293
26314
  }
26294
26315
  if (protoStartLoc != null) {
26295
26316
  this.unexpected(protoStartLoc);
26296
26317
  }
26297
26318
  if (variance) {
26298
- this.raise(FlowErrors.SpreadVariance, {
26299
- at: variance
26300
- });
26319
+ this.raise(FlowErrors.SpreadVariance, variance);
26301
26320
  }
26302
26321
  node.argument = this.flowParseType();
26303
26322
  return this.finishNode(node, "ObjectTypeSpreadProperty");
@@ -26320,9 +26339,7 @@ function requireLib () {
26320
26339
  this.flowCheckGetterSetterParams(node);
26321
26340
  }
26322
26341
  if (!allowSpread && node.key.name === "constructor" && node.value.this) {
26323
- this.raise(FlowErrors.ThisParamBannedInConstructor, {
26324
- at: node.value.this
26325
- });
26342
+ this.raise(FlowErrors.ThisParamBannedInConstructor, node.value.this);
26326
26343
  }
26327
26344
  } else {
26328
26345
  if (kind !== "init") this.unexpected();
@@ -26341,19 +26358,13 @@ function requireLib () {
26341
26358
  const paramCount = property.kind === "get" ? 0 : 1;
26342
26359
  const length = property.value.params.length + (property.value.rest ? 1 : 0);
26343
26360
  if (property.value.this) {
26344
- this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, {
26345
- at: property.value.this
26346
- });
26361
+ this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, property.value.this);
26347
26362
  }
26348
26363
  if (length !== paramCount) {
26349
- this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, {
26350
- at: property
26351
- });
26364
+ this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, property);
26352
26365
  }
26353
26366
  if (property.kind === "set" && property.value.rest) {
26354
- this.raise(Errors.BadSetterRestParameter, {
26355
- at: property
26356
- });
26367
+ this.raise(Errors.BadSetterRestParameter, property);
26357
26368
  }
26358
26369
  }
26359
26370
  flowObjectTypeSemicolon() {
@@ -26409,17 +26420,13 @@ function requireLib () {
26409
26420
  const isThis = this.state.type === 78;
26410
26421
  if (lh.type === 14 || lh.type === 17) {
26411
26422
  if (isThis && !first) {
26412
- this.raise(FlowErrors.ThisParamMustBeFirst, {
26413
- at: node
26414
- });
26423
+ this.raise(FlowErrors.ThisParamMustBeFirst, node);
26415
26424
  }
26416
26425
  name = this.parseIdentifier(isThis);
26417
26426
  if (this.eat(17)) {
26418
26427
  optional = true;
26419
26428
  if (isThis) {
26420
- this.raise(FlowErrors.ThisParamMayNotBeOptional, {
26421
- at: node
26422
- });
26429
+ this.raise(FlowErrors.ThisParamMayNotBeOptional, node);
26423
26430
  }
26424
26431
  }
26425
26432
  typeAnnotation = this.flowParseTypeInitialiser();
@@ -26575,9 +26582,7 @@ function requireLib () {
26575
26582
  if (this.match(135)) {
26576
26583
  return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
26577
26584
  }
26578
- throw this.raise(FlowErrors.UnexpectedSubtractionOperand, {
26579
- at: this.state.startLoc
26580
- });
26585
+ throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
26581
26586
  }
26582
26587
  this.unexpected();
26583
26588
  return;
@@ -26841,9 +26846,7 @@ function requireLib () {
26841
26846
  [valid, invalid] = this.getArrowLikeExpressions(consequent);
26842
26847
  }
26843
26848
  if (failed && valid.length > 1) {
26844
- this.raise(FlowErrors.AmbiguousConditionalArrow, {
26845
- at: state.startLoc
26846
- });
26849
+ this.raise(FlowErrors.AmbiguousConditionalArrow, state.startLoc);
26847
26850
  }
26848
26851
  if (failed && valid.length === 1) {
26849
26852
  this.state = state;
@@ -27004,13 +27007,9 @@ function requireLib () {
27004
27007
  super.parseClassMember(classBody, member, state);
27005
27008
  if (member.declare) {
27006
27009
  if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") {
27007
- this.raise(FlowErrors.DeclareClassElement, {
27008
- at: startLoc
27009
- });
27010
+ this.raise(FlowErrors.DeclareClassElement, startLoc);
27010
27011
  } else if (member.value) {
27011
- this.raise(FlowErrors.DeclareClassFieldInitializer, {
27012
- at: member.value
27013
- });
27012
+ this.raise(FlowErrors.DeclareClassFieldInitializer, member.value);
27014
27013
  }
27015
27014
  }
27016
27015
  }
@@ -27021,8 +27020,7 @@ function requireLib () {
27021
27020
  const word = super.readWord1();
27022
27021
  const fullWord = "@@" + word;
27023
27022
  if (!this.isIterator(word) || !this.state.inType) {
27024
- this.raise(Errors.InvalidIdentifier, {
27025
- at: this.state.curPosition(),
27023
+ this.raise(Errors.InvalidIdentifier, this.state.curPosition(), {
27026
27024
  identifierName: fullWord
27027
27025
  });
27028
27026
  }
@@ -27074,9 +27072,7 @@ function requireLib () {
27074
27072
  var _expr$extra;
27075
27073
  const expr = exprList[i];
27076
27074
  if (expr && expr.type === "TypeCastExpression" && !((_expr$extra = expr.extra) != null && _expr$extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr)) {
27077
- this.raise(FlowErrors.TypeCastInPattern, {
27078
- at: expr.typeAnnotation
27079
- });
27075
+ this.raise(FlowErrors.TypeCastInPattern, expr.typeAnnotation);
27080
27076
  }
27081
27077
  }
27082
27078
  return exprList;
@@ -27124,16 +27120,12 @@ function requireLib () {
27124
27120
  if (method.params && isConstructor) {
27125
27121
  const params = method.params;
27126
27122
  if (params.length > 0 && this.isThisParam(params[0])) {
27127
- this.raise(FlowErrors.ThisParamBannedInConstructor, {
27128
- at: method
27129
- });
27123
+ this.raise(FlowErrors.ThisParamBannedInConstructor, method);
27130
27124
  }
27131
27125
  } else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
27132
27126
  const params = method.value.params;
27133
27127
  if (params.length > 0 && this.isThisParam(params[0])) {
27134
- this.raise(FlowErrors.ThisParamBannedInConstructor, {
27135
- at: method
27136
- });
27128
+ this.raise(FlowErrors.ThisParamBannedInConstructor, method);
27137
27129
  }
27138
27130
  }
27139
27131
  }
@@ -27173,13 +27165,9 @@ function requireLib () {
27173
27165
  if (params.length > 0) {
27174
27166
  const param = params[0];
27175
27167
  if (this.isThisParam(param) && method.kind === "get") {
27176
- this.raise(FlowErrors.GetterMayNotHaveThisParam, {
27177
- at: param
27178
- });
27168
+ this.raise(FlowErrors.GetterMayNotHaveThisParam, param);
27179
27169
  } else if (this.isThisParam(param)) {
27180
- this.raise(FlowErrors.SetterMayNotHaveThisParam, {
27181
- at: param
27182
- });
27170
+ this.raise(FlowErrors.SetterMayNotHaveThisParam, param);
27183
27171
  }
27184
27172
  }
27185
27173
  }
@@ -27205,28 +27193,20 @@ function requireLib () {
27205
27193
  parseAssignableListItemTypes(param) {
27206
27194
  if (this.eat(17)) {
27207
27195
  if (param.type !== "Identifier") {
27208
- this.raise(FlowErrors.PatternIsOptional, {
27209
- at: param
27210
- });
27196
+ this.raise(FlowErrors.PatternIsOptional, param);
27211
27197
  }
27212
27198
  if (this.isThisParam(param)) {
27213
- this.raise(FlowErrors.ThisParamMayNotBeOptional, {
27214
- at: param
27215
- });
27199
+ this.raise(FlowErrors.ThisParamMayNotBeOptional, param);
27216
27200
  }
27217
27201
  param.optional = true;
27218
27202
  }
27219
27203
  if (this.match(14)) {
27220
27204
  param.typeAnnotation = this.flowParseTypeAnnotation();
27221
27205
  } else if (this.isThisParam(param)) {
27222
- this.raise(FlowErrors.ThisParamAnnotationRequired, {
27223
- at: param
27224
- });
27206
+ this.raise(FlowErrors.ThisParamAnnotationRequired, param);
27225
27207
  }
27226
27208
  if (this.match(29) && this.isThisParam(param)) {
27227
- this.raise(FlowErrors.ThisParamNoDefault, {
27228
- at: param
27229
- });
27209
+ this.raise(FlowErrors.ThisParamNoDefault, param);
27230
27210
  }
27231
27211
  this.resetEndLocation(param);
27232
27212
  return param;
@@ -27234,18 +27214,14 @@ function requireLib () {
27234
27214
  parseMaybeDefault(startLoc, left) {
27235
27215
  const node = super.parseMaybeDefault(startLoc, left);
27236
27216
  if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
27237
- this.raise(FlowErrors.TypeBeforeInitializer, {
27238
- at: node.typeAnnotation
27239
- });
27217
+ this.raise(FlowErrors.TypeBeforeInitializer, node.typeAnnotation);
27240
27218
  }
27241
27219
  return node;
27242
27220
  }
27243
27221
  checkImportReflection(node) {
27244
27222
  super.checkImportReflection(node);
27245
27223
  if (node.module && node.importKind !== "value") {
27246
- this.raise(FlowErrors.ImportReflectionHasImportType, {
27247
- at: node.specifiers[0].loc.start
27248
- });
27224
+ this.raise(FlowErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
27249
27225
  }
27250
27226
  }
27251
27227
  parseImportSpecifierLocal(node, specifier, type) {
@@ -27301,8 +27277,7 @@ function requireLib () {
27301
27277
  specifier.importKind = specifierTypeKind;
27302
27278
  } else {
27303
27279
  if (importedIsString) {
27304
- throw this.raise(Errors.ImportBindingIsString, {
27305
- at: specifier,
27280
+ throw this.raise(Errors.ImportBindingIsString, specifier, {
27306
27281
  importName: firstIdent.value
27307
27282
  });
27308
27283
  }
@@ -27318,9 +27293,7 @@ function requireLib () {
27318
27293
  }
27319
27294
  const specifierIsTypeImport = hasTypeImportKind(specifier);
27320
27295
  if (isInTypeOnlyImport && specifierIsTypeImport) {
27321
- this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, {
27322
- at: specifier
27323
- });
27296
+ this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, specifier);
27324
27297
  }
27325
27298
  if (isInTypeOnlyImport || specifierIsTypeImport) {
27326
27299
  this.checkReservedType(specifier.local.name, specifier.local.loc.start, true);
@@ -27403,9 +27376,7 @@ function requireLib () {
27403
27376
  if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
27404
27377
  if (!arrow.error && !arrow.aborted) {
27405
27378
  if (arrow.node.async) {
27406
- this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, {
27407
- at: typeParameters
27408
- });
27379
+ this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, typeParameters);
27409
27380
  }
27410
27381
  return arrow.node;
27411
27382
  }
@@ -27421,9 +27392,7 @@ function requireLib () {
27421
27392
  }
27422
27393
  if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
27423
27394
  if (arrow.thrown) throw arrow.error;
27424
- throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, {
27425
- at: typeParameters
27426
- });
27395
+ throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, typeParameters);
27427
27396
  }
27428
27397
  return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
27429
27398
  }
@@ -27461,9 +27430,7 @@ function requireLib () {
27461
27430
  }
27462
27431
  for (let i = 0; i < node.params.length; i++) {
27463
27432
  if (this.isThisParam(node.params[i]) && i > 0) {
27464
- this.raise(FlowErrors.ThisParamMustBeFirst, {
27465
- at: node.params[i]
27466
- });
27433
+ this.raise(FlowErrors.ThisParamMustBeFirst, node.params[i]);
27467
27434
  }
27468
27435
  }
27469
27436
  super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
@@ -27565,18 +27532,14 @@ function requireLib () {
27565
27532
  parseTopLevel(file, program) {
27566
27533
  const fileNode = super.parseTopLevel(file, program);
27567
27534
  if (this.state.hasFlowComment) {
27568
- this.raise(FlowErrors.UnterminatedFlowComment, {
27569
- at: this.state.curPosition()
27570
- });
27535
+ this.raise(FlowErrors.UnterminatedFlowComment, this.state.curPosition());
27571
27536
  }
27572
27537
  return fileNode;
27573
27538
  }
27574
27539
  skipBlockComment() {
27575
27540
  if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
27576
27541
  if (this.state.hasFlowComment) {
27577
- throw this.raise(FlowErrors.NestedFlowComment, {
27578
- at: this.state.startLoc
27579
- });
27542
+ throw this.raise(FlowErrors.NestedFlowComment, this.state.startLoc);
27580
27543
  }
27581
27544
  this.hasFlowCommentCompletion();
27582
27545
  const commentSkip = this.skipFlowComment();
@@ -27612,43 +27575,26 @@ function requireLib () {
27612
27575
  hasFlowCommentCompletion() {
27613
27576
  const end = this.input.indexOf("*/", this.state.pos);
27614
27577
  if (end === -1) {
27615
- throw this.raise(Errors.UnterminatedComment, {
27616
- at: this.state.curPosition()
27617
- });
27578
+ throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
27618
27579
  }
27619
27580
  }
27620
27581
  flowEnumErrorBooleanMemberNotInitialized(loc, {
27621
27582
  enumName,
27622
27583
  memberName
27623
27584
  }) {
27624
- this.raise(FlowErrors.EnumBooleanMemberNotInitialized, {
27625
- at: loc,
27585
+ this.raise(FlowErrors.EnumBooleanMemberNotInitialized, loc, {
27626
27586
  memberName,
27627
27587
  enumName
27628
27588
  });
27629
27589
  }
27630
27590
  flowEnumErrorInvalidMemberInitializer(loc, enumContext) {
27631
- return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, Object.assign({
27632
- at: loc
27633
- }, enumContext));
27591
+ return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, loc, enumContext);
27634
27592
  }
27635
- flowEnumErrorNumberMemberNotInitialized(loc, {
27636
- enumName,
27637
- memberName
27638
- }) {
27639
- this.raise(FlowErrors.EnumNumberMemberNotInitialized, {
27640
- at: loc,
27641
- enumName,
27642
- memberName
27643
- });
27593
+ flowEnumErrorNumberMemberNotInitialized(loc, details) {
27594
+ this.raise(FlowErrors.EnumNumberMemberNotInitialized, loc, details);
27644
27595
  }
27645
- flowEnumErrorStringMemberInconsistentlyInitialized(node, {
27646
- enumName
27647
- }) {
27648
- this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, {
27649
- at: node,
27650
- enumName
27651
- });
27596
+ flowEnumErrorStringMemberInconsistentlyInitialized(node, details) {
27597
+ this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, node, details);
27652
27598
  }
27653
27599
  flowEnumMemberInit() {
27654
27600
  const startLoc = this.state.startLoc;
@@ -27757,16 +27703,14 @@ function requireLib () {
27757
27703
  continue;
27758
27704
  }
27759
27705
  if (/^[a-z]/.test(memberName)) {
27760
- this.raise(FlowErrors.EnumInvalidMemberName, {
27761
- at: id,
27706
+ this.raise(FlowErrors.EnumInvalidMemberName, id, {
27762
27707
  memberName,
27763
27708
  suggestion: memberName[0].toUpperCase() + memberName.slice(1),
27764
27709
  enumName
27765
27710
  });
27766
27711
  }
27767
27712
  if (seenNames.has(memberName)) {
27768
- this.raise(FlowErrors.EnumDuplicateMemberName, {
27769
- at: id,
27713
+ this.raise(FlowErrors.EnumDuplicateMemberName, id, {
27770
27714
  memberName,
27771
27715
  enumName
27772
27716
  });
@@ -27855,8 +27799,7 @@ function requireLib () {
27855
27799
  }) {
27856
27800
  if (!this.eatContextual(102)) return null;
27857
27801
  if (!tokenIsIdentifier(this.state.type)) {
27858
- throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, {
27859
- at: this.state.startLoc,
27802
+ throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, {
27860
27803
  enumName
27861
27804
  });
27862
27805
  }
@@ -27865,8 +27808,7 @@ function requireLib () {
27865
27808
  } = this.state;
27866
27809
  this.next();
27867
27810
  if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") {
27868
- this.raise(FlowErrors.EnumInvalidExplicitType, {
27869
- at: this.state.startLoc,
27811
+ this.raise(FlowErrors.EnumInvalidExplicitType, this.state.startLoc, {
27870
27812
  enumName,
27871
27813
  invalidEnumType: value
27872
27814
  });
@@ -27951,8 +27893,7 @@ function requireLib () {
27951
27893
  this.expect(8);
27952
27894
  return this.finishNode(node, "EnumNumberBody");
27953
27895
  } else {
27954
- this.raise(FlowErrors.EnumInconsistentMemberValues, {
27955
- at: nameLoc,
27896
+ this.raise(FlowErrors.EnumInconsistentMemberValues, nameLoc, {
27956
27897
  enumName
27957
27898
  });
27958
27899
  return empty();
@@ -28270,9 +28211,7 @@ function requireLib () {
28270
28211
  let chunkStart = this.state.pos;
28271
28212
  for (;;) {
28272
28213
  if (this.state.pos >= this.length) {
28273
- throw this.raise(JsxErrors.UnterminatedJsxContent, {
28274
- at: this.state.startLoc
28275
- });
28214
+ throw this.raise(JsxErrors.UnterminatedJsxContent, this.state.startLoc);
28276
28215
  }
28277
28216
  const ch = this.input.charCodeAt(this.state.pos);
28278
28217
  switch (ch) {
@@ -28327,9 +28266,7 @@ function requireLib () {
28327
28266
  let chunkStart = ++this.state.pos;
28328
28267
  for (;;) {
28329
28268
  if (this.state.pos >= this.length) {
28330
- throw this.raise(Errors.UnterminatedString, {
28331
- at: this.state.startLoc
28332
- });
28269
+ throw this.raise(Errors.UnterminatedString, this.state.startLoc);
28333
28270
  }
28334
28271
  const ch = this.input.charCodeAt(this.state.pos);
28335
28272
  if (ch === quote) break;
@@ -28432,18 +28369,14 @@ function requireLib () {
28432
28369
  this.next();
28433
28370
  node = this.jsxParseExpressionContainer(node, types.j_oTag);
28434
28371
  if (node.expression.type === "JSXEmptyExpression") {
28435
- this.raise(JsxErrors.AttributeIsEmpty, {
28436
- at: node
28437
- });
28372
+ this.raise(JsxErrors.AttributeIsEmpty, node);
28438
28373
  }
28439
28374
  return node;
28440
28375
  case 142:
28441
28376
  case 133:
28442
28377
  return this.parseExprAtom();
28443
28378
  default:
28444
- throw this.raise(JsxErrors.UnsupportedJsxValue, {
28445
- at: this.state.startLoc
28446
- });
28379
+ throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
28447
28380
  }
28448
28381
  }
28449
28382
  jsxParseEmptyExpression() {
@@ -28550,18 +28483,14 @@ function requireLib () {
28550
28483
  }
28551
28484
  }
28552
28485
  if (isFragment(openingElement) && !isFragment(closingElement) && closingElement !== null) {
28553
- this.raise(JsxErrors.MissingClosingTagFragment, {
28554
- at: closingElement
28555
- });
28486
+ this.raise(JsxErrors.MissingClosingTagFragment, closingElement);
28556
28487
  } else if (!isFragment(openingElement) && isFragment(closingElement)) {
28557
- this.raise(JsxErrors.MissingClosingTagElement, {
28558
- at: closingElement,
28488
+ this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
28559
28489
  openingTagName: getQualifiedJSXName(openingElement.name)
28560
28490
  });
28561
28491
  } else if (!isFragment(openingElement) && !isFragment(closingElement)) {
28562
28492
  if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
28563
- this.raise(JsxErrors.MissingClosingTagElement, {
28564
- at: closingElement,
28493
+ this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
28565
28494
  openingTagName: getQualifiedJSXName(openingElement.name)
28566
28495
  });
28567
28496
  }
@@ -28576,9 +28505,7 @@ function requireLib () {
28576
28505
  }
28577
28506
  node.children = children;
28578
28507
  if (this.match(47)) {
28579
- throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, {
28580
- at: this.state.startLoc
28581
- });
28508
+ throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, this.state.startLoc);
28582
28509
  }
28583
28510
  return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
28584
28511
  }
@@ -28664,11 +28591,7 @@ function requireLib () {
28664
28591
  class TypeScriptScope extends Scope {
28665
28592
  constructor(...args) {
28666
28593
  super(...args);
28667
- this.types = new Set();
28668
- this.enums = new Set();
28669
- this.constEnums = new Set();
28670
- this.classes = new Set();
28671
- this.exportOnlyBindings = new Set();
28594
+ this.tsNames = new Map();
28672
28595
  }
28673
28596
  }
28674
28597
  class TypeScriptScopeHandler extends ScopeHandler {
@@ -28708,8 +28631,7 @@ function requireLib () {
28708
28631
  declareName(name, bindingType, loc) {
28709
28632
  if (bindingType & 4096) {
28710
28633
  if (this.hasImport(name, true)) {
28711
- this.parser.raise(Errors.VarRedeclaration, {
28712
- at: loc,
28634
+ this.parser.raise(Errors.VarRedeclaration, loc, {
28713
28635
  identifierName: name
28714
28636
  });
28715
28637
  }
@@ -28717,9 +28639,10 @@ function requireLib () {
28717
28639
  return;
28718
28640
  }
28719
28641
  const scope = this.currentScope();
28642
+ let type = scope.tsNames.get(name) || 0;
28720
28643
  if (bindingType & 1024) {
28721
28644
  this.maybeExportDefined(scope, name);
28722
- scope.exportOnlyBindings.add(name);
28645
+ scope.tsNames.set(name, type | 16);
28723
28646
  return;
28724
28647
  }
28725
28648
  super.declareName(name, bindingType, loc);
@@ -28728,31 +28651,37 @@ function requireLib () {
28728
28651
  this.checkRedeclarationInScope(scope, name, bindingType, loc);
28729
28652
  this.maybeExportDefined(scope, name);
28730
28653
  }
28731
- scope.types.add(name);
28654
+ type = type | 1;
28655
+ }
28656
+ if (bindingType & 256) {
28657
+ type = type | 2;
28732
28658
  }
28733
- if (bindingType & 256) scope.enums.add(name);
28734
28659
  if (bindingType & 512) {
28735
- scope.constEnums.add(name);
28660
+ type = type | 4;
28661
+ }
28662
+ if (bindingType & 128) {
28663
+ type = type | 8;
28736
28664
  }
28737
- if (bindingType & 128) scope.classes.add(name);
28665
+ if (type) scope.tsNames.set(name, type);
28738
28666
  }
28739
28667
  isRedeclaredInScope(scope, name, bindingType) {
28740
- if (scope.enums.has(name)) {
28668
+ const type = scope.tsNames.get(name);
28669
+ if ((type & 2) > 0) {
28741
28670
  if (bindingType & 256) {
28742
28671
  const isConst = !!(bindingType & 512);
28743
- const wasConst = scope.constEnums.has(name);
28672
+ const wasConst = (type & 4) > 0;
28744
28673
  return isConst !== wasConst;
28745
28674
  }
28746
28675
  return true;
28747
28676
  }
28748
- if (bindingType & 128 && scope.classes.has(name)) {
28749
- if (scope.lexical.has(name)) {
28677
+ if (bindingType & 128 && (type & 8) > 0) {
28678
+ if (scope.names.get(name) & 2) {
28750
28679
  return !!(bindingType & 1);
28751
28680
  } else {
28752
28681
  return false;
28753
28682
  }
28754
28683
  }
28755
- if (bindingType & 2 && scope.types.has(name)) {
28684
+ if (bindingType & 2 && (type & 1) > 0) {
28756
28685
  return true;
28757
28686
  }
28758
28687
  return super.isRedeclaredInScope(scope, name, bindingType);
@@ -28765,7 +28694,10 @@ function requireLib () {
28765
28694
  const len = this.scopeStack.length;
28766
28695
  for (let i = len - 1; i >= 0; i--) {
28767
28696
  const scope = this.scopeStack[i];
28768
- 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
+ }
28769
28701
  }
28770
28702
  super.checkLocalExport(id);
28771
28703
  }
@@ -28782,18 +28714,12 @@ function requireLib () {
28782
28714
  parenthesized = unwrapParenthesizedExpression(node);
28783
28715
  if (isLHS) {
28784
28716
  if (parenthesized.type === "Identifier") {
28785
- this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, {
28786
- at: node
28787
- });
28717
+ this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, node);
28788
28718
  } else if (parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) {
28789
- this.raise(Errors.InvalidParenthesizedAssignment, {
28790
- at: node
28791
- });
28719
+ this.raise(Errors.InvalidParenthesizedAssignment, node);
28792
28720
  }
28793
28721
  } else {
28794
- this.raise(Errors.InvalidParenthesizedAssignment, {
28795
- at: node
28796
- });
28722
+ this.raise(Errors.InvalidParenthesizedAssignment, node);
28797
28723
  }
28798
28724
  }
28799
28725
  switch (node.type) {
@@ -28811,9 +28737,7 @@ function requireLib () {
28811
28737
  const isLast = i === last;
28812
28738
  this.toAssignableObjectExpressionProp(prop, isLast, isLHS);
28813
28739
  if (isLast && prop.type === "RestElement" && (_node$extra2 = node.extra) != null && _node$extra2.trailingCommaLoc) {
28814
- this.raise(Errors.RestTrailingComma, {
28815
- at: node.extra.trailingCommaLoc
28816
- });
28740
+ this.raise(Errors.RestTrailingComma, node.extra.trailingCommaLoc);
28817
28741
  }
28818
28742
  }
28819
28743
  break;
@@ -28839,9 +28763,7 @@ function requireLib () {
28839
28763
  break;
28840
28764
  case "AssignmentExpression":
28841
28765
  if (node.operator !== "=") {
28842
- this.raise(Errors.MissingEqInAssignment, {
28843
- at: node.left.loc.end
28844
- });
28766
+ this.raise(Errors.MissingEqInAssignment, node.left.loc.end);
28845
28767
  }
28846
28768
  node.type = "AssignmentPattern";
28847
28769
  delete node.operator;
@@ -28854,18 +28776,14 @@ function requireLib () {
28854
28776
  }
28855
28777
  toAssignableObjectExpressionProp(prop, isLast, isLHS) {
28856
28778
  if (prop.type === "ObjectMethod") {
28857
- this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, {
28858
- at: prop.key
28859
- });
28779
+ this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, prop.key);
28860
28780
  } else if (prop.type === "SpreadElement") {
28861
28781
  prop.type = "RestElement";
28862
28782
  const arg = prop.argument;
28863
28783
  this.checkToRestConversion(arg, false);
28864
28784
  this.toAssignable(arg, isLHS);
28865
28785
  if (!isLast) {
28866
- this.raise(Errors.RestTrailingComma, {
28867
- at: prop
28868
- });
28786
+ this.raise(Errors.RestTrailingComma, prop);
28869
28787
  }
28870
28788
  } else {
28871
28789
  this.toAssignable(prop, isLHS);
@@ -28886,13 +28804,9 @@ function requireLib () {
28886
28804
  }
28887
28805
  if (elt.type === "RestElement") {
28888
28806
  if (i < end) {
28889
- this.raise(Errors.RestTrailingComma, {
28890
- at: elt
28891
- });
28807
+ this.raise(Errors.RestTrailingComma, elt);
28892
28808
  } else if (trailingCommaLoc) {
28893
- this.raise(Errors.RestTrailingComma, {
28894
- at: trailingCommaLoc
28895
- });
28809
+ this.raise(Errors.RestTrailingComma, trailingCommaLoc);
28896
28810
  }
28897
28811
  }
28898
28812
  }
@@ -28989,9 +28903,7 @@ function requireLib () {
28989
28903
  } else {
28990
28904
  const decorators = [];
28991
28905
  if (this.match(26) && this.hasPlugin("decorators")) {
28992
- this.raise(Errors.UnsupportedParameterDecorator, {
28993
- at: this.state.startLoc
28994
- });
28906
+ this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc);
28995
28907
  }
28996
28908
  while (this.match(26)) {
28997
28909
  decorators.push(this.parseDecorator());
@@ -29075,16 +28987,13 @@ function requireLib () {
29075
28987
  if (isOptionalMemberExpression) {
29076
28988
  this.expectPlugin("optionalChainingAssign", expression.loc.start);
29077
28989
  if (ancestor.type !== "AssignmentExpression") {
29078
- this.raise(Errors.InvalidLhsOptionalChaining, {
29079
- at: expression,
28990
+ this.raise(Errors.InvalidLhsOptionalChaining, expression, {
29080
28991
  ancestor
29081
28992
  });
29082
28993
  }
29083
28994
  }
29084
28995
  if (binding !== 64) {
29085
- this.raise(Errors.InvalidPropertyBindingPattern, {
29086
- at: expression
29087
- });
28996
+ this.raise(Errors.InvalidPropertyBindingPattern, expression);
29088
28997
  }
29089
28998
  return;
29090
28999
  }
@@ -29095,9 +29004,7 @@ function requireLib () {
29095
29004
  } = expression;
29096
29005
  if (checkClashes) {
29097
29006
  if (checkClashes.has(name)) {
29098
- this.raise(Errors.ParamDupe, {
29099
- at: expression
29100
- });
29007
+ this.raise(Errors.ParamDupe, expression);
29101
29008
  } else {
29102
29009
  checkClashes.add(name);
29103
29010
  }
@@ -29108,8 +29015,7 @@ function requireLib () {
29108
29015
  if (validity === true) return;
29109
29016
  if (validity === false) {
29110
29017
  const ParseErrorClass = binding === 64 ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
29111
- this.raise(ParseErrorClass, {
29112
- at: expression,
29018
+ this.raise(ParseErrorClass, expression, {
29113
29019
  ancestor
29114
29020
  });
29115
29021
  return;
@@ -29133,21 +29039,17 @@ function requireLib () {
29133
29039
  checkIdentifier(at, bindingType, strictModeChanged = false) {
29134
29040
  if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
29135
29041
  if (bindingType === 64) {
29136
- this.raise(Errors.StrictEvalArguments, {
29137
- at,
29042
+ this.raise(Errors.StrictEvalArguments, at, {
29138
29043
  referenceName: at.name
29139
29044
  });
29140
29045
  } else {
29141
- this.raise(Errors.StrictEvalArgumentsBinding, {
29142
- at,
29046
+ this.raise(Errors.StrictEvalArgumentsBinding, at, {
29143
29047
  bindingName: at.name
29144
29048
  });
29145
29049
  }
29146
29050
  }
29147
29051
  if (bindingType & 8192 && at.name === "let") {
29148
- this.raise(Errors.LetInLexicalBinding, {
29149
- at
29150
- });
29052
+ this.raise(Errors.LetInLexicalBinding, at);
29151
29053
  }
29152
29054
  if (!(bindingType & 64)) {
29153
29055
  this.declareNameFromIdentifier(at, bindingType);
@@ -29168,18 +29070,14 @@ function requireLib () {
29168
29070
  case "ObjectExpression":
29169
29071
  if (allowPattern) break;
29170
29072
  default:
29171
- this.raise(Errors.InvalidRestAssignmentPattern, {
29172
- at: node
29173
- });
29073
+ this.raise(Errors.InvalidRestAssignmentPattern, node);
29174
29074
  }
29175
29075
  }
29176
29076
  checkCommaAfterRest(close) {
29177
29077
  if (!this.match(12)) {
29178
29078
  return false;
29179
29079
  }
29180
- this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, {
29181
- at: this.state.startLoc
29182
- });
29080
+ this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, this.state.startLoc);
29183
29081
  return true;
29184
29082
  }
29185
29083
  }
@@ -29375,16 +29273,14 @@ function requireLib () {
29375
29273
  }, modified) {
29376
29274
  const enforceOrder = (loc, modifier, before, after) => {
29377
29275
  if (modifier === before && modified[after]) {
29378
- this.raise(TSErrors.InvalidModifiersOrder, {
29379
- at: loc,
29276
+ this.raise(TSErrors.InvalidModifiersOrder, loc, {
29380
29277
  orderedModifiers: [before, after]
29381
29278
  });
29382
29279
  }
29383
29280
  };
29384
29281
  const incompatible = (loc, modifier, mod1, mod2) => {
29385
29282
  if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) {
29386
- this.raise(TSErrors.IncompatibleModifiers, {
29387
- at: loc,
29283
+ this.raise(TSErrors.IncompatibleModifiers, loc, {
29388
29284
  modifiers: [mod1, mod2]
29389
29285
  });
29390
29286
  }
@@ -29397,8 +29293,7 @@ function requireLib () {
29397
29293
  if (!modifier) break;
29398
29294
  if (tsIsAccessModifier(modifier)) {
29399
29295
  if (modified.accessibility) {
29400
- this.raise(TSErrors.DuplicateAccessibilityModifier, {
29401
- at: startLoc,
29296
+ this.raise(TSErrors.DuplicateAccessibilityModifier, startLoc, {
29402
29297
  modifier
29403
29298
  });
29404
29299
  } else {
@@ -29409,8 +29304,7 @@ function requireLib () {
29409
29304
  }
29410
29305
  } else if (tsIsVarianceAnnotations(modifier)) {
29411
29306
  if (modified[modifier]) {
29412
- this.raise(TSErrors.DuplicateModifier, {
29413
- at: startLoc,
29307
+ this.raise(TSErrors.DuplicateModifier, startLoc, {
29414
29308
  modifier
29415
29309
  });
29416
29310
  }
@@ -29418,8 +29312,7 @@ function requireLib () {
29418
29312
  enforceOrder(startLoc, modifier, "in", "out");
29419
29313
  } else {
29420
29314
  if (Object.hasOwnProperty.call(modified, modifier)) {
29421
- this.raise(TSErrors.DuplicateModifier, {
29422
- at: startLoc,
29315
+ this.raise(TSErrors.DuplicateModifier, startLoc, {
29423
29316
  modifier
29424
29317
  });
29425
29318
  } else {
@@ -29433,8 +29326,7 @@ function requireLib () {
29433
29326
  modified[modifier] = true;
29434
29327
  }
29435
29328
  if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
29436
- this.raise(errorTemplate, {
29437
- at: startLoc,
29329
+ this.raise(errorTemplate, startLoc, {
29438
29330
  modifier
29439
29331
  });
29440
29332
  }
@@ -29477,7 +29369,7 @@ function requireLib () {
29477
29369
  }
29478
29370
  result.push(element);
29479
29371
  if (this.eat(12)) {
29480
- trailingCommaPos = this.state.lastTokStart;
29372
+ trailingCommaPos = this.state.lastTokStartLoc.index;
29481
29373
  continue;
29482
29374
  }
29483
29375
  if (this.tsIsListTerminator(kind)) {
@@ -29514,9 +29406,7 @@ function requireLib () {
29514
29406
  this.expect(83);
29515
29407
  this.expect(10);
29516
29408
  if (!this.match(133)) {
29517
- this.raise(TSErrors.UnsupportedImportTypeArgument, {
29518
- at: this.state.startLoc
29519
- });
29409
+ this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
29520
29410
  }
29521
29411
  node.argument = super.parseExprAtom();
29522
29412
  this.expect(11);
@@ -29597,9 +29487,7 @@ function requireLib () {
29597
29487
  };
29598
29488
  node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
29599
29489
  if (node.params.length === 0) {
29600
- this.raise(TSErrors.EmptyTypeParameters, {
29601
- at: node
29602
- });
29490
+ this.raise(TSErrors.EmptyTypeParameters, node);
29603
29491
  }
29604
29492
  if (refTrailingCommaPos.value !== -1) {
29605
29493
  this.addExtra(node, "trailingComma", refTrailingCommaPos.value);
@@ -29626,8 +29514,7 @@ function requireLib () {
29626
29514
  type
29627
29515
  } = pattern;
29628
29516
  if (type === "AssignmentPattern" || type === "TSParameterProperty") {
29629
- this.raise(TSErrors.UnsupportedSignatureParameterKind, {
29630
- at: pattern,
29517
+ this.raise(TSErrors.UnsupportedSignatureParameterKind, pattern, {
29631
29518
  type
29632
29519
  });
29633
29520
  }
@@ -29672,15 +29559,11 @@ function requireLib () {
29672
29559
  const nodeAny = node;
29673
29560
  if (this.match(10) || this.match(47)) {
29674
29561
  if (readonly) {
29675
- this.raise(TSErrors.ReadonlyForMethodSignature, {
29676
- at: node
29677
- });
29562
+ this.raise(TSErrors.ReadonlyForMethodSignature, node);
29678
29563
  }
29679
29564
  const method = nodeAny;
29680
29565
  if (method.kind && this.match(47)) {
29681
- this.raise(TSErrors.AccesorCannotHaveTypeParameters, {
29682
- at: this.state.curPosition()
29683
- });
29566
+ this.raise(TSErrors.AccesorCannotHaveTypeParameters, this.state.curPosition());
29684
29567
  }
29685
29568
  this.tsFillSignature(14, method);
29686
29569
  this.tsParseTypeMemberSemicolon();
@@ -29688,42 +29571,28 @@ function requireLib () {
29688
29571
  const returnTypeKey = "typeAnnotation";
29689
29572
  if (method.kind === "get") {
29690
29573
  if (method[paramsKey].length > 0) {
29691
- this.raise(Errors.BadGetterArity, {
29692
- at: this.state.curPosition()
29693
- });
29574
+ this.raise(Errors.BadGetterArity, this.state.curPosition());
29694
29575
  if (this.isThisParam(method[paramsKey][0])) {
29695
- this.raise(TSErrors.AccesorCannotDeclareThisParameter, {
29696
- at: this.state.curPosition()
29697
- });
29576
+ this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition());
29698
29577
  }
29699
29578
  }
29700
29579
  } else if (method.kind === "set") {
29701
29580
  if (method[paramsKey].length !== 1) {
29702
- this.raise(Errors.BadSetterArity, {
29703
- at: this.state.curPosition()
29704
- });
29581
+ this.raise(Errors.BadSetterArity, this.state.curPosition());
29705
29582
  } else {
29706
29583
  const firstParameter = method[paramsKey][0];
29707
29584
  if (this.isThisParam(firstParameter)) {
29708
- this.raise(TSErrors.AccesorCannotDeclareThisParameter, {
29709
- at: this.state.curPosition()
29710
- });
29585
+ this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition());
29711
29586
  }
29712
29587
  if (firstParameter.type === "Identifier" && firstParameter.optional) {
29713
- this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, {
29714
- at: this.state.curPosition()
29715
- });
29588
+ this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, this.state.curPosition());
29716
29589
  }
29717
29590
  if (firstParameter.type === "RestElement") {
29718
- this.raise(TSErrors.SetAccesorCannotHaveRestParameter, {
29719
- at: this.state.curPosition()
29720
- });
29591
+ this.raise(TSErrors.SetAccesorCannotHaveRestParameter, this.state.curPosition());
29721
29592
  }
29722
29593
  }
29723
29594
  if (method[returnTypeKey]) {
29724
- this.raise(TSErrors.SetAccesorCannotHaveReturnType, {
29725
- at: method[returnTypeKey]
29726
- });
29595
+ this.raise(TSErrors.SetAccesorCannotHaveReturnType, method[returnTypeKey]);
29727
29596
  }
29728
29597
  } else {
29729
29598
  method.kind = "method";
@@ -29838,9 +29707,7 @@ function requireLib () {
29838
29707
  type
29839
29708
  } = elementNode;
29840
29709
  if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) {
29841
- this.raise(TSErrors.OptionalTypeBeforeRequired, {
29842
- at: elementNode
29843
- });
29710
+ this.raise(TSErrors.OptionalTypeBeforeRequired, elementNode);
29844
29711
  }
29845
29712
  seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
29846
29713
  });
@@ -29893,16 +29760,12 @@ function requireLib () {
29893
29760
  labeledNode.elementType = type;
29894
29761
  if (this.eat(17)) {
29895
29762
  labeledNode.optional = true;
29896
- this.raise(TSErrors.TupleOptionalAfterType, {
29897
- at: this.state.lastTokStartLoc
29898
- });
29763
+ this.raise(TSErrors.TupleOptionalAfterType, this.state.lastTokStartLoc);
29899
29764
  }
29900
29765
  } else {
29901
29766
  labeledNode = this.startNodeAtNode(type);
29902
29767
  labeledNode.optional = optional;
29903
- this.raise(TSErrors.InvalidTupleMemberLabel, {
29904
- at: type
29905
- });
29768
+ this.raise(TSErrors.InvalidTupleMemberLabel, type);
29906
29769
  labeledNode.label = type;
29907
29770
  labeledNode.elementType = this.tsParseType();
29908
29771
  }
@@ -30055,9 +29918,7 @@ function requireLib () {
30055
29918
  case "TSArrayType":
30056
29919
  return;
30057
29920
  default:
30058
- this.raise(TSErrors.UnexpectedReadonly, {
30059
- at: node
30060
- });
29921
+ this.raise(TSErrors.UnexpectedReadonly, node);
30061
29922
  }
30062
29923
  }
30063
29924
  tsParseInferType() {
@@ -30225,8 +30086,7 @@ function requireLib () {
30225
30086
  return false;
30226
30087
  }
30227
30088
  if (containsEsc) {
30228
- this.raise(Errors.InvalidEscapedReservedWord, {
30229
- at: this.state.lastTokStartLoc,
30089
+ this.raise(Errors.InvalidEscapedReservedWord, this.state.lastTokStartLoc, {
30230
30090
  reservedWord: "asserts"
30231
30091
  });
30232
30092
  }
@@ -30270,9 +30130,7 @@ function requireLib () {
30270
30130
  }
30271
30131
  tsParseTypeAssertion() {
30272
30132
  if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
30273
- this.raise(TSErrors.ReservedTypeAssertion, {
30274
- at: this.state.startLoc
30275
- });
30133
+ this.raise(TSErrors.ReservedTypeAssertion, this.state.startLoc);
30276
30134
  }
30277
30135
  const node = this.startNode();
30278
30136
  node.typeAnnotation = this.tsInType(() => {
@@ -30294,8 +30152,7 @@ function requireLib () {
30294
30152
  return this.finishNode(node, "TSExpressionWithTypeArguments");
30295
30153
  });
30296
30154
  if (!delimitedList.length) {
30297
- this.raise(TSErrors.EmptyHeritageClauseType, {
30298
- at: originalStartLoc,
30155
+ this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
30299
30156
  token
30300
30157
  });
30301
30158
  }
@@ -30310,9 +30167,7 @@ function requireLib () {
30310
30167
  this.checkIdentifier(node.id, 130);
30311
30168
  } else {
30312
30169
  node.id = null;
30313
- this.raise(TSErrors.MissingInterfaceName, {
30314
- at: this.state.startLoc
30315
- });
30170
+ this.raise(TSErrors.MissingInterfaceName, this.state.startLoc);
30316
30171
  }
30317
30172
  node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);
30318
30173
  if (this.eat(81)) {
@@ -30464,9 +30319,7 @@ function requireLib () {
30464
30319
  this.expect(29);
30465
30320
  const moduleReference = this.tsParseModuleReference();
30466
30321
  if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") {
30467
- this.raise(TSErrors.ImportAliasHasImportType, {
30468
- at: moduleReference
30469
- });
30322
+ this.raise(TSErrors.ImportAliasHasImportType, moduleReference);
30470
30323
  }
30471
30324
  node.moduleReference = moduleReference;
30472
30325
  this.semicolon();
@@ -30652,9 +30505,7 @@ function requireLib () {
30652
30505
  return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
30653
30506
  }));
30654
30507
  if (node.params.length === 0) {
30655
- this.raise(TSErrors.EmptyTypeArguments, {
30656
- at: node
30657
- });
30508
+ this.raise(TSErrors.EmptyTypeArguments, node);
30658
30509
  } else if (!this.state.inType && this.curContext() === types.brace) {
30659
30510
  this.reScan_lt_gt();
30660
30511
  }
@@ -30678,9 +30529,7 @@ function requireLib () {
30678
30529
  const override = modified.override;
30679
30530
  const readonly = modified.readonly;
30680
30531
  if (!(flags & 4) && (accessibility || readonly || override)) {
30681
- this.raise(TSErrors.UnexpectedParameterModifier, {
30682
- at: startLoc
30683
- });
30532
+ this.raise(TSErrors.UnexpectedParameterModifier, startLoc);
30684
30533
  }
30685
30534
  const left = this.parseMaybeDefault();
30686
30535
  this.parseAssignableListItemTypes(left, flags);
@@ -30694,9 +30543,7 @@ function requireLib () {
30694
30543
  if (readonly) pp.readonly = readonly;
30695
30544
  if (override) pp.override = override;
30696
30545
  if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
30697
- this.raise(TSErrors.UnsupportedParameterPropertyKind, {
30698
- at: pp
30699
- });
30546
+ this.raise(TSErrors.UnsupportedParameterPropertyKind, pp);
30700
30547
  }
30701
30548
  pp.parameter = elt;
30702
30549
  return this.finishNode(pp, "TSParameterProperty");
@@ -30712,9 +30559,7 @@ function requireLib () {
30712
30559
  tsDisallowOptionalPattern(node) {
30713
30560
  for (const param of node.params) {
30714
30561
  if (param.type !== "Identifier" && param.optional && !this.state.isAmbientContext) {
30715
- this.raise(TSErrors.PatternIsOptional, {
30716
- at: param
30717
- });
30562
+ this.raise(TSErrors.PatternIsOptional, param);
30718
30563
  }
30719
30564
  }
30720
30565
  }
@@ -30731,9 +30576,7 @@ function requireLib () {
30731
30576
  return this.finishNode(node, bodilessType);
30732
30577
  }
30733
30578
  if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) {
30734
- this.raise(TSErrors.DeclareFunctionHasImplementation, {
30735
- at: node
30736
- });
30579
+ this.raise(TSErrors.DeclareFunctionHasImplementation, node);
30737
30580
  if (node.declare) {
30738
30581
  return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
30739
30582
  }
@@ -30751,9 +30594,7 @@ function requireLib () {
30751
30594
  tsCheckForInvalidTypeCasts(items) {
30752
30595
  items.forEach(node => {
30753
30596
  if ((node == null ? void 0 : node.type) === "TSTypeCastExpression") {
30754
- this.raise(TSErrors.UnexpectedTypeAnnotation, {
30755
- at: node.typeAnnotation
30756
- });
30597
+ this.raise(TSErrors.UnexpectedTypeAnnotation, node.typeAnnotation);
30757
30598
  }
30758
30599
  });
30759
30600
  }
@@ -30830,9 +30671,7 @@ function requireLib () {
30830
30671
  }
30831
30672
  if (result) {
30832
30673
  if (result.type === "TSInstantiationExpression" && (this.match(16) || this.match(18) && this.lookaheadCharCode() !== 40)) {
30833
- this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, {
30834
- at: this.state.startLoc
30835
- });
30674
+ this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, this.state.startLoc);
30836
30675
  }
30837
30676
  return result;
30838
30677
  }
@@ -30859,8 +30698,7 @@ function requireLib () {
30859
30698
  this.next();
30860
30699
  if (this.match(75)) {
30861
30700
  if (isSatisfies) {
30862
- this.raise(Errors.UnexpectedKeyword, {
30863
- at: this.state.startLoc,
30701
+ this.raise(Errors.UnexpectedKeyword, this.state.startLoc, {
30864
30702
  keyword: "const"
30865
30703
  });
30866
30704
  }
@@ -30882,9 +30720,7 @@ function requireLib () {
30882
30720
  checkImportReflection(node) {
30883
30721
  super.checkImportReflection(node);
30884
30722
  if (node.module && node.importKind !== "value") {
30885
- this.raise(TSErrors.ImportReflectionHasImportType, {
30886
- at: node.specifiers[0].loc.start
30887
- });
30723
+ this.raise(TSErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
30888
30724
  }
30889
30725
  }
30890
30726
  checkDuplicateExports() {}
@@ -30924,9 +30760,7 @@ function requireLib () {
30924
30760
  importNode = super.parseImport(node);
30925
30761
  }
30926
30762
  if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
30927
- this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, {
30928
- at: importNode
30929
- });
30763
+ this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, importNode);
30930
30764
  }
30931
30765
  return importNode;
30932
30766
  }
@@ -30984,13 +30818,9 @@ function requireLib () {
30984
30818
  } of declaration.declarations) {
30985
30819
  if (!init) continue;
30986
30820
  if (kind !== "const" || !!id.typeAnnotation) {
30987
- this.raise(TSErrors.InitializerNotAllowedInAmbientContext, {
30988
- at: init
30989
- });
30821
+ this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init);
30990
30822
  } else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) {
30991
- this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, {
30992
- at: init
30993
- });
30823
+ this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, init);
30994
30824
  }
30995
30825
  }
30996
30826
  return declaration;
@@ -31039,9 +30869,7 @@ function requireLib () {
31039
30869
  this.next();
31040
30870
  this.next();
31041
30871
  if (this.tsHasSomeModifiers(member, modifiers)) {
31042
- this.raise(TSErrors.StaticBlockCannotHaveModifier, {
31043
- at: this.state.curPosition()
31044
- });
30872
+ this.raise(TSErrors.StaticBlockCannotHaveModifier, this.state.curPosition());
31045
30873
  }
31046
30874
  super.parseClassStaticBlock(classBody, member);
31047
30875
  } else {
@@ -31059,38 +30887,27 @@ function requireLib () {
31059
30887
  if (idx) {
31060
30888
  classBody.body.push(idx);
31061
30889
  if (member.abstract) {
31062
- this.raise(TSErrors.IndexSignatureHasAbstract, {
31063
- at: member
31064
- });
30890
+ this.raise(TSErrors.IndexSignatureHasAbstract, member);
31065
30891
  }
31066
30892
  if (member.accessibility) {
31067
- this.raise(TSErrors.IndexSignatureHasAccessibility, {
31068
- at: member,
30893
+ this.raise(TSErrors.IndexSignatureHasAccessibility, member, {
31069
30894
  modifier: member.accessibility
31070
30895
  });
31071
30896
  }
31072
30897
  if (member.declare) {
31073
- this.raise(TSErrors.IndexSignatureHasDeclare, {
31074
- at: member
31075
- });
30898
+ this.raise(TSErrors.IndexSignatureHasDeclare, member);
31076
30899
  }
31077
30900
  if (member.override) {
31078
- this.raise(TSErrors.IndexSignatureHasOverride, {
31079
- at: member
31080
- });
30901
+ this.raise(TSErrors.IndexSignatureHasOverride, member);
31081
30902
  }
31082
30903
  return;
31083
30904
  }
31084
30905
  if (!this.state.inAbstractClass && member.abstract) {
31085
- this.raise(TSErrors.NonAbstractClassHasAbstractMethod, {
31086
- at: member
31087
- });
30906
+ this.raise(TSErrors.NonAbstractClassHasAbstractMethod, member);
31088
30907
  }
31089
30908
  if (member.override) {
31090
30909
  if (!state.hadSuperClass) {
31091
- this.raise(TSErrors.OverrideNotInSubClass, {
31092
- at: member
31093
- });
30910
+ this.raise(TSErrors.OverrideNotInSubClass, member);
31094
30911
  }
31095
30912
  }
31096
30913
  super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
@@ -31099,14 +30916,10 @@ function requireLib () {
31099
30916
  const optional = this.eat(17);
31100
30917
  if (optional) methodOrProp.optional = true;
31101
30918
  if (methodOrProp.readonly && this.match(10)) {
31102
- this.raise(TSErrors.ClassMethodHasReadonly, {
31103
- at: methodOrProp
31104
- });
30919
+ this.raise(TSErrors.ClassMethodHasReadonly, methodOrProp);
31105
30920
  }
31106
30921
  if (methodOrProp.declare && this.match(10)) {
31107
- this.raise(TSErrors.ClassMethodHasDeclare, {
31108
- at: methodOrProp
31109
- });
30922
+ this.raise(TSErrors.ClassMethodHasDeclare, methodOrProp);
31110
30923
  }
31111
30924
  }
31112
30925
  parseExpressionStatement(node, expr, decorators) {
@@ -31152,9 +30965,7 @@ function requireLib () {
31152
30965
  const startLoc = this.state.startLoc;
31153
30966
  const isDeclare = this.eatContextual(125);
31154
30967
  if (isDeclare && (this.isContextual(125) || !this.shouldParseExportDeclaration())) {
31155
- throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, {
31156
- at: this.state.startLoc
31157
- });
30968
+ throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
31158
30969
  }
31159
30970
  const isIdentifier = tokenIsIdentifier(this.state.type);
31160
30971
  const declaration = isIdentifier && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
@@ -31190,16 +31001,13 @@ function requireLib () {
31190
31001
  parseClassProperty(node) {
31191
31002
  this.parseClassPropertyAnnotation(node);
31192
31003
  if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(29)) {
31193
- this.raise(TSErrors.DeclareClassFieldHasInitializer, {
31194
- at: this.state.startLoc
31195
- });
31004
+ this.raise(TSErrors.DeclareClassFieldHasInitializer, this.state.startLoc);
31196
31005
  }
31197
31006
  if (node.abstract && this.match(29)) {
31198
31007
  const {
31199
31008
  key
31200
31009
  } = node;
31201
- this.raise(TSErrors.AbstractPropertyHasInitializer, {
31202
- at: this.state.startLoc,
31010
+ this.raise(TSErrors.AbstractPropertyHasInitializer, this.state.startLoc, {
31203
31011
  propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
31204
31012
  });
31205
31013
  }
@@ -31207,13 +31015,10 @@ function requireLib () {
31207
31015
  }
31208
31016
  parseClassPrivateProperty(node) {
31209
31017
  if (node.abstract) {
31210
- this.raise(TSErrors.PrivateElementHasAbstract, {
31211
- at: node
31212
- });
31018
+ this.raise(TSErrors.PrivateElementHasAbstract, node);
31213
31019
  }
31214
31020
  if (node.accessibility) {
31215
- this.raise(TSErrors.PrivateElementHasAccessibility, {
31216
- at: node,
31021
+ this.raise(TSErrors.PrivateElementHasAccessibility, node, {
31217
31022
  modifier: node.accessibility
31218
31023
  });
31219
31024
  }
@@ -31223,26 +31028,21 @@ function requireLib () {
31223
31028
  parseClassAccessorProperty(node) {
31224
31029
  this.parseClassPropertyAnnotation(node);
31225
31030
  if (node.optional) {
31226
- this.raise(TSErrors.AccessorCannotBeOptional, {
31227
- at: node
31228
- });
31031
+ this.raise(TSErrors.AccessorCannotBeOptional, node);
31229
31032
  }
31230
31033
  return super.parseClassAccessorProperty(node);
31231
31034
  }
31232
31035
  pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
31233
31036
  const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
31234
31037
  if (typeParameters && isConstructor) {
31235
- this.raise(TSErrors.ConstructorHasTypeParameters, {
31236
- at: typeParameters
31237
- });
31038
+ this.raise(TSErrors.ConstructorHasTypeParameters, typeParameters);
31238
31039
  }
31239
31040
  const {
31240
31041
  declare = false,
31241
31042
  kind
31242
31043
  } = method;
31243
31044
  if (declare && (kind === "get" || kind === "set")) {
31244
- this.raise(TSErrors.DeclareAccessor, {
31245
- at: method,
31045
+ this.raise(TSErrors.DeclareAccessor, method, {
31246
31046
  kind
31247
31047
  });
31248
31048
  }
@@ -31357,9 +31157,7 @@ function requireLib () {
31357
31157
  reportReservedArrowTypeParam(node) {
31358
31158
  var _node$extra;
31359
31159
  if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra = node.extra) != null && _node$extra.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
31360
- this.raise(TSErrors.ReservedArrowTypeParam, {
31361
- at: node
31362
- });
31160
+ this.raise(TSErrors.ReservedArrowTypeParam, node);
31363
31161
  }
31364
31162
  }
31365
31163
  parseMaybeUnary(refExpressionErrors, sawUnary) {
@@ -31413,13 +31211,9 @@ function requireLib () {
31413
31211
  case "TSNonNullExpression":
31414
31212
  case "TSTypeAssertion":
31415
31213
  if (isLHS) {
31416
- this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, {
31417
- at: node
31418
- });
31214
+ this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, node);
31419
31215
  } else {
31420
- this.raise(TSErrors.UnexpectedTypeCastInParameter, {
31421
- at: node
31422
- });
31216
+ this.raise(TSErrors.UnexpectedTypeCastInParameter, node);
31423
31217
  }
31424
31218
  this.toAssignable(node.expression, isLHS);
31425
31219
  break;
@@ -31500,9 +31294,7 @@ function requireLib () {
31500
31294
  parseMaybeDefault(startLoc, left) {
31501
31295
  const node = super.parseMaybeDefault(startLoc, left);
31502
31296
  if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
31503
- this.raise(TSErrors.TypeAnnotationAfterAssign, {
31504
- at: node.typeAnnotation
31505
- });
31297
+ this.raise(TSErrors.TypeAnnotationAfterAssign, node.typeAnnotation);
31506
31298
  }
31507
31299
  return node;
31508
31300
  }
@@ -31616,9 +31408,7 @@ function requireLib () {
31616
31408
  } else if (this.isContextual(129)) {
31617
31409
  if (!this.hasFollowingLineBreak()) {
31618
31410
  node.abstract = true;
31619
- this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, {
31620
- at: node
31621
- });
31411
+ this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, node);
31622
31412
  return this.tsParseInterfaceDeclaration(node);
31623
31413
  }
31624
31414
  } else {
@@ -31633,8 +31423,7 @@ function requireLib () {
31633
31423
  const {
31634
31424
  key
31635
31425
  } = method;
31636
- this.raise(TSErrors.AbstractMethodHasImplementation, {
31637
- at: method,
31426
+ this.raise(TSErrors.AbstractMethodHasImplementation, method, {
31638
31427
  methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
31639
31428
  });
31640
31429
  }
@@ -31716,9 +31505,7 @@ function requireLib () {
31716
31505
  }
31717
31506
  }
31718
31507
  if (hasTypeSpecifier && isInTypeOnlyImportExport) {
31719
- this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, {
31720
- at: loc
31721
- });
31508
+ this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, loc);
31722
31509
  }
31723
31510
  node[leftOfAsKey] = leftOfAs;
31724
31511
  node[rightOfAsKey] = rightOfAs;
@@ -31905,9 +31692,7 @@ function requireLib () {
31905
31692
  node.body = this.finishPlaceholder(placeholder, "ClassBody");
31906
31693
  return this.finishNode(node, type);
31907
31694
  } else {
31908
- throw this.raise(PlaceholderErrors.ClassNameIsRequired, {
31909
- at: this.state.startLoc
31910
- });
31695
+ throw this.raise(PlaceholderErrors.ClassNameIsRequired, this.state.startLoc);
31911
31696
  }
31912
31697
  } else {
31913
31698
  this.parseClassId(node, isStatement, optionalId);
@@ -31985,9 +31770,7 @@ function requireLib () {
31985
31770
  }
31986
31771
  assertNoSpace() {
31987
31772
  if (this.state.start > this.state.lastTokEndLoc.index) {
31988
- this.raise(PlaceholderErrors.UnexpectedSpace, {
31989
- at: this.state.lastTokEndLoc
31990
- });
31773
+ this.raise(PlaceholderErrors.UnexpectedSpace, this.state.lastTokEndLoc);
31991
31774
  }
31992
31775
  }
31993
31776
  };
@@ -32176,9 +31959,7 @@ function requireLib () {
32176
31959
  const name = key.type === "Identifier" ? key.name : key.value;
32177
31960
  if (name === "__proto__") {
32178
31961
  if (isRecord) {
32179
- this.raise(Errors.RecordNoProto, {
32180
- at: key
32181
- });
31962
+ this.raise(Errors.RecordNoProto, key);
32182
31963
  return;
32183
31964
  }
32184
31965
  if (protoRef.used) {
@@ -32187,9 +31968,7 @@ function requireLib () {
32187
31968
  refExpressionErrors.doubleProtoLoc = key.loc.start;
32188
31969
  }
32189
31970
  } else {
32190
- this.raise(Errors.DuplicateProto, {
32191
- at: key
32192
- });
31971
+ this.raise(Errors.DuplicateProto, key);
32193
31972
  }
32194
31973
  }
32195
31974
  protoRef.used = true;
@@ -32206,7 +31985,7 @@ function requireLib () {
32206
31985
  this.unexpected();
32207
31986
  }
32208
31987
  this.finalizeRemainingComments();
32209
- expr.comments = this.state.comments;
31988
+ expr.comments = this.comments;
32210
31989
  expr.errors = this.state.errors;
32211
31990
  if (this.options.tokens) {
32212
31991
  expr.tokens = this.tokens;
@@ -32339,8 +32118,7 @@ function requireLib () {
32339
32118
  if (this.isPrivateName(left)) {
32340
32119
  const value = this.getPrivateNameSV(left);
32341
32120
  if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) {
32342
- this.raise(Errors.PrivateInExpectedIn, {
32343
- at: left,
32121
+ this.raise(Errors.PrivateInExpectedIn, left, {
32344
32122
  identifierName: value
32345
32123
  });
32346
32124
  }
@@ -32370,18 +32148,14 @@ function requireLib () {
32370
32148
  proposal: "minimal"
32371
32149
  }])) {
32372
32150
  if (this.state.type === 96 && this.prodParam.hasAwait) {
32373
- throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, {
32374
- at: this.state.startLoc
32375
- });
32151
+ throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, this.state.startLoc);
32376
32152
  }
32377
32153
  }
32378
32154
  node.right = this.parseExprOpRightExpr(op, prec);
32379
32155
  const finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
32380
32156
  const nextOp = this.state.type;
32381
32157
  if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) {
32382
- throw this.raise(Errors.MixingCoalesceWithLogical, {
32383
- at: this.state.startLoc
32384
- });
32158
+ throw this.raise(Errors.MixingCoalesceWithLogical, this.state.startLoc);
32385
32159
  }
32386
32160
  return this.parseExprOp(finishedNode, leftStartLoc, minPrec);
32387
32161
  }
@@ -32400,9 +32174,7 @@ function requireLib () {
32400
32174
  case "smart":
32401
32175
  return this.withTopicBindingContext(() => {
32402
32176
  if (this.prodParam.hasYield && this.isContextual(108)) {
32403
- throw this.raise(Errors.PipeBodyIsTighter, {
32404
- at: this.state.startLoc
32405
- });
32177
+ throw this.raise(Errors.PipeBodyIsTighter, this.state.startLoc);
32406
32178
  }
32407
32179
  return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startLoc);
32408
32180
  });
@@ -32427,23 +32199,18 @@ function requireLib () {
32427
32199
  const body = this.parseMaybeAssign();
32428
32200
  const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);
32429
32201
  if (requiredParentheses && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) {
32430
- this.raise(Errors.PipeUnparenthesizedBody, {
32431
- at: startLoc,
32202
+ this.raise(Errors.PipeUnparenthesizedBody, startLoc, {
32432
32203
  type: body.type
32433
32204
  });
32434
32205
  }
32435
32206
  if (!this.topicReferenceWasUsedInCurrentContext()) {
32436
- this.raise(Errors.PipeTopicUnused, {
32437
- at: startLoc
32438
- });
32207
+ this.raise(Errors.PipeTopicUnused, startLoc);
32439
32208
  }
32440
32209
  return body;
32441
32210
  }
32442
32211
  checkExponentialAfterUnary(node) {
32443
32212
  if (this.match(57)) {
32444
- this.raise(Errors.UnexpectedTokenUnaryExponentiation, {
32445
- at: node.argument
32446
- });
32213
+ this.raise(Errors.UnexpectedTokenUnaryExponentiation, node.argument);
32447
32214
  }
32448
32215
  }
32449
32216
  parseMaybeUnary(refExpressionErrors, sawUnary) {
@@ -32470,13 +32237,9 @@ function requireLib () {
32470
32237
  if (this.state.strict && isDelete) {
32471
32238
  const arg = node.argument;
32472
32239
  if (arg.type === "Identifier") {
32473
- this.raise(Errors.StrictDelete, {
32474
- at: node
32475
- });
32240
+ this.raise(Errors.StrictDelete, node);
32476
32241
  } else if (this.hasPropertyAsPrivateName(arg)) {
32477
- this.raise(Errors.DeletePrivateField, {
32478
- at: node
32479
- });
32242
+ this.raise(Errors.DeletePrivateField, node);
32480
32243
  }
32481
32244
  }
32482
32245
  if (!update) {
@@ -32493,9 +32256,7 @@ function requireLib () {
32493
32256
  } = this.state;
32494
32257
  const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54);
32495
32258
  if (startsExpr && !this.isAmbiguousAwait()) {
32496
- this.raiseOverwrite(Errors.AwaitNotInAsyncContext, {
32497
- at: startLoc
32498
- });
32259
+ this.raiseOverwrite(Errors.AwaitNotInAsyncContext, startLoc);
32499
32260
  return this.parseAwait(startLoc);
32500
32261
  }
32501
32262
  }
@@ -32557,9 +32318,7 @@ function requireLib () {
32557
32318
  let optional = false;
32558
32319
  if (type === 18) {
32559
32320
  if (noCalls) {
32560
- this.raise(Errors.OptionalChainingNoNew, {
32561
- at: this.state.startLoc
32562
- });
32321
+ this.raise(Errors.OptionalChainingNoNew, this.state.startLoc);
32563
32322
  if (this.lookaheadCharCode() === 40) {
32564
32323
  state.stop = true;
32565
32324
  return base;
@@ -32589,9 +32348,7 @@ function requireLib () {
32589
32348
  this.expect(3);
32590
32349
  } else if (this.match(138)) {
32591
32350
  if (base.type === "Super") {
32592
- this.raise(Errors.SuperPrivateField, {
32593
- at: startLoc
32594
- });
32351
+ this.raise(Errors.SuperPrivateField, startLoc);
32595
32352
  }
32596
32353
  this.classScope.usePrivateName(this.state.value, this.state.startLoc);
32597
32354
  node.property = this.parsePrivateName();
@@ -32661,9 +32418,7 @@ function requireLib () {
32661
32418
  node.tag = base;
32662
32419
  node.quasi = this.parseTemplate(true);
32663
32420
  if (state.optionalChainMember) {
32664
- this.raise(Errors.OptionalChainingNoTemplate, {
32665
- at: startLoc
32666
- });
32421
+ this.raise(Errors.OptionalChainingNoTemplate, startLoc);
32667
32422
  }
32668
32423
  return this.finishNode(node, "TaggedTemplateExpression");
32669
32424
  }
@@ -32685,16 +32440,13 @@ function requireLib () {
32685
32440
  }
32686
32441
  }
32687
32442
  if (node.arguments.length === 0 || node.arguments.length > 2) {
32688
- this.raise(Errors.ImportCallArity, {
32689
- at: node,
32443
+ this.raise(Errors.ImportCallArity, node, {
32690
32444
  maxArgumentCount: this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? 2 : 1
32691
32445
  });
32692
32446
  } else {
32693
32447
  for (const arg of node.arguments) {
32694
32448
  if (arg.type === "SpreadElement") {
32695
- this.raise(Errors.ImportCallSpreadArgument, {
32696
- at: arg
32697
- });
32449
+ this.raise(Errors.ImportCallSpreadArgument, arg);
32698
32450
  }
32699
32451
  }
32700
32452
  }
@@ -32713,9 +32465,7 @@ function requireLib () {
32713
32465
  this.expect(12);
32714
32466
  if (this.match(close)) {
32715
32467
  if (dynamicImport && !this.hasPlugin("importAttributes") && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) {
32716
- this.raise(Errors.ImportCallArgumentTrailingComma, {
32717
- at: this.state.lastTokStartLoc
32718
- });
32468
+ this.raise(Errors.ImportCallArgumentTrailingComma, this.state.lastTokStartLoc);
32719
32469
  }
32720
32470
  if (nodeForExtra) {
32721
32471
  this.addTrailingCommaExtraToNode(nodeForExtra);
@@ -32771,9 +32521,7 @@ function requireLib () {
32771
32521
  return this.finishNode(node, "Import");
32772
32522
  }
32773
32523
  } else {
32774
- this.raise(Errors.UnsupportedImport, {
32775
- at: this.state.lastTokStartLoc
32776
- });
32524
+ this.raise(Errors.UnsupportedImport, this.state.lastTokStartLoc);
32777
32525
  return this.finishNode(node, "Import");
32778
32526
  }
32779
32527
  case 78:
@@ -32847,15 +32595,12 @@ function requireLib () {
32847
32595
  if (callee.type === "MemberExpression") {
32848
32596
  return this.finishNode(node, "BindExpression");
32849
32597
  } else {
32850
- throw this.raise(Errors.UnsupportedBind, {
32851
- at: callee
32852
- });
32598
+ throw this.raise(Errors.UnsupportedBind, callee);
32853
32599
  }
32854
32600
  }
32855
32601
  case 138:
32856
32602
  {
32857
- this.raise(Errors.PrivateInExpectedIn, {
32858
- at: this.state.startLoc,
32603
+ this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, {
32859
32604
  identifierName: this.state.value
32860
32605
  });
32861
32606
  return this.parsePrivateName();
@@ -32955,15 +32700,12 @@ function requireLib () {
32955
32700
  if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
32956
32701
  const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" : "TopicReference";
32957
32702
  if (!this.topicReferenceIsAllowedInCurrentContext()) {
32958
- this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, {
32959
- at: startLoc
32960
- });
32703
+ this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, startLoc);
32961
32704
  }
32962
32705
  this.registerTopicReference();
32963
32706
  return this.finishNode(node, nodeType);
32964
32707
  } else {
32965
- throw this.raise(Errors.PipeTopicUnconfiguredToken, {
32966
- at: startLoc,
32708
+ throw this.raise(Errors.PipeTopicUnconfiguredToken, startLoc, {
32967
32709
  token: tokenLabelName(tokenType)
32968
32710
  });
32969
32711
  }
@@ -32979,9 +32721,7 @@ function requireLib () {
32979
32721
  case "smart":
32980
32722
  return tokenType === 27;
32981
32723
  default:
32982
- throw this.raise(Errors.PipeTopicRequiresHackPipes, {
32983
- at: startLoc
32984
- });
32724
+ throw this.raise(Errors.PipeTopicRequiresHackPipes, startLoc);
32985
32725
  }
32986
32726
  }
32987
32727
  parseAsyncArrowUnaryFunction(node) {
@@ -32989,9 +32729,7 @@ function requireLib () {
32989
32729
  const params = [this.parseIdentifier()];
32990
32730
  this.prodParam.exit();
32991
32731
  if (this.hasPrecedingLineBreak()) {
32992
- this.raise(Errors.LineTerminatorBeforeArrow, {
32993
- at: this.state.curPosition()
32994
- });
32732
+ this.raise(Errors.LineTerminatorBeforeArrow, this.state.curPosition());
32995
32733
  }
32996
32734
  this.expect(19);
32997
32735
  return this.parseArrowExpression(node, params, true);
@@ -33019,18 +32757,12 @@ function requireLib () {
33019
32757
  const node = this.startNode();
33020
32758
  this.next();
33021
32759
  if (this.match(10) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod) {
33022
- this.raise(Errors.SuperNotAllowed, {
33023
- at: node
33024
- });
32760
+ this.raise(Errors.SuperNotAllowed, node);
33025
32761
  } else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) {
33026
- this.raise(Errors.UnexpectedSuper, {
33027
- at: node
33028
- });
32762
+ this.raise(Errors.UnexpectedSuper, node);
33029
32763
  }
33030
32764
  if (!this.match(10) && !this.match(0) && !this.match(16)) {
33031
- this.raise(Errors.UnsupportedSuper, {
33032
- at: node
33033
- });
32765
+ this.raise(Errors.UnsupportedSuper, node);
33034
32766
  }
33035
32767
  return this.finishNode(node, "Super");
33036
32768
  }
@@ -33062,8 +32794,7 @@ function requireLib () {
33062
32794
  const containsEsc = this.state.containsEsc;
33063
32795
  node.property = this.parseIdentifier(true);
33064
32796
  if (node.property.name !== propertyName || containsEsc) {
33065
- this.raise(Errors.UnsupportedMetaProperty, {
33066
- at: node.property,
32797
+ this.raise(Errors.UnsupportedMetaProperty, node.property, {
33067
32798
  target: meta.name,
33068
32799
  onlyValidPropertyName: propertyName
33069
32800
  });
@@ -33075,9 +32806,7 @@ function requireLib () {
33075
32806
  this.next();
33076
32807
  if (this.isContextual(101)) {
33077
32808
  if (!this.inModule) {
33078
- this.raise(Errors.ImportMetaOutsideModule, {
33079
- at: id
33080
- });
32809
+ this.raise(Errors.ImportMetaOutsideModule, id);
33081
32810
  }
33082
32811
  this.sawUnambiguousESM = true;
33083
32812
  } else if (this.isContextual(105) || this.isContextual(97)) {
@@ -33085,8 +32814,7 @@ function requireLib () {
33085
32814
  if (!isSource) this.unexpected();
33086
32815
  this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
33087
32816
  if (!this.options.createImportExpressions) {
33088
- throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, {
33089
- at: this.state.startLoc,
32817
+ throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, {
33090
32818
  phase: this.state.value
33091
32819
  });
33092
32820
  }
@@ -33232,9 +32960,7 @@ function requireLib () {
33232
32960
  this.next();
33233
32961
  const metaProp = this.parseMetaProperty(node, meta, "target");
33234
32962
  if (!this.scope.inNonArrowFunction && !this.scope.inClass && !this.options.allowNewTargetOutsideFunction) {
33235
- this.raise(Errors.UnexpectedNewTarget, {
33236
- at: metaProp
33237
- });
32963
+ this.raise(Errors.UnexpectedNewTarget, metaProp);
33238
32964
  }
33239
32965
  return metaProp;
33240
32966
  }
@@ -33256,9 +32982,7 @@ function requireLib () {
33256
32982
  const callee = this.parseNoCallExpr();
33257
32983
  node.callee = callee;
33258
32984
  if (isImport && (callee.type === "Import" || callee.type === "ImportExpression")) {
33259
- this.raise(Errors.ImportCallNotNewExpression, {
33260
- at: callee
33261
- });
32985
+ this.raise(Errors.ImportCallNotNewExpression, callee);
33262
32986
  }
33263
32987
  }
33264
32988
  parseTemplateElement(isTagged) {
@@ -33272,9 +32996,7 @@ function requireLib () {
33272
32996
  const elem = this.startNodeAt(createPositionWithColumnOffset(startLoc, 1));
33273
32997
  if (value === null) {
33274
32998
  if (!isTagged) {
33275
- this.raise(Errors.InvalidEscapeSequenceTemplate, {
33276
- at: createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1)
33277
- });
32999
+ this.raise(Errors.InvalidEscapeSequenceTemplate, createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1));
33278
33000
  }
33279
33001
  }
33280
33002
  const isTail = this.match(24);
@@ -33334,9 +33056,7 @@ function requireLib () {
33334
33056
  this.checkProto(prop, isRecord, propHash, refExpressionErrors);
33335
33057
  }
33336
33058
  if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
33337
- this.raise(Errors.InvalidRecordProperty, {
33338
- at: prop
33339
- });
33059
+ this.raise(Errors.InvalidRecordProperty, prop);
33340
33060
  }
33341
33061
  if (prop.shorthand) {
33342
33062
  this.addExtra(prop, "shorthand", true);
@@ -33354,7 +33074,7 @@ function requireLib () {
33354
33074
  return this.finishNode(node, type);
33355
33075
  }
33356
33076
  addTrailingCommaExtraToNode(node) {
33357
- this.addExtra(node, "trailingComma", this.state.lastTokStart);
33077
+ this.addExtra(node, "trailingComma", this.state.lastTokStartLoc.index);
33358
33078
  this.addExtra(node, "trailingCommaLoc", this.state.lastTokStartLoc, false);
33359
33079
  }
33360
33080
  maybeAsyncOrAccessorProp(prop) {
@@ -33364,9 +33084,7 @@ function requireLib () {
33364
33084
  let decorators = [];
33365
33085
  if (this.match(26)) {
33366
33086
  if (this.hasPlugin("decorators")) {
33367
- this.raise(Errors.UnsupportedPropertyDecorator, {
33368
- at: this.state.startLoc
33369
- });
33087
+ this.raise(Errors.UnsupportedPropertyDecorator, this.state.startLoc);
33370
33088
  }
33371
33089
  while (this.match(26)) {
33372
33090
  decorators.push(this.parseDecorator());
@@ -33406,8 +33124,7 @@ function requireLib () {
33406
33124
  prop.kind = keyName;
33407
33125
  if (this.match(55)) {
33408
33126
  isGenerator = true;
33409
- this.raise(Errors.AccessorIsGenerator, {
33410
- at: this.state.curPosition(),
33127
+ this.raise(Errors.AccessorIsGenerator, this.state.curPosition(), {
33411
33128
  kind: keyName
33412
33129
  });
33413
33130
  this.next();
@@ -33428,14 +33145,10 @@ function requireLib () {
33428
33145
  const paramCount = this.getGetterSetterExpectedParamCount(method);
33429
33146
  const params = this.getObjectOrClassMethodParams(method);
33430
33147
  if (params.length !== paramCount) {
33431
- this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, {
33432
- at: method
33433
- });
33148
+ this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, method);
33434
33149
  }
33435
33150
  if (method.kind === "set" && ((_params = params[params.length - 1]) == null ? void 0 : _params.type) === "RestElement") {
33436
- this.raise(Errors.BadSetterRestParameter, {
33437
- at: method
33438
- });
33151
+ this.raise(Errors.BadSetterRestParameter, method);
33439
33152
  }
33440
33153
  }
33441
33154
  parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
@@ -33468,9 +33181,7 @@ function requireLib () {
33468
33181
  refExpressionErrors.shorthandAssignLoc = shorthandAssignLoc;
33469
33182
  }
33470
33183
  } else {
33471
- this.raise(Errors.InvalidCoverInitializedName, {
33472
- at: shorthandAssignLoc
33473
- });
33184
+ this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
33474
33185
  }
33475
33186
  prop.value = this.parseMaybeDefault(startLoc, cloneIdentifier(prop.key));
33476
33187
  } else {
@@ -33520,9 +33231,7 @@ function requireLib () {
33520
33231
  refExpressionErrors.privateKeyLoc = privateKeyLoc;
33521
33232
  }
33522
33233
  } else {
33523
- this.raise(Errors.UnexpectedPrivateField, {
33524
- at: privateKeyLoc
33525
- });
33234
+ this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
33526
33235
  }
33527
33236
  key = this.parsePrivateName();
33528
33237
  break;
@@ -33608,9 +33317,7 @@ function requireLib () {
33608
33317
  node.body = this.parseBlock(true, false, hasStrictModeDirective => {
33609
33318
  const nonSimple = !this.isSimpleParamList(node.params);
33610
33319
  if (hasStrictModeDirective && nonSimple) {
33611
- this.raise(Errors.IllegalLanguageModeDirective, {
33612
- at: (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node
33613
- });
33320
+ this.raise(Errors.IllegalLanguageModeDirective, (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node);
33614
33321
  }
33615
33322
  const strictModeChanged = !oldStrict && this.state.strict;
33616
33323
  this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
@@ -33670,8 +33377,7 @@ function requireLib () {
33670
33377
  let elt;
33671
33378
  if (this.match(12)) {
33672
33379
  if (!allowEmpty) {
33673
- this.raise(Errors.UnexpectedToken, {
33674
- at: this.state.curPosition(),
33380
+ this.raise(Errors.UnexpectedToken, this.state.curPosition(), {
33675
33381
  unexpected: ","
33676
33382
  });
33677
33383
  }
@@ -33682,9 +33388,7 @@ function requireLib () {
33682
33388
  } else if (this.match(17)) {
33683
33389
  this.expectPlugin("partialApplication");
33684
33390
  if (!allowPlaceholder) {
33685
- this.raise(Errors.UnexpectedArgumentPlaceholder, {
33686
- at: this.state.startLoc
33687
- });
33391
+ this.raise(Errors.UnexpectedArgumentPlaceholder, this.state.startLoc);
33688
33392
  }
33689
33393
  const node = this.startNode();
33690
33394
  this.next();
@@ -33734,47 +33438,35 @@ function requireLib () {
33734
33438
  return;
33735
33439
  }
33736
33440
  if (checkKeywords && isKeyword(word)) {
33737
- this.raise(Errors.UnexpectedKeyword, {
33738
- at: startLoc,
33441
+ this.raise(Errors.UnexpectedKeyword, startLoc, {
33739
33442
  keyword: word
33740
33443
  });
33741
33444
  return;
33742
33445
  }
33743
33446
  const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord;
33744
33447
  if (reservedTest(word, this.inModule)) {
33745
- this.raise(Errors.UnexpectedReservedWord, {
33746
- at: startLoc,
33448
+ this.raise(Errors.UnexpectedReservedWord, startLoc, {
33747
33449
  reservedWord: word
33748
33450
  });
33749
33451
  return;
33750
33452
  } else if (word === "yield") {
33751
33453
  if (this.prodParam.hasYield) {
33752
- this.raise(Errors.YieldBindingIdentifier, {
33753
- at: startLoc
33754
- });
33454
+ this.raise(Errors.YieldBindingIdentifier, startLoc);
33755
33455
  return;
33756
33456
  }
33757
33457
  } else if (word === "await") {
33758
33458
  if (this.prodParam.hasAwait) {
33759
- this.raise(Errors.AwaitBindingIdentifier, {
33760
- at: startLoc
33761
- });
33459
+ this.raise(Errors.AwaitBindingIdentifier, startLoc);
33762
33460
  return;
33763
33461
  }
33764
33462
  if (this.scope.inStaticBlock) {
33765
- this.raise(Errors.AwaitBindingIdentifierInStaticBlock, {
33766
- at: startLoc
33767
- });
33463
+ this.raise(Errors.AwaitBindingIdentifierInStaticBlock, startLoc);
33768
33464
  return;
33769
33465
  }
33770
- this.expressionScope.recordAsyncArrowParametersError({
33771
- at: startLoc
33772
- });
33466
+ this.expressionScope.recordAsyncArrowParametersError(startLoc);
33773
33467
  } else if (word === "arguments") {
33774
33468
  if (this.scope.inClassAndNotInNonArrowFunction) {
33775
- this.raise(Errors.ArgumentsInClass, {
33776
- at: startLoc
33777
- });
33469
+ this.raise(Errors.ArgumentsInClass, startLoc);
33778
33470
  return;
33779
33471
  }
33780
33472
  }
@@ -33788,13 +33480,9 @@ function requireLib () {
33788
33480
  }
33789
33481
  parseAwait(startLoc) {
33790
33482
  const node = this.startNodeAt(startLoc);
33791
- this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, {
33792
- at: node
33793
- });
33483
+ this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, node);
33794
33484
  if (this.eat(55)) {
33795
- this.raise(Errors.ObsoleteAwaitStar, {
33796
- at: node
33797
- });
33485
+ this.raise(Errors.ObsoleteAwaitStar, node);
33798
33486
  }
33799
33487
  if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) {
33800
33488
  if (this.isAmbiguousAwait()) {
@@ -33817,9 +33505,7 @@ function requireLib () {
33817
33505
  }
33818
33506
  parseYield() {
33819
33507
  const node = this.startNode();
33820
- this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, {
33821
- at: node
33822
- });
33508
+ this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, node);
33823
33509
  this.next();
33824
33510
  let delegating = false;
33825
33511
  let argument = null;
@@ -33864,9 +33550,7 @@ function requireLib () {
33864
33550
  proposal: "smart"
33865
33551
  }])) {
33866
33552
  if (left.type === "SequenceExpression") {
33867
- this.raise(Errors.PipelineHeadSequenceExpression, {
33868
- at: leftStartLoc
33869
- });
33553
+ this.raise(Errors.PipelineHeadSequenceExpression, leftStartLoc);
33870
33554
  }
33871
33555
  }
33872
33556
  }
@@ -33894,14 +33578,10 @@ function requireLib () {
33894
33578
  }
33895
33579
  checkSmartPipeTopicBodyEarlyErrors(startLoc) {
33896
33580
  if (this.match(19)) {
33897
- throw this.raise(Errors.PipelineBodyNoArrow, {
33898
- at: this.state.startLoc
33899
- });
33581
+ throw this.raise(Errors.PipelineBodyNoArrow, this.state.startLoc);
33900
33582
  }
33901
33583
  if (!this.topicReferenceWasUsedInCurrentContext()) {
33902
- this.raise(Errors.PipelineTopicUnused, {
33903
- at: startLoc
33904
- });
33584
+ this.raise(Errors.PipelineTopicUnused, startLoc);
33905
33585
  }
33906
33586
  }
33907
33587
  withTopicBindingContext(callback) {
@@ -34008,10 +33688,10 @@ function requireLib () {
34008
33688
  parsePropertyNamePrefixOperator(prop) {}
34009
33689
  }
34010
33690
  const loopLabel = {
34011
- kind: "loop"
33691
+ kind: 1
34012
33692
  },
34013
33693
  switchLabel = {
34014
- kind: "switch"
33694
+ kind: 2
34015
33695
  };
34016
33696
  const loneSurrogate = /[\uD800-\uDFFF]/u;
34017
33697
  const keywordRelationalOperator = /in(?:stanceof)?/y;
@@ -34125,7 +33805,7 @@ function requireLib () {
34125
33805
  class StatementParser extends ExpressionParser {
34126
33806
  parseTopLevel(file, program) {
34127
33807
  file.program = this.parseProgram(program);
34128
- file.comments = this.state.comments;
33808
+ file.comments = this.comments;
34129
33809
  if (this.options.tokens) {
34130
33810
  file.tokens = babel7CompatTokens(this.tokens, this.input);
34131
33811
  }
@@ -34137,8 +33817,7 @@ function requireLib () {
34137
33817
  this.parseBlockBody(program, true, true, end);
34138
33818
  if (this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
34139
33819
  for (const [localName, at] of Array.from(this.scope.undefinedExports)) {
34140
- this.raise(Errors.ModuleExportUndefined, {
34141
- at,
33820
+ this.raise(Errors.ModuleExportUndefined, at, {
34142
33821
  localName
34143
33822
  });
34144
33823
  }
@@ -34280,9 +33959,7 @@ function requireLib () {
34280
33959
  case 68:
34281
33960
  if (this.lookaheadCharCode() === 46) break;
34282
33961
  if (!allowFunctionDeclaration) {
34283
- this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, {
34284
- at: this.state.startLoc
34285
- });
33962
+ this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, this.state.startLoc);
34286
33963
  }
34287
33964
  return this.parseFunctionStatement(node, false, !allowDeclaration && allowFunctionDeclaration);
34288
33965
  case 80:
@@ -34301,13 +33978,9 @@ function requireLib () {
34301
33978
  case 96:
34302
33979
  if (!this.state.containsEsc && this.startsAwaitUsing()) {
34303
33980
  if (!this.isAwaitAllowed()) {
34304
- this.raise(Errors.AwaitUsingNotInAsyncContext, {
34305
- at: node
34306
- });
33981
+ this.raise(Errors.AwaitUsingNotInAsyncContext, node);
34307
33982
  } else if (!allowDeclaration) {
34308
- this.raise(Errors.UnexpectedLexicalDeclaration, {
34309
- at: node
34310
- });
33983
+ this.raise(Errors.UnexpectedLexicalDeclaration, node);
34311
33984
  }
34312
33985
  this.next();
34313
33986
  return this.parseVarStatement(node, "await using");
@@ -34319,13 +33992,9 @@ function requireLib () {
34319
33992
  }
34320
33993
  this.expectPlugin("explicitResourceManagement");
34321
33994
  if (!this.scope.inModule && this.scope.inTopLevel) {
34322
- this.raise(Errors.UnexpectedUsingDeclaration, {
34323
- at: this.state.startLoc
34324
- });
33995
+ this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
34325
33996
  } else if (!allowDeclaration) {
34326
- this.raise(Errors.UnexpectedLexicalDeclaration, {
34327
- at: this.state.startLoc
34328
- });
33997
+ this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
34329
33998
  }
34330
33999
  return this.parseVarStatement(node, "using");
34331
34000
  case 100:
@@ -34345,9 +34014,7 @@ function requireLib () {
34345
34014
  case 75:
34346
34015
  {
34347
34016
  if (!allowDeclaration) {
34348
- this.raise(Errors.UnexpectedLexicalDeclaration, {
34349
- at: this.state.startLoc
34350
- });
34017
+ this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
34351
34018
  }
34352
34019
  }
34353
34020
  case 74:
@@ -34373,9 +34040,7 @@ function requireLib () {
34373
34040
  case 82:
34374
34041
  {
34375
34042
  if (!this.options.allowImportExportEverywhere && !topLevel) {
34376
- this.raise(Errors.UnexpectedImportExport, {
34377
- at: this.state.startLoc
34378
- });
34043
+ this.raise(Errors.UnexpectedImportExport, this.state.startLoc);
34379
34044
  }
34380
34045
  this.next();
34381
34046
  let result;
@@ -34397,9 +34062,7 @@ function requireLib () {
34397
34062
  {
34398
34063
  if (this.isAsyncFunction()) {
34399
34064
  if (!allowDeclaration) {
34400
- this.raise(Errors.AsyncFunctionInSingleStatementContext, {
34401
- at: this.state.startLoc
34402
- });
34065
+ this.raise(Errors.AsyncFunctionInSingleStatementContext, this.state.startLoc);
34403
34066
  }
34404
34067
  this.next();
34405
34068
  return this.parseFunctionStatement(node, true, !allowDeclaration && allowFunctionDeclaration);
@@ -34416,9 +34079,7 @@ function requireLib () {
34416
34079
  }
34417
34080
  assertModuleNodeAllowed(node) {
34418
34081
  if (!this.options.allowImportExportEverywhere && !this.inModule) {
34419
- this.raise(Errors.ImportOutsideModule, {
34420
- at: node
34421
- });
34082
+ this.raise(Errors.ImportOutsideModule, node);
34422
34083
  }
34423
34084
  }
34424
34085
  decoratorsEnabledBeforeExport() {
@@ -34429,9 +34090,7 @@ function requireLib () {
34429
34090
  if (maybeDecorators) {
34430
34091
  if (classNode.decorators && classNode.decorators.length > 0) {
34431
34092
  if (typeof this.getPluginOption("decorators", "decoratorsBeforeExport") !== "boolean") {
34432
- this.raise(Errors.DecoratorsBeforeAfterExport, {
34433
- at: classNode.decorators[0]
34434
- });
34093
+ this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
34435
34094
  }
34436
34095
  classNode.decorators.unshift(...maybeDecorators);
34437
34096
  } else {
@@ -34455,14 +34114,10 @@ function requireLib () {
34455
34114
  this.unexpected();
34456
34115
  }
34457
34116
  if (!this.decoratorsEnabledBeforeExport()) {
34458
- this.raise(Errors.DecoratorExportClass, {
34459
- at: this.state.startLoc
34460
- });
34117
+ this.raise(Errors.DecoratorExportClass, this.state.startLoc);
34461
34118
  }
34462
34119
  } else if (!this.canHaveLeadingDecorator()) {
34463
- throw this.raise(Errors.UnexpectedLeadingDecorator, {
34464
- at: this.state.startLoc
34465
- });
34120
+ throw this.raise(Errors.UnexpectedLeadingDecorator, this.state.startLoc);
34466
34121
  }
34467
34122
  return decorators;
34468
34123
  }
@@ -34482,9 +34137,7 @@ function requireLib () {
34482
34137
  const paramsStartLoc = this.state.startLoc;
34483
34138
  node.expression = this.parseMaybeDecoratorArguments(expr);
34484
34139
  if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
34485
- this.raise(Errors.DecoratorArgumentsOutsideParentheses, {
34486
- at: paramsStartLoc
34487
- });
34140
+ this.raise(Errors.DecoratorArgumentsOutsideParentheses, paramsStartLoc);
34488
34141
  }
34489
34142
  } else {
34490
34143
  expr = this.parseIdentifier(false);
@@ -34533,14 +34186,15 @@ function requireLib () {
34533
34186
  for (i = 0; i < this.state.labels.length; ++i) {
34534
34187
  const lab = this.state.labels[i];
34535
34188
  if (node.label == null || lab.name === node.label.name) {
34536
- if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
34189
+ if (lab.kind != null && (isBreak || lab.kind === 1)) {
34190
+ break;
34191
+ }
34537
34192
  if (node.label && isBreak) break;
34538
34193
  }
34539
34194
  }
34540
34195
  if (i === this.state.labels.length) {
34541
34196
  const type = isBreak ? "BreakStatement" : "ContinueStatement";
34542
- this.raise(Errors.IllegalBreakContinue, {
34543
- at: node,
34197
+ this.raise(Errors.IllegalBreakContinue, node, {
34544
34198
  type
34545
34199
  });
34546
34200
  }
@@ -34592,9 +34246,7 @@ function requireLib () {
34592
34246
  if (startsWithAwaitUsing) {
34593
34247
  kind = "await using";
34594
34248
  if (!this.isAwaitAllowed()) {
34595
- this.raise(Errors.AwaitUsingNotInAsyncContext, {
34596
- at: this.state.startLoc
34597
- });
34249
+ this.raise(Errors.AwaitUsingNotInAsyncContext, this.state.startLoc);
34598
34250
  }
34599
34251
  this.next();
34600
34252
  } else {
@@ -34605,9 +34257,7 @@ function requireLib () {
34605
34257
  const init = this.finishNode(initNode, "VariableDeclaration");
34606
34258
  const isForIn = this.match(58);
34607
34259
  if (isForIn && starsWithUsingDeclaration) {
34608
- this.raise(Errors.ForInUsing, {
34609
- at: init
34610
- });
34260
+ this.raise(Errors.ForInUsing, init);
34611
34261
  }
34612
34262
  if ((isForIn || this.isContextual(102)) && init.declarations.length === 1) {
34613
34263
  return this.parseForIn(node, init, awaitAt);
@@ -34624,14 +34274,10 @@ function requireLib () {
34624
34274
  const isForOf = this.isContextual(102);
34625
34275
  if (isForOf) {
34626
34276
  if (startsWithLet) {
34627
- this.raise(Errors.ForOfLet, {
34628
- at: init
34629
- });
34277
+ this.raise(Errors.ForOfLet, init);
34630
34278
  }
34631
34279
  if (awaitAt === null && startsWithAsync && init.type === "Identifier") {
34632
- this.raise(Errors.ForOfAsync, {
34633
- at: init
34634
- });
34280
+ this.raise(Errors.ForOfAsync, init);
34635
34281
  }
34636
34282
  }
34637
34283
  if (isForOf || this.match(58)) {
@@ -34665,9 +34311,7 @@ function requireLib () {
34665
34311
  }
34666
34312
  parseReturnStatement(node) {
34667
34313
  if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) {
34668
- this.raise(Errors.IllegalReturn, {
34669
- at: this.state.startLoc
34670
- });
34314
+ this.raise(Errors.IllegalReturn, this.state.startLoc);
34671
34315
  }
34672
34316
  this.next();
34673
34317
  if (this.isLineTerminator()) {
@@ -34697,9 +34341,7 @@ function requireLib () {
34697
34341
  cur.test = this.parseExpression();
34698
34342
  } else {
34699
34343
  if (sawDefault) {
34700
- this.raise(Errors.MultipleDefaultsInSwitch, {
34701
- at: this.state.lastTokStartLoc
34702
- });
34344
+ this.raise(Errors.MultipleDefaultsInSwitch, this.state.lastTokStartLoc);
34703
34345
  }
34704
34346
  sawDefault = true;
34705
34347
  cur.test = null;
@@ -34722,9 +34364,7 @@ function requireLib () {
34722
34364
  parseThrowStatement(node) {
34723
34365
  this.next();
34724
34366
  if (this.hasPrecedingLineBreak()) {
34725
- this.raise(Errors.NewlineAfterThrow, {
34726
- at: this.state.lastTokEndLoc
34727
- });
34367
+ this.raise(Errors.NewlineAfterThrow, this.state.lastTokEndLoc);
34728
34368
  }
34729
34369
  node.argument = this.parseExpression();
34730
34370
  this.semicolon();
@@ -34762,9 +34402,7 @@ function requireLib () {
34762
34402
  }
34763
34403
  node.finalizer = this.eat(67) ? this.parseBlock() : null;
34764
34404
  if (!node.handler && !node.finalizer) {
34765
- this.raise(Errors.NoCatchOrFinally, {
34766
- at: node
34767
- });
34405
+ this.raise(Errors.NoCatchOrFinally, node);
34768
34406
  }
34769
34407
  return this.finishNode(node, "TryStatement");
34770
34408
  }
@@ -34784,9 +34422,7 @@ function requireLib () {
34784
34422
  }
34785
34423
  parseWithStatement(node) {
34786
34424
  if (this.state.strict) {
34787
- this.raise(Errors.StrictWith, {
34788
- at: this.state.startLoc
34789
- });
34425
+ this.raise(Errors.StrictWith, this.state.startLoc);
34790
34426
  }
34791
34427
  this.next();
34792
34428
  node.object = this.parseHeaderExpression();
@@ -34800,13 +34436,12 @@ function requireLib () {
34800
34436
  parseLabeledStatement(node, maybeName, expr, flags) {
34801
34437
  for (const label of this.state.labels) {
34802
34438
  if (label.name === maybeName) {
34803
- this.raise(Errors.LabelRedeclaration, {
34804
- at: expr,
34439
+ this.raise(Errors.LabelRedeclaration, expr, {
34805
34440
  labelName: maybeName
34806
34441
  });
34807
34442
  }
34808
34443
  }
34809
- 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;
34810
34445
  for (let i = this.state.labels.length - 1; i >= 0; i--) {
34811
34446
  const label = this.state.labels[i];
34812
34447
  if (label.statementStart === node.start) {
@@ -34902,14 +34537,12 @@ function requireLib () {
34902
34537
  node.await = awaitAt !== null;
34903
34538
  }
34904
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")) {
34905
- this.raise(Errors.ForInOfLoopInitializer, {
34906
- at: init,
34540
+ this.raise(Errors.ForInOfLoopInitializer, init, {
34907
34541
  type: isForIn ? "ForInStatement" : "ForOfStatement"
34908
34542
  });
34909
34543
  }
34910
34544
  if (init.type === "AssignmentPattern") {
34911
- this.raise(Errors.InvalidLhs, {
34912
- at: init,
34545
+ this.raise(Errors.InvalidLhs, init, {
34913
34546
  ancestor: {
34914
34547
  type: "ForStatement"
34915
34548
  }
@@ -34932,13 +34565,11 @@ function requireLib () {
34932
34565
  decl.init = !this.eat(29) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
34933
34566
  if (decl.init === null && !allowMissingInitializer) {
34934
34567
  if (decl.id.type !== "Identifier" && !(isFor && (this.match(58) || this.isContextual(102)))) {
34935
- this.raise(Errors.DeclarationMissingInitializer, {
34936
- at: this.state.lastTokEndLoc,
34568
+ this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
34937
34569
  kind: "destructuring"
34938
34570
  });
34939
34571
  } else if (kind === "const" && !(this.match(58) || this.isContextual(102))) {
34940
- this.raise(Errors.DeclarationMissingInitializer, {
34941
- at: this.state.lastTokEndLoc,
34572
+ this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
34942
34573
  kind: "const"
34943
34574
  });
34944
34575
  }
@@ -34969,9 +34600,7 @@ function requireLib () {
34969
34600
  this.initFunction(node, isAsync);
34970
34601
  if (this.match(55)) {
34971
34602
  if (hangingDeclaration) {
34972
- this.raise(Errors.GeneratorInSingleStatementContext, {
34973
- at: this.state.startLoc
34974
- });
34603
+ this.raise(Errors.GeneratorInSingleStatementContext, this.state.startLoc);
34975
34604
  }
34976
34605
  this.next();
34977
34606
  node.generator = true;
@@ -35043,9 +34672,7 @@ function requireLib () {
35043
34672
  while (!this.match(8)) {
35044
34673
  if (this.eat(13)) {
35045
34674
  if (decorators.length > 0) {
35046
- throw this.raise(Errors.DecoratorSemicolon, {
35047
- at: this.state.lastTokEndLoc
35048
- });
34675
+ throw this.raise(Errors.DecoratorSemicolon, this.state.lastTokEndLoc);
35049
34676
  }
35050
34677
  continue;
35051
34678
  }
@@ -35061,18 +34688,14 @@ function requireLib () {
35061
34688
  }
35062
34689
  this.parseClassMember(classBody, member, state);
35063
34690
  if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
35064
- this.raise(Errors.DecoratorConstructor, {
35065
- at: member
35066
- });
34691
+ this.raise(Errors.DecoratorConstructor, member);
35067
34692
  }
35068
34693
  }
35069
34694
  });
35070
34695
  this.state.strict = oldStrict;
35071
34696
  this.next();
35072
34697
  if (decorators.length) {
35073
- throw this.raise(Errors.TrailingDecorator, {
35074
- at: this.state.startLoc
35075
- });
34698
+ throw this.raise(Errors.TrailingDecorator, this.state.startLoc);
35076
34699
  }
35077
34700
  this.classScope.exit();
35078
34701
  return this.finishNode(classBody, "ClassBody");
@@ -35130,9 +34753,7 @@ function requireLib () {
35130
34753
  return;
35131
34754
  }
35132
34755
  if (this.isNonstaticConstructor(publicMethod)) {
35133
- this.raise(Errors.ConstructorIsGenerator, {
35134
- at: publicMethod.key
35135
- });
34756
+ this.raise(Errors.ConstructorIsGenerator, publicMethod.key);
35136
34757
  }
35137
34758
  this.pushClassMethod(classBody, publicMethod, true, false, false, false);
35138
34759
  return;
@@ -35153,14 +34774,10 @@ function requireLib () {
35153
34774
  if (isConstructor) {
35154
34775
  publicMethod.kind = "constructor";
35155
34776
  if (state.hadConstructor && !this.hasPlugin("typescript")) {
35156
- this.raise(Errors.DuplicateConstructor, {
35157
- at: key
35158
- });
34777
+ this.raise(Errors.DuplicateConstructor, key);
35159
34778
  }
35160
34779
  if (isConstructor && this.hasPlugin("typescript") && member.override) {
35161
- this.raise(Errors.OverrideOnConstructor, {
35162
- at: key
35163
- });
34780
+ this.raise(Errors.OverrideOnConstructor, key);
35164
34781
  }
35165
34782
  state.hadConstructor = true;
35166
34783
  allowsDirectSuper = state.hadSuperClass;
@@ -35186,9 +34803,7 @@ function requireLib () {
35186
34803
  this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
35187
34804
  } else {
35188
34805
  if (this.isNonstaticConstructor(publicMethod)) {
35189
- this.raise(Errors.ConstructorIsAsync, {
35190
- at: publicMethod.key
35191
- });
34806
+ this.raise(Errors.ConstructorIsAsync, publicMethod.key);
35192
34807
  }
35193
34808
  this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
35194
34809
  }
@@ -35201,9 +34816,7 @@ function requireLib () {
35201
34816
  this.pushClassPrivateMethod(classBody, privateMethod, false, false);
35202
34817
  } else {
35203
34818
  if (this.isNonstaticConstructor(publicMethod)) {
35204
- this.raise(Errors.ConstructorIsAccessor, {
35205
- at: publicMethod.key
35206
- });
34819
+ this.raise(Errors.ConstructorIsAccessor, publicMethod.key);
35207
34820
  }
35208
34821
  this.pushClassMethod(classBody, publicMethod, false, false, false, false);
35209
34822
  }
@@ -35230,15 +34843,11 @@ function requireLib () {
35230
34843
  value
35231
34844
  } = this.state;
35232
34845
  if ((type === 132 || type === 133) && member.static && value === "prototype") {
35233
- this.raise(Errors.StaticPrototype, {
35234
- at: this.state.startLoc
35235
- });
34846
+ this.raise(Errors.StaticPrototype, this.state.startLoc);
35236
34847
  }
35237
34848
  if (type === 138) {
35238
34849
  if (value === "constructor") {
35239
- this.raise(Errors.ConstructorClassPrivateField, {
35240
- at: this.state.startLoc
35241
- });
34850
+ this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
35242
34851
  }
35243
34852
  const key = this.parsePrivateName();
35244
34853
  member.key = key;
@@ -35259,16 +34868,12 @@ function requireLib () {
35259
34868
  this.state.labels = oldLabels;
35260
34869
  classBody.body.push(this.finishNode(member, "StaticBlock"));
35261
34870
  if ((_member$decorators = member.decorators) != null && _member$decorators.length) {
35262
- this.raise(Errors.DecoratorStaticBlock, {
35263
- at: member
35264
- });
34871
+ this.raise(Errors.DecoratorStaticBlock, member);
35265
34872
  }
35266
34873
  }
35267
34874
  pushClassProperty(classBody, prop) {
35268
34875
  if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) {
35269
- this.raise(Errors.ConstructorClassField, {
35270
- at: prop.key
35271
- });
34876
+ this.raise(Errors.ConstructorClassField, prop.key);
35272
34877
  }
35273
34878
  classBody.body.push(this.parseClassProperty(prop));
35274
34879
  }
@@ -35281,9 +34886,7 @@ function requireLib () {
35281
34886
  if (!isPrivate && !prop.computed) {
35282
34887
  const key = prop.key;
35283
34888
  if (key.name === "constructor" || key.value === "constructor") {
35284
- this.raise(Errors.ConstructorClassField, {
35285
- at: key
35286
- });
34889
+ this.raise(Errors.ConstructorClassField, key);
35287
34890
  }
35288
34891
  }
35289
34892
  const node = this.parseClassAccessorProperty(prop);
@@ -35339,9 +34942,7 @@ function requireLib () {
35339
34942
  if (optionalId || !isStatement) {
35340
34943
  node.id = null;
35341
34944
  } else {
35342
- throw this.raise(Errors.MissingClassName, {
35343
- at: this.state.startLoc
35344
- });
34945
+ throw this.raise(Errors.MissingClassName, this.state.startLoc);
35345
34946
  }
35346
34947
  }
35347
34948
  }
@@ -35359,9 +34960,7 @@ function requireLib () {
35359
34960
  if (hasStar && !hasNamespace) {
35360
34961
  if (hasDefault) this.unexpected();
35361
34962
  if (decorators) {
35362
- throw this.raise(Errors.UnsupportedDecoratorExport, {
35363
- at: node
35364
- });
34963
+ throw this.raise(Errors.UnsupportedDecoratorExport, node);
35365
34964
  }
35366
34965
  this.parseExportFrom(node, true);
35367
34966
  return this.finishNode(node, "ExportAllDeclaration");
@@ -35377,9 +34976,7 @@ function requireLib () {
35377
34976
  if (isFromRequired || hasSpecifiers) {
35378
34977
  hasDeclaration = false;
35379
34978
  if (decorators) {
35380
- throw this.raise(Errors.UnsupportedDecoratorExport, {
35381
- at: node
35382
- });
34979
+ throw this.raise(Errors.UnsupportedDecoratorExport, node);
35383
34980
  }
35384
34981
  this.parseExportFrom(node, isFromRequired);
35385
34982
  } else {
@@ -35392,9 +34989,7 @@ function requireLib () {
35392
34989
  if (((_node2$declaration = node2.declaration) == null ? void 0 : _node2$declaration.type) === "ClassDeclaration") {
35393
34990
  this.maybeTakeDecorators(decorators, node2.declaration, node2);
35394
34991
  } else if (decorators) {
35395
- throw this.raise(Errors.UnsupportedDecoratorExport, {
35396
- at: node
35397
- });
34992
+ throw this.raise(Errors.UnsupportedDecoratorExport, node);
35398
34993
  }
35399
34994
  return this.finishNode(node2, "ExportNamedDeclaration");
35400
34995
  }
@@ -35405,9 +35000,7 @@ function requireLib () {
35405
35000
  if (decl.type === "ClassDeclaration") {
35406
35001
  this.maybeTakeDecorators(decorators, decl, node2);
35407
35002
  } else if (decorators) {
35408
- throw this.raise(Errors.UnsupportedDecoratorExport, {
35409
- at: node
35410
- });
35003
+ throw this.raise(Errors.UnsupportedDecoratorExport, node);
35411
35004
  }
35412
35005
  this.checkExport(node2, true, true);
35413
35006
  return this.finishNode(node2, "ExportDefaultDeclaration");
@@ -35485,16 +35078,12 @@ function requireLib () {
35485
35078
  }
35486
35079
  if (this.match(26)) {
35487
35080
  if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
35488
- this.raise(Errors.DecoratorBeforeExport, {
35489
- at: this.state.startLoc
35490
- });
35081
+ this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
35491
35082
  }
35492
35083
  return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
35493
35084
  }
35494
35085
  if (this.match(75) || this.match(74) || this.isLet()) {
35495
- throw this.raise(Errors.UnsupportedDefaultExport, {
35496
- at: this.state.startLoc
35497
- });
35086
+ throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
35498
35087
  }
35499
35088
  const res = this.parseMaybeAssignAllowIn();
35500
35089
  this.semicolon();
@@ -35557,9 +35146,7 @@ function requireLib () {
35557
35146
  this.expectOnePlugin(["decorators", "decorators-legacy"]);
35558
35147
  if (this.hasPlugin("decorators")) {
35559
35148
  if (this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
35560
- this.raise(Errors.DecoratorBeforeExport, {
35561
- at: this.state.startLoc
35562
- });
35149
+ this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
35563
35150
  }
35564
35151
  return true;
35565
35152
  }
@@ -35575,9 +35162,7 @@ function requireLib () {
35575
35162
  var _declaration$extra;
35576
35163
  const declaration = node.declaration;
35577
35164
  if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) {
35578
- this.raise(Errors.ExportDefaultFromAsIdentifier, {
35579
- at: declaration
35580
- });
35165
+ this.raise(Errors.ExportDefaultFromAsIdentifier, declaration);
35581
35166
  }
35582
35167
  }
35583
35168
  } else if ((_node$specifiers = node.specifiers) != null && _node$specifiers.length) {
@@ -35592,8 +35177,7 @@ function requireLib () {
35592
35177
  local
35593
35178
  } = specifier;
35594
35179
  if (local.type !== "Identifier") {
35595
- this.raise(Errors.ExportBindingIsString, {
35596
- at: specifier,
35180
+ this.raise(Errors.ExportBindingIsString, specifier, {
35597
35181
  localName: local.value,
35598
35182
  exportName
35599
35183
  });
@@ -35640,12 +35224,9 @@ function requireLib () {
35640
35224
  checkDuplicateExports(node, exportName) {
35641
35225
  if (this.exportedIdentifiers.has(exportName)) {
35642
35226
  if (exportName === "default") {
35643
- this.raise(Errors.DuplicateDefaultExport, {
35644
- at: node
35645
- });
35227
+ this.raise(Errors.DuplicateDefaultExport, node);
35646
35228
  } else {
35647
- this.raise(Errors.DuplicateExport, {
35648
- at: node,
35229
+ this.raise(Errors.DuplicateExport, node, {
35649
35230
  exportName
35650
35231
  });
35651
35232
  }
@@ -35686,8 +35267,7 @@ function requireLib () {
35686
35267
  const result = this.parseStringLiteral(this.state.value);
35687
35268
  const surrogate = result.value.match(loneSurrogate);
35688
35269
  if (surrogate) {
35689
- this.raise(Errors.ModuleExportNameHasLoneSurrogate, {
35690
- at: result,
35270
+ this.raise(Errors.ModuleExportNameHasLoneSurrogate, result, {
35691
35271
  surrogateCharCode: surrogate[0].charCodeAt(0)
35692
35272
  });
35693
35273
  }
@@ -35713,27 +35293,19 @@ function requireLib () {
35713
35293
  const singleBindingType = specifiers.length === 1 ? specifiers[0].type : null;
35714
35294
  if (node.phase === "source") {
35715
35295
  if (singleBindingType !== "ImportDefaultSpecifier") {
35716
- this.raise(Errors.SourcePhaseImportRequiresDefault, {
35717
- at: specifiers[0].loc.start
35718
- });
35296
+ this.raise(Errors.SourcePhaseImportRequiresDefault, specifiers[0].loc.start);
35719
35297
  }
35720
35298
  } else if (node.phase === "defer") {
35721
35299
  if (singleBindingType !== "ImportNamespaceSpecifier") {
35722
- this.raise(Errors.DeferImportRequiresNamespace, {
35723
- at: specifiers[0].loc.start
35724
- });
35300
+ this.raise(Errors.DeferImportRequiresNamespace, specifiers[0].loc.start);
35725
35301
  }
35726
35302
  } else if (node.module) {
35727
35303
  var _node$assertions;
35728
35304
  if (singleBindingType !== "ImportDefaultSpecifier") {
35729
- this.raise(Errors.ImportReflectionNotBinding, {
35730
- at: specifiers[0].loc.start
35731
- });
35305
+ this.raise(Errors.ImportReflectionNotBinding, specifiers[0].loc.start);
35732
35306
  }
35733
35307
  if (((_node$assertions = node.assertions) == null ? void 0 : _node$assertions.length) > 0) {
35734
- this.raise(Errors.ImportReflectionHasAssertion, {
35735
- at: node.specifiers[0].loc.start
35736
- });
35308
+ this.raise(Errors.ImportReflectionHasAssertion, specifiers[0].loc.start);
35737
35309
  }
35738
35310
  }
35739
35311
  }
@@ -35755,9 +35327,7 @@ function requireLib () {
35755
35327
  }
35756
35328
  });
35757
35329
  if (nonDefaultNamedSpecifier !== undefined) {
35758
- this.raise(Errors.ImportJSONBindingNotDefault, {
35759
- at: nonDefaultNamedSpecifier.loc.start
35760
- });
35330
+ this.raise(Errors.ImportJSONBindingNotDefault, nonDefaultNamedSpecifier.loc.start);
35761
35331
  }
35762
35332
  }
35763
35333
  }
@@ -35864,8 +35434,7 @@ function requireLib () {
35864
35434
  const node = this.startNode();
35865
35435
  const keyName = this.state.value;
35866
35436
  if (attrNames.has(keyName)) {
35867
- this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
35868
- at: this.state.startLoc,
35437
+ this.raise(Errors.ModuleAttributesWithDuplicateKeys, this.state.startLoc, {
35869
35438
  key: keyName
35870
35439
  });
35871
35440
  }
@@ -35877,9 +35446,7 @@ function requireLib () {
35877
35446
  }
35878
35447
  this.expect(14);
35879
35448
  if (!this.match(133)) {
35880
- throw this.raise(Errors.ModuleAttributeInvalidValue, {
35881
- at: this.state.startLoc
35882
- });
35449
+ throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
35883
35450
  }
35884
35451
  node.value = this.parseStringLiteral(this.state.value);
35885
35452
  attrs.push(this.finishNode(node, "ImportAttribute"));
@@ -35894,22 +35461,17 @@ function requireLib () {
35894
35461
  const node = this.startNode();
35895
35462
  node.key = this.parseIdentifier(true);
35896
35463
  if (node.key.name !== "type") {
35897
- this.raise(Errors.ModuleAttributeDifferentFromType, {
35898
- at: node.key
35899
- });
35464
+ this.raise(Errors.ModuleAttributeDifferentFromType, node.key);
35900
35465
  }
35901
35466
  if (attributes.has(node.key.name)) {
35902
- this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
35903
- at: node.key,
35467
+ this.raise(Errors.ModuleAttributesWithDuplicateKeys, node.key, {
35904
35468
  key: node.key.name
35905
35469
  });
35906
35470
  }
35907
35471
  attributes.add(node.key.name);
35908
35472
  this.expect(14);
35909
35473
  if (!this.match(133)) {
35910
- throw this.raise(Errors.ModuleAttributeInvalidValue, {
35911
- at: this.state.startLoc
35912
- });
35474
+ throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
35913
35475
  }
35914
35476
  node.value = this.parseStringLiteral(this.state.value);
35915
35477
  attrs.push(this.finishNode(node, "ImportAttribute"));
@@ -35936,9 +35498,7 @@ function requireLib () {
35936
35498
  } else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
35937
35499
  if (this.hasPlugin("importAttributes")) {
35938
35500
  if (this.getPluginOption("importAttributes", "deprecatedAssertSyntax") !== true) {
35939
- this.raise(Errors.ImportAttributesUseAssert, {
35940
- at: this.state.startLoc
35941
- });
35501
+ this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
35942
35502
  }
35943
35503
  this.addExtra(node, "deprecatedAssertSyntax", true);
35944
35504
  } else {
@@ -35989,9 +35549,7 @@ function requireLib () {
35989
35549
  first = false;
35990
35550
  } else {
35991
35551
  if (this.eat(14)) {
35992
- throw this.raise(Errors.DestructureNamedImport, {
35993
- at: this.state.startLoc
35994
- });
35552
+ throw this.raise(Errors.DestructureNamedImport, this.state.startLoc);
35995
35553
  }
35996
35554
  this.expect(12);
35997
35555
  if (this.eat(8)) break;
@@ -36012,8 +35570,7 @@ function requireLib () {
36012
35570
  imported
36013
35571
  } = specifier;
36014
35572
  if (importedIsString) {
36015
- throw this.raise(Errors.ImportBindingIsString, {
36016
- at: specifier,
35573
+ throw this.raise(Errors.ImportBindingIsString, specifier, {
36017
35574
  importName: imported.value
36018
35575
  });
36019
35576
  }
@@ -36048,6 +35605,7 @@ function requireLib () {
36048
35605
  file.errors = null;
36049
35606
  this.parseTopLevel(file, program);
36050
35607
  file.errors = this.state.errors;
35608
+ file.comments.length = this.state.commentsLen;
36051
35609
  return file;
36052
35610
  }
36053
35611
  }