This commit is contained in:
Arthur Ozga 2016-11-08 16:48:54 -08:00
parent 4973852722
commit 1d6ef6aedd
5 changed files with 6 additions and 27 deletions

View File

@ -11,11 +11,9 @@ namespace ts.codefix {
if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) {
const classDeclaration = <ClassDeclaration>token.parent;
const startPos = classDeclaration.members.pos;
// const abstractClassMembers = ts.map(getNamedAbstractClassMembers(classDeclaration), member => member.name.getText());
// const trackingAddedMembers: string[] = [];
// const extendsClause = ts.getClassExtendsHeritageClauseElement(classDeclaration);
// const textChanges = getCodeFixChanges(extendsClause, abstractClassMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter);
const insertion = getMissingAbstractMemberInsertion(classDeclaration, checker, context.newLineCharacter);
if (insertion.length > 0) {
return [{
description: getLocaleSpecificMessage(Diagnostics.Implement_inherited_abstract_class),

View File

@ -27,7 +27,6 @@ namespace ts.codefix {
}];
}
}
return undefined;
}
});

View File

@ -372,7 +372,7 @@ namespace ts {
export function isThis(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.ThisKeyword:
// case SyntaxKind.ThisType: TODO: GH#9267
// case SyntaxKind.ThisType: TODO: GH#9267
return true;
case SyntaxKind.Identifier:
// 'this' as a parameter
@ -1360,11 +1360,6 @@ namespace ts {
}
export function getMissingAbstractMemberInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string {
const baseTypeNode: ExpressionWithTypeArguments = getClassExtendsHeritageClauseElement(classDecl);
if (!baseTypeNode) {
return "";
}
const classSymbol = checker.getSymbolOfNode(classDecl);
const InstantiatedExtendsType = <InterfaceType>checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl));
@ -1377,9 +1372,6 @@ namespace ts {
export function getMissingInterfaceMembersInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string {
const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl);
if (!implementedTypeNodes || implementedTypeNodes.length === 0) {
return "";
}
const classSymbol = checker.getSymbolOfNode(classDecl);
@ -1445,7 +1437,6 @@ namespace ts {
function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string {
const name = symbol.getName();
const type = checker.getTypeOfSymbol(symbol);
const decls = symbol.getDeclarations();
if (!(decls && decls.length)) {
return "";
@ -1465,7 +1456,7 @@ namespace ts {
return "";
}
// TODO: (arozga) Deal with multiple signatures.
const sigString = checker.signatureToString(sigs[0], enclosingDeclaration, TypeFormatFlags.WriteTypeArgumentsOfSignature | TypeFormatFlags.supressAnyReturnType, SignatureKind.Call);
const sigString = checker.signatureToString(sigs[0], enclosingDeclaration, TypeFormatFlags.supressAnyReturnType, SignatureKind.Call);
return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`;
default:

View File

@ -11,6 +11,5 @@
// 1) Make x protected, and then insert.
// 2) Make x private, and then insert.
// 3) Make x not abstract.
// So we offer no fixes for now.
// TODO: (arozga) change this behavior.
// So we offer no fixes.
verify.not.codeFixAvailable();

View File

@ -14,15 +14,7 @@
////
//// |]}
verify.rangeAfterCodeFix(`f1<T>(){
throw new Error('Method not Implemented');
}
`);
// TODO: (arozga) Include type qualifiers.
/*
verify.rangeAfterCodeFix(`f1<T extends number>(){
throw new Error('Method not Implemented');
}
`);
*/
`);