ast: add stmt printing

This commit is contained in:
Luna 2019-08-24 16:20:32 -03:00
parent 86d8fe1a3a
commit a4fa0e0cfc

View file

@ -142,7 +142,28 @@ pub fn printNode(node: *Node, ident: usize) void {
}
},
.Expr => |expr| printExpr(expr),
.Expr => |expr| {
printIdent(ident);
printExpr(expr);
std.debug.warn("\n");
},
.Stmt => |stmt| blk: {
switch (stmt.*) {
.Println => |expr| blk2: {
printIdent(ident);
std.debug.warn("println(");
printExpr(expr);
std.debug.warn("\n");
},
.Expr => |expr| {
printIdent(ident);
printExpr(expr);
std.debug.warn("\n");
},
}
},
else => {
print(ident, "unknown node: {}\n", node);