File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2208,13 +2208,13 @@ namespace ts {
22082208 const parameterDeclaration = parameterSymbol.declarations[0] as ParameterDeclaration;
22092209 const parameterType = getTypeOfSymbol(parameterSymbol);
22102210 const parameterTypeNode = typeToTypeNode(parameterType, enclosingDeclaration);
2211- // TODO: how should we clone members/modifiers?
22122211 // TODO: check initializer accessibility correctly.
22132212 const parameterNode = createParameter(
22142213 parameterDeclaration.decorators,
22152214 parameterDeclaration.modifiers,
22162215 parameterDeclaration.dotDotDotToken && createToken(SyntaxKind.DotDotDotToken),
2217- parameterDeclaration.name,
2216+ // Clone name to remove trivia.
2217+ getSynthesizedClone(parameterDeclaration.name),
22182218 parameterDeclaration.questionToken && createToken(SyntaxKind.QuestionToken),
22192219 parameterTypeNode,
22202220 parameterDeclaration.initializer);
Original file line number Diff line number Diff line change @@ -62,7 +62,8 @@ namespace ts.codefix {
6262 }
6363
6464 const declaration = declarations [ 0 ] as Declaration ;
65- const name = < PropertyName > declaration . name ;
65+ // Clone name to remove leading trivia.
66+ const name = getSynthesizedClone ( < PropertyName > declaration . name ) ;
6667 const visibilityModifier = createVisibilityModifier ( getModifierFlags ( declaration ) ) ;
6768 const modifiers = visibilityModifier ? createNodeArray ( [ visibilityModifier ] ) : undefined ;
6869 const type = checker . getWidenedType ( checker . getTypeOfSymbolAtLocation ( symbol , enclosingDeclaration ) ) ;
@@ -227,4 +228,12 @@ namespace ts.codefix {
227228 }
228229 return undefined ;
229230 }
231+
232+ function stripComments ( node : Node ) : Node {
233+ if ( node === undefined ) {
234+ return node ;
235+ }
236+ const strippedChildren = visitEachChild ( node , stripComments , nullTransformationContext ) ;
237+ return strippedChildren === node ? getSynthesizedClone ( strippedChildren ) : strippedChildren ;
238+ }
230239}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 22
33// @lib : es2017
44
5- //// /** interface prefix */
6- //// interface /**interface name prefix */ I /**open-brace prefix*/{
7- //// /** property prefix*/ x /**colon prefix*/: /**number prefix*/ number;
8- ////
5+ //// namespace N {
6+ //// /**enum prefix */
7+ //// export enum /**enum identifier prefix */ E /**open-brace prefix*/ {
8+ //// /* literal prefix */ a /** comma prefix */,
9+ //// /* literal prefix */ b /** comma prefix */,
10+ //// /* literal prefix */ c
11+ //// /** close brace prefix */ }
12+ //// /** interface prefix */
13+ //// export interface /**interface name prefix */ I /**open-brace prefix*/ {
14+ //// /** property prefix */ a /** colon prefix */: /** enum literal prefix 1*/ E /** dot prefix */. /** enum literal prefix 2*/a;
15+ //// /** property prefix */ b /** colon prefix */: /** enum prefix */ E;
16+ //// /**method signature prefix */foo /**open angle prefix */< /**type parameter name prefix */ X /** closing angle prefix */> /**open paren prefix */(/** parameter prefix */ a/** colon prefix */: /** parameter type prefix */ X /** close paren prefix */) /** colon prefix */: /** return type prefix */ string /** semicolon prefix */;
17+ //// /**close-brace prefix*/ }
918//// /**close-brace prefix*/ }
10- //// class C implements I {[| |]}
19+ //// class C implements N. I {[| |]}
1120
1221verify . rangeAfterCodeFix ( `
13- x: number;
22+ a: N.E.a;
23+ b: N.E;
24+ foo<X>(a: X): string {
25+ throw new Error("Method not implemented.");
26+ }
1427` ) ;
You can’t perform that action at this time.
0 commit comments