From 386e76543aca28eddd98d514c408f4853e441ba2 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Wed, 27 Sep 2017 18:08:35 -0700 Subject: [PATCH] TODOs for repeated substitution --- src/harness/unittests/extractConstants.ts | 7 +++++++ src/harness/unittests/extractFunctions.ts | 7 +++++++ src/services/refactors/extractSymbol.ts | 6 +++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/harness/unittests/extractConstants.ts b/src/harness/unittests/extractConstants.ts index e4ec0932a73..e2c64afb526 100644 --- a/src/harness/unittests/extractConstants.ts +++ b/src/harness/unittests/extractConstants.ts @@ -62,6 +62,13 @@ namespace ts { let x = [#|t + 1|]; }`); +// TODO (acasey): handle repeated substitution +// testExtractConstant("extractConstant_RepeatedSubstitution", +// `namespace X { +// export const j = 10; +// export const y = [#|j * j|]; +// }`); + testExtractConstantFailed("extractConstant_BlockScopes_Dependencies", `for (let i = 0; i < 10; i++) { for (let j = 0; j < 10; j++) { diff --git a/src/harness/unittests/extractFunctions.ts b/src/harness/unittests/extractFunctions.ts index 2497b2eec51..4e7cba9606c 100644 --- a/src/harness/unittests/extractFunctions.ts +++ b/src/harness/unittests/extractFunctions.ts @@ -364,6 +364,13 @@ function parsePrimaryExpression(): any { `function F() { [#|function G() { }|] }`); + +// TODO (acasey): handle repeated substitution +// testExtractMethod("extractMethod_RepeatedSubstitution", +// `namespace X { +// export const j = 10; +// export const y = [#|j * j|]; +// }`); }); function testExtractMethod(caption: string, text: string) { diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 75b21e809ed..375acb7e585 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -1382,9 +1382,9 @@ namespace ts.refactor.extractSymbol { if (symbolId) { for (let i = 0; i < scopes.length; i++) { // push substitution from map to map to simplify rewriting - const substitition = substitutionsPerScope[i].get(symbolId); - if (substitition) { - usagesPerScope[i].substitutions.set(getNodeId(n).toString(), substitition); + const substitution = substitutionsPerScope[i].get(symbolId); + if (substitution) { + usagesPerScope[i].substitutions.set(getNodeId(n).toString(), substitution); } } }