-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support class implements and extends
- Loading branch information
1 parent
1a733ce
commit 1a345e8
Showing
9 changed files
with
451 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/scope-manager/tests/fixtures/class/declaration/extends-generic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class A<U> {} | ||
type T = string; | ||
class B extends A<T> {} |
128 changes: 128 additions & 0 deletions
128
packages/scope-manager/tests/fixtures/class/declaration/extends-generic.ts.shot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`class declaration extends-generic 1`] = ` | ||
ScopeManager { | ||
variables: Array [ | ||
Variable$1 { | ||
defs: Array [ | ||
ClassNameDefinition$1 { | ||
name: Identifier<"A">, | ||
node: ClassDeclaration$1, | ||
}, | ||
], | ||
name: "A", | ||
references: Array [ | ||
Reference$1 { | ||
identifier: Identifier<"A">, | ||
isTypeReference: false, | ||
resolved: Variable$1, | ||
}, | ||
], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$2 { | ||
defs: Array [ | ||
ClassNameDefinition$2 { | ||
name: Identifier<"A">, | ||
node: ClassDeclaration$1, | ||
}, | ||
], | ||
name: "A", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$3 { | ||
defs: Array [ | ||
TypeDefinition$3 { | ||
name: Identifier<"T">, | ||
node: TSTypeAliasDeclaration$2, | ||
}, | ||
], | ||
name: "T", | ||
references: Array [ | ||
Reference$2 { | ||
identifier: Identifier<"T">, | ||
isTypeReference: true, | ||
resolved: Variable$3, | ||
}, | ||
], | ||
isValueVariable: false, | ||
isTypeVariable: true, | ||
}, | ||
Variable$4 { | ||
defs: Array [ | ||
ClassNameDefinition$4 { | ||
name: Identifier<"B">, | ||
node: ClassDeclaration$3, | ||
}, | ||
], | ||
name: "B", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$5 { | ||
defs: Array [ | ||
ClassNameDefinition$5 { | ||
name: Identifier<"B">, | ||
node: ClassDeclaration$3, | ||
}, | ||
], | ||
name: "B", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
], | ||
scopes: Array [ | ||
GlobalScope$1 { | ||
block: Program$4, | ||
isStrict: false, | ||
references: Array [ | ||
Reference$1, | ||
Reference$2, | ||
], | ||
set: Map { | ||
"A" => Variable$1, | ||
"T" => Variable$3, | ||
"B" => Variable$4, | ||
}, | ||
type: "global", | ||
upper: null, | ||
variables: Array [ | ||
Variable$1, | ||
Variable$3, | ||
Variable$4, | ||
], | ||
}, | ||
ClassScope$2 { | ||
block: ClassDeclaration$1, | ||
isStrict: true, | ||
references: Array [], | ||
set: Map { | ||
"A" => Variable$2, | ||
}, | ||
type: "class", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$2, | ||
], | ||
}, | ||
ClassScope$3 { | ||
block: ClassDeclaration$3, | ||
isStrict: true, | ||
references: Array [], | ||
set: Map { | ||
"B" => Variable$5, | ||
}, | ||
type: "class", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$5, | ||
], | ||
}, | ||
], | ||
} | ||
`; |
3 changes: 3 additions & 0 deletions
3
packages/scope-manager/tests/fixtures/class/declaration/implements-generic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
interface A<U> {} | ||
type T = string; | ||
class B implements A<T> {} |
128 changes: 128 additions & 0 deletions
128
packages/scope-manager/tests/fixtures/class/declaration/implements-generic.ts.shot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`class declaration implements-generic 1`] = ` | ||
ScopeManager { | ||
variables: Array [ | ||
Variable$1 { | ||
defs: Array [ | ||
TypeDefinition$1 { | ||
name: Identifier<"A">, | ||
node: TSInterfaceDeclaration$1, | ||
}, | ||
], | ||
name: "A", | ||
references: Array [ | ||
Reference$1 { | ||
identifier: Identifier<"A">, | ||
isTypeReference: true, | ||
resolved: Variable$1, | ||
}, | ||
], | ||
isValueVariable: false, | ||
isTypeVariable: true, | ||
}, | ||
Variable$2 { | ||
defs: Array [ | ||
TypeDefinition$2 { | ||
name: Identifier<"U">, | ||
node: TSTypeParameter$2, | ||
}, | ||
], | ||
name: "U", | ||
references: Array [], | ||
isValueVariable: false, | ||
isTypeVariable: true, | ||
}, | ||
Variable$3 { | ||
defs: Array [ | ||
TypeDefinition$3 { | ||
name: Identifier<"T">, | ||
node: TSTypeAliasDeclaration$3, | ||
}, | ||
], | ||
name: "T", | ||
references: Array [ | ||
Reference$2 { | ||
identifier: Identifier<"T">, | ||
isTypeReference: true, | ||
resolved: Variable$3, | ||
}, | ||
], | ||
isValueVariable: false, | ||
isTypeVariable: true, | ||
}, | ||
Variable$4 { | ||
defs: Array [ | ||
ClassNameDefinition$4 { | ||
name: Identifier<"B">, | ||
node: ClassDeclaration$4, | ||
}, | ||
], | ||
name: "B", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$5 { | ||
defs: Array [ | ||
ClassNameDefinition$5 { | ||
name: Identifier<"B">, | ||
node: ClassDeclaration$4, | ||
}, | ||
], | ||
name: "B", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
], | ||
scopes: Array [ | ||
GlobalScope$1 { | ||
block: Program$5, | ||
isStrict: false, | ||
references: Array [ | ||
Reference$1, | ||
Reference$2, | ||
], | ||
set: Map { | ||
"A" => Variable$1, | ||
"T" => Variable$3, | ||
"B" => Variable$4, | ||
}, | ||
type: "global", | ||
upper: null, | ||
variables: Array [ | ||
Variable$1, | ||
Variable$3, | ||
Variable$4, | ||
], | ||
}, | ||
TypeScope$2 { | ||
block: TSInterfaceDeclaration$1, | ||
isStrict: true, | ||
references: Array [], | ||
set: Map { | ||
"U" => Variable$2, | ||
}, | ||
type: "type", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$2, | ||
], | ||
}, | ||
ClassScope$3 { | ||
block: ClassDeclaration$4, | ||
isStrict: true, | ||
references: Array [], | ||
set: Map { | ||
"B" => Variable$5, | ||
}, | ||
type: "class", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$5, | ||
], | ||
}, | ||
], | ||
} | ||
`; |
2 changes: 2 additions & 0 deletions
2
packages/scope-manager/tests/fixtures/class/declaration/implements.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
interface A {} | ||
class B implements A {} |
82 changes: 82 additions & 0 deletions
82
packages/scope-manager/tests/fixtures/class/declaration/implements.ts.shot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`class declaration implements 1`] = ` | ||
ScopeManager { | ||
variables: Array [ | ||
Variable$1 { | ||
defs: Array [ | ||
TypeDefinition$1 { | ||
name: Identifier<"A">, | ||
node: TSInterfaceDeclaration$1, | ||
}, | ||
], | ||
name: "A", | ||
references: Array [ | ||
Reference$1 { | ||
identifier: Identifier<"A">, | ||
isTypeReference: true, | ||
resolved: Variable$1, | ||
}, | ||
], | ||
isValueVariable: false, | ||
isTypeVariable: true, | ||
}, | ||
Variable$2 { | ||
defs: Array [ | ||
ClassNameDefinition$2 { | ||
name: Identifier<"B">, | ||
node: ClassDeclaration$2, | ||
}, | ||
], | ||
name: "B", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$3 { | ||
defs: Array [ | ||
ClassNameDefinition$3 { | ||
name: Identifier<"B">, | ||
node: ClassDeclaration$2, | ||
}, | ||
], | ||
name: "B", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
], | ||
scopes: Array [ | ||
GlobalScope$1 { | ||
block: Program$3, | ||
isStrict: false, | ||
references: Array [ | ||
Reference$1, | ||
], | ||
set: Map { | ||
"A" => Variable$1, | ||
"B" => Variable$2, | ||
}, | ||
type: "global", | ||
upper: null, | ||
variables: Array [ | ||
Variable$1, | ||
Variable$2, | ||
], | ||
}, | ||
ClassScope$2 { | ||
block: ClassDeclaration$2, | ||
isStrict: true, | ||
references: Array [], | ||
set: Map { | ||
"B" => Variable$3, | ||
}, | ||
type: "class", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$3, | ||
], | ||
}, | ||
], | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function decorator() {} | ||
@decorator | ||
class Foo {} |
Oops, something went wrong.