Skip to content

Commit

Permalink
Also change slice notation
Browse files Browse the repository at this point in the history
  • Loading branch information
samestep committed Sep 12, 2023
1 parent c578241 commit 0581ac8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,10 @@ pub fn pprint(f: &Func) -> Result<String, JsError> {
writeln!(&mut s, "x{}[{}]", tuple.var(), member.member())?
}
rose::Expr::Slice { array, index } => {
writeln!(&mut s, "x{}![x{}]", array.var(), index.var())?
writeln!(&mut s, "&x{}[x{}]", array.var(), index.var())?
}
rose::Expr::Field { tuple, member } => {
writeln!(&mut s, "x{}![{}]", tuple.var(), member.member())?
writeln!(&mut s, "&x{}[{}]", tuple.var(), member.member())?
}
rose::Expr::Unary { op, arg } => match op {
rose::Unop::Not => writeln!(&mut s, "not x{}", arg.var())?,
Expand Down Expand Up @@ -558,9 +558,7 @@ pub fn pprint(f: &Func) -> Result<String, JsError> {
rose::Ty::Fin { size } => writeln!(&mut s, "{size}")?,
rose::Ty::Generic { id } => writeln!(&mut s, "G{}", id.generic())?,
rose::Ty::Ref { inner } => writeln!(&mut s, "&T{}", inner.ty())?,
rose::Ty::Array { index, elem } => {
writeln!(&mut s, "[T{}]T{}", index.ty(), elem.ty())?
}
rose::Ty::Array { index, elem } => writeln!(&mut s, "[T{}]T{}", index.ty(), elem.ty())?,
rose::Ty::Tuple { members } => {
write!(&mut s, "(")?;
print_elems(&mut s, 'T', members.iter().map(|member| member.ty()))?;
Expand Down

0 comments on commit 0581ac8

Please sign in to comment.