Skip to content
Snippets Groups Projects
Commit 88413cd2 authored by Per Lindgren's avatar Per Lindgren
Browse files

ast printing

parent fb1f90a7
Branches
No related tags found
No related merge requests found
......@@ -2,6 +2,6 @@ fn f(x: i32, y: i32) -> i32 {
3 + 5 + x + y
}
fn main() -> i32 {
f(1, 2)
fn main() {
f(1, 2);
}
fn main() {
let mut a = 1;
let b = &mut a;
let c = b;
let c: &mut i32 = b;
}
......@@ -233,10 +233,12 @@ impl Stmt {
match self {
// Id mut? (: Type)? (= Expr)?
Stmt::Let(id, m, ot, oe) => {
write!(fmt, "let {}", id)?;
write!(fmt, "let ")?;
if *m {
write!(fmt, "mut ")?;
}
write!(fmt, "{}", id)?;
if let Some(t) = ot {
write!(fmt, ": {}", t)?;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment