File: fixExtractToInnerFunctionDuplicaton.ts

package info (click to toggle)
node-typescript 5.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 497,488 kB
  • sloc: javascript: 2,107,274; makefile: 6; sh: 1
file content (14 lines) | stat: -rw-r--r-- 783 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/// <reference path="../fourslash.ts" />

//// function foo(): void { /*x*/console.log('a');/*y*/ }

goTo.select("x","y");
verify.refactorAvailable("Extract Symbol", 'function_scope_0', "Extract to inner function in function 'foo'");
verify.refactorAvailable("Extract Symbol", 'function_scope_1', "Extract to function in global scope");

verify.not.refactorAvailable("Extract Symbol", 'constant_scope_0', "Extract to inner function in function 'foo'");

verify.refactorAvailable("Extract Symbol", 'constant_scope_0', "Extract to constant in enclosing scope");
verify.refactorAvailable("Extract Symbol", 'constant_scope_1', "Extract to constant in global scope");

verify.not.refactorAvailable("Extract Symbol", 'constant_scope_0', "Extract to constant in global scope");