diff --git a/lang/src/fmt.rs b/lang/src/fmt.rs index caad9ec..e8c1862 100644 --- a/lang/src/fmt.rs +++ b/lang/src/fmt.rs @@ -149,7 +149,7 @@ impl<'a> Formatter<'a> { if let Some(expr) = list.get(i + 1) && let Some(rest) = self.source.get(expr.posi() as usize..) { - if insert_needed_semicolon(rest) { + if sep.is_empty() && insert_needed_semicolon(rest) { f.write_str(";")?; } if preserve_newlines(&self.source[..expr.posi() as usize]) > 1 { diff --git a/lang/src/son/hbvm/my_regalloc.rs b/lang/src/son/hbvm/my_regalloc.rs index ad33569..3d8feab 100644 --- a/lang/src/son/hbvm/my_regalloc.rs +++ b/lang/src/son/hbvm/my_regalloc.rs @@ -240,7 +240,10 @@ impl HbvmBackend { }; } - if let Some(PLoc::Ref(r, ..)) = ret { + if node.ty.loc(tys) == Loc::Stack + && let Some(PLoc::Reg(r, ..) | PLoc::WideReg(r, ..) | PLoc::Ref(r, ..)) = + ret + { alloc_buf.push(atr(*node.inputs.last().unwrap())); self.emit(instrs::cp(r, *alloc_buf.last().unwrap())) }