@@ -56,7 +56,6 @@ pub fn extract_calls(content: &str, language_name: &str) -> Result<Vec<CallSite>
5656 _ => return Ok ( vec ! [ ] ) ,
5757 } ;
5858
59- // Limit query analysis to prevent tree-sitter internal bugs
6059 let query = Query :: new ( & ts_language, query_source)
6160 . map_err ( |e| anyhow ! ( "Failed to compile query: {}" , e) ) ?;
6261
@@ -157,47 +156,17 @@ pub fn extract_calls(content: &str, language_name: &str) -> Result<Vec<CallSite>
157156 }
158157 }
159158
160- // Safely detect method calls using query context analysis
161- // For PHP: check if the call is wrapped in a method call pattern
162- if let ( Some ( name) , Some ( CallType :: Call ) , Some ( pos) ) = ( & callee_name, call_type, position) {
163- let is_method_call = match language {
164- Language :: TypeScript
165- | Language :: TypeScriptTsx
166- | Language :: JavaScript
167- | Language :: JavaScriptJsx => match_. captures . iter ( ) . any ( |c| {
168- callee_name_idx. map ( |idx| c. index == idx) . unwrap_or ( false )
169- && ( c. node . kind ( ) == "property_identifier" || c. node . kind ( ) == "identifier" )
170- } ) ,
171- Language :: Python => match_. captures . iter ( ) . any ( |c| {
172- callee_name_idx. map ( |idx| c. index == idx) . unwrap_or ( false )
173- && c. node . kind ( ) == "identifier"
174- } ) ,
175- Language :: Rust => match_. captures . iter ( ) . any ( |c| {
176- callee_name_idx. map ( |idx| c. index == idx) . unwrap_or ( false )
177- && c. node . kind ( ) == "field_identifier"
178- } ) ,
179- Language :: Go => match_. captures . iter ( ) . any ( |c| {
180- callee_name_idx. map ( |idx| c. index == idx) . unwrap_or ( false )
181- && c. node . kind ( ) == "field_identifier"
182- } ) ,
183- Language :: Php => {
184- // PHP method calls are already marked in query (@method.call, @static.call)
185- // @call is only for direct function calls
186- // So if we reach here with CallType::Call, it's definitely not a method call
187- false
188- }
189- _ => false ,
190- } ;
191-
192- let final_call_type = if is_method_call {
193- CallType :: MethodCall
194- } else {
195- CallType :: Call
196- } ;
197-
159+ // PHP method calls are already marked in query (@method.call, @static.call)
160+ // @call is only for direct function calls
161+ // So we need to check if the call was already classified as a method call
162+ if let ( Some ( name) , Some ( ct) , Some ( pos) ) = ( callee_name, call_type, position) {
198163 // PHP function/method names are case-insensitive; normalize to lowercase
199164 // so that HELPER() matches symbol helper during resolution and lookup.
200- let normalized_name = if language == Language :: Php {
165+ // Import names and constructor names should keep their original case for proper symbol resolution
166+ let normalized_name = if language == Language :: Php
167+ && ct != CallType :: Import
168+ && ct != CallType :: Constructor
169+ {
201170 name. to_lowercase ( )
202171 } else {
203172 name. clone ( )
@@ -207,13 +176,6 @@ pub fn extract_calls(content: &str, language_name: &str) -> Result<Vec<CallSite>
207176 callee_name : normalized_name,
208177 line : pos. 0 ,
209178 column : pos. 1 ,
210- call_type : final_call_type,
211- } ) ;
212- } else if let ( Some ( name) , Some ( ct) , Some ( pos) ) = ( callee_name, call_type, position) {
213- calls. push ( CallSite {
214- callee_name : name,
215- line : pos. 0 ,
216- column : pos. 1 ,
217179 call_type : ct,
218180 } ) ;
219181 }
0 commit comments