remove fix

* fixRemoveAbstractModifierInNonAbstractClass.ts
This commit is contained in:
Arthur Ozga 2016-11-15 12:49:38 -08:00
parent a94d955d9d
commit 43afb806de
4 changed files with 1 additions and 44 deletions

View File

@ -174,7 +174,6 @@ var servicesSources = [
"codefixes/fixClassDoesntImplementInheritedAbstractMember.ts",
"codefixes/fixClassSuperMustPrecedeThisAccess.ts",
"codefixes/fixConstructorForDerivedNeedSuperCall.ts",
"codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts"
].map(function (f) {
return path.join(servicesDirectory, f);
}));

View File

@ -79,7 +79,6 @@
"../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts",
"../services/codefixes/fixes.ts",
"../services/codefixes/fixExtendsInterfaceBecomesImplements.ts",
"../services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts",
"harness.ts",
"sourceMapRecorder.ts",
"harnessLanguageService.ts",

View File

@ -1,40 +0,0 @@
/* @internal */
namespace ts.codefix {
registerCodeFix({
errorCodes: [Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class.code],
getCodeActions: (context: CodeFixContext) => {
const sourceFile = context.sourceFile;
const start = context.span.start;
const token = getTokenAtPosition(sourceFile, start);
Debug.assert(token.kind === SyntaxKind.AbstractKeyword);
const propertyDeclaration = <PropertyDeclaration>token.parent;
const classDeclaration = <ClassDeclaration>propertyDeclaration.parent;
const classKeywordStart = classDeclaration.getChildren()[0].getStart();
return [
{
description: `Remove abstract modifier from ${propertyDeclaration.name.getText()}.`,
changes: [{
fileName: sourceFile.fileName,
textChanges: [{
span: { start: start, length: context.span.length + /*space*/ 1 },
newText: ""
}]
}]
},
{
description: `Make class ${classDeclaration.name.getText()} abstract.`,
changes: [{
fileName: sourceFile.fileName,
textChanges: [{
span: { start: classKeywordStart, length: 0 },
newText: "abstract "
}]
}]
}
];
}
});
}

View File

@ -2,5 +2,4 @@
/// <reference path="fixClassDoesntImplementInheritedAbstractMember.ts" />
/// <reference path="fixClassSuperMustPrecedeThisAccess.ts" />
/// <reference path="fixConstructorForDerivedNeedSuperCall.ts" />
/// <reference path="fixExtendsInterfaceBecomesImplements.ts" />
/// <reference path="fixRemoveAbstractModifierInNonAbstractClass.ts" />
/// <reference path="fixExtendsInterfaceBecomesImplements.ts" />