Compare commits

...

2 commits

Author SHA1 Message Date
d69365ba92 ast_printer: fix printing of func params 2019-09-20 13:36:15 -03:00
79107f876b add semicolons after statements 2019-09-20 13:34:13 -03:00
2 changed files with 6 additions and 4 deletions

View file

@ -48,20 +48,21 @@ pub fn printNode(node: *const Node, ident: usize) void {
const typ = method.typ.lexeme;
if (method.mutable) {
warn("(method mut {} {} {} {} ", vari, typ, name, ret_type);
warn("(method mut {} {} {} {} (", vari, typ, name, ret_type);
} else {
warn("(method {} {} {} {} ", vari, typ, name, ret_type);
warn("(method {} {} {} {} (", vari, typ, name, ret_type);
}
} else {
warn("(fn {} {} (", name, ret_type);
}
for (decl.params.toSlice()) |param| {
warn("({} {}) ", param.name.lexeme, param.typ.lexeme);
warn(" ({} {})", param.name.lexeme, param.typ.lexeme);
}
warn(") ");
printBlock(ident + 1, decl.body, false);
warn(")\n");
warn("\n");
},
.ConstDecl => |consts| {

View file

@ -679,6 +679,7 @@ pub const Parser = struct {
while (self.peek().typ != .RightBrace) {
var stmt = try self.parseStmt();
printer.printNode(try self.mkStmt(stmt), 0);
_ = try self.consumeSingle(.Semicolon);
try stmts.append(stmt.*);
}