Skip to content

Commit

Permalink
rename Procedure::code() to body_node terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
plafer committed Jun 16, 2024
1 parent fad9712 commit c34a532
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
11 changes: 6 additions & 5 deletions assembly/src/assembler/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,12 @@ impl ProcedureContext {
self.visibility.is_syscall()
}

pub fn into_procedure(self, code: MastNodeId) -> Box<Procedure> {
let procedure = Procedure::new(self.name, self.visibility, self.num_locals as u32, code)
.with_span(self.span)
.with_source_file(self.source_file)
.with_callset(self.callset);
pub fn into_procedure(self, body_node_id: MastNodeId) -> Box<Procedure> {
let procedure =
Procedure::new(self.name, self.visibility, self.num_locals as u32, body_node_id)
.with_span(self.span)
.with_source_file(self.source_file)
.with_callset(self.callset);
Box::new(procedure)
}
}
Expand Down
4 changes: 2 additions & 2 deletions assembly/src/assembler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ impl Assembler {
}
});

let proc_code_node = &mast_forest[proc.code()];
let proc_code_node = &mast_forest[proc.body_node_id()];
exports.push(proc_code_node.digest());
}

Expand All @@ -592,7 +592,7 @@ impl Assembler {
// Compile the module graph rooted at the entrypoint
let entry_procedure = self.compile_subgraph(entrypoint, true, context, mast_forest)?;

mast_forest.set_entrypoint(entry_procedure.code());
mast_forest.set_entrypoint(entry_procedure.body_node_id());

Ok(())
}
Expand Down
14 changes: 7 additions & 7 deletions assembly/src/assembler/procedure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct Procedure {
visibility: Visibility,
num_locals: u32,
/// The MAST node id for the root of this procedure
code: MastNodeId,
body_node_id: MastNodeId,
/// The set of MAST roots called by this procedure
callset: CallSet,
}
Expand All @@ -40,15 +40,15 @@ impl Procedure {
path: FullyQualifiedProcedureName,
visibility: Visibility,
num_locals: u32,
code: MastNodeId,
body_node_id: MastNodeId,
) -> Self {
Self {
span: SourceSpan::default(),
source_file: None,
path,
visibility,
num_locals,
code,
body_node_id,
callset: Default::default(),
}
}
Expand Down Expand Up @@ -104,13 +104,13 @@ impl Procedure {

/// Returns the root of this procedure's MAST.
pub fn mast_root(&self, mast_forest: &MastForest) -> RpoDigest {
let code_node = &mast_forest[self.code];
code_node.digest()
let body_node = &mast_forest[self.body_node_id];
body_node.digest()
}

/// Returns a reference to the MAST node ID of this procedure.
pub fn code(&self) -> MastNodeId {
self.code
pub fn body_node_id(&self) -> MastNodeId {
self.body_node_id
}

/// Returns a reference to a set of all procedures (identified by their MAST roots) which may
Expand Down
4 changes: 2 additions & 2 deletions core/src/mast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ pub struct MastForest {

/// The "entrypoint", when set, is the root of the entire forest, i.e. a path exists from this
/// node to all other roots in the forest. This corresponds to the executable entry point.
/// Whether or not the entrypoint is set distinguishes a MAST which is executable, versus a MAST
/// which represents a library.
/// Whether or not the entrypoint is set distinguishes a MAST which is executable, versus a
/// MAST which represents a library.
entrypoint: Option<MastNodeId>,
kernel: Kernel,
}
Expand Down

0 comments on commit c34a532

Please sign in to comment.