@typescript-deploys/pr-build 5.4.0-pr-56300-6 → 5.4.0-pr-56183-8

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.
@@ -18,3 +18,4 @@ and limitations under the License.
18
18
 
19
19
  /// <reference lib="es2015" />
20
20
  /// <reference lib="es2016.array.include" />
21
+ /// <reference lib="es2016.intl" />
@@ -0,0 +1,31 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+
17
+ /// <reference no-default-lib="true"/>
18
+
19
+ declare namespace Intl {
20
+ /**
21
+ * The `Intl.getCanonicalLocales()` method returns an array containing
22
+ * the canonical locale names. Duplicates will be omitted and elements
23
+ * will be validated as structurally valid language tags.
24
+ *
25
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales)
26
+ *
27
+ * @param locale A list of String values for which to get the canonical locale names
28
+ * @returns An array containing the canonical and validated locale names.
29
+ */
30
+ function getCanonicalLocales(locale?: string | string[]): string[];
31
+ }
package/lib/tsc.js CHANGED
@@ -23404,7 +23404,7 @@ function createEmitHelperFactory(context) {
23404
23404
  ]
23405
23405
  );
23406
23406
  }
23407
- function createAwaiterHelper(hasLexicalThis, hasLexicalArguments, promiseConstructor, body) {
23407
+ function createAwaiterHelper(hasLexicalThis, argumentsExpression, promiseConstructor, parameters, body) {
23408
23408
  context.requestEmitHelper(awaiterHelper);
23409
23409
  const generatorFunc = factory2.createFunctionExpression(
23410
23410
  /*modifiers*/
@@ -23414,8 +23414,7 @@ function createEmitHelperFactory(context) {
23414
23414
  void 0,
23415
23415
  /*typeParameters*/
23416
23416
  void 0,
23417
- /*parameters*/
23418
- [],
23417
+ parameters ?? [],
23419
23418
  /*type*/
23420
23419
  void 0,
23421
23420
  body
@@ -23427,7 +23426,7 @@ function createEmitHelperFactory(context) {
23427
23426
  void 0,
23428
23427
  [
23429
23428
  hasLexicalThis ? factory2.createThis() : factory2.createVoidZero(),
23430
- hasLexicalArguments ? factory2.createIdentifier("arguments") : factory2.createVoidZero(),
23429
+ argumentsExpression ?? factory2.createVoidZero(),
23431
23430
  promiseConstructor ? createExpressionFromEntityName(factory2, promiseConstructor) : factory2.createVoidZero(),
23432
23431
  generatorFunc
23433
23432
  ]
@@ -33842,6 +33841,7 @@ var libEntries = [
33842
33841
  ["es2015.symbol", "lib.es2015.symbol.d.ts"],
33843
33842
  ["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
33844
33843
  ["es2016.array.include", "lib.es2016.array.include.d.ts"],
33844
+ ["es2016.intl", "lib.es2016.intl.d.ts"],
33845
33845
  ["es2017.date", "lib.es2017.date.d.ts"],
33846
33846
  ["es2017.object", "lib.es2017.object.d.ts"],
33847
33847
  ["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
@@ -34173,6 +34173,7 @@ var targetOptionDeclaration = {
34173
34173
  affectsModuleResolution: true,
34174
34174
  affectsEmit: true,
34175
34175
  affectsBuildInfo: true,
34176
+ deprecatedKeys: /* @__PURE__ */ new Set(["es3"]),
34176
34177
  paramType: Diagnostics.VERSION,
34177
34178
  showInSimplifiedHelpView: true,
34178
34179
  category: Diagnostics.Language_and_Environment,
@@ -63740,7 +63741,7 @@ function createTypeChecker(host) {
63740
63741
  const templateType = getTemplateTypeFromMappedType(target);
63741
63742
  const inference = createInferenceInfo(typeParameter);
63742
63743
  inferTypes([inference], sourceType, templateType);
63743
- return getTypeFromInference(inference) || getBaseConstraintOfType(typeParameter) || unknownType;
63744
+ return getTypeFromInference(inference) || unknownType;
63744
63745
  }
63745
63746
  function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
63746
63747
  const properties = getPropertiesOfType(target);
@@ -66869,15 +66870,23 @@ function createTypeChecker(host) {
66869
66870
  error(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
66870
66871
  return errorType;
66871
66872
  }
66872
- const container = getContainingFunction(node);
66873
- if (languageVersion < 2 /* ES2015 */) {
66874
- if (container.kind === 219 /* ArrowFunction */) {
66875
- error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
66876
- } else if (hasSyntacticModifier(container, 1024 /* Async */)) {
66877
- error(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);
66873
+ let container = getContainingFunction(node);
66874
+ if (container) {
66875
+ if (languageVersion < 2 /* ES2015 */) {
66876
+ if (container.kind === 219 /* ArrowFunction */) {
66877
+ error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
66878
+ } else if (hasSyntacticModifier(container, 1024 /* Async */)) {
66879
+ error(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);
66880
+ }
66881
+ }
66882
+ getNodeLinks(container).flags |= 512 /* CaptureArguments */;
66883
+ while (container && isArrowFunction(container)) {
66884
+ container = getContainingFunction(container);
66885
+ if (container) {
66886
+ getNodeLinks(container).flags |= 512 /* CaptureArguments */;
66887
+ }
66878
66888
  }
66879
66889
  }
66880
- getNodeLinks(container).flags |= 512 /* CaptureArguments */;
66881
66890
  return getTypeOfSymbol(symbol);
66882
66891
  }
66883
66892
  if (shouldMarkIdentifierAliasReferenced(node)) {
@@ -68102,6 +68111,17 @@ function createTypeChecker(host) {
68102
68111
  isTypeAssignableTo
68103
68112
  );
68104
68113
  }
68114
+ function filterContextualTypeForLiteralExpressionOfObject(node, contextualType) {
68115
+ if (!isLiteralExpressionOfObject(node)) {
68116
+ return contextualType;
68117
+ }
68118
+ return filterType(contextualType, (t) => {
68119
+ if (!t.symbol || !(t.symbol.flags & 32 /* Class */)) {
68120
+ return true;
68121
+ }
68122
+ return every(getPropertiesOfType(t), (p) => !p.valueDeclaration || !isNamedDeclaration(p.valueDeclaration) || !isPrivateIdentifier(p.valueDeclaration.name) && !(getDeclarationModifierFlagsFromSymbol(p) & 6 /* NonPublicAccessibilityModifier */));
68123
+ });
68124
+ }
68105
68125
  function getApparentTypeOfContextualType(node, contextFlags) {
68106
68126
  const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType(node, contextFlags);
68107
68127
  const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
@@ -68145,7 +68165,6 @@ function createTypeChecker(host) {
68145
68165
  return type;
68146
68166
  }
68147
68167
  function getContextualType(node, contextFlags) {
68148
- var _a;
68149
68168
  if (node.flags & 67108864 /* InWithStatement */) {
68150
68169
  return void 0;
68151
68170
  }
@@ -68157,6 +68176,14 @@ function createTypeChecker(host) {
68157
68176
  if (index >= 0) {
68158
68177
  return contextualTypes[index];
68159
68178
  }
68179
+ const contextualType = getContextualTypeWorker(node, contextFlags);
68180
+ if (!contextualType) {
68181
+ return void 0;
68182
+ }
68183
+ return filterContextualTypeForLiteralExpressionOfObject(node, contextualType);
68184
+ }
68185
+ function getContextualTypeWorker(node, contextFlags) {
68186
+ var _a;
68160
68187
  const { parent } = node;
68161
68188
  switch (parent.kind) {
68162
68189
  case 260 /* VariableDeclaration */:
@@ -74937,10 +74964,11 @@ function createTypeChecker(host) {
74937
74964
  return node;
74938
74965
  }
74939
74966
  function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
74967
+ const filteredContextualType = filterContextualTypeForLiteralExpressionOfObject(node, contextualType);
74940
74968
  const contextNode = getContextNode(node);
74941
74969
  pushContextualType(
74942
74970
  contextNode,
74943
- contextualType,
74971
+ filteredContextualType,
74944
74972
  /*isCache*/
74945
74973
  false
74946
74974
  );
@@ -74950,7 +74978,7 @@ function createTypeChecker(host) {
74950
74978
  inferenceContext.intraExpressionInferenceSites = void 0;
74951
74979
  }
74952
74980
  const result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(
74953
- contextualType,
74981
+ filteredContextualType,
74954
74982
  node,
74955
74983
  /*contextFlags*/
74956
74984
  void 0
@@ -86744,6 +86772,12 @@ function setPrivateIdentifier(privateEnv, name, entry) {
86744
86772
  function accessPrivateIdentifier(env, name) {
86745
86773
  return walkUpLexicalEnvironments(env, (env2) => getPrivateIdentifier(env2.privateEnv, name));
86746
86774
  }
86775
+ function isSimpleParameter(node) {
86776
+ return !node.initializer && isIdentifier(node.name);
86777
+ }
86778
+ function isSimpleParameterList(nodes) {
86779
+ return every(nodes, isSimpleParameter);
86780
+ }
86747
86781
 
86748
86782
  // src/compiler/transformers/destructuring.ts
86749
86783
  function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) {
@@ -94220,6 +94254,7 @@ function transformES2017(context) {
94220
94254
  let enclosingFunctionParameterNames;
94221
94255
  let capturedSuperProperties;
94222
94256
  let hasSuperElementAccess;
94257
+ let lexicalArgumentsBinding;
94223
94258
  const substitutedSuperAccessors = [];
94224
94259
  let contextFlags = 0 /* None */;
94225
94260
  const previousOnEmitNode = context.onEmitNode;
@@ -94270,9 +94305,30 @@ function transformES2017(context) {
94270
94305
  function visitDefault(node) {
94271
94306
  return visitEachChild(node, visitor, context);
94272
94307
  }
94308
+ function argumentsVisitor(node) {
94309
+ switch (node.kind) {
94310
+ case 218 /* FunctionExpression */:
94311
+ case 262 /* FunctionDeclaration */:
94312
+ case 174 /* MethodDeclaration */:
94313
+ case 177 /* GetAccessor */:
94314
+ case 178 /* SetAccessor */:
94315
+ case 176 /* Constructor */:
94316
+ return node;
94317
+ case 169 /* Parameter */:
94318
+ case 208 /* BindingElement */:
94319
+ case 260 /* VariableDeclaration */:
94320
+ break;
94321
+ case 80 /* Identifier */:
94322
+ if (lexicalArgumentsBinding && resolver.isArgumentsLocalBinding(node)) {
94323
+ return lexicalArgumentsBinding;
94324
+ }
94325
+ break;
94326
+ }
94327
+ return visitEachChild(node, argumentsVisitor, context);
94328
+ }
94273
94329
  function visitor(node) {
94274
94330
  if ((node.transformFlags & 256 /* ContainsES2017 */) === 0) {
94275
- return node;
94331
+ return lexicalArgumentsBinding ? argumentsVisitor(node) : node;
94276
94332
  }
94277
94333
  switch (node.kind) {
94278
94334
  case 134 /* AsyncKeyword */:
@@ -94430,15 +94486,23 @@ function transformES2017(context) {
94430
94486
  );
94431
94487
  }
94432
94488
  function visitConstructorDeclaration(node) {
94433
- return factory2.updateConstructorDeclaration(
94489
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
94490
+ lexicalArgumentsBinding = void 0;
94491
+ const updated = factory2.updateConstructorDeclaration(
94434
94492
  node,
94435
94493
  visitNodes2(node.modifiers, visitor, isModifier),
94436
94494
  visitParameterList(node.parameters, visitor, context),
94437
94495
  transformMethodBody(node)
94438
94496
  );
94497
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
94498
+ return updated;
94439
94499
  }
94440
94500
  function visitMethodDeclaration(node) {
94441
- return factory2.updateMethodDeclaration(
94501
+ let parameters;
94502
+ const functionFlags = getFunctionFlags(node);
94503
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
94504
+ lexicalArgumentsBinding = void 0;
94505
+ const updated = factory2.updateMethodDeclaration(
94442
94506
  node,
94443
94507
  visitNodes2(node.modifiers, visitor, isModifierLike),
94444
94508
  node.asteriskToken,
@@ -94447,14 +94511,18 @@ function transformES2017(context) {
94447
94511
  void 0,
94448
94512
  /*typeParameters*/
94449
94513
  void 0,
94450
- visitParameterList(node.parameters, visitor, context),
94514
+ parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
94451
94515
  /*type*/
94452
94516
  void 0,
94453
- getFunctionFlags(node) & 2 /* Async */ ? transformAsyncFunctionBody(node) : transformMethodBody(node)
94517
+ functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : transformMethodBody(node)
94454
94518
  );
94519
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
94520
+ return updated;
94455
94521
  }
94456
94522
  function visitGetAccessorDeclaration(node) {
94457
- return factory2.updateGetAccessorDeclaration(
94523
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
94524
+ lexicalArgumentsBinding = void 0;
94525
+ const updated = factory2.updateGetAccessorDeclaration(
94458
94526
  node,
94459
94527
  visitNodes2(node.modifiers, visitor, isModifierLike),
94460
94528
  node.name,
@@ -94463,55 +94531,75 @@ function transformES2017(context) {
94463
94531
  void 0,
94464
94532
  transformMethodBody(node)
94465
94533
  );
94534
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
94535
+ return updated;
94466
94536
  }
94467
94537
  function visitSetAccessorDeclaration(node) {
94468
- return factory2.updateSetAccessorDeclaration(
94538
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
94539
+ lexicalArgumentsBinding = void 0;
94540
+ const updated = factory2.updateSetAccessorDeclaration(
94469
94541
  node,
94470
94542
  visitNodes2(node.modifiers, visitor, isModifierLike),
94471
94543
  node.name,
94472
94544
  visitParameterList(node.parameters, visitor, context),
94473
94545
  transformMethodBody(node)
94474
94546
  );
94547
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
94548
+ return updated;
94475
94549
  }
94476
94550
  function visitFunctionDeclaration(node) {
94477
- return factory2.updateFunctionDeclaration(
94551
+ let parameters;
94552
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
94553
+ lexicalArgumentsBinding = void 0;
94554
+ const functionFlags = getFunctionFlags(node);
94555
+ const updated = factory2.updateFunctionDeclaration(
94478
94556
  node,
94479
94557
  visitNodes2(node.modifiers, visitor, isModifierLike),
94480
94558
  node.asteriskToken,
94481
94559
  node.name,
94482
94560
  /*typeParameters*/
94483
94561
  void 0,
94484
- visitParameterList(node.parameters, visitor, context),
94562
+ parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
94485
94563
  /*type*/
94486
94564
  void 0,
94487
- getFunctionFlags(node) & 2 /* Async */ ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context)
94565
+ functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
94488
94566
  );
94567
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
94568
+ return updated;
94489
94569
  }
94490
94570
  function visitFunctionExpression(node) {
94491
- return factory2.updateFunctionExpression(
94571
+ let parameters;
94572
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
94573
+ lexicalArgumentsBinding = void 0;
94574
+ const functionFlags = getFunctionFlags(node);
94575
+ const updated = factory2.updateFunctionExpression(
94492
94576
  node,
94493
94577
  visitNodes2(node.modifiers, visitor, isModifier),
94494
94578
  node.asteriskToken,
94495
94579
  node.name,
94496
94580
  /*typeParameters*/
94497
94581
  void 0,
94498
- visitParameterList(node.parameters, visitor, context),
94582
+ parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
94499
94583
  /*type*/
94500
94584
  void 0,
94501
- getFunctionFlags(node) & 2 /* Async */ ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context)
94585
+ functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
94502
94586
  );
94587
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
94588
+ return updated;
94503
94589
  }
94504
94590
  function visitArrowFunction(node) {
94591
+ let parameters;
94592
+ const functionFlags = getFunctionFlags(node);
94505
94593
  return factory2.updateArrowFunction(
94506
94594
  node,
94507
94595
  visitNodes2(node.modifiers, visitor, isModifier),
94508
94596
  /*typeParameters*/
94509
94597
  void 0,
94510
- visitParameterList(node.parameters, visitor, context),
94598
+ parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
94511
94599
  /*type*/
94512
94600
  void 0,
94513
94601
  node.equalsGreaterThanToken,
94514
- getFunctionFlags(node) & 2 /* Async */ ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context)
94602
+ functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
94515
94603
  );
94516
94604
  }
94517
94605
  function recordDeclarationName({ name }, names) {
@@ -94605,13 +94693,91 @@ function transformES2017(context) {
94605
94693
  hasSuperElementAccess = savedHasSuperElementAccess;
94606
94694
  return updated;
94607
94695
  }
94608
- function transformAsyncFunctionBody(node) {
94696
+ function createCaptureArgumentsStatement() {
94697
+ Debug.assert(lexicalArgumentsBinding);
94698
+ const variable = factory2.createVariableDeclaration(
94699
+ lexicalArgumentsBinding,
94700
+ /*exclamationToken*/
94701
+ void 0,
94702
+ /*type*/
94703
+ void 0,
94704
+ factory2.createIdentifier("arguments")
94705
+ );
94706
+ const statement = factory2.createVariableStatement(
94707
+ /*modifiers*/
94708
+ void 0,
94709
+ [variable]
94710
+ );
94711
+ startOnNewLine(statement);
94712
+ addEmitFlags(statement, 2097152 /* CustomPrologue */);
94713
+ return statement;
94714
+ }
94715
+ function transformAsyncFunctionParameterList(node) {
94716
+ if (isSimpleParameterList(node.parameters)) {
94717
+ return visitParameterList(node.parameters, visitor, context);
94718
+ }
94719
+ const newParameters = [];
94720
+ for (const parameter of node.parameters) {
94721
+ if (parameter.initializer || parameter.dotDotDotToken) {
94722
+ if (node.kind === 219 /* ArrowFunction */) {
94723
+ const restParameter = factory2.createParameterDeclaration(
94724
+ /*modifiers*/
94725
+ void 0,
94726
+ factory2.createToken(26 /* DotDotDotToken */),
94727
+ factory2.createUniqueName("args", 8 /* ReservedInNestedScopes */)
94728
+ );
94729
+ newParameters.push(restParameter);
94730
+ }
94731
+ break;
94732
+ }
94733
+ const newParameter = factory2.createParameterDeclaration(
94734
+ /*modifiers*/
94735
+ void 0,
94736
+ /*dotDotDotToken*/
94737
+ void 0,
94738
+ factory2.getGeneratedNameForNode(parameter.name, 8 /* ReservedInNestedScopes */)
94739
+ );
94740
+ newParameters.push(newParameter);
94741
+ }
94742
+ const newParametersArray = factory2.createNodeArray(newParameters);
94743
+ setTextRange(newParametersArray, node.parameters);
94744
+ return newParametersArray;
94745
+ }
94746
+ function transformAsyncFunctionBody(node, outerParameters) {
94747
+ const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0;
94609
94748
  resumeLexicalEnvironment();
94610
94749
  const original = getOriginalNode(node, isFunctionLike);
94611
94750
  const nodeType = original.type;
94612
94751
  const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
94613
94752
  const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
94753
+ const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
94614
94754
  const hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 512 /* CaptureArguments */) !== 0;
94755
+ const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
94756
+ if (captureLexicalArguments) {
94757
+ lexicalArgumentsBinding = factory2.createUniqueName("arguments");
94758
+ }
94759
+ let argumentsExpression;
94760
+ if (innerParameters) {
94761
+ if (isArrowFunction2) {
94762
+ const parameterBindings = [];
94763
+ Debug.assert(outerParameters.length <= node.parameters.length);
94764
+ for (let i = 0; i < node.parameters.length; i++) {
94765
+ Debug.assert(i < outerParameters.length);
94766
+ const originalParameter = node.parameters[i];
94767
+ const outerParameter = outerParameters[i];
94768
+ Debug.assertNode(outerParameter.name, isIdentifier);
94769
+ if (originalParameter.initializer || originalParameter.dotDotDotToken) {
94770
+ Debug.assert(i === outerParameters.length - 1);
94771
+ parameterBindings.push(factory2.createSpreadElement(outerParameter.name));
94772
+ break;
94773
+ }
94774
+ parameterBindings.push(outerParameter.name);
94775
+ }
94776
+ argumentsExpression = factory2.createArrayLiteralExpression(parameterBindings);
94777
+ } else {
94778
+ argumentsExpression = factory2.createIdentifier("arguments");
94779
+ }
94780
+ }
94615
94781
  const savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames;
94616
94782
  enclosingFunctionParameterNames = /* @__PURE__ */ new Set();
94617
94783
  for (const parameter of node.parameters) {
@@ -94623,27 +94789,23 @@ function transformES2017(context) {
94623
94789
  capturedSuperProperties = /* @__PURE__ */ new Set();
94624
94790
  hasSuperElementAccess = false;
94625
94791
  }
94792
+ const hasLexicalThis = inHasLexicalThisContext();
94793
+ let asyncBody = transformAsyncFunctionBodyWorker(node.body);
94794
+ asyncBody = factory2.updateBlock(asyncBody, factory2.mergeLexicalEnvironment(asyncBody.statements, endLexicalEnvironment()));
94626
94795
  let result;
94627
94796
  if (!isArrowFunction2) {
94628
94797
  const statements = [];
94629
- const statementOffset = factory2.copyPrologue(
94630
- node.body.statements,
94631
- statements,
94632
- /*ensureUseStrict*/
94633
- false,
94634
- visitor
94635
- );
94636
94798
  statements.push(
94637
94799
  factory2.createReturnStatement(
94638
94800
  emitHelpers().createAwaiterHelper(
94639
- inHasLexicalThisContext(),
94640
- hasLexicalArguments,
94801
+ hasLexicalThis,
94802
+ argumentsExpression,
94641
94803
  promiseConstructor,
94642
- transformAsyncFunctionBodyWorker(node.body, statementOffset)
94804
+ innerParameters,
94805
+ asyncBody
94643
94806
  )
94644
94807
  )
94645
94808
  );
94646
- insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
94647
94809
  const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */);
94648
94810
  if (emitSuperHelpers) {
94649
94811
  enableSubstitutionForAsyncMethodsWithSuper();
@@ -94653,6 +94815,9 @@ function transformES2017(context) {
94653
94815
  insertStatementsAfterStandardPrologue(statements, [variableStatement]);
94654
94816
  }
94655
94817
  }
94818
+ if (captureLexicalArguments) {
94819
+ insertStatementsAfterStandardPrologue(statements, [createCaptureArgumentsStatement()]);
94820
+ }
94656
94821
  const block = factory2.createBlock(
94657
94822
  statements,
94658
94823
  /*multiLine*/
@@ -94668,24 +94833,23 @@ function transformES2017(context) {
94668
94833
  }
94669
94834
  result = block;
94670
94835
  } else {
94671
- const expression = emitHelpers().createAwaiterHelper(
94672
- inHasLexicalThisContext(),
94673
- hasLexicalArguments,
94836
+ result = emitHelpers().createAwaiterHelper(
94837
+ hasLexicalThis,
94838
+ argumentsExpression,
94674
94839
  promiseConstructor,
94675
- transformAsyncFunctionBodyWorker(node.body)
94840
+ innerParameters,
94841
+ asyncBody
94676
94842
  );
94677
- const declarations = endLexicalEnvironment();
94678
- if (some(declarations)) {
94679
- const block = factory2.converters.convertToFunctionBlock(expression);
94680
- result = factory2.updateBlock(block, setTextRange(factory2.createNodeArray(concatenate(declarations, block.statements)), block.statements));
94681
- } else {
94682
- result = expression;
94843
+ if (captureLexicalArguments) {
94844
+ const block = factory2.converters.convertToFunctionBlock(result);
94845
+ result = factory2.updateBlock(block, factory2.mergeLexicalEnvironment(block.statements, [createCaptureArgumentsStatement()]));
94683
94846
  }
94684
94847
  }
94685
94848
  enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames;
94686
94849
  if (!isArrowFunction2) {
94687
94850
  capturedSuperProperties = savedCapturedSuperProperties;
94688
94851
  hasSuperElementAccess = savedHasSuperElementAccess;
94852
+ lexicalArgumentsBinding = savedLexicalArgumentsBinding;
94689
94853
  }
94690
94854
  return result;
94691
94855
  }
@@ -95801,7 +95965,7 @@ function transformES2018(context) {
95801
95965
  ),
95802
95966
  /*typeParameters*/
95803
95967
  void 0,
95804
- visitParameterList(node.parameters, parameterVisitor, context),
95968
+ enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
95805
95969
  /*type*/
95806
95970
  void 0,
95807
95971
  enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody(node)
@@ -95822,7 +95986,7 @@ function transformES2018(context) {
95822
95986
  node.name,
95823
95987
  /*typeParameters*/
95824
95988
  void 0,
95825
- visitParameterList(node.parameters, parameterVisitor, context),
95989
+ enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
95826
95990
  /*type*/
95827
95991
  void 0,
95828
95992
  enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody(node)
@@ -95863,7 +96027,7 @@ function transformES2018(context) {
95863
96027
  node.name,
95864
96028
  /*typeParameters*/
95865
96029
  void 0,
95866
- visitParameterList(node.parameters, parameterVisitor, context),
96030
+ enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
95867
96031
  /*type*/
95868
96032
  void 0,
95869
96033
  enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody(node)
@@ -95872,21 +96036,38 @@ function transformES2018(context) {
95872
96036
  parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread;
95873
96037
  return updated;
95874
96038
  }
96039
+ function transformAsyncGeneratorFunctionParameterList(node) {
96040
+ if (isSimpleParameterList(node.parameters)) {
96041
+ return visitParameterList(node.parameters, visitor, context);
96042
+ }
96043
+ const newParameters = [];
96044
+ for (const parameter of node.parameters) {
96045
+ if (parameter.initializer || parameter.dotDotDotToken) {
96046
+ break;
96047
+ }
96048
+ const newParameter = factory2.createParameterDeclaration(
96049
+ /*modifiers*/
96050
+ void 0,
96051
+ /*dotDotDotToken*/
96052
+ void 0,
96053
+ factory2.getGeneratedNameForNode(parameter.name, 8 /* ReservedInNestedScopes */)
96054
+ );
96055
+ newParameters.push(newParameter);
96056
+ }
96057
+ const newParametersArray = factory2.createNodeArray(newParameters);
96058
+ setTextRange(newParametersArray, node.parameters);
96059
+ return newParametersArray;
96060
+ }
95875
96061
  function transformAsyncGeneratorFunctionBody(node) {
96062
+ const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0;
95876
96063
  resumeLexicalEnvironment();
95877
- const statements = [];
95878
- const statementOffset = factory2.copyPrologue(
95879
- node.body.statements,
95880
- statements,
95881
- /*ensureUseStrict*/
95882
- false,
95883
- visitor
95884
- );
95885
- appendObjectRestAssignmentsIfNeeded(statements, node);
95886
96064
  const savedCapturedSuperProperties = capturedSuperProperties;
95887
96065
  const savedHasSuperElementAccess = hasSuperElementAccess;
95888
96066
  capturedSuperProperties = /* @__PURE__ */ new Set();
95889
96067
  hasSuperElementAccess = false;
96068
+ const outerStatements = [];
96069
+ let asyncBody = factory2.updateBlock(node.body, visitNodes2(node.body.statements, visitor, isStatement));
96070
+ asyncBody = factory2.updateBlock(asyncBody, factory2.mergeLexicalEnvironment(asyncBody.statements, appendObjectRestAssignmentsIfNeeded(endLexicalEnvironment(), node)));
95890
96071
  const returnStatement = factory2.createReturnStatement(
95891
96072
  emitHelpers().createAsyncGeneratorHelper(
95892
96073
  factory2.createFunctionExpression(
@@ -95896,14 +96077,10 @@ function transformES2018(context) {
95896
96077
  node.name && factory2.getGeneratedNameForNode(node.name),
95897
96078
  /*typeParameters*/
95898
96079
  void 0,
95899
- /*parameters*/
95900
- [],
96080
+ innerParameters ?? [],
95901
96081
  /*type*/
95902
96082
  void 0,
95903
- factory2.updateBlock(
95904
- node.body,
95905
- visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)
95906
- )
96083
+ asyncBody
95907
96084
  ),
95908
96085
  !!(hierarchyFacts & 1 /* HasLexicalThis */)
95909
96086
  )
@@ -95913,11 +96090,10 @@ function transformES2018(context) {
95913
96090
  enableSubstitutionForAsyncMethodsWithSuper();
95914
96091
  const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
95915
96092
  substitutedSuperAccessors[getNodeId(variableStatement)] = true;
95916
- insertStatementsAfterStandardPrologue(statements, [variableStatement]);
96093
+ insertStatementsAfterStandardPrologue(outerStatements, [variableStatement]);
95917
96094
  }
95918
- statements.push(returnStatement);
95919
- insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
95920
- const block = factory2.updateBlock(node.body, statements);
96095
+ outerStatements.push(returnStatement);
96096
+ const block = factory2.updateBlock(node.body, outerStatements);
95921
96097
  if (emitSuperHelpers && hasSuperElementAccess) {
95922
96098
  if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
95923
96099
  addEmitHelper(block, advancedAsyncSuperHelper);
@@ -125890,7 +126066,10 @@ function generateOptionOutput(sys2, option, rightAlignOfLeft, leftAlignOfRight)
125890
126066
  default:
125891
126067
  const inverted = {};
125892
126068
  option3.type.forEach((value, name2) => {
125893
- (inverted[value] || (inverted[value] = [])).push(name2);
126069
+ var _a2;
126070
+ if (!((_a2 = option3.deprecatedKeys) == null ? void 0 : _a2.has(name2))) {
126071
+ (inverted[value] || (inverted[value] = [])).push(name2);
126072
+ }
125894
126073
  });
125895
126074
  return Object.entries(inverted).map(([, synonyms]) => synonyms.join("/")).join(", ");
125896
126075
  }