Skip to content
Merged
9 changes: 5 additions & 4 deletions compiler/noirc_frontend/src/hir/def_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,15 @@ impl CrateDefMap {
let mut ast = ast.into_sorted();

for macro_processor in &macro_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
Expand Down
3 changes: 2 additions & 1 deletion compiler/noirc_frontend/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ fn force<'a, T: 'a>(parser: impl NoirParser<T> + 'a) -> impl NoirParser<Option<T
parser.map(Some).recover_via(empty().map(|_| None))
}

#[derive(Default)]
#[derive(Clone, Default)]
pub struct SortedModule {
pub imports: Vec<ImportStatement>,
pub functions: Vec<NoirFunction>,
Expand Down Expand Up @@ -344,6 +344,7 @@ impl std::fmt::Display for SortedSubModule {
}
}

#[derive(Clone)]
pub struct SortedSubModule {
pub name: Ident,
pub contents: SortedModule,
Expand Down