File: findAllRefsThisKeyword.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 (33 lines) | stat: -rw-r--r-- 1,247 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
/// <reference path='fourslash.ts' />
// @noLib: true

////[|this|];
////function f([|{| "isWriteAccess": true, "isDefinition": true |}this|]) {
////    return [|this|];
////    function g([|{| "isWriteAccess": true, "isDefinition": true |}this|]) { return [|this|]; }
////}
////class C {
////    static x() {
////        [|this|];
////    }
////    static y() {
////        () => [|this|];
////    }
////    constructor() {
////        [|this|];
////    }
////    method() {
////        () => [|this|];
////    }
////}
////// These are *not* real uses of the 'this' keyword, they are identifiers.
////const x = { [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 9 |}this|]: 0|] }
////x.[|this|];

const [glob, f0, f1, g0, g1, x, y, constructor, method, propDefDef, propDef, propUse] = test.ranges();
verify.singleReferenceGroup("this: typeof globalThis", [glob]);
verify.singleReferenceGroup("(parameter) this: any", [f0, f1]);
verify.singleReferenceGroup("(parameter) this: any", [g0, g1]);
verify.singleReferenceGroup("this: typeof C", [x, y]);
verify.singleReferenceGroup("this: this", [constructor, method]);
verify.singleReferenceGroup("(property) this: number", [propDef, propUse]);