Skip to content

Commit

Permalink
Pretty-print tuple access with brackets (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
samestep authored Sep 8, 2023
1 parent f87a813 commit 53267c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,13 @@ pub fn pprint(f: &Func) -> Result<String, JsError> {
writeln!(&mut s, "x{}[x{}]", array.var(), index.var())?
}
rose::Expr::Member { tuple, member } => {
writeln!(&mut s, "x{}.{}", tuple.var(), member.member())?
writeln!(&mut s, "x{}[{}]", tuple.var(), member.member())?
}
rose::Expr::Slice { array, index } => {
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

0 comments on commit 53267c2

Please sign in to comment.