pub struct FunctionDefItem {
pub name: String,
pub return_type: TypeInfo,
pub is_static: bool,
pub is_inline: bool,
pub parameters: Vec<Parameter>,
pub body_statements: Vec<Statement>,
pub location: SourceLocation,
pub body_location: Option<SourceLocation>,
pub doc: Option<FunctionDoc>,
}Fields§
§name: String§return_type: TypeInfo§is_static: bool§is_inline: bool§parameters: Vec<Parameter>§body_statements: Vec<Statement>§location: SourceLocation§body_location: Option<SourceLocation>§doc: Option<FunctionDoc>Implementations§
Source§impl FunctionDefItem
impl FunctionDefItem
Sourcepub fn find_calls<'a>(
&'a self,
function_names: &[&str],
) -> Vec<&'a CallExpression>
pub fn find_calls<'a>( &'a self, function_names: &[&str], ) -> Vec<&'a CallExpression>
Find all calls to specific functions in the body Returns references to all CallExpression nodes that match any of the given function names
Sourcepub fn find_calls_matching<F>(&self, predicate: F) -> Vec<&CallExpression>
pub fn find_calls_matching<F>(&self, predicate: F) -> Vec<&CallExpression>
Find all calls matching a predicate in the body
Sourcepub fn find_signal_registrations(&self, type_name: &str) -> Vec<Signal>
pub fn find_signal_registrations(&self, type_name: &str) -> Vec<Signal>
Extract signal registrations from the function body.
Populates enum_value when the signal is assigned via
signals[ENUM] = g_signal_new(...).
Sourcepub fn iter_local_declarations(&self) -> impl Iterator<Item = &VariableDecl>
pub fn iter_local_declarations(&self) -> impl Iterator<Item = &VariableDecl>
Iterate all local variable declarations in the function body recursively
Sourcepub fn collect_return_values(&self) -> Vec<&Expression>
pub fn collect_return_values(&self) -> Vec<&Expression>
Collect all return values from the function body
Sourcepub fn is_var_returned(&self, type_info: &TypeInfo) -> bool
pub fn is_var_returned(&self, type_info: &TypeInfo) -> bool
Check if any variable of the given type is directly returned from the function
Sourcepub fn is_var_passed_to_cleanup(&self, type_info: &TypeInfo) -> bool
pub fn is_var_passed_to_cleanup(&self, type_info: &TypeInfo) -> bool
Check if any variable of the given type is passed to a cleanup call (g_object_unref, g_free, etc.)
Sourcepub fn is_var_passed_to_function(
&self,
var_name: &str,
func_name: &str,
arg_index: usize,
) -> bool
pub fn is_var_passed_to_function( &self, var_name: &str, func_name: &str, arg_index: usize, ) -> bool
Check if the named variable is passed to a specific function at a specific argument position
Sourcepub fn is_var_allocated(&self, type_info: &TypeInfo) -> bool
pub fn is_var_allocated(&self, type_info: &TypeInfo) -> bool
Check if any variable of the given type is allocated via an allocation
call Uses call.is_allocation_call() to detect allocations by
default
Sourcepub fn is_var_allocated_with(
&self,
type_info: &TypeInfo,
is_allocation: impl Fn(&CallExpression) -> bool,
) -> bool
pub fn is_var_allocated_with( &self, type_info: &TypeInfo, is_allocation: impl Fn(&CallExpression) -> bool, ) -> bool
Check if any variable of the given type is allocated via a custom allocation predicate
Sourcepub fn find_install_properties_calls(&self) -> Vec<&CallExpression>
pub fn find_install_properties_calls(&self) -> Vec<&CallExpression>
Find all g_object_class_install_properties calls in the function body
Sourcepub fn local_var_types(&self) -> HashMap<&str, &TypeInfo>
pub fn local_var_types(&self) -> HashMap<&str, &TypeInfo>
Map every named parameter and local variable to its TypeInfo.
Parameters appear first; local declarations in body order after that,
so an inner-scope shadowing declaration overwrites the outer one.
Sourcepub fn get_param_by_name(&self, name: &str) -> Option<&Parameter>
pub fn get_param_by_name(&self, name: &str) -> Option<&Parameter>
Get a parameter by name