codegen: add Grouping expr support

- entry: return value of rayoko main
This commit is contained in:
Luna 2019-10-05 10:08:27 -03:00
parent 34481c8ea8
commit 809dad1095
3 changed files with 6 additions and 2 deletions

View file

@ -26,7 +26,7 @@ fn multwo(num: i32, double_flag: bool) i32 {
}
fn add(a: i32, b: i32) i32 {
return a + b;
return a + b + (2 * b);
}
fn main() i32 {

View file

@ -258,6 +258,10 @@ pub const Codegen = struct {
};
},
.Grouping => |expr_ptr| blk: {
break :blk try self.emitExpr(builder, expr_ptr);
},
else => {
std.debug.warn("Got unexpected expr {}\n", ast.ExprType(expr.*));
return CompileError.EmitError;

View file

@ -1,3 +1,3 @@
int main(void) {
__rayoko_main();
return __rayoko_main();
}