Skip to content

Commit 9f8de0f

Browse files
Merge pull request #4531 from DickvdBrink/fix-occurrences-classexpressions
Fix occurrences for classexpressions
2 parents 59782a9 + 1f8de04 commit 9f8de0f

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed

src/services/services.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5885,6 +5885,7 @@ namespace ts {
58855885
result.push(getReferenceEntryFromNode(node));
58865886
}
58875887
break;
5888+
case SyntaxKind.ClassExpression:
58885889
case SyntaxKind.ClassDeclaration:
58895890
// Make sure the container belongs to the same class
58905891
// and has the appropriate static modifier from the original container.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////var x = class C {
4+
//// public x;
5+
//// public y;
6+
//// public z;
7+
//// public staticX;
8+
//// constructor() {
9+
//// this;
10+
//// this.x;
11+
//// this.y;
12+
//// this.z;
13+
//// }
14+
//// foo() {
15+
//// this;
16+
//// () => this;
17+
//// () => {
18+
//// if (this) {
19+
//// this;
20+
//// }
21+
//// }
22+
//// function inside() {
23+
//// this;
24+
//// (function (_) {
25+
//// this;
26+
//// })(this);
27+
//// }
28+
//// return this.x;
29+
//// }
30+
////
31+
//// static bar() {
32+
//// [|this|];
33+
//// [|this|].staticX;
34+
//// () => [|this|];
35+
//// () => {
36+
//// if ([|this|]) {
37+
//// [|this|];
38+
//// }
39+
//// }
40+
//// function inside() {
41+
//// this;
42+
//// (function (_) {
43+
//// this;
44+
//// })(this);
45+
//// }
46+
//// }
47+
////}
48+
49+
const ranges = test.ranges();
50+
for (let r of ranges) {
51+
goTo.position(r.start);
52+
53+
for (let range of ranges) {
54+
verify.occurrencesAtPositionContains(range, false);
55+
}
56+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////var x = class C {
4+
//// public x;
5+
//// public y;
6+
//// public z;
7+
//// constructor() {
8+
//// [|this|];
9+
//// [|this|].x;
10+
//// [|this|].y;
11+
//// [|this|].z;
12+
//// }
13+
//// foo() {
14+
//// [|this|];
15+
//// () => [|this|];
16+
//// () => {
17+
//// if ([|this|]) {
18+
//// [|this|];
19+
//// }
20+
//// }
21+
//// function inside() {
22+
//// this;
23+
//// (function (_) {
24+
//// this;
25+
//// })(this);
26+
//// }
27+
//// return [|this|].x;
28+
//// }
29+
////
30+
//// static bar() {
31+
//// this;
32+
//// () => this;
33+
//// () => {
34+
//// if (this) {
35+
//// this;
36+
//// }
37+
//// }
38+
//// function inside() {
39+
//// this;
40+
//// (function (_) {
41+
//// this;
42+
//// })(this);
43+
//// }
44+
//// }
45+
////}
46+
47+
const ranges = test.ranges();
48+
for (let r of ranges) {
49+
goTo.position(r.start);
50+
51+
for (let range of ranges) {
52+
verify.occurrencesAtPositionContains(range, false);
53+
}
54+
}

0 commit comments

Comments
 (0)