Skip to content

Commit 1d6ef6a

Browse files
committed
cleanup
1 parent 4973852 commit 1d6ef6a

File tree

5 files changed

+6
-27
lines changed

5 files changed

+6
-27
lines changed

src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ namespace ts.codefix {
1111
if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) {
1212
const classDeclaration = <ClassDeclaration>token.parent;
1313
const startPos = classDeclaration.members.pos;
14-
// const abstractClassMembers = ts.map(getNamedAbstractClassMembers(classDeclaration), member => member.name.getText());
15-
// const trackingAddedMembers: string[] = [];
16-
// const extendsClause = ts.getClassExtendsHeritageClauseElement(classDeclaration);
17-
// const textChanges = getCodeFixChanges(extendsClause, abstractClassMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter);
14+
1815
const insertion = getMissingAbstractMemberInsertion(classDeclaration, checker, context.newLineCharacter);
16+
1917
if (insertion.length > 0) {
2018
return [{
2119
description: getLocaleSpecificMessage(Diagnostics.Implement_inherited_abstract_class),

src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ namespace ts.codefix {
2727
}];
2828
}
2929
}
30-
3130
return undefined;
3231
}
3332
});

src/services/utilities.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ namespace ts {
372372
export function isThis(node: Node): boolean {
373373
switch (node.kind) {
374374
case SyntaxKind.ThisKeyword:
375-
// case SyntaxKind.ThisType: TODO: GH#9267
375+
// case SyntaxKind.ThisType: TODO: GH#9267
376376
return true;
377377
case SyntaxKind.Identifier:
378378
// 'this' as a parameter
@@ -1360,11 +1360,6 @@ namespace ts {
13601360
}
13611361

13621362
export function getMissingAbstractMemberInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string {
1363-
const baseTypeNode: ExpressionWithTypeArguments = getClassExtendsHeritageClauseElement(classDecl);
1364-
if (!baseTypeNode) {
1365-
return "";
1366-
}
1367-
13681363
const classSymbol = checker.getSymbolOfNode(classDecl);
13691364

13701365
const InstantiatedExtendsType = <InterfaceType>checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl));
@@ -1377,9 +1372,6 @@ namespace ts {
13771372

13781373
export function getMissingInterfaceMembersInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string {
13791374
const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl);
1380-
if (!implementedTypeNodes || implementedTypeNodes.length === 0) {
1381-
return "";
1382-
}
13831375

13841376
const classSymbol = checker.getSymbolOfNode(classDecl);
13851377

@@ -1445,7 +1437,6 @@ namespace ts {
14451437
function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string {
14461438
const name = symbol.getName();
14471439
const type = checker.getTypeOfSymbol(symbol);
1448-
14491440
const decls = symbol.getDeclarations();
14501441
if (!(decls && decls.length)) {
14511442
return "";
@@ -1465,7 +1456,7 @@ namespace ts {
14651456
return "";
14661457
}
14671458
// TODO: (arozga) Deal with multiple signatures.
1468-
const sigString = checker.signatureToString(sigs[0], enclosingDeclaration, TypeFormatFlags.WriteTypeArgumentsOfSignature | TypeFormatFlags.supressAnyReturnType, SignatureKind.Call);
1459+
const sigString = checker.signatureToString(sigs[0], enclosingDeclaration, TypeFormatFlags.supressAnyReturnType, SignatureKind.Call);
14691460

14701461
return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`;
14711462
default:

tests/cases/fourslash/codeFixClassExtendsAbstractPrivateProperty.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
// 1) Make x protected, and then insert.
1212
// 2) Make x private, and then insert.
1313
// 3) Make x not abstract.
14-
// So we offer no fixes for now.
15-
// TODO: (arozga) change this behavior.
14+
// So we offer no fixes.
1615
verify.not.codeFixAvailable();

tests/cases/fourslash/codeFixUnImplementedInterface36.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,7 @@
1414
////
1515
//// |]}
1616

17-
verify.rangeAfterCodeFix(`f1<T>(){
18-
throw new Error('Method not Implemented');
19-
}
20-
`);
21-
22-
// TODO: (arozga) Include type qualifiers.
23-
/*
2417
verify.rangeAfterCodeFix(`f1<T extends number>(){
2518
throw new Error('Method not Implemented');
2619
}
27-
`);
28-
*/
20+
`);

0 commit comments

Comments
 (0)