Skip to content

Commit 386e765

Browse files
committed
TODOs for repeated substitution
1 parent e6bfce1 commit 386e765

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/harness/unittests/extractConstants.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ namespace ts {
6262
let x = [#|t + 1|];
6363
}`);
6464

65+
// TODO (acasey): handle repeated substitution
66+
// testExtractConstant("extractConstant_RepeatedSubstitution",
67+
// `namespace X {
68+
// export const j = 10;
69+
// export const y = [#|j * j|];
70+
// }`);
71+
6572
testExtractConstantFailed("extractConstant_BlockScopes_Dependencies",
6673
`for (let i = 0; i < 10; i++) {
6774
for (let j = 0; j < 10; j++) {

src/harness/unittests/extractFunctions.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,13 @@ function parsePrimaryExpression(): any {
364364
`function F() {
365365
[#|function G() { }|]
366366
}`);
367+
368+
// TODO (acasey): handle repeated substitution
369+
// testExtractMethod("extractMethod_RepeatedSubstitution",
370+
// `namespace X {
371+
// export const j = 10;
372+
// export const y = [#|j * j|];
373+
// }`);
367374
});
368375

369376
function testExtractMethod(caption: string, text: string) {

src/services/refactors/extractSymbol.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,9 +1382,9 @@ namespace ts.refactor.extractSymbol {
13821382
if (symbolId) {
13831383
for (let i = 0; i < scopes.length; i++) {
13841384
// push substitution from map<symbolId, subst> to map<nodeId, subst> to simplify rewriting
1385-
const substitition = substitutionsPerScope[i].get(symbolId);
1386-
if (substitition) {
1387-
usagesPerScope[i].substitutions.set(getNodeId(n).toString(), substitition);
1385+
const substitution = substitutionsPerScope[i].get(symbolId);
1386+
if (substitution) {
1387+
usagesPerScope[i].substitutions.set(getNodeId(n).toString(), substitution);
13881388
}
13891389
}
13901390
}

0 commit comments

Comments
 (0)