Skip to content

Commit 67256e5

Browse files
authoredOct 10, 2022
Remove unused declarations array in extractSymbol's TargetRange (#51091)
1 parent 9c87ded commit 67256e5

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed
 

‎src/services/refactors/extractSymbol.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,6 @@ namespace ts.refactor.extractSymbol {
239239
interface TargetRange {
240240
readonly range: Expression | Statement[];
241241
readonly facts: RangeFacts;
242-
/**
243-
* A list of symbols that are declared in the selected range which are visible in the containing lexical scope
244-
* Used to ensure we don't turn something used outside the range free (or worse, resolve to a different entity).
245-
*/
246-
readonly declarations: Symbol[];
247242
/**
248243
* If `this` is referring to a function instead of class, we need to retrieve its type.
249244
*/
@@ -294,8 +289,6 @@ namespace ts.refactor.extractSymbol {
294289
// Do the same for the ending position
295290
const end = cursorRequest ? start : getParentNodeInSpan(endToken, sourceFile, adjustedSpan);
296291

297-
const declarations: Symbol[] = [];
298-
299292
// We'll modify these flags as we walk the tree to collect data
300293
// about what things need to be done as part of the extraction.
301294
let rangeFacts = RangeFacts.None;
@@ -344,7 +337,7 @@ namespace ts.refactor.extractSymbol {
344337
return { errors: [createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
345338
}
346339

347-
return { targetRange: { range: statements, facts: rangeFacts, declarations, thisNode } };
340+
return { targetRange: { range: statements, facts: rangeFacts, thisNode } };
348341
}
349342

350343
if (isReturnStatement(start) && !start.expression) {
@@ -359,7 +352,7 @@ namespace ts.refactor.extractSymbol {
359352
if (errors) {
360353
return { errors };
361354
}
362-
return { targetRange: { range: getStatementOrExpressionRange(node)!, facts: rangeFacts, declarations, thisNode } }; // TODO: GH#18217
355+
return { targetRange: { range: getStatementOrExpressionRange(node)!, facts: rangeFacts, thisNode } }; // TODO: GH#18217
363356

364357
/**
365358
* Attempt to refine the extraction node (generally, by shrinking it) to produce better results.
@@ -489,7 +482,6 @@ namespace ts.refactor.extractSymbol {
489482
(errors ||= []).push(createDiagnosticForNode(node, Messages.cannotExtractExportedEntity));
490483
return true;
491484
}
492-
declarations.push(node.symbol);
493485
}
494486

495487
// Some things can't be extracted in certain situations

0 commit comments

Comments
 (0)
Please sign in to comment.