diff --git a/compiler/noirc_frontend/src/hir/def_map/mod.rs b/compiler/noirc_frontend/src/hir/def_map/mod.rs index fbf94468c4b..e86d4efede7 100644 --- a/compiler/noirc_frontend/src/hir/def_map/mod.rs +++ b/compiler/noirc_frontend/src/hir/def_map/mod.rs @@ -91,14 +91,15 @@ impl CrateDefMap { let mut ast = ast.into_sorted(); for macro_processor in ¯o_processors { - ast = match macro_processor.process_untyped_ast(ast, &crate_id, context) { - Ok(ast) => ast, + match macro_processor.process_untyped_ast(ast.clone(), &crate_id, context) { + Ok(processed_ast) => { + ast = processed_ast; + } Err((error, file_id)) => { let def_error = DefCollectorErrorKind::MacroError(error); errors.push((def_error.into(), file_id)); - return errors; } - }; + } } // Allocate a default Module for the root, giving it a ModuleId diff --git a/compiler/noirc_frontend/src/parser/mod.rs b/compiler/noirc_frontend/src/parser/mod.rs index a6c631895cd..0ff7819c00f 100644 --- a/compiler/noirc_frontend/src/parser/mod.rs +++ b/compiler/noirc_frontend/src/parser/mod.rs @@ -208,7 +208,7 @@ fn force<'a, T: 'a>(parser: impl NoirParser + 'a) -> impl NoirParser, pub functions: Vec, @@ -344,6 +344,7 @@ impl std::fmt::Display for SortedSubModule { } } +#[derive(Clone)] pub struct SortedSubModule { pub name: Ident, pub contents: SortedModule,