File: extract-method11.ts

package info (click to toggle)
node-typescript 4.8.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 523,068 kB
  • sloc: javascript: 1,735,777; makefile: 7; sh: 1
file content (28 lines) | stat: -rw-r--r-- 833 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/// <reference path='fourslash.ts' />

// Nonexhaustive list of things it should be illegal to be extract-method on

// * Import declarations
// * Super calls
// * Function body blocks
// * try/catch blocks

//// /*1a*/import * as x from 'y';/*1b*/
//// namespace N {
////     /*oka*/class C extends B {
////         constructor() {
////             /*2a*/super();/*2b*/
////         }
////     }/*okb*/
//// }
//// function f() /*3a*/{ return 0 }/*3b*/
//// try /*4a*/{ console.log }/*4b*/ catch (e) /*5a*/{ console.log; }/*5b*/

for (const m of ['1', '2', '3', '4', '5']) {
    goTo.select(m + 'a', m + 'b');
    verify.not.refactorAvailable('Extract Symbol');
}

// Verify we can still extract the entire class
goTo.select('oka', 'okb');
verify.refactorAvailable('Extract Symbol', 'function_scope_0');