pub fn find_function_in_ast<'a>(
ast: &'a File,
metric_name: &str,
line: usize,
) -> Option<FoundFunction<'a>>Expand description
Find a function in the AST by name and line number.
Searches both top-level functions (syn::Item::Fn) and methods
inside impl blocks (syn::Item::Impl -> syn::ImplItem::Fn).
§Name Matching
The metric_name parameter may be in one of two formats:
- Simple name:
"method_name"(for top-level functions) - Qualified name:
"TypeName::method_name"(for impl methods)
For impl methods, we match if either:
- The metric name equals the simple method name
- The metric name ends with
::method_name
§Spec 213
This function is used by the fallback purity analysis path when pre-extracted
data is not available. When with_extracted_data() is called on the builder,
this function is not used. It’s kept for backward compatibility with non-parallel
analysis paths and testing.