diff --git a/crates/analysis/src/lib.rs b/crates/analysis/src/lib.rs index ffe8f97..4ab221b 100644 --- a/crates/analysis/src/lib.rs +++ b/crates/analysis/src/lib.rs @@ -272,15 +272,10 @@ impl<'a, 'src, 'ast: 'src, E: FnMut(AnalysisError<'ast, 'src>)> MacroAnalysis<'a }); return; } - if self - .global_defs - .get(code_ref.ident()) - .map_or(false, |defs| { - defs.iter().any( - |def| matches!(def, Definition::Macro(m) if m.args.0.len() > 0), - ) - }) - { + if self.global_defs.get(code_ref.ident()).is_some_and(|defs| { + defs.iter() + .any(|def| matches!(def, Definition::Macro(m) if m.args.0.len() > 0)) + }) { self.emit(AnalysisError::NotYetSupported { intent: "code introspection for macros with arguments".to_owned(), span: ((), code_ref.1), diff --git a/crates/ast/src/util.rs b/crates/ast/src/util.rs index 38d91f9..dbf69ef 100644 --- a/crates/ast/src/util.rs +++ b/crates/ast/src/util.rs @@ -56,7 +56,7 @@ pub fn u256_as_push(value: U256) -> Opcode { } } -pub fn compute_selector(name: &Spanned<&str>, args: Box<[&Spanned]>) -> FixedBytes<4> { +pub fn compute_selector(name: &Spanned<&str>, args: &[&Spanned]) -> FixedBytes<4> { let arg_types: Vec = args.iter().map(|arg| arg.0.to_string()).collect(); let signature = format!("{}({})", name.0, arg_types.join(",")); @@ -90,8 +90,10 @@ mod tests { ]), }; - let func_selector = compute_selector(&func.name, func.args.iter().collect::>()); - let err_selector = compute_selector(&err.name, err.args.iter().collect::>()); + let func_selector = + compute_selector(&func.name, func.args.iter().collect::>().as_slice()); + let err_selector = + compute_selector(&err.name, err.args.iter().collect::>().as_slice()); let expected_func_signature = "transfer(address,uint256)"; let expected_err_signature = "TransferFailed(string,uint256)";