@@ -90,9 +90,9 @@ impl SemanticAnalyzer {
9090 Ok ( ( ) )
9191 }
9292
93- fn collect_symbols_recursive ( & mut self , node : & ASTNode , file_path : & str , scope_path : & mut Vec < String > ) -> Result < ( ) , AnalysisError > {
94- use crate :: symbol_table:: { Symbol , SymbolKind , Scope , ScopeType } ;
95- use crate :: ast:: NodeType ;
93+ fn collect_symbols_recursive ( & mut self , node : & ASTNode , file_path : & str , _scope_path : & mut Vec < String > ) -> Result < ( ) , AnalysisError > {
94+ use crate :: symbol_table:: { Symbol , SymbolKind } ;
95+ use smart_diff_parser :: ast:: NodeType ;
9696
9797 match node. node_type {
9898 NodeType :: Function | NodeType :: Method | NodeType :: Constructor => {
@@ -101,8 +101,8 @@ impl SemanticAnalyzer {
101101
102102 let symbol = Symbol {
103103 name : name. clone ( ) ,
104- kind : SymbolKind :: Function ,
105- scope_id : self . symbol_table . current_scope ( ) ,
104+ symbol_kind : SymbolKind :: Function ,
105+ scope_id : 0 , // Use global scope for now
106106 line : node. metadata . line ,
107107 column : node. metadata . column ,
108108 file_path : file_path. to_string ( ) ,
@@ -119,8 +119,8 @@ impl SemanticAnalyzer {
119119
120120 let symbol = Symbol {
121121 name : name. clone ( ) ,
122- kind : SymbolKind :: Variable ,
123- scope_id : self . symbol_table . current_scope ( ) ,
122+ symbol_kind : SymbolKind :: Variable ,
123+ scope_id : 0 , // Use global scope for now
124124 line : node. metadata . line ,
125125 column : node. metadata . column ,
126126 file_path : file_path. to_string ( ) ,
@@ -135,8 +135,8 @@ impl SemanticAnalyzer {
135135 if let Some ( name) = node. metadata . attributes . get ( "name" ) {
136136 let symbol = Symbol {
137137 name : name. clone ( ) ,
138- kind : SymbolKind :: Type ,
139- scope_id : self . symbol_table . current_scope ( ) ,
138+ symbol_kind : SymbolKind :: Class ,
139+ scope_id : 0 , // Use global scope for now
140140 line : node. metadata . line ,
141141 column : node. metadata . column ,
142142 file_path : file_path. to_string ( ) ,
@@ -145,33 +145,14 @@ impl SemanticAnalyzer {
145145 } ;
146146
147147 self . symbol_table . add_symbol ( symbol) ;
148-
149- // Create new scope for class
150- let scope = Scope {
151- scope_type : ScopeType :: Class ,
152- name : Some ( name. clone ( ) ) ,
153- parent : Some ( self . symbol_table . current_scope ( ) ) ,
154- symbols : Vec :: new ( ) ,
155- } ;
156- let scope_id = self . symbol_table . add_scope ( scope) ;
157- self . symbol_table . enter_scope ( scope_id) ;
158- scope_path. push ( name. clone ( ) ) ;
159148 }
160149 }
161150 _ => { }
162151 }
163152
164153 // Recursively process children
165154 for child in & node. children {
166- self . collect_symbols_recursive ( child, file_path, scope_path) ?;
167- }
168-
169- // Exit scope if we entered one
170- if matches ! ( node. node_type, NodeType :: Class | NodeType :: Interface ) {
171- if node. metadata . attributes . get ( "name" ) . is_some ( ) {
172- self . symbol_table . exit_scope ( ) ;
173- scope_path. pop ( ) ;
174- }
155+ self . collect_symbols_recursive ( child, file_path, _scope_path) ?;
175156 }
176157
177158 Ok ( ( ) )
0 commit comments