diff options
Diffstat (limited to 'src/lower.c')
-rw-r--r-- | src/lower.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/lower.c b/src/lower.c index cf36fb0..35d16fe 100644 --- a/src/lower.c +++ b/src/lower.c @@ -48,13 +48,13 @@ static int lower_binop(struct state *state, struct ast *binop) return -1; switch (binop->k) { - case AST_ADD: printf(" + "); break; - case AST_SUB: printf(" - "); break; - case AST_MUL: printf(" * "); break; - case AST_DIV: printf(" / "); break; - case AST_REM: printf(" %% "); break; - case AST_LSHIFT: printf(" << "); break; - case AST_RSHIFT: printf(" >> "); break; + case AST_ADD: printf(" + "); break; + case AST_SUB: printf(" - "); break; + case AST_MUL: printf(" * "); break; + case AST_DIV: printf(" / "); break; + case AST_REM: printf(" %% "); break; + case AST_LSHIFT: printf(" << "); break; + case AST_RSHIFT: printf(" >> "); break; default: internal_error("missing binop lowering"); return -1; @@ -143,6 +143,7 @@ static int lower_type_ref(struct type *type) static int lower_type_ptr(struct type *type) { + /* would I need parentheses in some cases? */ if (lower_type(tptr_base(type))) return -1; @@ -207,9 +208,9 @@ static int lower_init(struct state *state, struct ast *init) static int lower_unop(struct state *state, struct ast *expr) { switch (expr->k) { - case AST_LNOT: printf("-"); break; - case AST_NOT: printf("~"); break; - case AST_NEG: printf("-"); break; + case AST_LNOT: printf("-"); break; + case AST_NOT: printf("~"); break; + case AST_NEG: printf("-"); break; default: internal_error("missing unop lowering"); return -1; @@ -330,9 +331,9 @@ static int lower_if(struct state *state, struct ast *stmt) static int lower_statement(struct state *state, struct ast *stmt) { switch (stmt->k) { - case AST_LET: return lower_let(state, stmt); - case AST_CALL: return lower_call(state, stmt); - case AST_IF: return lower_if(state, stmt); + case AST_LET: return lower_let(state, stmt); + case AST_CALL: return lower_call(state, stmt); + case AST_IF: return lower_if(state, stmt); default: internal_error("missing statement lowering"); return -1; |