1
1
use std:: collections:: HashMap ;
2
2
3
3
use fuse_ast:: {
4
- Atom , BindingPatternKind , CallExpression , Chunk , Function , Identifier , VariableDeclaration ,
4
+ Atom , BinaryOperator , BinaryOperatorKind , BindingPatternKind , CallExpression , Chunk , Function ,
5
+ Identifier , VariableDeclaration ,
5
6
} ;
6
7
use fuse_common:: ReferenceType ;
7
8
use fuse_visitor:: {
8
- walk_call_expression_mut , walk_function_mut , walk_variable_declaration_mut , ScopeVisitor ,
9
- VisitorMut ,
9
+ walk_binary_operator_mut , walk_call_expression_mut , walk_function_mut ,
10
+ walk_variable_declaration_mut , ScopeVisitor , VisitorMut ,
10
11
} ;
11
12
12
13
#[ derive( Debug , PartialEq , Clone , Copy ) ]
@@ -30,19 +31,21 @@ impl PartialEq<ReferenceType> for ScopeId {
30
31
}
31
32
}
32
33
33
- struct IdentifierMap ( HashMap < Atom , ReferenceType > ) ;
34
+ struct IdentifierMap {
35
+ map : HashMap < Atom , ReferenceType > ,
36
+ }
34
37
35
38
impl IdentifierMap {
36
39
fn new ( ) -> Self {
37
- Self ( HashMap :: new ( ) )
40
+ Self { map : HashMap :: new ( ) }
38
41
}
39
42
40
43
fn insert ( & mut self , atom : Atom , ref_id : ReferenceType ) -> Option < ReferenceType > {
41
- self . 0 . insert ( atom, ref_id)
44
+ self . map . insert ( atom, ref_id)
42
45
}
43
46
44
47
fn get ( & self , atom : & Atom ) -> Option < ReferenceType > {
45
- self . 0 . get ( atom) . map ( |r| r. clone ( ) )
48
+ self . map . get ( atom) . map ( |r| r. clone ( ) )
46
49
}
47
50
}
48
51
@@ -185,6 +188,14 @@ impl<'ast> VisitorMut<'ast> for Inference<'ast> {
185
188
self . declare_identifier ( identifier) ;
186
189
walk_function_mut ( self , decl)
187
190
}
191
+
192
+ fn visit_binary_operator_mut ( & mut self , op : & ' ast mut BinaryOperator ) {
193
+ match & op. kind {
194
+ BinaryOperatorKind :: Member ( _) => { }
195
+ _ => { }
196
+ }
197
+ walk_binary_operator_mut ( self , op)
198
+ }
188
199
}
189
200
190
201
impl < ' ast > ScopeVisitor for Inference < ' ast > {
0 commit comments