File: findAllRefsDestructureGetter.ts

package info (click to toggle)
node-typescript 4.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 396,552 kB
  • sloc: javascript: 1,444,377; makefile: 7; sh: 3
file content (24 lines) | stat: -rw-r--r-- 1,250 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/// <reference path="fourslash.ts" />

////class Test {
////    [|get [|{| "isDefinition": true, "isWriteAccess": true, "contextRangeIndex": 0 |}x|]() { return 0; }|]
////
////    [|set [|{| "isDefinition": true, "isWriteAccess": true, "contextRangeIndex": 2 |}y|](a: number) {}|]
////}
////[|const { [|{| "isDefinition": true, "isWriteAccess": true, "contextRangeIndex": 4 |}x|], [|{| "isDefinition": true, "isWriteAccess": true, "contextRangeIndex": 4 |}y|] } = new Test();|]
////[|x|]; [|y|];

const [x0Def, x0, y0Def, y0, xy1Def, x1, y1, x2, y2] = test.ranges();
verify.referenceGroups(x0, [{ definition: "(property) Test.x: number", ranges: [x0, x1] }]);
verify.referenceGroups(x1, [
    { definition: "(property) Test.x: number", ranges: [x0] },
    { definition: "const x: number", ranges: [x1, x2] },
]);
verify.referenceGroups(x2, [{ definition: "const x: number", ranges: [x1, x2] }]);

verify.referenceGroups(y0, [{ definition: "(property) Test.y: number", ranges: [y0, y1] }]);
verify.referenceGroups(y1, [
    { definition: "(property) Test.y: number", ranges: [y0] },
    { definition: "const y: number", ranges: [y1, y2] },
]);
verify.referenceGroups(y2, [{ definition: "const y: number", ranges: [y1, y2] }]);