File: referencesForOverrides.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 (117 lines) | stat: -rw-r--r-- 4,478 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/// <reference path='fourslash.ts'/>

////module FindRef3 {
////	module SimpleClassTest {
////		export class Foo {
////			[|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}foo|](): void {
////			}|]
////		}
////		export class Bar extends Foo {
////			[|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}foo|](): void {
////			}|]
////		}
////	}
////
////	module SimpleInterfaceTest {
////		export interface IFoo {
////			[|[|{| "isDefinition": true, "contextRangeIndex": 4 |}ifoo|](): void;|]
////		}
////		export interface IBar extends IFoo {
////			[|[|{| "isDefinition": true, "contextRangeIndex": 6 |}ifoo|](): void;|]
////		}
////	}
////
////	module SimpleClassInterfaceTest {
////		export interface IFoo {
////			[|[|{| "isDefinition": true, "contextRangeIndex": 8 |}icfoo|](): void;|]
////		}
////		export class Bar implements IFoo {
////			[|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 10 |}icfoo|](): void {
////			}|]
////		}
////	}
////
////	module Test {
////		export interface IBase {
////			[|[|{| "isDefinition": true, "contextRangeIndex": 12 |}field|]: string;|]
////			[|[|{| "isDefinition": true, "contextRangeIndex": 14 |}method|](): void;|]
////		}
////
////		export interface IBlah extends IBase {
////			[|[|{| "isDefinition": true, "contextRangeIndex": 16 |}field|]: string;|]
////		}
////
////		export interface IBlah2 extends IBlah {
////			[|[|{| "isDefinition": true, "contextRangeIndex": 18 |}field|]: string;|]
////		}
////
////		export interface IDerived extends IBlah2 {
////			[|[|{| "isDefinition": true, "contextRangeIndex": 20 |}method|](): void;|]
////		}
////
////		export class Bar implements IDerived {
////			[|public [|{| "isDefinition": true, "contextRangeIndex": 22 |}field|]: string;|]
////			[|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 24 |}method|](): void { }|]
////		}
////
////		export class BarBlah extends Bar {
////			[|public [|{| "isDefinition": true, "contextRangeIndex": 26 |}field|]: string;|]
////		}
////	}
////
////	function test() {
////		var x = new SimpleClassTest.Bar();
////		x.[|foo|]();
////
////		var y: SimpleInterfaceTest.IBar = null;
////		y.[|ifoo|]();
////
////        var w: SimpleClassInterfaceTest.Bar = null;
////        w.[|icfoo|]();
////
////		var z = new Test.BarBlah();
////		z.[|{| "isWriteAccess": true |}field|] = "";
////        z.[|method|]();
////	}
////}

const ranges = test.rangesByText();

const fooRanges = ranges.get("foo");
const [foo0, foo1, foo2] = fooRanges;
verify.referenceGroups(fooRanges, [
    { definition: "(method) SimpleClassTest.Foo.foo(): void", ranges: [foo0] },
    { definition: "(method) SimpleClassTest.Bar.foo(): void", ranges: [foo1, foo2] },
]);

const ifooRanges = ranges.get("ifoo");
const [ifoo0, ifoo1, ifoo2] = ifooRanges;
verify.referenceGroups(ifooRanges, [
    { definition: "(method) SimpleInterfaceTest.IFoo.ifoo(): void", ranges: [ifoo0] },
    { definition: "(method) SimpleInterfaceTest.IBar.ifoo(): void", ranges: [ifoo1, ifoo2] }
]);

const icfooRanges = ranges.get("icfoo");
const [icfoo0, icfoo1, icfoo2] = icfooRanges;
verify.referenceGroups(icfooRanges, [
    { definition: "(method) SimpleClassInterfaceTest.IFoo.icfoo(): void", ranges: [icfoo0] },
    { definition: "(method) SimpleClassInterfaceTest.Bar.icfoo(): void", ranges: [icfoo1, icfoo2] }
]);

const fieldRanges = ranges.get("field");
const [field0, field1, field2, field3, field4, field5] = fieldRanges;
verify.referenceGroups(fieldRanges, [
    { definition: "(property) Test.IBase.field: string", ranges: [field0] },
    { definition: "(property) Test.IBlah.field: string", ranges: [field1] },
    { definition: "(property) Test.IBlah2.field: string", ranges: [field2] },
    { definition: "(property) Test.Bar.field: string", ranges: [field3] },
    { definition: "(property) Test.BarBlah.field: string", ranges: [field4, field5] },
]);

const methodRanges = ranges.get("method");
const [method0, method1, method2, method3] = methodRanges;
verify.referenceGroups(methodRanges, [
    { definition: "(method) Test.IBase.method(): void", ranges: [method0] },
    { definition: "(method) Test.IDerived.method(): void", ranges: [method1] },
    { definition: "(method) Test.Bar.method(): void", ranges: [method2, method3] },
]);