diff --git a/src/analyzer/expr/call/argument_analyzer.rs b/src/analyzer/expr/call/argument_analyzer.rs index c0d4fdbc..91f59dc9 100644 --- a/src/analyzer/expr/call/argument_analyzer.rs +++ b/src/analyzer/expr/call/argument_analyzer.rs @@ -56,21 +56,26 @@ pub(crate) fn check_argument_matches( let config = statements_analyzer.get_config(); - for hook in &config.hooks { - hook.after_argument_analysis( - analysis_data, - AfterArgAnalysisData { - functionlike_id, - statements_analyzer, - context, - arg_value_type: &arg_value_type, - arg, - param_type: ¶m_type, - argument_offset, - function_call_pos, - function_name_pos, - }, - ); + if !analysis_data.after_arg_hook_called.insert(( + arg.1.pos().start_offset() as u32, + arg.1.pos().end_offset() as u32, + )) { + for hook in &config.hooks { + hook.after_argument_analysis( + analysis_data, + AfterArgAnalysisData { + functionlike_id, + statements_analyzer, + context, + arg_value_type: &arg_value_type, + arg, + param_type: ¶m_type, + argument_offset, + function_call_pos, + function_name_pos, + }, + ); + } } self::verify_type( diff --git a/src/analyzer/expression_analyzer.rs b/src/analyzer/expression_analyzer.rs index 93b48c0d..945e4ea2 100644 --- a/src/analyzer/expression_analyzer.rs +++ b/src/analyzer/expression_analyzer.rs @@ -585,15 +585,20 @@ pub(crate) fn analyze( aast::Expr_::Package(_) => todo!(), } - for hook in &statements_analyzer.get_config().hooks { - hook.after_expr_analysis( - analysis_data, - AfterExprAnalysisData { - statements_analyzer, - expr, - context, - }, - ); + if !analysis_data.after_expr_hook_called.insert(( + expr.pos().start_offset() as u32, + expr.pos().end_offset() as u32, + )) { + for hook in &statements_analyzer.get_config().hooks { + hook.after_expr_analysis( + analysis_data, + AfterExprAnalysisData { + statements_analyzer, + expr, + context, + }, + ); + } } Ok(()) diff --git a/src/analyzer/function_analysis_data.rs b/src/analyzer/function_analysis_data.rs index e27fe95d..dcebdb51 100644 --- a/src/analyzer/function_analysis_data.rs +++ b/src/analyzer/function_analysis_data.rs @@ -41,6 +41,8 @@ pub struct FunctionAnalysisData { pub matched_ignore_positions: FxHashSet<(u32, u32)>, pub type_variable_bounds: FxHashMap, Vec)>, pub migrate_function: Option, + pub after_expr_hook_called: FxHashSet<(u32, u32)>, + pub after_arg_hook_called: FxHashSet<(u32, u32)>, } impl FunctionAnalysisData { @@ -81,6 +83,8 @@ impl FunctionAnalysisData { issue_counts: FxHashMap::default(), type_variable_bounds: FxHashMap::default(), migrate_function: None, + after_arg_hook_called: FxHashSet::default(), + after_expr_hook_called: FxHashSet::default(), } }