TODOs for repeated substitution

This commit is contained in:
Andrew Casey 2017-09-27 18:08:35 -07:00
parent e6bfce193c
commit 386e76543a
3 changed files with 17 additions and 3 deletions

View File

@ -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++) {

View File

@ -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) {

View File

@ -1382,9 +1382,9 @@ namespace ts.refactor.extractSymbol {
if (symbolId) {
for (let i = 0; i < scopes.length; i++) {
// push substitution from map<symbolId, subst> to map<nodeId, subst> 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);
}
}
}