2016-08-24 18:26:38 +02:00
|
|
|
/// <reference path="fourslash.ts" />
|
|
|
|
|
|
|
|
// @Filename: a.ts
|
|
|
|
////export class C {
|
2020-01-17 23:26:36 +01:00
|
|
|
//// [|[|{| "contextRangeIndex": 0, "isDefinition": true |}constructor|](n: number);|]
|
|
|
|
//// [|[|{| "contextRangeIndex": 2, "isDefinition": true |}constructor|]();|]
|
|
|
|
//// [|[|{| "contextRangeIndex": 4, "isDefinition": true |}constructor|](n?: number){}|]
|
2016-08-24 18:26:38 +02:00
|
|
|
//// static f() {
|
|
|
|
//// this.f();
|
|
|
|
//// new [|this|]();
|
|
|
|
//// }
|
|
|
|
////}
|
|
|
|
////new [|C|]();
|
|
|
|
// Does not handle alias.
|
|
|
|
////const D = C;
|
|
|
|
////new D();
|
|
|
|
|
|
|
|
// @Filename: b.ts
|
|
|
|
////import { C } from "./a";
|
|
|
|
////new [|C|]();
|
|
|
|
|
|
|
|
// @Filename: c.ts
|
|
|
|
////import { C } from "./a";
|
|
|
|
////class D extends C {
|
|
|
|
//// constructor() {
|
|
|
|
//// [|super|]();
|
|
|
|
//// super.method();
|
|
|
|
//// }
|
|
|
|
//// method() { super(); }
|
|
|
|
////}
|
2016-08-26 22:46:12 +02:00
|
|
|
// Does not find 'super()' calls for a class that merely implements 'C',
|
|
|
|
// since those must be calling a different constructor.
|
2016-08-24 18:26:38 +02:00
|
|
|
////class E implements C {
|
|
|
|
//// constructor() { super(); }
|
|
|
|
////}
|
|
|
|
|
|
|
|
// Works with qualified names too
|
|
|
|
// @Filename: d.ts
|
|
|
|
////import * as a from "./a";
|
|
|
|
////new a.[|C|]();
|
|
|
|
////class d extends a.C { constructor() { [|super|](); }
|
|
|
|
|
2019-06-06 18:49:31 +02:00
|
|
|
const [a0Def, a0, a1Def, a1, a2Def, a2, a3, a4, b0, c0, d0, d1] = test.ranges();
|
2018-03-01 21:46:00 +01:00
|
|
|
verify.referenceGroups([a0, a2], defs("class C"));
|
|
|
|
verify.referenceGroups(a1, defs("class C"));
|
2017-01-26 20:02:08 +01:00
|
|
|
|
|
|
|
function defs(definition: string) {
|
|
|
|
return [
|
|
|
|
{ definition, ranges: [a0, a1, a2, a3, d0, d1, a4] },
|
2017-10-26 02:50:11 +02:00
|
|
|
{ definition: "(alias) class C\nimport C", ranges: [b0] },
|
|
|
|
{ definition: "(alias) class C\nimport C", ranges: [c0] }
|
2017-01-26 20:02:08 +01:00
|
|
|
]
|
|
|
|
}
|