@typescript-deploys/pr-build 5.3.0-pr-55811-15 → 5.3.0-pr-56201-9

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/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.3";
21
- var version = `${versionMajorMinor}.0-insiders.20231023`;
21
+ var version = `${versionMajorMinor}.0-insiders.20231024`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -18747,8 +18747,9 @@ function createNodeFactory(flags, baseFactory2) {
18747
18747
  ensureUseStrict,
18748
18748
  liftToBlock,
18749
18749
  mergeLexicalEnvironment,
18750
- updateModifiers,
18751
- updateModifierLike
18750
+ replaceModifiers,
18751
+ replaceDecoratorsAndModifiers,
18752
+ replacePropertyName
18752
18753
  };
18753
18754
  forEach(nodeFactoryPatchers, (fn) => fn(factory2));
18754
18755
  return factory2;
@@ -22256,7 +22257,7 @@ function createNodeFactory(flags, baseFactory2) {
22256
22257
  }
22257
22258
  return statements;
22258
22259
  }
22259
- function updateModifiers(node, modifiers) {
22260
+ function replaceModifiers(node, modifiers) {
22260
22261
  let modifierArray;
22261
22262
  if (typeof modifiers === "number") {
22262
22263
  modifierArray = createModifiersFromModifierFlags(modifiers);
@@ -22265,9 +22266,27 @@ function createNodeFactory(flags, baseFactory2) {
22265
22266
  }
22266
22267
  return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.attributes) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.attributes) : Debug.assertNever(node);
22267
22268
  }
22268
- function updateModifierLike(node, modifierArray) {
22269
+ function replaceDecoratorsAndModifiers(node, modifierArray) {
22269
22270
  return isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isPropertyDeclaration(node) ? updatePropertyDeclaration(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : Debug.assertNever(node);
22270
22271
  }
22272
+ function replacePropertyName(node, name) {
22273
+ switch (node.kind) {
22274
+ case 177 /* GetAccessor */:
22275
+ return updateGetAccessorDeclaration(node, node.modifiers, name, node.parameters, node.type, node.body);
22276
+ case 178 /* SetAccessor */:
22277
+ return updateSetAccessorDeclaration(node, node.modifiers, name, node.parameters, node.body);
22278
+ case 174 /* MethodDeclaration */:
22279
+ return updateMethodDeclaration(node, node.modifiers, node.asteriskToken, name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body);
22280
+ case 173 /* MethodSignature */:
22281
+ return updateMethodSignature(node, node.modifiers, name, node.questionToken, node.typeParameters, node.parameters, node.type);
22282
+ case 172 /* PropertyDeclaration */:
22283
+ return updatePropertyDeclaration(node, node.modifiers, name, node.questionToken ?? node.exclamationToken, node.type, node.initializer);
22284
+ case 171 /* PropertySignature */:
22285
+ return updatePropertySignature(node, node.modifiers, name, node.questionToken, node.type);
22286
+ case 303 /* PropertyAssignment */:
22287
+ return updatePropertyAssignment(node, name, node.initializer);
22288
+ }
22289
+ }
22271
22290
  function asNodeArray(array) {
22272
22291
  return array ? createNodeArray(array) : void 0;
22273
22292
  }
@@ -49933,11 +49952,11 @@ function createTypeChecker(host) {
49933
49952
  }
49934
49953
  function addExportModifier(node) {
49935
49954
  const flags = (getEffectiveModifierFlags(node) | 1 /* Export */) & ~2 /* Ambient */;
49936
- return factory.updateModifiers(node, flags);
49955
+ return factory.replaceModifiers(node, flags);
49937
49956
  }
49938
49957
  function removeExportModifier(node) {
49939
49958
  const flags = getEffectiveModifierFlags(node) & ~1 /* Export */;
49940
- return factory.updateModifiers(node, flags);
49959
+ return factory.replaceModifiers(node, flags);
49941
49960
  }
49942
49961
  function visitSymbolTable(symbolTable2, suppressNewPrivateContext, propertyAsAlias) {
49943
49962
  if (!suppressNewPrivateContext) {
@@ -50178,7 +50197,7 @@ function createTypeChecker(host) {
50178
50197
  newModifierFlags |= 1024 /* Default */;
50179
50198
  }
50180
50199
  if (newModifierFlags) {
50181
- node = factory.updateModifiers(node, newModifierFlags | getEffectiveModifierFlags(node));
50200
+ node = factory.replaceModifiers(node, newModifierFlags | getEffectiveModifierFlags(node));
50182
50201
  }
50183
50202
  }
50184
50203
  results.push(node);
@@ -54051,18 +54070,6 @@ function createTypeChecker(host) {
54051
54070
  function replaceIndexedAccess(instantiable, type, replacement) {
54052
54071
  return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
54053
54072
  }
54054
- function getLimitedConstraint(type) {
54055
- const constraint = getConstraintTypeFromMappedType(type.mappedType);
54056
- if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
54057
- return;
54058
- }
54059
- const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
54060
- if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
54061
- return;
54062
- }
54063
- const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
54064
- return limitedConstraint !== neverType ? limitedConstraint : void 0;
54065
- }
54066
54073
  function resolveReverseMappedTypeMembers(type) {
54067
54074
  const indexInfo = getIndexInfoOfType(type.source, stringType);
54068
54075
  const modifiers = getMappedTypeModifiers(type.mappedType);
@@ -54070,14 +54077,7 @@ function createTypeChecker(host) {
54070
54077
  const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
54071
54078
  const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
54072
54079
  const members = createSymbolTable();
54073
- const limitedConstraint = getLimitedConstraint(type);
54074
54080
  for (const prop of getPropertiesOfType(type.source)) {
54075
- if (limitedConstraint) {
54076
- const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
54077
- if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
54078
- continue;
54079
- }
54080
- }
54081
54081
  const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
54082
54082
  const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
54083
54083
  inferredProp.declarations = prop.declarations;
@@ -64198,7 +64198,7 @@ function createTypeChecker(host) {
64198
64198
  }
64199
64199
  }
64200
64200
  function inferToMappedType(source, target, constraintType) {
64201
- if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
64201
+ if (constraintType.flags & 1048576 /* Union */) {
64202
64202
  let result = false;
64203
64203
  for (const type of constraintType.types) {
64204
64204
  result = inferToMappedType(source, target, type) || result;
@@ -67786,7 +67786,7 @@ function createTypeChecker(host) {
67786
67786
  type,
67787
67787
  (t) => {
67788
67788
  var _a;
67789
- if (isGenericMappedType(t) && !t.declaration.nameType) {
67789
+ if (isGenericMappedType(t) && (!t.declaration.nameType || isFilteringMappedType(t))) {
67790
67790
  const constraint = getConstraintTypeFromMappedType(t);
67791
67791
  const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
67792
67792
  const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
@@ -98021,7 +98021,7 @@ function transformES2015(context) {
98021
98021
  hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -32768 /* SubtreeFactsMask */ | ancestorFacts;
98022
98022
  }
98023
98023
  function isReturnVoidStatementInConstructorWithCapturedSuper(node) {
98024
- return (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */) !== 0 && node.kind === 253 /* ReturnStatement */ && !node.expression;
98024
+ return (hierarchyFacts & 8192 /* ConstructorWithSuperCall */) !== 0 && node.kind === 253 /* ReturnStatement */ && !node.expression;
98025
98025
  }
98026
98026
  function isOrMayContainReturnCompletion(node) {
98027
98027
  return node.transformFlags & 4194304 /* ContainsHoistedDeclarationOrCompletion */ && (isReturnStatement(node) || isIfStatement(node) || isWithStatement(node) || isSwitchStatement(node) || isCaseBlock(node) || isCaseClause(node) || isDefaultClause(node) || isTryStatement(node) || isCatchClause(node) || isLabeledStatement(node) || isIterationStatement(
@@ -98031,7 +98031,7 @@ function transformES2015(context) {
98031
98031
  ) || isBlock(node));
98032
98032
  }
98033
98033
  function shouldVisitNode(node) {
98034
- return (node.transformFlags & 1024 /* ContainsES2015 */) !== 0 || convertedLoopState !== void 0 || hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */ && isOrMayContainReturnCompletion(node) || isIterationStatement(
98034
+ return (node.transformFlags & 1024 /* ContainsES2015 */) !== 0 || convertedLoopState !== void 0 || hierarchyFacts & 8192 /* ConstructorWithSuperCall */ && isOrMayContainReturnCompletion(node) || isIterationStatement(
98035
98035
  node,
98036
98036
  /*lookInLabeledStatements*/
98037
98037
  false
@@ -98064,7 +98064,7 @@ function transformES2015(context) {
98064
98064
  /*expressionResultIsUnused*/
98065
98065
  false
98066
98066
  );
98067
- exitSubtree(ancestorFacts, 98304 /* FunctionSubtreeExcludes */, 0 /* None */);
98067
+ exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
98068
98068
  return result;
98069
98069
  }
98070
98070
  return visitorWorker(
@@ -98078,6 +98078,7 @@ function transformES2015(context) {
98078
98078
  function callExpressionVisitor(node) {
98079
98079
  if (node.kind === 108 /* SuperKeyword */) {
98080
98080
  return visitSuperKeyword(
98081
+ node,
98081
98082
  /*isExpressionOfCall*/
98082
98083
  true
98083
98084
  );
@@ -98187,6 +98188,7 @@ function transformES2015(context) {
98187
98188
  return visitSpreadElement(node);
98188
98189
  case 108 /* SuperKeyword */:
98189
98190
  return visitSuperKeyword(
98191
+ node,
98190
98192
  /*isExpressionOfCall*/
98191
98193
  false
98192
98194
  );
@@ -98256,7 +98258,10 @@ function transformES2015(context) {
98256
98258
  return updated;
98257
98259
  }
98258
98260
  function returnCapturedThis(node) {
98259
- return setOriginalNode(factory2.createReturnStatement(factory2.createUniqueName("_this", 16 /* Optimistic */ | 32 /* FileLevel */)), node);
98261
+ return setOriginalNode(factory2.createReturnStatement(createCapturedThis()), node);
98262
+ }
98263
+ function createCapturedThis() {
98264
+ return factory2.createUniqueName("_this", 16 /* Optimistic */ | 32 /* FileLevel */);
98260
98265
  }
98261
98266
  function visitReturnStatement(node) {
98262
98267
  if (convertedLoopState) {
@@ -98280,8 +98285,9 @@ function transformES2015(context) {
98280
98285
  return visitEachChild(node, visitor, context);
98281
98286
  }
98282
98287
  function visitThisKeyword(node) {
98288
+ hierarchyFacts |= 65536 /* LexicalThis */;
98283
98289
  if (hierarchyFacts & 2 /* ArrowFunction */ && !(hierarchyFacts & 16384 /* StaticInitializer */)) {
98284
- hierarchyFacts |= 65536 /* CapturedLexicalThis */;
98290
+ hierarchyFacts |= 131072 /* CapturedLexicalThis */;
98285
98291
  }
98286
98292
  if (convertedLoopState) {
98287
98293
  if (hierarchyFacts & 2 /* ArrowFunction */) {
@@ -98420,7 +98426,7 @@ function transformES2015(context) {
98420
98426
  void 0,
98421
98427
  /*dotDotDotToken*/
98422
98428
  void 0,
98423
- factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */)
98429
+ createSyntheticSuper()
98424
98430
  )] : [],
98425
98431
  /*type*/
98426
98432
  void 0,
@@ -98510,7 +98516,7 @@ function transformES2015(context) {
98510
98516
  setEmitFlags(constructorFunction, 16 /* CapturesThis */);
98511
98517
  }
98512
98518
  statements.push(constructorFunction);
98513
- exitSubtree(ancestorFacts, 98304 /* FunctionSubtreeExcludes */, 0 /* None */);
98519
+ exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
98514
98520
  convertedLoopState = savedConvertedLoopState;
98515
98521
  }
98516
98522
  function transformConstructorParameters(constructor, hasSynthesizedSuper) {
@@ -98534,103 +98540,35 @@ function transformES2015(context) {
98534
98540
  setEmitFlags(block, 3072 /* NoComments */);
98535
98541
  return block;
98536
98542
  }
98537
- function transformConstructorBodyWorker(prologueOut, statementsOut, statementsIn, statementOffset, superPath, superPathDepth, constructor, isDerivedClass, hasSynthesizedSuper, isFirstStatement) {
98538
- let mayReplaceThis = false;
98539
- const superStatementIndex = superPathDepth < superPath.length ? superPath[superPathDepth] : -1;
98540
- const leadingStatementsEnd = superStatementIndex >= 0 ? superStatementIndex : statementsIn.length;
98541
- if (isFirstStatement && superStatementIndex >= 0) {
98542
- let firstMaterialIndex = statementOffset;
98543
- while (isFirstStatement && firstMaterialIndex < superStatementIndex) {
98544
- const statement = constructor.body.statements[firstMaterialIndex];
98545
- if (!isUninitializedVariableStatement(statement) && !isUsingDeclarationStateVariableStatement(statement))
98546
- break;
98547
- firstMaterialIndex++;
98548
- }
98549
- isFirstStatement = superStatementIndex === firstMaterialIndex;
98550
- }
98551
- addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, statementOffset, leadingStatementsEnd - statementOffset));
98552
- const superStatement = superStatementIndex >= 0 ? statementsIn[superStatementIndex] : void 0;
98553
- if (superStatement && isTryStatement(superStatement)) {
98554
- const tryBlockStatements = [];
98555
- mayReplaceThis = transformConstructorBodyWorker(
98556
- prologueOut,
98557
- tryBlockStatements,
98558
- superStatement.tryBlock.statements,
98559
- /*statementOffset*/
98560
- 0,
98561
- superPath,
98562
- superPathDepth + 1,
98563
- constructor,
98564
- isDerivedClass,
98565
- hasSynthesizedSuper,
98566
- isFirstStatement
98567
- );
98568
- const tryBlockStatementsArray = factory2.createNodeArray(tryBlockStatements);
98569
- setTextRange(tryBlockStatementsArray, superStatement.tryBlock.statements);
98570
- statementsOut.push(factory2.updateTryStatement(
98571
- superStatement,
98572
- factory2.updateBlock(superStatement.tryBlock, tryBlockStatements),
98573
- visitNode(superStatement.catchClause, visitor, isCatchClause),
98574
- visitNode(superStatement.finallyBlock, visitor, isBlock)
98575
- ));
98576
- } else {
98577
- const superCall = superStatement && getSuperCallFromStatement(superStatement);
98578
- let superCallExpression;
98579
- if (hasSynthesizedSuper) {
98580
- superCallExpression = createDefaultSuperCallOrThis();
98581
- hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
98582
- } else if (superCall) {
98583
- superCallExpression = visitSuperCallInBody(superCall);
98584
- hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
98585
- }
98586
- if (isDerivedClass || superCallExpression) {
98587
- if (superCallExpression && superStatementIndex === statementsIn.length - 1 && !(constructor.body.transformFlags & 16384 /* ContainsLexicalThis */)) {
98588
- const superCall2 = cast(cast(superCallExpression, isBinaryExpression).left, isCallExpression);
98589
- const returnStatement = factory2.createReturnStatement(superCallExpression);
98590
- setCommentRange(returnStatement, getCommentRange(superCall2));
98591
- setEmitFlags(superCall2, 3072 /* NoComments */);
98592
- statementsOut.push(returnStatement);
98593
- return false;
98594
- } else {
98595
- if (isFirstStatement) {
98596
- insertCaptureThisForNode(statementsOut, constructor, superCallExpression || createActualThis());
98597
- } else {
98598
- insertCaptureThisForNode(prologueOut, constructor, createActualThis());
98599
- if (superCallExpression) {
98600
- addSuperThisCaptureThisForNode(statementsOut, superCallExpression);
98601
- }
98602
- }
98603
- mayReplaceThis = true;
98604
- }
98605
- } else {
98606
- insertCaptureThisForNodeIfNeeded(prologueOut, constructor);
98607
- }
98608
- }
98609
- if (superStatementIndex >= 0) {
98610
- addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, superStatementIndex + 1));
98611
- }
98612
- return mayReplaceThis;
98613
- }
98614
98543
  function isUninitializedVariableStatement(node) {
98615
98544
  return isVariableStatement(node) && every(node.declarationList.declarations, (decl) => isIdentifier(decl.name) && !decl.initializer);
98616
98545
  }
98617
- function isUsingDeclarationStateVariableStatement(node) {
98618
- if (!isVariableStatement(node) || node.declarationList.declarations.length !== 1)
98619
- return false;
98620
- const varDecl = node.declarationList.declarations[0];
98621
- if (!isIdentifier(varDecl.name) || !varDecl.initializer)
98622
- return false;
98623
- const initializer = varDecl.initializer;
98624
- if (!isObjectLiteralExpression(initializer) || initializer.properties.length !== 3)
98625
- return false;
98626
- const [stackProp, errorProp, hasErrorProp] = initializer.properties;
98627
- if (!isPropertyAssignment(stackProp) || !isIdentifier(stackProp.name) || idText(stackProp.name) !== "stack" || !isArrayLiteralExpression(stackProp.initializer))
98628
- return false;
98629
- if (!isPropertyAssignment(errorProp) || !isIdentifier(errorProp.name) || idText(errorProp.name) !== "error" || !isVoidExpression(errorProp.initializer) || !isNumericLiteral(errorProp.initializer.expression))
98630
- return false;
98631
- if (!isPropertyAssignment(hasErrorProp) || !isIdentifier(hasErrorProp.name) || idText(hasErrorProp.name) !== "hasError" || hasErrorProp.initializer.kind !== 97 /* FalseKeyword */)
98546
+ function containsSuperCall(node) {
98547
+ if (isSuperCall(node)) {
98548
+ return true;
98549
+ }
98550
+ if (!(node.transformFlags & 134217728 /* ContainsLexicalSuper */)) {
98632
98551
  return false;
98633
- return true;
98552
+ }
98553
+ switch (node.kind) {
98554
+ case 219 /* ArrowFunction */:
98555
+ case 218 /* FunctionExpression */:
98556
+ case 262 /* FunctionDeclaration */:
98557
+ case 176 /* Constructor */:
98558
+ case 175 /* ClassStaticBlockDeclaration */:
98559
+ return false;
98560
+ case 177 /* GetAccessor */:
98561
+ case 178 /* SetAccessor */:
98562
+ case 174 /* MethodDeclaration */:
98563
+ case 172 /* PropertyDeclaration */: {
98564
+ const named = node;
98565
+ if (isComputedPropertyName(named.name)) {
98566
+ return !!forEachChild(named.name, containsSuperCall);
98567
+ }
98568
+ return false;
98569
+ }
98570
+ }
98571
+ return !!forEachChild(node, containsSuperCall);
98634
98572
  }
98635
98573
  function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
98636
98574
  const isDerivedClass = !!extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 106 /* NullKeyword */;
@@ -98645,31 +98583,22 @@ function transformES2015(context) {
98645
98583
  /*statementOffset*/
98646
98584
  0
98647
98585
  );
98648
- const superStatementIndices = findSuperStatementIndexPath(constructor.body.statements, standardPrologueEnd);
98649
- if (hasSynthesizedSuper || superStatementIndices.length > 0) {
98650
- hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
98586
+ if (hasSynthesizedSuper || containsSuperCall(constructor.body)) {
98587
+ hierarchyFacts |= 8192 /* ConstructorWithSuperCall */;
98651
98588
  }
98652
- const mayReplaceThis = transformConstructorBodyWorker(
98653
- prologue,
98654
- statements,
98655
- constructor.body.statements,
98656
- standardPrologueEnd,
98657
- superStatementIndices,
98658
- /*superPathDepth*/
98659
- 0,
98660
- constructor,
98661
- isDerivedClass,
98662
- hasSynthesizedSuper,
98663
- /*isFirstStatement*/
98664
- true
98665
- // NOTE: this will be recalculated inside of transformConstructorBodyWorker
98666
- );
98589
+ addRange(statements, visitNodes2(constructor.body.statements, visitor, isStatement, standardPrologueEnd));
98590
+ const mayReplaceThis = isDerivedClass || hierarchyFacts & 8192 /* ConstructorWithSuperCall */;
98667
98591
  addDefaultValueAssignmentsIfNeeded2(prologue, constructor);
98668
98592
  addRestParameterIfNeeded(prologue, constructor, hasSynthesizedSuper);
98669
98593
  insertCaptureNewTargetIfNeeded(prologue, constructor);
98594
+ if (mayReplaceThis) {
98595
+ insertCaptureThisForNode(prologue, constructor, createActualThis());
98596
+ } else {
98597
+ insertCaptureThisForNodeIfNeeded(prologue, constructor);
98598
+ }
98670
98599
  factory2.mergeLexicalEnvironment(prologue, endLexicalEnvironment());
98671
98600
  if (mayReplaceThis && !isSufficientlyCoveredByReturnStatements(constructor.body)) {
98672
- statements.push(factory2.createReturnStatement(factory2.createUniqueName("_this", 16 /* Optimistic */ | 32 /* FileLevel */)));
98601
+ statements.push(factory2.createReturnStatement(createCapturedThis()));
98673
98602
  }
98674
98603
  const body = factory2.createBlock(
98675
98604
  setTextRange(
@@ -98686,6 +98615,230 @@ function transformES2015(context) {
98686
98615
  true
98687
98616
  );
98688
98617
  setTextRange(body, constructor.body);
98618
+ return simplifyConstructor(body, constructor.body, hasSynthesizedSuper);
98619
+ }
98620
+ function isCapturedThis(node) {
98621
+ return isGeneratedIdentifier(node) && idText(node) === "_this";
98622
+ }
98623
+ function isSyntheticSuper(node) {
98624
+ return isGeneratedIdentifier(node) && idText(node) === "_super";
98625
+ }
98626
+ function isThisCapturingVariableStatement(node) {
98627
+ return isVariableStatement(node) && node.declarationList.declarations.length === 1 && isThisCapturingVariableDeclaration(node.declarationList.declarations[0]);
98628
+ }
98629
+ function isThisCapturingVariableDeclaration(node) {
98630
+ return isVariableDeclaration(node) && isCapturedThis(node.name) && !!node.initializer;
98631
+ }
98632
+ function isThisCapturingAssignment(node) {
98633
+ return isAssignmentExpression(
98634
+ node,
98635
+ /*excludeCompoundAssignment*/
98636
+ true
98637
+ ) && isCapturedThis(node.left);
98638
+ }
98639
+ function isTransformedSuperCall(node) {
98640
+ return isCallExpression(node) && isPropertyAccessExpression(node.expression) && isSyntheticSuper(node.expression.expression) && isIdentifier(node.expression.name) && (idText(node.expression.name) === "call" || idText(node.expression.name) === "apply") && node.arguments.length >= 1 && node.arguments[0].kind === 110 /* ThisKeyword */;
98641
+ }
98642
+ function isTransformedSuperCallWithFallback(node) {
98643
+ return isBinaryExpression(node) && node.operatorToken.kind === 57 /* BarBarToken */ && node.right.kind === 110 /* ThisKeyword */ && isTransformedSuperCall(node.left);
98644
+ }
98645
+ function isImplicitSuperCall(node) {
98646
+ return isBinaryExpression(node) && node.operatorToken.kind === 56 /* AmpersandAmpersandToken */ && isBinaryExpression(node.left) && node.left.operatorToken.kind === 38 /* ExclamationEqualsEqualsToken */ && isSyntheticSuper(node.left.left) && node.left.right.kind === 106 /* NullKeyword */ && isTransformedSuperCall(node.right) && idText(node.right.expression.name) === "apply";
98647
+ }
98648
+ function isImplicitSuperCallWithFallback(node) {
98649
+ return isBinaryExpression(node) && node.operatorToken.kind === 57 /* BarBarToken */ && node.right.kind === 110 /* ThisKeyword */ && isImplicitSuperCall(node.left);
98650
+ }
98651
+ function isThisCapturingTransformedSuperCallWithFallback(node) {
98652
+ return isThisCapturingAssignment(node) && isTransformedSuperCallWithFallback(node.right);
98653
+ }
98654
+ function isThisCapturingImplicitSuperCallWithFallback(node) {
98655
+ return isThisCapturingAssignment(node) && isImplicitSuperCallWithFallback(node.right);
98656
+ }
98657
+ function isTransformedSuperCallLike(node) {
98658
+ return isTransformedSuperCall(node) || isTransformedSuperCallWithFallback(node) || isThisCapturingTransformedSuperCallWithFallback(node) || isImplicitSuperCall(node) || isImplicitSuperCallWithFallback(node) || isThisCapturingImplicitSuperCallWithFallback(node);
98659
+ }
98660
+ function simplifyConstructorInlineSuperInThisCaptureVariable(body) {
98661
+ for (let i = 0; i < body.statements.length - 1; i++) {
98662
+ const statement = body.statements[i];
98663
+ if (!isThisCapturingVariableStatement(statement)) {
98664
+ continue;
98665
+ }
98666
+ const varDecl = statement.declarationList.declarations[0];
98667
+ if (varDecl.initializer.kind !== 110 /* ThisKeyword */) {
98668
+ continue;
98669
+ }
98670
+ const thisCaptureStatementIndex = i;
98671
+ let superCallIndex = i + 1;
98672
+ while (superCallIndex < body.statements.length) {
98673
+ const statement2 = body.statements[superCallIndex];
98674
+ if (isExpressionStatement(statement2)) {
98675
+ if (isTransformedSuperCallLike(skipOuterExpressions(statement2.expression))) {
98676
+ break;
98677
+ }
98678
+ }
98679
+ if (isUninitializedVariableStatement(statement2)) {
98680
+ superCallIndex++;
98681
+ continue;
98682
+ }
98683
+ return body;
98684
+ }
98685
+ const following = body.statements[superCallIndex];
98686
+ let expression = following.expression;
98687
+ if (isThisCapturingAssignment(expression)) {
98688
+ expression = expression.right;
98689
+ }
98690
+ const newVarDecl = factory2.updateVariableDeclaration(
98691
+ varDecl,
98692
+ varDecl.name,
98693
+ /*exclamationToken*/
98694
+ void 0,
98695
+ /*type*/
98696
+ void 0,
98697
+ expression
98698
+ );
98699
+ const newDeclList = factory2.updateVariableDeclarationList(statement.declarationList, [newVarDecl]);
98700
+ const newVarStatement = factory2.createVariableStatement(statement.modifiers, newDeclList);
98701
+ setOriginalNode(newVarStatement, following);
98702
+ setTextRange(newVarStatement, following);
98703
+ const newStatements = factory2.createNodeArray([
98704
+ ...body.statements.slice(0, thisCaptureStatementIndex),
98705
+ // copy statements preceding to `var _this`
98706
+ ...body.statements.slice(thisCaptureStatementIndex + 1, superCallIndex),
98707
+ // copy intervening temp variables
98708
+ newVarStatement,
98709
+ ...body.statements.slice(superCallIndex + 1)
98710
+ // copy statements following `super.call(this, ...)`
98711
+ ]);
98712
+ setTextRange(newStatements, body.statements);
98713
+ return factory2.updateBlock(body, newStatements);
98714
+ }
98715
+ return body;
98716
+ }
98717
+ function simplifyConstructorInlineSuperReturn(body, original) {
98718
+ for (const statement of original.statements) {
98719
+ if (statement.transformFlags & 134217728 /* ContainsLexicalSuper */ && !getSuperCallFromStatement(statement)) {
98720
+ return body;
98721
+ }
98722
+ }
98723
+ const canElideThisCapturingVariable = !(original.transformFlags & 16384 /* ContainsLexicalThis */) && !(hierarchyFacts & 65536 /* LexicalThis */) && !(hierarchyFacts & 131072 /* CapturedLexicalThis */);
98724
+ for (let i = body.statements.length - 1; i > 0; i--) {
98725
+ const statement = body.statements[i];
98726
+ if (isReturnStatement(statement) && statement.expression && isCapturedThis(statement.expression)) {
98727
+ const preceding = body.statements[i - 1];
98728
+ let expression;
98729
+ if (isExpressionStatement(preceding) && isThisCapturingTransformedSuperCallWithFallback(skipOuterExpressions(preceding.expression))) {
98730
+ expression = preceding.expression;
98731
+ } else if (canElideThisCapturingVariable && isThisCapturingVariableStatement(preceding)) {
98732
+ const varDecl = preceding.declarationList.declarations[0];
98733
+ if (isTransformedSuperCallLike(skipOuterExpressions(varDecl.initializer))) {
98734
+ expression = factory2.createAssignment(
98735
+ createCapturedThis(),
98736
+ varDecl.initializer
98737
+ );
98738
+ }
98739
+ }
98740
+ if (!expression) {
98741
+ break;
98742
+ }
98743
+ const newReturnStatement = factory2.createReturnStatement(expression);
98744
+ setOriginalNode(newReturnStatement, preceding);
98745
+ setTextRange(newReturnStatement, preceding);
98746
+ const newStatements = factory2.createNodeArray([
98747
+ ...body.statements.slice(0, i - 1),
98748
+ // copy all statements preceding `_super.call(this, ...)`
98749
+ newReturnStatement,
98750
+ ...body.statements.slice(i + 1)
98751
+ // copy all statements following `return _this;`
98752
+ ]);
98753
+ setTextRange(newStatements, body.statements);
98754
+ return factory2.updateBlock(body, newStatements);
98755
+ }
98756
+ }
98757
+ return body;
98758
+ }
98759
+ function elideUnusedThisCaptureWorker(node) {
98760
+ if (isThisCapturingVariableStatement(node)) {
98761
+ const varDecl = node.declarationList.declarations[0];
98762
+ if (varDecl.initializer.kind === 110 /* ThisKeyword */) {
98763
+ return void 0;
98764
+ }
98765
+ } else if (isThisCapturingAssignment(node)) {
98766
+ return factory2.createPartiallyEmittedExpression(node.right, node);
98767
+ }
98768
+ switch (node.kind) {
98769
+ case 219 /* ArrowFunction */:
98770
+ case 218 /* FunctionExpression */:
98771
+ case 262 /* FunctionDeclaration */:
98772
+ case 176 /* Constructor */:
98773
+ case 175 /* ClassStaticBlockDeclaration */:
98774
+ return node;
98775
+ case 177 /* GetAccessor */:
98776
+ case 178 /* SetAccessor */:
98777
+ case 174 /* MethodDeclaration */:
98778
+ case 172 /* PropertyDeclaration */: {
98779
+ const named = node;
98780
+ if (isComputedPropertyName(named.name)) {
98781
+ return factory2.replacePropertyName(named, visitEachChild(named.name, elideUnusedThisCaptureWorker, nullTransformationContext));
98782
+ }
98783
+ return node;
98784
+ }
98785
+ }
98786
+ return visitEachChild(node, elideUnusedThisCaptureWorker, nullTransformationContext);
98787
+ }
98788
+ function simplifyConstructorElideUnusedThisCapture(body, original) {
98789
+ if (original.transformFlags & 16384 /* ContainsLexicalThis */ || hierarchyFacts & 65536 /* LexicalThis */ || hierarchyFacts & 131072 /* CapturedLexicalThis */) {
98790
+ return body;
98791
+ }
98792
+ for (const statement of original.statements) {
98793
+ if (statement.transformFlags & 134217728 /* ContainsLexicalSuper */ && !getSuperCallFromStatement(statement)) {
98794
+ return body;
98795
+ }
98796
+ }
98797
+ return factory2.updateBlock(body, visitNodes2(body.statements, elideUnusedThisCaptureWorker, isStatement));
98798
+ }
98799
+ function injectSuperPresenceCheckWorker(node) {
98800
+ if (isTransformedSuperCall(node) && node.arguments.length === 2 && isIdentifier(node.arguments[1]) && idText(node.arguments[1]) === "arguments") {
98801
+ return factory2.createLogicalAnd(
98802
+ factory2.createStrictInequality(
98803
+ createSyntheticSuper(),
98804
+ factory2.createNull()
98805
+ ),
98806
+ node
98807
+ );
98808
+ }
98809
+ switch (node.kind) {
98810
+ case 219 /* ArrowFunction */:
98811
+ case 218 /* FunctionExpression */:
98812
+ case 262 /* FunctionDeclaration */:
98813
+ case 176 /* Constructor */:
98814
+ case 175 /* ClassStaticBlockDeclaration */:
98815
+ return node;
98816
+ case 177 /* GetAccessor */:
98817
+ case 178 /* SetAccessor */:
98818
+ case 174 /* MethodDeclaration */:
98819
+ case 172 /* PropertyDeclaration */: {
98820
+ const named = node;
98821
+ if (isComputedPropertyName(named.name)) {
98822
+ return factory2.replacePropertyName(named, visitEachChild(named.name, injectSuperPresenceCheckWorker, nullTransformationContext));
98823
+ }
98824
+ return node;
98825
+ }
98826
+ }
98827
+ return visitEachChild(node, injectSuperPresenceCheckWorker, nullTransformationContext);
98828
+ }
98829
+ function complicateConstructorInjectSuperPresenceCheck(body) {
98830
+ return factory2.updateBlock(body, visitNodes2(body.statements, injectSuperPresenceCheckWorker, isStatement));
98831
+ }
98832
+ function simplifyConstructor(body, original, hasSynthesizedSuper) {
98833
+ const inputBody = body;
98834
+ body = simplifyConstructorInlineSuperInThisCaptureVariable(body);
98835
+ body = simplifyConstructorInlineSuperReturn(body, original);
98836
+ if (body !== inputBody) {
98837
+ body = simplifyConstructorElideUnusedThisCapture(body, original);
98838
+ }
98839
+ if (hasSynthesizedSuper) {
98840
+ body = complicateConstructorInjectSuperPresenceCheck(body);
98841
+ }
98689
98842
  return body;
98690
98843
  }
98691
98844
  function isSufficientlyCoveredByReturnStatements(statement) {
@@ -98711,11 +98864,11 @@ function transformES2015(context) {
98711
98864
  return factory2.createLogicalOr(
98712
98865
  factory2.createLogicalAnd(
98713
98866
  factory2.createStrictInequality(
98714
- factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */),
98867
+ createSyntheticSuper(),
98715
98868
  factory2.createNull()
98716
98869
  ),
98717
98870
  factory2.createFunctionApplyCall(
98718
- factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */),
98871
+ createSyntheticSuper(),
98719
98872
  createActualThis(),
98720
98873
  factory2.createIdentifier("arguments")
98721
98874
  )
@@ -98970,24 +99123,12 @@ function transformES2015(context) {
98970
99123
  return true;
98971
99124
  }
98972
99125
  function insertCaptureThisForNodeIfNeeded(statements, node) {
98973
- if (hierarchyFacts & 65536 /* CapturedLexicalThis */ && node.kind !== 219 /* ArrowFunction */) {
99126
+ if (hierarchyFacts & 131072 /* CapturedLexicalThis */ && node.kind !== 219 /* ArrowFunction */) {
98974
99127
  insertCaptureThisForNode(statements, node, factory2.createThis());
98975
99128
  return true;
98976
99129
  }
98977
99130
  return false;
98978
99131
  }
98979
- function addSuperThisCaptureThisForNode(statements, superExpression) {
98980
- enableSubstitutionsForCapturedThis();
98981
- const assignSuperExpression = factory2.createExpressionStatement(
98982
- factory2.createBinaryExpression(
98983
- factory2.createThis(),
98984
- 64 /* EqualsToken */,
98985
- superExpression
98986
- )
98987
- );
98988
- statements.push(assignSuperExpression);
98989
- setCommentRange(assignSuperExpression, getOriginalNode(superExpression).parent);
98990
- }
98991
99132
  function insertCaptureThisForNode(statements, node, initializer) {
98992
99133
  enableSubstitutionsForCapturedThis();
98993
99134
  const captureThisStatement = factory2.createVariableStatement(
@@ -98995,7 +99136,7 @@ function transformES2015(context) {
98995
99136
  void 0,
98996
99137
  factory2.createVariableDeclarationList([
98997
99138
  factory2.createVariableDeclaration(
98998
- factory2.createUniqueName("_this", 16 /* Optimistic */ | 32 /* FileLevel */),
99139
+ createCapturedThis(),
98999
99140
  /*exclamationToken*/
99000
99141
  void 0,
99001
99142
  /*type*/
@@ -99216,7 +99357,7 @@ function transformES2015(context) {
99216
99357
  }
99217
99358
  function visitArrowFunction(node) {
99218
99359
  if (node.transformFlags & 16384 /* ContainsLexicalThis */ && !(hierarchyFacts & 16384 /* StaticInitializer */)) {
99219
- hierarchyFacts |= 65536 /* CapturedLexicalThis */;
99360
+ hierarchyFacts |= 131072 /* CapturedLexicalThis */;
99220
99361
  }
99221
99362
  const savedConvertedLoopState = convertedLoopState;
99222
99363
  convertedLoopState = void 0;
@@ -99249,7 +99390,7 @@ function transformES2015(context) {
99249
99390
  const parameters = visitParameterList(node.parameters, visitor, context);
99250
99391
  const body = transformFunctionBody(node);
99251
99392
  const name = hierarchyFacts & 32768 /* NewTarget */ ? factory2.getLocalName(node) : node.name;
99252
- exitSubtree(ancestorFacts, 98304 /* FunctionSubtreeExcludes */, 0 /* None */);
99393
+ exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
99253
99394
  convertedLoopState = savedConvertedLoopState;
99254
99395
  return factory2.updateFunctionExpression(
99255
99396
  node,
@@ -99272,7 +99413,7 @@ function transformES2015(context) {
99272
99413
  const parameters = visitParameterList(node.parameters, visitor, context);
99273
99414
  const body = transformFunctionBody(node);
99274
99415
  const name = hierarchyFacts & 32768 /* NewTarget */ ? factory2.getLocalName(node) : node.name;
99275
- exitSubtree(ancestorFacts, 98304 /* FunctionSubtreeExcludes */, 0 /* None */);
99416
+ exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
99276
99417
  convertedLoopState = savedConvertedLoopState;
99277
99418
  return factory2.updateFunctionDeclaration(
99278
99419
  node,
@@ -99296,7 +99437,7 @@ function transformES2015(context) {
99296
99437
  if (hierarchyFacts & 32768 /* NewTarget */ && !name && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */)) {
99297
99438
  name = factory2.getGeneratedNameForNode(node);
99298
99439
  }
99299
- exitSubtree(ancestorFacts, 98304 /* FunctionSubtreeExcludes */, 0 /* None */);
99440
+ exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
99300
99441
  convertedLoopState = savedConvertedLoopState;
99301
99442
  return setOriginalNode(
99302
99443
  setTextRange(
@@ -100705,7 +100846,7 @@ function transformES2015(context) {
100705
100846
  } else {
100706
100847
  updated = factory2.updateSetAccessorDeclaration(node, node.modifiers, node.name, parameters, body);
100707
100848
  }
100708
- exitSubtree(ancestorFacts, 98304 /* FunctionSubtreeExcludes */, 0 /* None */);
100849
+ exitSubtree(ancestorFacts, 229376 /* FunctionSubtreeExcludes */, 0 /* None */);
100709
100850
  convertedLoopState = savedConvertedLoopState;
100710
100851
  return updated;
100711
100852
  }
@@ -100855,13 +100996,6 @@ function transformES2015(context) {
100855
100996
  )
100856
100997
  );
100857
100998
  }
100858
- function visitSuperCallInBody(node) {
100859
- return visitCallExpressionWithPotentialCapturedThisAssignment(
100860
- node,
100861
- /*assignToCapturedThis*/
100862
- false
100863
- );
100864
- }
100865
100999
  function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
100866
101000
  if (node.transformFlags & 32768 /* ContainsRestOrSpread */ || node.expression.kind === 108 /* SuperKeyword */ || isSuperProperty(skipOuterExpressions(node.expression))) {
100867
101001
  const { target, thisArg } = factory2.createCallBinding(node.expression, hoistVariableDeclaration);
@@ -100898,10 +101032,13 @@ function transformES2015(context) {
100898
101032
  resultingCall,
100899
101033
  createActualThis()
100900
101034
  );
100901
- resultingCall = assignToCapturedThis ? factory2.createAssignment(factory2.createUniqueName("_this", 16 /* Optimistic */ | 32 /* FileLevel */), initializer) : initializer;
101035
+ resultingCall = assignToCapturedThis ? factory2.createAssignment(createCapturedThis(), initializer) : initializer;
100902
101036
  }
100903
101037
  return setOriginalNode(resultingCall, node);
100904
101038
  }
101039
+ if (isSuperCall(node)) {
101040
+ hierarchyFacts |= 131072 /* CapturedLexicalThis */;
101041
+ }
100905
101042
  return visitEachChild(node, visitor, context);
100906
101043
  }
100907
101044
  function visitNewExpression(node) {
@@ -101028,8 +101165,15 @@ function transformES2015(context) {
101028
101165
  }
101029
101166
  return setTextRange(expression, node);
101030
101167
  }
101031
- function visitSuperKeyword(isExpressionOfCall) {
101032
- return hierarchyFacts & 8 /* NonStaticClassElement */ && !isExpressionOfCall ? factory2.createPropertyAccessExpression(factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */), "prototype") : factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */);
101168
+ function createSyntheticSuper() {
101169
+ return factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */);
101170
+ }
101171
+ function visitSuperKeyword(node, isExpressionOfCall) {
101172
+ const expression = hierarchyFacts & 8 /* NonStaticClassElement */ && !isExpressionOfCall ? factory2.createPropertyAccessExpression(setOriginalNode(createSyntheticSuper(), node), "prototype") : createSyntheticSuper();
101173
+ setOriginalNode(expression, node);
101174
+ setCommentRange(expression, node);
101175
+ setSourceMapRange(expression, node);
101176
+ return expression;
101033
101177
  }
101034
101178
  function visitMetaProperty(node) {
101035
101179
  if (node.keywordToken === 105 /* NewKeyword */ && node.name.escapedText === "target") {
@@ -101135,7 +101279,7 @@ function transformES2015(context) {
101135
101279
  }
101136
101280
  function substituteThisKeyword(node) {
101137
101281
  if (enabledSubstitutions & 1 /* CapturedThis */ && hierarchyFacts & 16 /* CapturesThis */) {
101138
- return setTextRange(factory2.createUniqueName("_this", 16 /* Optimistic */ | 32 /* FileLevel */), node);
101282
+ return setTextRange(createCapturedThis(), node);
101139
101283
  }
101140
101284
  return node;
101141
101285
  }
@@ -108233,7 +108377,7 @@ function transformDeclarations(context) {
108233
108377
  return statement;
108234
108378
  }
108235
108379
  const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (258047 /* All */ ^ 1 /* Export */));
108236
- return factory2.updateModifiers(statement, modifiers);
108380
+ return factory2.replaceModifiers(statement, modifiers);
108237
108381
  }
108238
108382
  function updateModuleDeclarationAndKeyword(node, modifiers, name, body) {
108239
108383
  const updated = factory2.updateModuleDeclaration(node, modifiers, name, body);
@@ -108364,7 +108508,7 @@ function transformDeclarations(context) {
108364
108508
  return factory2.createVariableStatement(isNonContextualKeywordName ? void 0 : [factory2.createToken(95 /* ExportKeyword */)], factory2.createVariableDeclarationList([varDecl]));
108365
108509
  });
108366
108510
  if (!exportMappings.length) {
108367
- declarations = mapDefined(declarations, (declaration) => factory2.updateModifiers(declaration, 0 /* None */));
108511
+ declarations = mapDefined(declarations, (declaration) => factory2.replaceModifiers(declaration, 0 /* None */));
108368
108512
  } else {
108369
108513
  declarations.push(factory2.createExportDeclaration(
108370
108514
  /*modifiers*/