Skip to content

Commit

Permalink
refactor: move proc registration to after proc compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbinth committed Jul 23, 2024
1 parent d11dcca commit a850c9b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions assembly/src/assembler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ impl Assembler {
// Compile this procedure
let procedure = self.compile_procedure(pctx, mast_forest_builder)?;

// register the procedure in the MAST forest
mast_forest_builder.make_root(procedure.body_node_id());

// Cache the compiled procedure, unless it's the program entrypoint
if is_entry {
compiled_entrypoint = Some(Arc::from(procedure));
Expand Down Expand Up @@ -432,8 +435,6 @@ impl Assembler {
self.compile_body(proc.iter(), &mut proc_ctx, None, mast_forest_builder)?
};

mast_forest_builder.make_root(proc_body_root);

Ok(proc_ctx.into_procedure(proc_body_root))
}

Expand Down

0 comments on commit a850c9b

Please sign in to comment.