Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eliascxstro committed Nov 12, 2024
1 parent 5378330 commit 8aab634
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion interp/src/flatten/structures/environment/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ impl<C: AsRef<Context> + Clone> Environment<C> {

pub fn print_pc_string(&self) {
let current_nodes = self.pc.iter();
let ctx = &self.ctx.as_ref();
let ctx = self.ctx.as_ref();
for node in current_nodes {
println!(
"{}: {}",
Expand Down
20 changes: 10 additions & 10 deletions interp/src/flatten/structures/environment/program_counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,21 @@ impl ControlPoint {
}
}

/// Returns a string showing the path from the root node to input node.
/// How to get context?
/// Returns a string showing the path from the root node to input node. This
/// path is displayed in the minimal metadata path syntax.
pub fn string_path(&self, ctx: &Context) -> String {
// Does it matter if it takes ownership?
let path = SearchPath::find_path_from_root(self.control_node_idx, ctx);
let mut path_vec = path.path;

// Remove first element since we know it is a root
path_vec.remove(0);
let mut string_path = String::new();
string_path.push_str(".");

Check failure on line 69 in interp/src/flatten/structures/environment/program_counter.rs

View workflow job for this annotation

GitHub Actions / Check Formatting

calling `push_str()` using a single-character string literal
let control_map = &ctx.primary.control;
let mut string_path = String::from("");
let mut count = -1;
let mut body = false;
let mut if_branches: HashMap<ControlIdx, String> = HashMap::new();
for search_node in path.path {
for search_node in path_vec {
// The control_idx should exist in the map, so we shouldn't worry about it
// exploding. First SearchNode is root, hence "."
let control_idx = search_node.node;
Expand Down Expand Up @@ -95,11 +99,7 @@ impl ControlPoint {
}
_ => {}
};
// At root, at end to process logic above.
if string_path.is_empty() {
string_path += ".";
continue;
}

let control_type = if body {
body = false;
count = -1;
Expand Down

0 comments on commit 8aab634

Please sign in to comment.