fix(49838): "Extract function" refactoring action is disabled for a wrong reason (#49840)

* fix(49838): allow extracting functions with a break statement inside loop context

* remove useless flag

* add more tests
This commit is contained in:
Oleksandr T
2022-07-19 23:06:45 +03:00
committed by GitHub
parent 298b3a432c
commit 5a53e9bb5e
5 changed files with 205 additions and 1 deletions

View File

@@ -551,7 +551,7 @@ namespace ts.refactor.extractSymbol {
const savedPermittedJumps = permittedJumps;
switch (node.kind) {
case SyntaxKind.IfStatement:
permittedJumps = PermittedJumps.None;
permittedJumps &= ~PermittedJumps.Return;
break;
case SyntaxKind.TryStatement:
// forbid all jumps inside try blocks