Commit de862aa Song Gao
committed
1 parent ac097e9 commit de862aa Copy full SHA for de862aa
File tree 6 files changed +80
-7
lines changed
tests/fixtures/typescript-eslint
functions/function-declaration
6 files changed +80
-7
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,9 @@ impl<'a> Binder<'a> for Function<'a> {
161
161
builder. current_node_id ,
162
162
) ;
163
163
ident. symbol_id . set ( Some ( symbol_id) ) ;
164
- } else if self . r#type == FunctionType :: FunctionDeclaration {
164
+ } else if self . r#type == FunctionType :: FunctionDeclaration
165
+ || self . r#type == FunctionType :: TSDeclareFunction
166
+ {
165
167
// The visitor is already inside the function scope,
166
168
// retrieve the parent scope for the function id to bind to.
167
169
Original file line number Diff line number Diff line change 1
1
-- -
2
2
source : crates / oxc_semantic / tests / main .rs
3
+ assertion_line : 147
3
4
input_file : crates / oxc_semantic / tests / fixtures / typescript - eslint / decorators / class -deco -with -object -param .ts
4
5
snapshot_kind : text
5
6
---
@@ -14,7 +15,7 @@ snapshot_kind: text
14
15
" symbols" : [
15
16
{
16
17
" flags" : " SymbolFlags(FunctionScopedVariable)" ,
17
- " id" : 0 ,
18
+ " id" : 1 ,
18
19
" name" : " param" ,
19
20
" node" : " BindingRestElement" ,
20
21
" references" : []
@@ -33,9 +34,23 @@ snapshot_kind: text
33
34
" id" : 0 ,
34
35
" node" : " Program" ,
35
36
" symbols" : [
37
+ {
38
+ " flags" : " SymbolFlags(BlockScopedVariable | Function)" ,
39
+ " id" : 0 ,
40
+ " name" : " deco" ,
41
+ " node" : " Function(deco)" ,
42
+ " references" : [
43
+ {
44
+ " flags" : " ReferenceFlags(Read)" ,
45
+ " id" : 0 ,
46
+ " name" : " deco" ,
47
+ " node_id" : 19
48
+ }
49
+ ]
50
+ },
36
51
{
37
52
" flags" : " SymbolFlags(Class)" ,
38
- " id" : 1 ,
53
+ " id" : 2 ,
39
54
" name" : " Foo" ,
40
55
" node" : " Class(Foo)" ,
41
56
" references" : []
Original file line number Diff line number Diff line change
1
+ -- -
2
+ source : crates / oxc_semantic / tests / main .rs
3
+ assertion_line : 147
4
+ input_file : crates / oxc_semantic / tests / fixtures / typescript - eslint / functions / function -declaration/declare-function .ts
5
+ snapshot_kind: text
6
+ ---
7
+ [
8
+ {
9
+ " children" : [
10
+ {
11
+ " children" : [],
12
+ " flags" : " ScopeFlags(StrictMode | Function)" ,
13
+ " id" : 1 ,
14
+ " node" : " Function(A)" ,
15
+ " symbols" : []
16
+ },
17
+ {
18
+ " children" : [],
19
+ " flags" : " ScopeFlags(StrictMode | Function)" ,
20
+ " id" : 2 ,
21
+ " node" : " Function(B)" ,
22
+ " symbols" : []
23
+ }
24
+ ],
25
+ " flags" : " ScopeFlags(StrictMode | Top)" ,
26
+ " id" : 0 ,
27
+ " node" : " Program" ,
28
+ " symbols" : [
29
+ {
30
+ " flags" : " SymbolFlags(BlockScopedVariable | Function)" ,
31
+ " id" : 0 ,
32
+ " name" : " A" ,
33
+ " node" : " Function(A)" ,
34
+ " references" : []
35
+ },
36
+ {
37
+ " flags" : " SymbolFlags(BlockScopedVariable | Function)" ,
38
+ " id" : 1 ,
39
+ " name" : " B" ,
40
+ " node" : " Function(B)" ,
41
+ " references" : []
42
+ }
43
+ ]
44
+ }
45
+ ]
Original file line number Diff line number Diff line change
1
+ declare function A ( ) : void ;
2
+ function B ( ) : void { } ;
Original file line number Diff line number Diff line change 1
1
-- -
2
2
source : crates / oxc_semantic / tests / main .rs
3
+ assertion_line : 147
3
4
input_file : crates / oxc_semantic / tests / fixtures / typescript - eslint / functions / function -declaration/overload.ts
4
5
snapshot_kind: text
5
6
---
@@ -14,14 +15,14 @@ snapshot_kind: text
14
15
" symbols" : [
15
16
{
16
17
" flags" : " SymbolFlags(FunctionScopedVariable)" ,
17
- " id" : 0 ,
18
+ " id" : 1 ,
18
19
" name" : " a" ,
19
20
" node" : " FormalParameter(a)" ,
20
21
" references" : []
21
22
},
22
23
{
23
24
" flags" : " SymbolFlags(FunctionScopedVariable)" ,
24
- " id" : 1 ,
25
+ " id" : 2 ,
25
26
" name" : " b" ,
26
27
" node" : " FormalParameter(b)" ,
27
28
" references" : []
@@ -64,7 +65,7 @@ snapshot_kind: text
64
65
" symbols" : [
65
66
{
66
67
" flags" : " SymbolFlags(BlockScopedVariable | Function)" ,
67
- " id" : 2 ,
68
+ " id" : 0 ,
68
69
" name" : " foo" ,
69
70
" node" : " Function(foo)" ,
70
71
" references" : []
Original file line number Diff line number Diff line change 1
1
-- -
2
2
source : crates / oxc_semantic / tests / main .rs
3
+ assertion_line : 147
3
4
input_file : crates / oxc_semantic / tests / fixtures / typescript - eslint / type - declaration / literal - type3 .ts
4
5
snapshot_kind : text
5
6
-- -
@@ -28,7 +29,7 @@ snapshot_kind: text
28
29
" symbols" : [
29
30
{
30
31
" flags" : " SymbolFlags(FunctionScopedVariable)" ,
31
- " id" : 2 ,
32
+ " id" : 3 ,
32
33
" name" : " value" ,
33
34
" node" : " FormalParameter(value)" ,
34
35
" references" : []
@@ -67,6 +68,13 @@ snapshot_kind: text
67
68
" node_id" : 31
68
69
}
69
70
]
71
+ },
72
+ {
73
+ " flags" : " SymbolFlags(BlockScopedVariable | Function)" ,
74
+ " id" : 2 ,
75
+ " name" : " setAlignment" ,
76
+ " node" : " Function(setAlignment)" ,
77
+ " references" : []
70
78
}
71
79
]
72
80
}
You can’t perform that action at this time.
0 commit comments