@@ -8760,7 +8760,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
87608760 }
87618761
87628762 function getPropertyNameNodeForSymbol(symbol: Symbol, context: NodeBuilderContext) {
8763- const hashPrivateName = getHashPrivateName (symbol);
8763+ const hashPrivateName = getClonedHashPrivateName (symbol);
87648764 if (hashPrivateName) {
87658765 return hashPrivateName;
87668766 }
@@ -9895,7 +9895,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
98959895 let initializer: Expression | undefined;
98969896 let initializerLength: number;
98979897 if (isExpanding(context) && memberDecl && memberDecl.initializer) {
9898- initializer = visitNode( memberDecl.initializer, factory.cloneNode, isExpression) ;
9898+ initializer = memberDecl.initializer;
98999899 initializerLength = memberDecl.initializer.end - memberDecl.initializer.pos;
99009900 }
99019901 else {
@@ -10626,7 +10626,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1062610626 Debug.assert(!!setter);
1062710627 const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : undefined;
1062810628 const setterDeclaration = p.declarations?.find(isSetAccessor);
10629- context.approximateLength += modifiersLength(flag) + 7 + (paramSymbol ? symbolName(paramSymbol).length : 5) + (omitType ? 0 : 1 ); // `modifiers set name(param);`, approximate name
10629+ context.approximateLength += modifiersLength(flag) + 7 + (paramSymbol ? symbolName(paramSymbol).length : 5) + (omitType ? 0 : 2 ); // `modifiers set name(param);`, approximate name
1063010630 result.push(setTextRange(
1063110631 context,
1063210632 factory.createSetAccessorDeclaration(
@@ -10646,7 +10646,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1064610646 }
1064710647 if (p.flags & SymbolFlags.GetAccessor) {
1064810648 const getterDeclaration = p.declarations?.find(isGetAccessor);
10649- context.approximateLength += modifiersLength(flag) + 9 + (omitType ? 0 : 1 ); // `modifiers get name(): ;`, approximate name
10649+ context.approximateLength += modifiersLength(flag) + 8 + (omitType ? 0 : 2 ); // `modifiers get name(): ;`, approximate name
1065010650 result.push(setTextRange(
1065110651 context,
1065210652 factory.createGetAccessorDeclaration(
@@ -10665,7 +10665,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1066510665 // If this happens, we assume the accessor takes priority, as it imposes more constraints
1066610666 else if (p.flags & (SymbolFlags.Property | SymbolFlags.Variable | SymbolFlags.Accessor)) {
1066710667 const modifierFlags = (isReadonlySymbol(p) ? ModifierFlags.Readonly : 0) | flag;
10668- context.approximateLength += 1 + (omitType ? 0 : 1 ) + modifiersLength(modifierFlags); // `modifiers name: ;`, approximate name
10668+ context.approximateLength += 2 + (omitType ? 0 : 2 ) + modifiersLength(modifierFlags); // `modifiers name: ;`, approximate name
1066910669 return setTextRange(
1067010670 context,
1067110671 createProperty(
@@ -10725,21 +10725,22 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1072510725
1072610726 function modifiersLength(flags: ModifierFlags): number {
1072710727 let result = 0;
10728- if (flags & ModifierFlags.Export) result += 6;
10729- if (flags & ModifierFlags.Ambient) result += 7;
10730- if (flags & ModifierFlags.Default) result += 7;
10731- if (flags & ModifierFlags.Const) result += 5;
10732- if (flags & ModifierFlags.Public) result += 6;
10733- if (flags & ModifierFlags.Private) result += 7;
10734- if (flags & ModifierFlags.Protected) result += 9;
10735- if (flags & ModifierFlags.Abstract) result += 8;
10736- if (flags & ModifierFlags.Static) result += 6;
10737- if (flags & ModifierFlags.Override) result += 8;
10738- if (flags & ModifierFlags.Readonly) result += 8;
10739- if (flags & ModifierFlags.Accessor) result += 8;
10740- if (flags & ModifierFlags.Async) result += 5;
10741- if (flags & ModifierFlags.In) result += 2;
10742- if (flags & ModifierFlags.Out) result += 3;
10728+ // Include the trailing space after the modifier keyword.
10729+ if (flags & ModifierFlags.Export) result += 7;
10730+ if (flags & ModifierFlags.Ambient) result += 8;
10731+ if (flags & ModifierFlags.Default) result += 8;
10732+ if (flags & ModifierFlags.Const) result += 6;
10733+ if (flags & ModifierFlags.Public) result += 7;
10734+ if (flags & ModifierFlags.Private) result += 8;
10735+ if (flags & ModifierFlags.Protected) result += 10;
10736+ if (flags & ModifierFlags.Abstract) result += 9;
10737+ if (flags & ModifierFlags.Static) result += 7;
10738+ if (flags & ModifierFlags.Override) result += 9;
10739+ if (flags & ModifierFlags.Readonly) result += 9;
10740+ if (flags & ModifierFlags.Accessor) result += 9;
10741+ if (flags & ModifierFlags.Async) result += 6;
10742+ if (flags & ModifierFlags.In) result += 3;
10743+ if (flags & ModifierFlags.Out) result += 4;
1074310744 return result;
1074410745 }
1074510746
@@ -10925,7 +10926,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1092510926 return !!s.valueDeclaration && isNamedDeclaration(s.valueDeclaration) && isPrivateIdentifier(s.valueDeclaration.name);
1092610927 }
1092710928
10928- function getHashPrivateName (s: Symbol): PrivateIdentifier | undefined {
10929+ function getClonedHashPrivateName (s: Symbol): PrivateIdentifier | undefined {
1092910930 if (s.valueDeclaration && isNamedDeclaration(s.valueDeclaration) && isPrivateIdentifier(s.valueDeclaration.name)) {
1093010931 return factory.cloneNode(s.valueDeclaration.name);
1093110932 }
0 commit comments