Move the declaration for lastImportDeclaration out of the getCodeActions lambda into getCodeActionForImport

This commit is contained in:
Mine Starks 2017-08-10 10:26:10 -07:00
parent de7b821a82
commit fa33d5016b

View file

@ -178,8 +178,6 @@ namespace ts.codefix {
const name = token.getText();
const symbolIdActionMap = new ImportCodeActionMap();
let lastImportDeclaration: Node;
const currentTokenMeaning = getMeaningFromLocation(token);
if (context.errorCode === Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) {
const umdSymbol = checker.getSymbolAtLocation(token);
@ -245,6 +243,7 @@ namespace ts.codefix {
}
function getCodeActionForImport(moduleSymbol: Symbol, context: ImportCodeFixContext, symbolName: string, isDefault?: boolean, isNamespaceImport?: boolean): ImportCodeAction[] {
let lastImportDeclaration: Node;
const { symbolName: name, sourceFile, getCanonicalFileName, newLineCharacter, host, checker, symbolToken, compilerOptions } = context;
getCanonicalFileName;
newLineCharacter;