Skip to content

Commit

Permalink
Merge pull request #35 from Chia-Network/20230914-fix-rename-first-ca…
Browse files Browse the repository at this point in the history
…ll-segment

Fix rename error which caused clvm ops and callables to be renamed
  • Loading branch information
prozacchiwawa authored Sep 19, 2023
2 parents 308a98f + a2dcb11 commit 7a8eec8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/compiler/rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,18 @@ fn rename_in_bodyform(
},

BodyForm::Call(l, vs, tail) => {
let new_vs = map_m(
let mut new_vs = map_m(
&|x: &Rc<BodyForm>| -> Result<Rc<BodyForm>, CompileErr> {
Ok(Rc::new(rename_in_bodyform(namemap, x.clone())?))
},
vs,
)?;
// Ensure that we haven't renamed the 0th element of a call
// They exist in a separate (global) namespace of callables
// and aren't in the variable scope stack.
if !vs.is_empty() {
new_vs[0] = vs[0].clone();
}
let new_tail = if let Some(t) = tail.as_ref() {
Some(Rc::new(rename_in_bodyform(namemap, t.clone())?))
} else {
Expand Down

0 comments on commit 7a8eec8

Please sign in to comment.