typescript 5.3.1-rc → 5.4.0-dev.20231104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsserver.js CHANGED
@@ -1721,6 +1721,8 @@ __export(server_exports, {
1721
1721
  isSignedNumericLiteral: () => isSignedNumericLiteral,
1722
1722
  isSimpleCopiableExpression: () => isSimpleCopiableExpression,
1723
1723
  isSimpleInlineableExpression: () => isSimpleInlineableExpression,
1724
+ isSimpleParameter: () => isSimpleParameter,
1725
+ isSimpleParameterList: () => isSimpleParameterList,
1724
1726
  isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
1725
1727
  isSourceFile: () => isSourceFile,
1726
1728
  isSourceFileFromLibrary: () => isSourceFileFromLibrary,
@@ -2327,8 +2329,8 @@ __export(server_exports, {
2327
2329
  module.exports = __toCommonJS(server_exports);
2328
2330
 
2329
2331
  // src/compiler/corePublic.ts
2330
- var versionMajorMinor = "5.3";
2331
- var version = "5.3.1-rc";
2332
+ var versionMajorMinor = "5.4";
2333
+ var version = `${versionMajorMinor}.0-dev.20231104`;
2332
2334
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2333
2335
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2334
2336
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -27668,7 +27670,7 @@ function createEmitHelperFactory(context) {
27668
27670
  ]
27669
27671
  );
27670
27672
  }
27671
- function createAwaiterHelper(hasLexicalThis, hasLexicalArguments, promiseConstructor, body) {
27673
+ function createAwaiterHelper(hasLexicalThis, argumentsExpression, promiseConstructor, parameters, body) {
27672
27674
  context.requestEmitHelper(awaiterHelper);
27673
27675
  const generatorFunc = factory2.createFunctionExpression(
27674
27676
  /*modifiers*/
@@ -27678,8 +27680,7 @@ function createEmitHelperFactory(context) {
27678
27680
  void 0,
27679
27681
  /*typeParameters*/
27680
27682
  void 0,
27681
- /*parameters*/
27682
- [],
27683
+ parameters ?? [],
27683
27684
  /*type*/
27684
27685
  void 0,
27685
27686
  body
@@ -27691,7 +27692,7 @@ function createEmitHelperFactory(context) {
27691
27692
  void 0,
27692
27693
  [
27693
27694
  hasLexicalThis ? factory2.createThis() : factory2.createVoidZero(),
27694
- hasLexicalArguments ? factory2.createIdentifier("arguments") : factory2.createVoidZero(),
27695
+ argumentsExpression ?? factory2.createVoidZero(),
27695
27696
  promiseConstructor ? createExpressionFromEntityName(factory2, promiseConstructor) : factory2.createVoidZero(),
27696
27697
  generatorFunc
27697
27698
  ]
@@ -38246,6 +38247,7 @@ var libEntries = [
38246
38247
  ["es2015.symbol", "lib.es2015.symbol.d.ts"],
38247
38248
  ["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
38248
38249
  ["es2016.array.include", "lib.es2016.array.include.d.ts"],
38250
+ ["es2016.intl", "lib.es2016.intl.d.ts"],
38249
38251
  ["es2017.date", "lib.es2017.date.d.ts"],
38250
38252
  ["es2017.object", "lib.es2017.object.d.ts"],
38251
38253
  ["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
@@ -38577,6 +38579,7 @@ var targetOptionDeclaration = {
38577
38579
  affectsModuleResolution: true,
38578
38580
  affectsEmit: true,
38579
38581
  affectsBuildInfo: true,
38582
+ deprecatedKeys: /* @__PURE__ */ new Set(["es3"]),
38580
38583
  paramType: Diagnostics.VERSION,
38581
38584
  showInSimplifiedHelpView: true,
38582
38585
  category: Diagnostics.Language_and_Environment,
@@ -44693,6 +44696,9 @@ function createBinder() {
44693
44696
  case 213 /* CallExpression */:
44694
44697
  return hasNarrowableArgument(expr);
44695
44698
  case 217 /* ParenthesizedExpression */:
44699
+ if (isJSDocTypeAssertion(expr)) {
44700
+ return false;
44701
+ }
44696
44702
  case 235 /* NonNullExpression */:
44697
44703
  return isNarrowingExpression(expr.expression);
44698
44704
  case 226 /* BinaryExpression */:
@@ -71570,15 +71576,23 @@ function createTypeChecker(host) {
71570
71576
  error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
71571
71577
  return errorType;
71572
71578
  }
71573
- const container = getContainingFunction(node);
71574
- if (languageVersion < 2 /* ES2015 */) {
71575
- if (container.kind === 219 /* ArrowFunction */) {
71576
- error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
71577
- } else if (hasSyntacticModifier(container, 1024 /* Async */)) {
71578
- error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);
71579
+ let container = getContainingFunction(node);
71580
+ if (container) {
71581
+ if (languageVersion < 2 /* ES2015 */) {
71582
+ if (container.kind === 219 /* ArrowFunction */) {
71583
+ error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
71584
+ } else if (hasSyntacticModifier(container, 1024 /* Async */)) {
71585
+ error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);
71586
+ }
71587
+ }
71588
+ getNodeLinks(container).flags |= 512 /* CaptureArguments */;
71589
+ while (container && isArrowFunction(container)) {
71590
+ container = getContainingFunction(container);
71591
+ if (container) {
71592
+ getNodeLinks(container).flags |= 512 /* CaptureArguments */;
71593
+ }
71579
71594
  }
71580
71595
  }
71581
- getNodeLinks(container).flags |= 512 /* CaptureArguments */;
71582
71596
  return getTypeOfSymbol(symbol);
71583
71597
  }
71584
71598
  if (shouldMarkIdentifierAliasReferenced(node)) {
@@ -91606,6 +91620,12 @@ function setPrivateIdentifier(privateEnv, name, entry) {
91606
91620
  function accessPrivateIdentifier(env, name) {
91607
91621
  return walkUpLexicalEnvironments(env, (env2) => getPrivateIdentifier(env2.privateEnv, name));
91608
91622
  }
91623
+ function isSimpleParameter(node) {
91624
+ return !node.initializer && isIdentifier(node.name);
91625
+ }
91626
+ function isSimpleParameterList(nodes) {
91627
+ return every(nodes, isSimpleParameter);
91628
+ }
91609
91629
 
91610
91630
  // src/compiler/transformers/destructuring.ts
91611
91631
  var FlattenLevel = /* @__PURE__ */ ((FlattenLevel2) => {
@@ -99092,6 +99112,7 @@ function transformES2017(context) {
99092
99112
  let enclosingFunctionParameterNames;
99093
99113
  let capturedSuperProperties;
99094
99114
  let hasSuperElementAccess;
99115
+ let lexicalArgumentsBinding;
99095
99116
  const substitutedSuperAccessors = [];
99096
99117
  let contextFlags = 0 /* None */;
99097
99118
  const previousOnEmitNode = context.onEmitNode;
@@ -99142,9 +99163,30 @@ function transformES2017(context) {
99142
99163
  function visitDefault(node) {
99143
99164
  return visitEachChild(node, visitor, context);
99144
99165
  }
99166
+ function argumentsVisitor(node) {
99167
+ switch (node.kind) {
99168
+ case 218 /* FunctionExpression */:
99169
+ case 262 /* FunctionDeclaration */:
99170
+ case 174 /* MethodDeclaration */:
99171
+ case 177 /* GetAccessor */:
99172
+ case 178 /* SetAccessor */:
99173
+ case 176 /* Constructor */:
99174
+ return node;
99175
+ case 169 /* Parameter */:
99176
+ case 208 /* BindingElement */:
99177
+ case 260 /* VariableDeclaration */:
99178
+ break;
99179
+ case 80 /* Identifier */:
99180
+ if (lexicalArgumentsBinding && resolver.isArgumentsLocalBinding(node)) {
99181
+ return lexicalArgumentsBinding;
99182
+ }
99183
+ break;
99184
+ }
99185
+ return visitEachChild(node, argumentsVisitor, context);
99186
+ }
99145
99187
  function visitor(node) {
99146
99188
  if ((node.transformFlags & 256 /* ContainsES2017 */) === 0) {
99147
- return node;
99189
+ return lexicalArgumentsBinding ? argumentsVisitor(node) : node;
99148
99190
  }
99149
99191
  switch (node.kind) {
99150
99192
  case 134 /* AsyncKeyword */:
@@ -99302,15 +99344,23 @@ function transformES2017(context) {
99302
99344
  );
99303
99345
  }
99304
99346
  function visitConstructorDeclaration(node) {
99305
- return factory2.updateConstructorDeclaration(
99347
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
99348
+ lexicalArgumentsBinding = void 0;
99349
+ const updated = factory2.updateConstructorDeclaration(
99306
99350
  node,
99307
99351
  visitNodes2(node.modifiers, visitor, isModifier),
99308
99352
  visitParameterList(node.parameters, visitor, context),
99309
99353
  transformMethodBody(node)
99310
99354
  );
99355
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
99356
+ return updated;
99311
99357
  }
99312
99358
  function visitMethodDeclaration(node) {
99313
- return factory2.updateMethodDeclaration(
99359
+ let parameters;
99360
+ const functionFlags = getFunctionFlags(node);
99361
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
99362
+ lexicalArgumentsBinding = void 0;
99363
+ const updated = factory2.updateMethodDeclaration(
99314
99364
  node,
99315
99365
  visitNodes2(node.modifiers, visitor, isModifierLike),
99316
99366
  node.asteriskToken,
@@ -99319,14 +99369,18 @@ function transformES2017(context) {
99319
99369
  void 0,
99320
99370
  /*typeParameters*/
99321
99371
  void 0,
99322
- visitParameterList(node.parameters, visitor, context),
99372
+ parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
99323
99373
  /*type*/
99324
99374
  void 0,
99325
- getFunctionFlags(node) & 2 /* Async */ ? transformAsyncFunctionBody(node) : transformMethodBody(node)
99375
+ functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : transformMethodBody(node)
99326
99376
  );
99377
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
99378
+ return updated;
99327
99379
  }
99328
99380
  function visitGetAccessorDeclaration(node) {
99329
- return factory2.updateGetAccessorDeclaration(
99381
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
99382
+ lexicalArgumentsBinding = void 0;
99383
+ const updated = factory2.updateGetAccessorDeclaration(
99330
99384
  node,
99331
99385
  visitNodes2(node.modifiers, visitor, isModifierLike),
99332
99386
  node.name,
@@ -99335,55 +99389,75 @@ function transformES2017(context) {
99335
99389
  void 0,
99336
99390
  transformMethodBody(node)
99337
99391
  );
99392
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
99393
+ return updated;
99338
99394
  }
99339
99395
  function visitSetAccessorDeclaration(node) {
99340
- return factory2.updateSetAccessorDeclaration(
99396
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
99397
+ lexicalArgumentsBinding = void 0;
99398
+ const updated = factory2.updateSetAccessorDeclaration(
99341
99399
  node,
99342
99400
  visitNodes2(node.modifiers, visitor, isModifierLike),
99343
99401
  node.name,
99344
99402
  visitParameterList(node.parameters, visitor, context),
99345
99403
  transformMethodBody(node)
99346
99404
  );
99405
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
99406
+ return updated;
99347
99407
  }
99348
99408
  function visitFunctionDeclaration(node) {
99349
- return factory2.updateFunctionDeclaration(
99409
+ let parameters;
99410
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
99411
+ lexicalArgumentsBinding = void 0;
99412
+ const functionFlags = getFunctionFlags(node);
99413
+ const updated = factory2.updateFunctionDeclaration(
99350
99414
  node,
99351
99415
  visitNodes2(node.modifiers, visitor, isModifierLike),
99352
99416
  node.asteriskToken,
99353
99417
  node.name,
99354
99418
  /*typeParameters*/
99355
99419
  void 0,
99356
- visitParameterList(node.parameters, visitor, context),
99420
+ parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
99357
99421
  /*type*/
99358
99422
  void 0,
99359
- getFunctionFlags(node) & 2 /* Async */ ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context)
99423
+ functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
99360
99424
  );
99425
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
99426
+ return updated;
99361
99427
  }
99362
99428
  function visitFunctionExpression(node) {
99363
- return factory2.updateFunctionExpression(
99429
+ let parameters;
99430
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
99431
+ lexicalArgumentsBinding = void 0;
99432
+ const functionFlags = getFunctionFlags(node);
99433
+ const updated = factory2.updateFunctionExpression(
99364
99434
  node,
99365
99435
  visitNodes2(node.modifiers, visitor, isModifier),
99366
99436
  node.asteriskToken,
99367
99437
  node.name,
99368
99438
  /*typeParameters*/
99369
99439
  void 0,
99370
- visitParameterList(node.parameters, visitor, context),
99440
+ parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
99371
99441
  /*type*/
99372
99442
  void 0,
99373
- getFunctionFlags(node) & 2 /* Async */ ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context)
99443
+ functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
99374
99444
  );
99445
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
99446
+ return updated;
99375
99447
  }
99376
99448
  function visitArrowFunction(node) {
99449
+ let parameters;
99450
+ const functionFlags = getFunctionFlags(node);
99377
99451
  return factory2.updateArrowFunction(
99378
99452
  node,
99379
99453
  visitNodes2(node.modifiers, visitor, isModifier),
99380
99454
  /*typeParameters*/
99381
99455
  void 0,
99382
- visitParameterList(node.parameters, visitor, context),
99456
+ parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
99383
99457
  /*type*/
99384
99458
  void 0,
99385
99459
  node.equalsGreaterThanToken,
99386
- getFunctionFlags(node) & 2 /* Async */ ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context)
99460
+ functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
99387
99461
  );
99388
99462
  }
99389
99463
  function recordDeclarationName({ name }, names) {
@@ -99477,13 +99551,91 @@ function transformES2017(context) {
99477
99551
  hasSuperElementAccess = savedHasSuperElementAccess;
99478
99552
  return updated;
99479
99553
  }
99480
- function transformAsyncFunctionBody(node) {
99554
+ function createCaptureArgumentsStatement() {
99555
+ Debug.assert(lexicalArgumentsBinding);
99556
+ const variable = factory2.createVariableDeclaration(
99557
+ lexicalArgumentsBinding,
99558
+ /*exclamationToken*/
99559
+ void 0,
99560
+ /*type*/
99561
+ void 0,
99562
+ factory2.createIdentifier("arguments")
99563
+ );
99564
+ const statement = factory2.createVariableStatement(
99565
+ /*modifiers*/
99566
+ void 0,
99567
+ [variable]
99568
+ );
99569
+ startOnNewLine(statement);
99570
+ addEmitFlags(statement, 2097152 /* CustomPrologue */);
99571
+ return statement;
99572
+ }
99573
+ function transformAsyncFunctionParameterList(node) {
99574
+ if (isSimpleParameterList(node.parameters)) {
99575
+ return visitParameterList(node.parameters, visitor, context);
99576
+ }
99577
+ const newParameters = [];
99578
+ for (const parameter of node.parameters) {
99579
+ if (parameter.initializer || parameter.dotDotDotToken) {
99580
+ if (node.kind === 219 /* ArrowFunction */) {
99581
+ const restParameter = factory2.createParameterDeclaration(
99582
+ /*modifiers*/
99583
+ void 0,
99584
+ factory2.createToken(26 /* DotDotDotToken */),
99585
+ factory2.createUniqueName("args", 8 /* ReservedInNestedScopes */)
99586
+ );
99587
+ newParameters.push(restParameter);
99588
+ }
99589
+ break;
99590
+ }
99591
+ const newParameter = factory2.createParameterDeclaration(
99592
+ /*modifiers*/
99593
+ void 0,
99594
+ /*dotDotDotToken*/
99595
+ void 0,
99596
+ factory2.getGeneratedNameForNode(parameter.name, 8 /* ReservedInNestedScopes */)
99597
+ );
99598
+ newParameters.push(newParameter);
99599
+ }
99600
+ const newParametersArray = factory2.createNodeArray(newParameters);
99601
+ setTextRange(newParametersArray, node.parameters);
99602
+ return newParametersArray;
99603
+ }
99604
+ function transformAsyncFunctionBody(node, outerParameters) {
99605
+ const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0;
99481
99606
  resumeLexicalEnvironment();
99482
99607
  const original = getOriginalNode(node, isFunctionLike);
99483
99608
  const nodeType = original.type;
99484
99609
  const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
99485
99610
  const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
99611
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
99486
99612
  const hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 512 /* CaptureArguments */) !== 0;
99613
+ const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
99614
+ if (captureLexicalArguments) {
99615
+ lexicalArgumentsBinding = factory2.createUniqueName("arguments");
99616
+ }
99617
+ let argumentsExpression;
99618
+ if (innerParameters) {
99619
+ if (isArrowFunction2) {
99620
+ const parameterBindings = [];
99621
+ Debug.assert(outerParameters.length <= node.parameters.length);
99622
+ for (let i = 0; i < node.parameters.length; i++) {
99623
+ Debug.assert(i < outerParameters.length);
99624
+ const originalParameter = node.parameters[i];
99625
+ const outerParameter = outerParameters[i];
99626
+ Debug.assertNode(outerParameter.name, isIdentifier);
99627
+ if (originalParameter.initializer || originalParameter.dotDotDotToken) {
99628
+ Debug.assert(i === outerParameters.length - 1);
99629
+ parameterBindings.push(factory2.createSpreadElement(outerParameter.name));
99630
+ break;
99631
+ }
99632
+ parameterBindings.push(outerParameter.name);
99633
+ }
99634
+ argumentsExpression = factory2.createArrayLiteralExpression(parameterBindings);
99635
+ } else {
99636
+ argumentsExpression = factory2.createIdentifier("arguments");
99637
+ }
99638
+ }
99487
99639
  const savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames;
99488
99640
  enclosingFunctionParameterNames = /* @__PURE__ */ new Set();
99489
99641
  for (const parameter of node.parameters) {
@@ -99495,27 +99647,23 @@ function transformES2017(context) {
99495
99647
  capturedSuperProperties = /* @__PURE__ */ new Set();
99496
99648
  hasSuperElementAccess = false;
99497
99649
  }
99650
+ const hasLexicalThis = inHasLexicalThisContext();
99651
+ let asyncBody = transformAsyncFunctionBodyWorker(node.body);
99652
+ asyncBody = factory2.updateBlock(asyncBody, factory2.mergeLexicalEnvironment(asyncBody.statements, endLexicalEnvironment()));
99498
99653
  let result;
99499
99654
  if (!isArrowFunction2) {
99500
99655
  const statements = [];
99501
- const statementOffset = factory2.copyPrologue(
99502
- node.body.statements,
99503
- statements,
99504
- /*ensureUseStrict*/
99505
- false,
99506
- visitor
99507
- );
99508
99656
  statements.push(
99509
99657
  factory2.createReturnStatement(
99510
99658
  emitHelpers().createAwaiterHelper(
99511
- inHasLexicalThisContext(),
99512
- hasLexicalArguments,
99659
+ hasLexicalThis,
99660
+ argumentsExpression,
99513
99661
  promiseConstructor,
99514
- transformAsyncFunctionBodyWorker(node.body, statementOffset)
99662
+ innerParameters,
99663
+ asyncBody
99515
99664
  )
99516
99665
  )
99517
99666
  );
99518
- insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
99519
99667
  const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */);
99520
99668
  if (emitSuperHelpers) {
99521
99669
  enableSubstitutionForAsyncMethodsWithSuper();
@@ -99525,6 +99673,9 @@ function transformES2017(context) {
99525
99673
  insertStatementsAfterStandardPrologue(statements, [variableStatement]);
99526
99674
  }
99527
99675
  }
99676
+ if (captureLexicalArguments) {
99677
+ insertStatementsAfterStandardPrologue(statements, [createCaptureArgumentsStatement()]);
99678
+ }
99528
99679
  const block = factory2.createBlock(
99529
99680
  statements,
99530
99681
  /*multiLine*/
@@ -99540,24 +99691,23 @@ function transformES2017(context) {
99540
99691
  }
99541
99692
  result = block;
99542
99693
  } else {
99543
- const expression = emitHelpers().createAwaiterHelper(
99544
- inHasLexicalThisContext(),
99545
- hasLexicalArguments,
99694
+ result = emitHelpers().createAwaiterHelper(
99695
+ hasLexicalThis,
99696
+ argumentsExpression,
99546
99697
  promiseConstructor,
99547
- transformAsyncFunctionBodyWorker(node.body)
99698
+ innerParameters,
99699
+ asyncBody
99548
99700
  );
99549
- const declarations = endLexicalEnvironment();
99550
- if (some(declarations)) {
99551
- const block = factory2.converters.convertToFunctionBlock(expression);
99552
- result = factory2.updateBlock(block, setTextRange(factory2.createNodeArray(concatenate(declarations, block.statements)), block.statements));
99553
- } else {
99554
- result = expression;
99701
+ if (captureLexicalArguments) {
99702
+ const block = factory2.converters.convertToFunctionBlock(result);
99703
+ result = factory2.updateBlock(block, factory2.mergeLexicalEnvironment(block.statements, [createCaptureArgumentsStatement()]));
99555
99704
  }
99556
99705
  }
99557
99706
  enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames;
99558
99707
  if (!isArrowFunction2) {
99559
99708
  capturedSuperProperties = savedCapturedSuperProperties;
99560
99709
  hasSuperElementAccess = savedHasSuperElementAccess;
99710
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
99561
99711
  }
99562
99712
  return result;
99563
99713
  }
@@ -100673,7 +100823,7 @@ function transformES2018(context) {
100673
100823
  ),
100674
100824
  /*typeParameters*/
100675
100825
  void 0,
100676
- visitParameterList(node.parameters, parameterVisitor, context),
100826
+ enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
100677
100827
  /*type*/
100678
100828
  void 0,
100679
100829
  enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node)
@@ -100694,7 +100844,7 @@ function transformES2018(context) {
100694
100844
  node.name,
100695
100845
  /*typeParameters*/
100696
100846
  void 0,
100697
- visitParameterList(node.parameters, parameterVisitor, context),
100847
+ enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
100698
100848
  /*type*/
100699
100849
  void 0,
100700
100850
  enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node)
@@ -100735,7 +100885,7 @@ function transformES2018(context) {
100735
100885
  node.name,
100736
100886
  /*typeParameters*/
100737
100887
  void 0,
100738
- visitParameterList(node.parameters, parameterVisitor, context),
100888
+ enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
100739
100889
  /*type*/
100740
100890
  void 0,
100741
100891
  enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node)
@@ -100744,21 +100894,38 @@ function transformES2018(context) {
100744
100894
  parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread;
100745
100895
  return updated;
100746
100896
  }
100897
+ function transformAsyncGeneratorFunctionParameterList(node) {
100898
+ if (isSimpleParameterList(node.parameters)) {
100899
+ return visitParameterList(node.parameters, visitor, context);
100900
+ }
100901
+ const newParameters = [];
100902
+ for (const parameter of node.parameters) {
100903
+ if (parameter.initializer || parameter.dotDotDotToken) {
100904
+ break;
100905
+ }
100906
+ const newParameter = factory2.createParameterDeclaration(
100907
+ /*modifiers*/
100908
+ void 0,
100909
+ /*dotDotDotToken*/
100910
+ void 0,
100911
+ factory2.getGeneratedNameForNode(parameter.name, 8 /* ReservedInNestedScopes */)
100912
+ );
100913
+ newParameters.push(newParameter);
100914
+ }
100915
+ const newParametersArray = factory2.createNodeArray(newParameters);
100916
+ setTextRange(newParametersArray, node.parameters);
100917
+ return newParametersArray;
100918
+ }
100747
100919
  function transformAsyncGeneratorFunctionBody(node) {
100920
+ const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0;
100748
100921
  resumeLexicalEnvironment();
100749
- const statements = [];
100750
- const statementOffset = factory2.copyPrologue(
100751
- node.body.statements,
100752
- statements,
100753
- /*ensureUseStrict*/
100754
- false,
100755
- visitor
100756
- );
100757
- appendObjectRestAssignmentsIfNeeded(statements, node);
100758
100922
  const savedCapturedSuperProperties = capturedSuperProperties;
100759
100923
  const savedHasSuperElementAccess = hasSuperElementAccess;
100760
100924
  capturedSuperProperties = /* @__PURE__ */ new Set();
100761
100925
  hasSuperElementAccess = false;
100926
+ const outerStatements = [];
100927
+ let asyncBody = factory2.updateBlock(node.body, visitNodes2(node.body.statements, visitor, isStatement));
100928
+ asyncBody = factory2.updateBlock(asyncBody, factory2.mergeLexicalEnvironment(asyncBody.statements, appendObjectRestAssignmentsIfNeeded(endLexicalEnvironment(), node)));
100762
100929
  const returnStatement = factory2.createReturnStatement(
100763
100930
  emitHelpers().createAsyncGeneratorHelper(
100764
100931
  factory2.createFunctionExpression(
@@ -100768,14 +100935,10 @@ function transformES2018(context) {
100768
100935
  node.name && factory2.getGeneratedNameForNode(node.name),
100769
100936
  /*typeParameters*/
100770
100937
  void 0,
100771
- /*parameters*/
100772
- [],
100938
+ innerParameters ?? [],
100773
100939
  /*type*/
100774
100940
  void 0,
100775
- factory2.updateBlock(
100776
- node.body,
100777
- visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)
100778
- )
100941
+ asyncBody
100779
100942
  ),
100780
100943
  !!(hierarchyFacts & 1 /* HasLexicalThis */)
100781
100944
  )
@@ -100785,11 +100948,10 @@ function transformES2018(context) {
100785
100948
  enableSubstitutionForAsyncMethodsWithSuper();
100786
100949
  const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
100787
100950
  substitutedSuperAccessors[getNodeId(variableStatement)] = true;
100788
- insertStatementsAfterStandardPrologue(statements, [variableStatement]);
100951
+ insertStatementsAfterStandardPrologue(outerStatements, [variableStatement]);
100789
100952
  }
100790
- statements.push(returnStatement);
100791
- insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
100792
- const block = factory2.updateBlock(node.body, statements);
100953
+ outerStatements.push(returnStatement);
100954
+ const block = factory2.updateBlock(node.body, outerStatements);
100793
100955
  if (emitSuperHelpers && hasSuperElementAccess) {
100794
100956
  if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
100795
100957
  addEmitHelper(block, advancedAsyncSuperHelper);
@@ -114634,27 +114796,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
114634
114796
  (_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Emit, "emitBuildInfo", { buildInfoPath });
114635
114797
  emitBuildInfo(bundleBuildInfo, buildInfoPath);
114636
114798
  (_f = tracing) == null ? void 0 : _f.pop();
114637
- if (!emitSkipped && emittedFilesList) {
114638
- if (!emitOnly) {
114639
- if (jsFilePath) {
114640
- emittedFilesList.push(jsFilePath);
114641
- }
114642
- if (sourceMapFilePath) {
114643
- emittedFilesList.push(sourceMapFilePath);
114644
- }
114645
- if (buildInfoPath) {
114646
- emittedFilesList.push(buildInfoPath);
114647
- }
114648
- }
114649
- if (emitOnly !== 0 /* Js */) {
114650
- if (declarationFilePath) {
114651
- emittedFilesList.push(declarationFilePath);
114652
- }
114653
- if (declarationMapPath) {
114654
- emittedFilesList.push(declarationMapPath);
114655
- }
114656
- }
114657
- }
114658
114799
  function relativeToBuildInfo(path) {
114659
114800
  return ensurePathIsNonModuleName(getRelativePathFromDirectory(buildInfoDirectory, path, host.getCanonicalFileName));
114660
114801
  }
@@ -114682,6 +114823,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
114682
114823
  void 0,
114683
114824
  { buildInfo }
114684
114825
  );
114826
+ emittedFilesList == null ? void 0 : emittedFilesList.push(buildInfoPath);
114685
114827
  }
114686
114828
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
114687
114829
  if (!sourceFileOrBundle || emitOnly || !jsFilePath) {
@@ -114727,6 +114869,12 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
114727
114869
  transform2.dispose();
114728
114870
  if (bundleBuildInfo)
114729
114871
  bundleBuildInfo.js = printer.bundleFileInfo;
114872
+ if (emittedFilesList) {
114873
+ emittedFilesList.push(jsFilePath);
114874
+ if (sourceMapFilePath) {
114875
+ emittedFilesList.push(sourceMapFilePath);
114876
+ }
114877
+ }
114730
114878
  }
114731
114879
  function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) {
114732
114880
  if (!sourceFileOrBundle || emitOnly === 0 /* Js */)
@@ -114757,33 +114905,33 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
114757
114905
  emitterDiagnostics.add(diagnostic);
114758
114906
  }
114759
114907
  }
114760
- const printerOptions = {
114761
- removeComments: compilerOptions.removeComments,
114762
- newLine: compilerOptions.newLine,
114763
- noEmitHelpers: true,
114764
- module: compilerOptions.module,
114765
- target: compilerOptions.target,
114766
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
114767
- inlineSourceMap: compilerOptions.inlineSourceMap,
114768
- extendedDiagnostics: compilerOptions.extendedDiagnostics,
114769
- onlyPrintJsDocStyle: true,
114770
- omitBraceSourceMapPositions: true,
114771
- writeBundleFileInfo: !!bundleBuildInfo,
114772
- recordInternalSection: !!bundleBuildInfo,
114773
- relativeToBuildInfo
114774
- };
114775
- const declarationPrinter = createPrinter(printerOptions, {
114776
- // resolver hooks
114777
- hasGlobalName: resolver.hasGlobalName,
114778
- // transform hooks
114779
- onEmitNode: declarationTransform.emitNodeWithNotification,
114780
- isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
114781
- substituteNode: declarationTransform.substituteNode
114782
- });
114783
114908
  const declBlocked = !!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
114784
114909
  emitSkipped = emitSkipped || declBlocked;
114785
114910
  if (!declBlocked || forceDtsEmit) {
114786
114911
  Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
114912
+ const printerOptions = {
114913
+ removeComments: compilerOptions.removeComments,
114914
+ newLine: compilerOptions.newLine,
114915
+ noEmitHelpers: true,
114916
+ module: compilerOptions.module,
114917
+ target: compilerOptions.target,
114918
+ sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
114919
+ inlineSourceMap: compilerOptions.inlineSourceMap,
114920
+ extendedDiagnostics: compilerOptions.extendedDiagnostics,
114921
+ onlyPrintJsDocStyle: true,
114922
+ omitBraceSourceMapPositions: true,
114923
+ writeBundleFileInfo: !!bundleBuildInfo,
114924
+ recordInternalSection: !!bundleBuildInfo,
114925
+ relativeToBuildInfo
114926
+ };
114927
+ const declarationPrinter = createPrinter(printerOptions, {
114928
+ // resolver hooks
114929
+ hasGlobalName: resolver.hasGlobalName,
114930
+ // transform hooks
114931
+ onEmitNode: declarationTransform.emitNodeWithNotification,
114932
+ isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
114933
+ substituteNode: declarationTransform.substituteNode
114934
+ });
114787
114935
  printSourceFileOrBundle(
114788
114936
  declarationFilePath,
114789
114937
  declarationMapPath,
@@ -114797,10 +114945,16 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
114797
114945
  // Explicitly do not passthru either `inline` option
114798
114946
  }
114799
114947
  );
114948
+ if (emittedFilesList) {
114949
+ emittedFilesList.push(declarationFilePath);
114950
+ if (declarationMapPath) {
114951
+ emittedFilesList.push(declarationMapPath);
114952
+ }
114953
+ }
114954
+ if (bundleBuildInfo)
114955
+ bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
114800
114956
  }
114801
114957
  declarationTransform.dispose();
114802
- if (bundleBuildInfo)
114803
- bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
114804
114958
  }
114805
114959
  function collectLinkedAliases(node) {
114806
114960
  if (isExportAssignment(node)) {
@@ -124924,6 +125078,7 @@ function createBuilderProgramState(newProgram, oldState) {
124924
125078
  const copyDeclarationFileDiagnostics = canCopySemanticDiagnostics && !compilerOptions.skipLibCheck === !oldCompilerOptions.skipLibCheck;
124925
125079
  const copyLibFileDiagnostics = copyDeclarationFileDiagnostics && !compilerOptions.skipDefaultLibCheck === !oldCompilerOptions.skipDefaultLibCheck;
124926
125080
  state.fileInfos.forEach((info, sourceFilePath) => {
125081
+ var _a2;
124927
125082
  let oldInfo;
124928
125083
  let newReferences;
124929
125084
  if (!useOldState || // File wasn't present in old state
@@ -124933,22 +125088,28 @@ function createBuilderProgramState(newProgram, oldState) {
124933
125088
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
124934
125089
  newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
124935
125090
  addFileToChangeSet(state, sourceFilePath);
124936
- } else if (canCopySemanticDiagnostics) {
125091
+ } else {
124937
125092
  const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
124938
- if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
124939
- return;
124940
- if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
124941
- return;
124942
- const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
124943
- if (diagnostics) {
124944
- state.semanticDiagnosticsPerFile.set(
125093
+ const emitDiagnostics = (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath);
125094
+ if (emitDiagnostics) {
125095
+ (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
124945
125096
  sourceFilePath,
124946
- oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
125097
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
124947
125098
  );
124948
- if (!state.semanticDiagnosticsFromOldState) {
124949
- state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set();
125099
+ }
125100
+ if (canCopySemanticDiagnostics) {
125101
+ if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
125102
+ return;
125103
+ if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
125104
+ return;
125105
+ const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
125106
+ if (diagnostics) {
125107
+ state.semanticDiagnosticsPerFile.set(
125108
+ sourceFilePath,
125109
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
125110
+ );
125111
+ (state.semanticDiagnosticsFromOldState ?? (state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set())).add(sourceFilePath);
124950
125112
  }
124951
- state.semanticDiagnosticsFromOldState.add(sourceFilePath);
124952
125113
  }
124953
125114
  }
124954
125115
  if (canCopyEmitSignatures) {
@@ -125085,7 +125246,9 @@ function backupBuilderProgramEmitState(state) {
125085
125246
  outSignature: state.outSignature,
125086
125247
  latestChangedDtsFile: state.latestChangedDtsFile,
125087
125248
  hasChangedEmitSignature: state.hasChangedEmitSignature,
125088
- changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0
125249
+ changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0,
125250
+ buildInfoEmitPending: state.buildInfoEmitPending,
125251
+ emitDiagnosticsPerFile: state.emitDiagnosticsPerFile && new Map(state.emitDiagnosticsPerFile)
125089
125252
  };
125090
125253
  }
125091
125254
  function restoreBuilderProgramEmitState(state, savedEmitState) {
@@ -125096,6 +125259,8 @@ function restoreBuilderProgramEmitState(state, savedEmitState) {
125096
125259
  state.outSignature = savedEmitState.outSignature;
125097
125260
  state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
125098
125261
  state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
125262
+ state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
125263
+ state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
125099
125264
  if (savedEmitState.changedFilesSet)
125100
125265
  state.changedFilesSet = savedEmitState.changedFilesSet;
125101
125266
  }
@@ -125186,6 +125351,22 @@ function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
125186
125351
  return { affectedFile, emitKind: pendingKind };
125187
125352
  });
125188
125353
  }
125354
+ function getNextPendingEmitDiagnosticsFile(state) {
125355
+ var _a;
125356
+ if (!((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size))
125357
+ return void 0;
125358
+ return forEachEntry(state.emitDiagnosticsPerFile, (diagnostics, path) => {
125359
+ var _a2;
125360
+ const affectedFile = state.program.getSourceFileByPath(path);
125361
+ if (!affectedFile || !sourceFileMayBeEmitted(affectedFile, state.program)) {
125362
+ state.emitDiagnosticsPerFile.delete(path);
125363
+ return void 0;
125364
+ }
125365
+ const seenKind = ((_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath)) || 0 /* None */;
125366
+ if (!(seenKind & 24 /* AllDts */))
125367
+ return { affectedFile, diagnostics, seenKind };
125368
+ });
125369
+ }
125189
125370
  function removeDiagnosticsOfLibraryFiles(state) {
125190
125371
  if (!state.cleanedDiagnosticsOfLibFiles) {
125191
125372
  state.cleanedDiagnosticsOfLibFiles = true;
@@ -125462,18 +125643,7 @@ function getBuildInfo2(state, bundle) {
125462
125643
  return void 0;
125463
125644
  });
125464
125645
  }
125465
- let semanticDiagnosticsPerFile;
125466
- if (state.semanticDiagnosticsPerFile) {
125467
- for (const key of arrayFrom(state.semanticDiagnosticsPerFile.keys()).sort(compareStringsCaseSensitive)) {
125468
- const value = state.semanticDiagnosticsPerFile.get(key);
125469
- (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(
125470
- value.length ? [
125471
- toFileId(key),
125472
- convertToReusableDiagnostics(value, relativeToBuildInfo)
125473
- ] : toFileId(key)
125474
- );
125475
- }
125476
- }
125646
+ const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.semanticDiagnosticsPerFile);
125477
125647
  let affectedFilesPendingEmit;
125478
125648
  if ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.size) {
125479
125649
  const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
@@ -125503,6 +125673,7 @@ function getBuildInfo2(state, bundle) {
125503
125673
  (changeFileSet || (changeFileSet = [])).push(toFileId(path));
125504
125674
  }
125505
125675
  }
125676
+ const emitDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.emitDiagnosticsPerFile);
125506
125677
  const program = {
125507
125678
  fileNames,
125508
125679
  fileInfos,
@@ -125512,6 +125683,7 @@ function getBuildInfo2(state, bundle) {
125512
125683
  referencedMap,
125513
125684
  exportedModulesMap,
125514
125685
  semanticDiagnosticsPerFile,
125686
+ emitDiagnosticsPerFile,
125515
125687
  affectedFilesPendingEmit,
125516
125688
  changeFileSet,
125517
125689
  emitSignatures,
@@ -125568,73 +125740,87 @@ function getBuildInfo2(state, bundle) {
125568
125740
  if (optionInfo == null ? void 0 : optionInfo.affectsBuildInfo) {
125569
125741
  (result || (result = {}))[name] = convertToReusableCompilerOptionValue(
125570
125742
  optionInfo,
125571
- options[name],
125572
- relativeToBuildInfoEnsuringAbsolutePath
125743
+ options[name]
125573
125744
  );
125574
125745
  }
125575
125746
  }
125576
125747
  return result;
125577
125748
  }
125578
- }
125579
- function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
125580
- if (option) {
125581
- Debug.assert(option.type !== "listOrElement");
125582
- if (option.type === "list") {
125583
- const values = value;
125584
- if (option.element.isFilePath && values.length) {
125585
- return values.map(relativeToBuildInfo);
125749
+ function convertToReusableCompilerOptionValue(option, value) {
125750
+ if (option) {
125751
+ Debug.assert(option.type !== "listOrElement");
125752
+ if (option.type === "list") {
125753
+ const values = value;
125754
+ if (option.element.isFilePath && values.length) {
125755
+ return values.map(relativeToBuildInfoEnsuringAbsolutePath);
125756
+ }
125757
+ } else if (option.isFilePath) {
125758
+ return relativeToBuildInfoEnsuringAbsolutePath(value);
125586
125759
  }
125587
- } else if (option.isFilePath) {
125588
- return relativeToBuildInfo(value);
125589
125760
  }
125761
+ return value;
125590
125762
  }
125591
- return value;
125592
- }
125593
- function convertToReusableDiagnostics(diagnostics, relativeToBuildInfo) {
125594
- Debug.assert(!!diagnostics.length);
125595
- return diagnostics.map((diagnostic) => {
125596
- const result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
125597
- result.reportsUnnecessary = diagnostic.reportsUnnecessary;
125598
- result.reportDeprecated = diagnostic.reportsDeprecated;
125599
- result.source = diagnostic.source;
125600
- result.skippedOn = diagnostic.skippedOn;
125601
- const { relatedInformation } = diagnostic;
125602
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo)) : [] : void 0;
125763
+ function convertToProgramBuildInfoDiagnostics(diagnostics) {
125764
+ let result;
125765
+ if (diagnostics) {
125766
+ for (const key of arrayFrom(diagnostics.keys()).sort(compareStringsCaseSensitive)) {
125767
+ const value = diagnostics.get(key);
125768
+ (result || (result = [])).push(
125769
+ value.length ? [
125770
+ toFileId(key),
125771
+ convertToReusableDiagnostics(value)
125772
+ ] : toFileId(key)
125773
+ );
125774
+ }
125775
+ }
125603
125776
  return result;
125604
- });
125605
- }
125606
- function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo) {
125607
- const { file } = diagnostic;
125608
- return {
125609
- ...diagnostic,
125610
- file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
125611
- messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
125612
- };
125613
- }
125614
- function convertToReusableDiagnosticMessageChain(chain) {
125615
- if (chain.repopulateInfo) {
125777
+ }
125778
+ function convertToReusableDiagnostics(diagnostics) {
125779
+ Debug.assert(!!diagnostics.length);
125780
+ return diagnostics.map((diagnostic) => {
125781
+ const result = convertToReusableDiagnosticRelatedInformation(diagnostic);
125782
+ result.reportsUnnecessary = diagnostic.reportsUnnecessary;
125783
+ result.reportDeprecated = diagnostic.reportsDeprecated;
125784
+ result.source = diagnostic.source;
125785
+ result.skippedOn = diagnostic.skippedOn;
125786
+ const { relatedInformation } = diagnostic;
125787
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r)) : [] : void 0;
125788
+ return result;
125789
+ });
125790
+ }
125791
+ function convertToReusableDiagnosticRelatedInformation(diagnostic) {
125792
+ const { file } = diagnostic;
125616
125793
  return {
125617
- info: chain.repopulateInfo(),
125618
- next: convertToReusableDiagnosticMessageChainArray(chain.next)
125794
+ ...diagnostic,
125795
+ file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
125796
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
125619
125797
  };
125620
125798
  }
125621
- const next = convertToReusableDiagnosticMessageChainArray(chain.next);
125622
- return next === chain.next ? chain : { ...chain, next };
125623
- }
125624
- function convertToReusableDiagnosticMessageChainArray(array) {
125625
- if (!array)
125626
- return array;
125627
- return forEach(array, (chain, index) => {
125628
- const reusable = convertToReusableDiagnosticMessageChain(chain);
125629
- if (chain === reusable)
125630
- return void 0;
125631
- const result = index > 0 ? array.slice(0, index - 1) : [];
125632
- result.push(reusable);
125633
- for (let i = index + 1; i < array.length; i++) {
125634
- result.push(convertToReusableDiagnosticMessageChain(array[i]));
125799
+ function convertToReusableDiagnosticMessageChain(chain) {
125800
+ if (chain.repopulateInfo) {
125801
+ return {
125802
+ info: chain.repopulateInfo(),
125803
+ next: convertToReusableDiagnosticMessageChainArray(chain.next)
125804
+ };
125635
125805
  }
125636
- return result;
125637
- }) || array;
125806
+ const next = convertToReusableDiagnosticMessageChainArray(chain.next);
125807
+ return next === chain.next ? chain : { ...chain, next };
125808
+ }
125809
+ function convertToReusableDiagnosticMessageChainArray(array) {
125810
+ if (!array)
125811
+ return array;
125812
+ return forEach(array, (chain, index) => {
125813
+ const reusable = convertToReusableDiagnosticMessageChain(chain);
125814
+ if (chain === reusable)
125815
+ return void 0;
125816
+ const result = index > 0 ? array.slice(0, index - 1) : [];
125817
+ result.push(reusable);
125818
+ for (let i = index + 1; i < array.length; i++) {
125819
+ result.push(convertToReusableDiagnosticMessageChain(array[i]));
125820
+ }
125821
+ return result;
125822
+ }) || array;
125823
+ }
125638
125824
  }
125639
125825
  var BuilderProgramKind = /* @__PURE__ */ ((BuilderProgramKind2) => {
125640
125826
  BuilderProgramKind2[BuilderProgramKind2["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram";
@@ -125748,6 +125934,14 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
125748
125934
  if (!outFile(state.compilerOptions)) {
125749
125935
  const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
125750
125936
  if (!pendingAffectedFile) {
125937
+ const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
125938
+ if (pendingForDiagnostics) {
125939
+ (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
125940
+ return {
125941
+ result: { emitSkipped: true, diagnostics: pendingForDiagnostics.diagnostics },
125942
+ affected: pendingForDiagnostics.affectedFile
125943
+ };
125944
+ }
125751
125945
  if (!state.buildInfoEmitPending)
125752
125946
  return void 0;
125753
125947
  const affected2 = state.program;
@@ -125796,6 +125990,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
125796
125990
  (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
125797
125991
  else
125798
125992
  (_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.delete(affectedSourceFile.resolvedPath);
125993
+ if (result.diagnostics.length)
125994
+ (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, result.diagnostics);
125799
125995
  } else {
125800
125996
  state.changedFilesSet.clear();
125801
125997
  }
@@ -125968,9 +126164,10 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
125968
126164
  }
125969
126165
  }
125970
126166
  function addToAffectedFilesPendingEmit(state, affectedFilePendingEmit, kind) {
125971
- var _a;
126167
+ var _a, _b;
125972
126168
  const existingKind = ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.get(affectedFilePendingEmit)) || 0 /* None */;
125973
126169
  (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedFilePendingEmit, existingKind | kind);
126170
+ (_b = state.emitDiagnosticsPerFile) == null ? void 0 : _b.delete(affectedFilePendingEmit);
125974
126171
  }
125975
126172
  function toBuilderStateFileInfoForMultiEmit(fileInfo) {
125976
126173
  return isString(fileInfo) ? { version: fileInfo, signature: fileInfo, affectsGlobalScope: void 0, impliedFormat: void 0 } : isString(fileInfo.signature) ? fileInfo : { version: fileInfo.version, signature: fileInfo.signature === false ? void 0 : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
@@ -126035,7 +126232,8 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
126035
126232
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
126036
126233
  referencedMap: toManyToManyPathMap(program.referencedMap),
126037
126234
  exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
126038
- semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && arrayToMap(program.semanticDiagnosticsPerFile, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]),
126235
+ semanticDiagnosticsPerFile: toPerFileDiagnostics(program.semanticDiagnosticsPerFile),
126236
+ emitDiagnosticsPerFile: toPerFileDiagnostics(program.emitDiagnosticsPerFile),
126039
126237
  hasReusableDiagnostic: true,
126040
126238
  affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
126041
126239
  changedFilesSet: new Set(map(program.changeFileSet, toFilePath)),
@@ -126088,6 +126286,9 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
126088
126286
  referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
126089
126287
  return map2;
126090
126288
  }
126289
+ function toPerFileDiagnostics(diagnostics) {
126290
+ return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]);
126291
+ }
126091
126292
  }
126092
126293
  function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
126093
126294
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
@@ -129734,7 +129935,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
129734
129935
  }
129735
129936
  }
129736
129937
  function getUpToDateStatusWorker(state, project, resolvedPath) {
129737
- var _a, _b;
129938
+ var _a, _b, _c;
129738
129939
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
129739
129940
  return {
129740
129941
  type: 16 /* ContainerOnly */
@@ -129808,7 +130009,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
129808
130009
  };
129809
130010
  }
129810
130011
  if (buildInfo.program) {
129811
- if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? (_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length : some(buildInfo.program.semanticDiagnosticsPerFile, isArray))) {
130012
+ if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.program.emitDiagnosticsPerFile) == null ? void 0 : _c.length) : some(buildInfo.program.semanticDiagnosticsPerFile, isArray))) {
129812
130013
  return {
129813
130014
  type: 8 /* OutOfDateBuildInfo */,
129814
130015
  buildInfoFile: buildInfoPath
@@ -146021,7 +146222,7 @@ function getPropertySymbolsFromContextualType(node, checker, contextualType, uni
146021
146222
  if (discriminatedPropertySymbols.length === 0) {
146022
146223
  return mapDefined(contextualType.types, (t) => t.getProperty(name));
146023
146224
  }
146024
- return discriminatedPropertySymbols;
146225
+ return deduplicate(discriminatedPropertySymbols, equateValues);
146025
146226
  }
146026
146227
  function isArgumentOfElementAccessExpression(node) {
146027
146228
  return node && node.parent && node.parent.kind === 212 /* ElementAccessExpression */ && node.parent.argumentExpression === node;
@@ -165120,6 +165321,7 @@ function provideInlayHints(context) {
165120
165321
  visitForDisplayParts(typeNode);
165121
165322
  return parts;
165122
165323
  function visitForDisplayParts(node) {
165324
+ var _a, _b;
165123
165325
  if (!node) {
165124
165326
  return;
165125
165327
  }
@@ -165134,9 +165336,9 @@ function provideInlayHints(context) {
165134
165336
  }
165135
165337
  switch (node.kind) {
165136
165338
  case 80 /* Identifier */:
165137
- const identifier = node;
165138
- const identifierText = idText(identifier);
165139
- const name = identifier.symbol && identifier.symbol.declarations && identifier.symbol.declarations.length && getNameOfDeclaration(identifier.symbol.declarations[0]);
165339
+ Debug.assertNode(node, isIdentifier);
165340
+ const identifierText = idText(node);
165341
+ const name = node.symbol && node.symbol.declarations && node.symbol.declarations.length && getNameOfDeclaration(node.symbol.declarations[0]);
165140
165342
  if (name) {
165141
165343
  parts.push(getNodeDisplayPart(identifierText, name));
165142
165344
  } else {
@@ -165144,252 +165346,307 @@ function provideInlayHints(context) {
165144
165346
  }
165145
165347
  break;
165146
165348
  case 166 /* QualifiedName */:
165147
- const qualifiedName = node;
165148
- visitForDisplayParts(qualifiedName.left);
165349
+ Debug.assertNode(node, isQualifiedName);
165350
+ visitForDisplayParts(node.left);
165149
165351
  parts.push({ text: "." });
165150
- visitForDisplayParts(qualifiedName.right);
165352
+ visitForDisplayParts(node.right);
165151
165353
  break;
165152
165354
  case 182 /* TypePredicate */:
165153
- const predicate = node;
165154
- if (predicate.assertsModifier) {
165355
+ Debug.assertNode(node, isTypePredicateNode);
165356
+ if (node.assertsModifier) {
165155
165357
  parts.push({ text: "asserts " });
165156
165358
  }
165157
- visitForDisplayParts(predicate.parameterName);
165158
- if (predicate.type) {
165359
+ visitForDisplayParts(node.parameterName);
165360
+ if (node.type) {
165159
165361
  parts.push({ text: " is " });
165160
- visitForDisplayParts(predicate.type);
165362
+ visitForDisplayParts(node.type);
165161
165363
  }
165162
165364
  break;
165163
165365
  case 183 /* TypeReference */:
165164
- const typeReference = node;
165165
- visitForDisplayParts(typeReference.typeName);
165166
- if (typeReference.typeArguments) {
165366
+ Debug.assertNode(node, isTypeReferenceNode);
165367
+ visitForDisplayParts(node.typeName);
165368
+ if (node.typeArguments) {
165167
165369
  parts.push({ text: "<" });
165168
- visitDisplayPartList(typeReference.typeArguments, ", ");
165370
+ visitDisplayPartList(node.typeArguments, ", ");
165169
165371
  parts.push({ text: ">" });
165170
165372
  }
165171
165373
  break;
165172
165374
  case 168 /* TypeParameter */:
165173
- const typeParameter = node;
165174
- if (typeParameter.modifiers) {
165175
- visitDisplayPartList(typeParameter.modifiers, " ");
165375
+ Debug.assertNode(node, isTypeParameterDeclaration);
165376
+ if (node.modifiers) {
165377
+ visitDisplayPartList(node.modifiers, " ");
165176
165378
  }
165177
- visitForDisplayParts(typeParameter.name);
165178
- if (typeParameter.constraint) {
165379
+ visitForDisplayParts(node.name);
165380
+ if (node.constraint) {
165179
165381
  parts.push({ text: " extends " });
165180
- visitForDisplayParts(typeParameter.constraint);
165382
+ visitForDisplayParts(node.constraint);
165181
165383
  }
165182
- if (typeParameter.default) {
165384
+ if (node.default) {
165183
165385
  parts.push({ text: " = " });
165184
- visitForDisplayParts(typeParameter.default);
165386
+ visitForDisplayParts(node.default);
165185
165387
  }
165186
165388
  break;
165187
165389
  case 169 /* Parameter */:
165188
- const parameter = node;
165189
- if (parameter.modifiers) {
165190
- visitDisplayPartList(parameter.modifiers, " ");
165390
+ Debug.assertNode(node, isParameter);
165391
+ if (node.modifiers) {
165392
+ visitDisplayPartList(node.modifiers, " ");
165191
165393
  }
165192
- if (parameter.dotDotDotToken) {
165394
+ if (node.dotDotDotToken) {
165193
165395
  parts.push({ text: "..." });
165194
165396
  }
165195
- visitForDisplayParts(parameter.name);
165196
- if (parameter.questionToken) {
165397
+ visitForDisplayParts(node.name);
165398
+ if (node.questionToken) {
165197
165399
  parts.push({ text: "?" });
165198
165400
  }
165199
- if (parameter.type) {
165401
+ if (node.type) {
165200
165402
  parts.push({ text: ": " });
165201
- visitForDisplayParts(parameter.type);
165403
+ visitForDisplayParts(node.type);
165202
165404
  }
165203
165405
  break;
165204
165406
  case 185 /* ConstructorType */:
165205
- const constructorType = node;
165407
+ Debug.assertNode(node, isConstructorTypeNode);
165206
165408
  parts.push({ text: "new " });
165207
- if (constructorType.typeParameters) {
165208
- parts.push({ text: "<" });
165209
- visitDisplayPartList(constructorType.typeParameters, ", ");
165210
- parts.push({ text: ">" });
165211
- }
165212
- parts.push({ text: "(" });
165213
- visitDisplayPartList(constructorType.parameters, ", ");
165214
- parts.push({ text: ")" });
165409
+ visitParametersAndTypeParameters(node);
165215
165410
  parts.push({ text: " => " });
165216
- visitForDisplayParts(constructorType.type);
165411
+ visitForDisplayParts(node.type);
165217
165412
  break;
165218
165413
  case 186 /* TypeQuery */:
165219
- const typeQuery = node;
165414
+ Debug.assertNode(node, isTypeQueryNode);
165220
165415
  parts.push({ text: "typeof " });
165221
- visitForDisplayParts(typeQuery.exprName);
165222
- if (typeQuery.typeArguments) {
165416
+ visitForDisplayParts(node.exprName);
165417
+ if (node.typeArguments) {
165223
165418
  parts.push({ text: "<" });
165224
- visitDisplayPartList(typeQuery.typeArguments, ", ");
165419
+ visitDisplayPartList(node.typeArguments, ", ");
165225
165420
  parts.push({ text: ">" });
165226
165421
  }
165227
165422
  break;
165228
165423
  case 187 /* TypeLiteral */:
165229
- const typeLiteral = node;
165424
+ Debug.assertNode(node, isTypeLiteralNode);
165230
165425
  parts.push({ text: "{" });
165231
- if (typeLiteral.members.length) {
165426
+ if (node.members.length) {
165232
165427
  parts.push({ text: " " });
165233
- visitDisplayPartList(typeLiteral.members, "; ");
165428
+ visitDisplayPartList(node.members, "; ");
165234
165429
  parts.push({ text: " " });
165235
165430
  }
165236
165431
  parts.push({ text: "}" });
165237
165432
  break;
165238
165433
  case 188 /* ArrayType */:
165434
+ Debug.assertNode(node, isArrayTypeNode);
165239
165435
  visitForDisplayParts(node.elementType);
165240
165436
  parts.push({ text: "[]" });
165241
165437
  break;
165242
165438
  case 189 /* TupleType */:
165439
+ Debug.assertNode(node, isTupleTypeNode);
165243
165440
  parts.push({ text: "[" });
165244
165441
  visitDisplayPartList(node.elements, ", ");
165245
165442
  parts.push({ text: "]" });
165246
165443
  break;
165247
165444
  case 202 /* NamedTupleMember */:
165248
- const member = node;
165249
- if (member.dotDotDotToken) {
165445
+ Debug.assertNode(node, isNamedTupleMember);
165446
+ if (node.dotDotDotToken) {
165250
165447
  parts.push({ text: "..." });
165251
165448
  }
165252
- visitForDisplayParts(member.name);
165253
- if (member.questionToken) {
165449
+ visitForDisplayParts(node.name);
165450
+ if (node.questionToken) {
165254
165451
  parts.push({ text: "?" });
165255
165452
  }
165256
165453
  parts.push({ text: ": " });
165257
- visitForDisplayParts(member.type);
165454
+ visitForDisplayParts(node.type);
165258
165455
  break;
165259
165456
  case 190 /* OptionalType */:
165457
+ Debug.assertNode(node, isOptionalTypeNode);
165260
165458
  visitForDisplayParts(node.type);
165261
165459
  parts.push({ text: "?" });
165262
165460
  break;
165263
165461
  case 191 /* RestType */:
165462
+ Debug.assertNode(node, isRestTypeNode);
165264
165463
  parts.push({ text: "..." });
165265
165464
  visitForDisplayParts(node.type);
165266
165465
  break;
165267
165466
  case 192 /* UnionType */:
165467
+ Debug.assertNode(node, isUnionTypeNode);
165268
165468
  visitDisplayPartList(node.types, " | ");
165269
165469
  break;
165270
165470
  case 193 /* IntersectionType */:
165471
+ Debug.assertNode(node, isIntersectionTypeNode);
165271
165472
  visitDisplayPartList(node.types, " & ");
165272
165473
  break;
165273
165474
  case 194 /* ConditionalType */:
165274
- const conditionalType = node;
165275
- visitForDisplayParts(conditionalType.checkType);
165475
+ Debug.assertNode(node, isConditionalTypeNode);
165476
+ visitForDisplayParts(node.checkType);
165276
165477
  parts.push({ text: " extends " });
165277
- visitForDisplayParts(conditionalType.extendsType);
165478
+ visitForDisplayParts(node.extendsType);
165278
165479
  parts.push({ text: " ? " });
165279
- visitForDisplayParts(conditionalType.trueType);
165480
+ visitForDisplayParts(node.trueType);
165280
165481
  parts.push({ text: " : " });
165281
- visitForDisplayParts(conditionalType.falseType);
165482
+ visitForDisplayParts(node.falseType);
165282
165483
  break;
165283
165484
  case 195 /* InferType */:
165485
+ Debug.assertNode(node, isInferTypeNode);
165284
165486
  parts.push({ text: "infer " });
165285
165487
  visitForDisplayParts(node.typeParameter);
165286
165488
  break;
165287
165489
  case 196 /* ParenthesizedType */:
165490
+ Debug.assertNode(node, isParenthesizedTypeNode);
165288
165491
  parts.push({ text: "(" });
165289
165492
  visitForDisplayParts(node.type);
165290
165493
  parts.push({ text: ")" });
165291
165494
  break;
165292
165495
  case 198 /* TypeOperator */:
165293
- const typeOperator = node;
165294
- parts.push({ text: `${tokenToString(typeOperator.operator)} ` });
165295
- visitForDisplayParts(typeOperator.type);
165496
+ Debug.assertNode(node, isTypeOperatorNode);
165497
+ parts.push({ text: `${tokenToString(node.operator)} ` });
165498
+ visitForDisplayParts(node.type);
165296
165499
  break;
165297
165500
  case 199 /* IndexedAccessType */:
165298
- const indexedAccess = node;
165299
- visitForDisplayParts(indexedAccess.objectType);
165501
+ Debug.assertNode(node, isIndexedAccessTypeNode);
165502
+ visitForDisplayParts(node.objectType);
165300
165503
  parts.push({ text: "[" });
165301
- visitForDisplayParts(indexedAccess.indexType);
165504
+ visitForDisplayParts(node.indexType);
165302
165505
  parts.push({ text: "]" });
165303
165506
  break;
165304
165507
  case 200 /* MappedType */:
165305
- const mappedType = node;
165508
+ Debug.assertNode(node, isMappedTypeNode);
165306
165509
  parts.push({ text: "{ " });
165307
- if (mappedType.readonlyToken) {
165308
- if (mappedType.readonlyToken.kind === 40 /* PlusToken */) {
165510
+ if (node.readonlyToken) {
165511
+ if (node.readonlyToken.kind === 40 /* PlusToken */) {
165309
165512
  parts.push({ text: "+" });
165310
- } else if (mappedType.readonlyToken.kind === 41 /* MinusToken */) {
165513
+ } else if (node.readonlyToken.kind === 41 /* MinusToken */) {
165311
165514
  parts.push({ text: "-" });
165312
165515
  }
165313
165516
  parts.push({ text: "readonly " });
165314
165517
  }
165315
165518
  parts.push({ text: "[" });
165316
- visitForDisplayParts(mappedType.typeParameter);
165317
- if (mappedType.nameType) {
165519
+ visitForDisplayParts(node.typeParameter);
165520
+ if (node.nameType) {
165318
165521
  parts.push({ text: " as " });
165319
- visitForDisplayParts(mappedType.nameType);
165522
+ visitForDisplayParts(node.nameType);
165320
165523
  }
165321
165524
  parts.push({ text: "]" });
165322
- if (mappedType.questionToken) {
165323
- if (mappedType.questionToken.kind === 40 /* PlusToken */) {
165525
+ if (node.questionToken) {
165526
+ if (node.questionToken.kind === 40 /* PlusToken */) {
165324
165527
  parts.push({ text: "+" });
165325
- } else if (mappedType.questionToken.kind === 41 /* MinusToken */) {
165528
+ } else if (node.questionToken.kind === 41 /* MinusToken */) {
165326
165529
  parts.push({ text: "-" });
165327
165530
  }
165328
165531
  parts.push({ text: "?" });
165329
165532
  }
165330
165533
  parts.push({ text: ": " });
165331
- if (mappedType.type) {
165332
- visitForDisplayParts(mappedType.type);
165534
+ if (node.type) {
165535
+ visitForDisplayParts(node.type);
165333
165536
  }
165334
165537
  parts.push({ text: "; }" });
165335
165538
  break;
165336
165539
  case 201 /* LiteralType */:
165540
+ Debug.assertNode(node, isLiteralTypeNode);
165337
165541
  visitForDisplayParts(node.literal);
165338
165542
  break;
165339
165543
  case 184 /* FunctionType */:
165340
- const functionType = node;
165341
- if (functionType.typeParameters) {
165342
- parts.push({ text: "<" });
165343
- visitDisplayPartList(functionType.typeParameters, ", ");
165344
- parts.push({ text: ">" });
165345
- }
165346
- parts.push({ text: "(" });
165347
- visitDisplayPartList(functionType.parameters, ", ");
165348
- parts.push({ text: ")" });
165544
+ Debug.assertNode(node, isFunctionTypeNode);
165545
+ visitParametersAndTypeParameters(node);
165349
165546
  parts.push({ text: " => " });
165350
- visitForDisplayParts(functionType.type);
165547
+ visitForDisplayParts(node.type);
165351
165548
  break;
165352
165549
  case 205 /* ImportType */:
165353
- const importType = node;
165354
- if (importType.isTypeOf) {
165550
+ Debug.assertNode(node, isImportTypeNode);
165551
+ if (node.isTypeOf) {
165355
165552
  parts.push({ text: "typeof " });
165356
165553
  }
165357
165554
  parts.push({ text: "import(" });
165358
- visitForDisplayParts(importType.argument);
165359
- if (importType.assertions) {
165555
+ visitForDisplayParts(node.argument);
165556
+ if (node.assertions) {
165360
165557
  parts.push({ text: ", { assert: " });
165361
- visitDisplayPartList(importType.assertions.assertClause.elements, ", ");
165558
+ visitDisplayPartList(node.assertions.assertClause.elements, ", ");
165362
165559
  parts.push({ text: " }" });
165363
165560
  }
165364
165561
  parts.push({ text: ")" });
165365
- if (importType.qualifier) {
165562
+ if (node.qualifier) {
165366
165563
  parts.push({ text: "." });
165367
- visitForDisplayParts(importType.qualifier);
165564
+ visitForDisplayParts(node.qualifier);
165368
165565
  }
165369
- if (importType.typeArguments) {
165566
+ if (node.typeArguments) {
165370
165567
  parts.push({ text: "<" });
165371
- visitDisplayPartList(importType.typeArguments, ", ");
165568
+ visitDisplayPartList(node.typeArguments, ", ");
165372
165569
  parts.push({ text: ">" });
165373
165570
  }
165374
165571
  break;
165375
165572
  case 171 /* PropertySignature */:
165376
- const propertySignature = node;
165377
- if (propertySignature.modifiers) {
165378
- visitDisplayPartList(propertySignature.modifiers, " ");
165573
+ Debug.assertNode(node, isPropertySignature);
165574
+ if ((_a = node.modifiers) == null ? void 0 : _a.length) {
165575
+ visitDisplayPartList(node.modifiers, " ");
165576
+ parts.push({ text: " " });
165577
+ }
165578
+ visitForDisplayParts(node.name);
165579
+ if (node.questionToken) {
165580
+ parts.push({ text: "?" });
165581
+ }
165582
+ if (node.type) {
165583
+ parts.push({ text: ": " });
165584
+ visitForDisplayParts(node.type);
165379
165585
  }
165380
- visitForDisplayParts(propertySignature.name);
165381
- if (propertySignature.questionToken) {
165586
+ break;
165587
+ case 173 /* MethodSignature */:
165588
+ Debug.assertNode(node, isMethodSignature);
165589
+ if ((_b = node.modifiers) == null ? void 0 : _b.length) {
165590
+ visitDisplayPartList(node.modifiers, " ");
165591
+ parts.push({ text: " " });
165592
+ }
165593
+ visitForDisplayParts(node.name);
165594
+ if (node.questionToken) {
165382
165595
  parts.push({ text: "?" });
165383
165596
  }
165384
- if (propertySignature.type) {
165597
+ visitParametersAndTypeParameters(node);
165598
+ if (node.type) {
165385
165599
  parts.push({ text: ": " });
165386
- visitForDisplayParts(propertySignature.type);
165600
+ visitForDisplayParts(node.type);
165387
165601
  }
165388
165602
  break;
165603
+ case 179 /* CallSignature */:
165604
+ Debug.assertNode(node, isCallSignatureDeclaration);
165605
+ visitParametersAndTypeParameters(node);
165606
+ if (node.type) {
165607
+ parts.push({ text: ": " });
165608
+ visitForDisplayParts(node.type);
165609
+ }
165610
+ break;
165611
+ case 207 /* ArrayBindingPattern */:
165612
+ Debug.assertNode(node, isArrayBindingPattern);
165613
+ parts.push({ text: "[" });
165614
+ visitDisplayPartList(node.elements, ", ");
165615
+ parts.push({ text: "]" });
165616
+ break;
165617
+ case 206 /* ObjectBindingPattern */:
165618
+ Debug.assertNode(node, isObjectBindingPattern);
165619
+ parts.push({ text: "{" });
165620
+ if (node.elements.length) {
165621
+ parts.push({ text: " " });
165622
+ visitDisplayPartList(node.elements, ", ");
165623
+ parts.push({ text: " " });
165624
+ }
165625
+ parts.push({ text: "}" });
165626
+ break;
165627
+ case 208 /* BindingElement */:
165628
+ Debug.assertNode(node, isBindingElement);
165629
+ visitForDisplayParts(node.name);
165630
+ break;
165631
+ case 224 /* PrefixUnaryExpression */:
165632
+ Debug.assertNode(node, isPrefixUnaryExpression);
165633
+ parts.push({ text: tokenToString(node.operator) });
165634
+ visitForDisplayParts(node.operand);
165635
+ break;
165389
165636
  default:
165390
165637
  Debug.failBadSyntaxKind(node);
165391
165638
  }
165392
165639
  }
165640
+ function visitParametersAndTypeParameters(signatureDeclaration) {
165641
+ if (signatureDeclaration.typeParameters) {
165642
+ parts.push({ text: "<" });
165643
+ visitDisplayPartList(signatureDeclaration.typeParameters, ", ");
165644
+ parts.push({ text: ">" });
165645
+ }
165646
+ parts.push({ text: "(" });
165647
+ visitDisplayPartList(signatureDeclaration.parameters, ", ");
165648
+ parts.push({ text: ")" });
165649
+ }
165393
165650
  function visitDisplayPartList(nodes, separator) {
165394
165651
  nodes.forEach((node, index) => {
165395
165652
  if (index > 0) {
@@ -170153,7 +170410,7 @@ function getAllRules() {
170153
170410
  const typeNames = [80 /* Identifier */, ...typeKeywords];
170154
170411
  const functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments;
170155
170412
  const typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([80 /* Identifier */, 3 /* MultiLineCommentTrivia */, 86 /* ClassKeyword */, 95 /* ExportKeyword */, 102 /* ImportKeyword */]);
170156
- const controlOpenBraceLeftTokenRange = tokenRangeFrom([22 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 92 /* DoKeyword */, 113 /* TryKeyword */, 98 /* FinallyKeyword */, 93 /* ElseKeyword */]);
170413
+ const controlOpenBraceLeftTokenRange = tokenRangeFrom([22 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 92 /* DoKeyword */, 113 /* TryKeyword */, 98 /* FinallyKeyword */, 93 /* ElseKeyword */, 85 /* CatchKeyword */]);
170157
170414
  const highPriorityCommonRules = [
170158
170415
  // Leave comments alone
170159
170416
  rule("IgnoreBeforeComment", anyToken, comments, anyContext, 1 /* StopProcessingSpaceActions */),
@@ -174141,6 +174398,8 @@ __export(ts_exports2, {
174141
174398
  isSignedNumericLiteral: () => isSignedNumericLiteral,
174142
174399
  isSimpleCopiableExpression: () => isSimpleCopiableExpression,
174143
174400
  isSimpleInlineableExpression: () => isSimpleInlineableExpression,
174401
+ isSimpleParameter: () => isSimpleParameter,
174402
+ isSimpleParameterList: () => isSimpleParameterList,
174144
174403
  isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
174145
174404
  isSourceFile: () => isSourceFile,
174146
174405
  isSourceFileFromLibrary: () => isSourceFileFromLibrary,
@@ -174855,9 +175114,9 @@ function buildOverload(name) {
174855
175114
 
174856
175115
  // src/deprecatedCompat/5.0/identifierProperties.ts
174857
175116
  addObjectAllocatorPatcher((objectAllocator2) => {
174858
- const Identifier78 = objectAllocator2.getIdentifierConstructor();
174859
- if (!hasProperty(Identifier78.prototype, "originalKeywordKind")) {
174860
- Object.defineProperty(Identifier78.prototype, "originalKeywordKind", {
175117
+ const Identifier79 = objectAllocator2.getIdentifierConstructor();
175118
+ if (!hasProperty(Identifier79.prototype, "originalKeywordKind")) {
175119
+ Object.defineProperty(Identifier79.prototype, "originalKeywordKind", {
174861
175120
  get: deprecate(function() {
174862
175121
  return identifierToKeywordKind(this);
174863
175122
  }, {
@@ -174869,8 +175128,8 @@ addObjectAllocatorPatcher((objectAllocator2) => {
174869
175128
  })
174870
175129
  });
174871
175130
  }
174872
- if (!hasProperty(Identifier78.prototype, "isInJSDocNamespace")) {
174873
- Object.defineProperty(Identifier78.prototype, "isInJSDocNamespace", {
175131
+ if (!hasProperty(Identifier79.prototype, "isInJSDocNamespace")) {
175132
+ Object.defineProperty(Identifier79.prototype, "isInJSDocNamespace", {
174874
175133
  get: deprecate(function() {
174875
175134
  return this.flags & 4096 /* IdentifierIsInJSDocNamespace */ ? true : void 0;
174876
175135
  }, {
@@ -188801,6 +189060,8 @@ start(initializeNodeSystem(), require("os").platform());
188801
189060
  isSignedNumericLiteral,
188802
189061
  isSimpleCopiableExpression,
188803
189062
  isSimpleInlineableExpression,
189063
+ isSimpleParameter,
189064
+ isSimpleParameterList,
188804
189065
  isSingleOrDoubleQuote,
188805
189066
  isSourceFile,
188806
189067
  isSourceFileFromLibrary,