diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-01-19 11:29:15 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-01-19 11:29:15 +0000 |
| commit | 4603d2525ebdfa57522ec60db4a86cbc99251ee5 (patch) | |
| tree | 9d5e22bbe6f93d7a5ebd3e404c7588243c22addb /src/ir.c | |
| parent | 2af9fb79dc528830aa2b57943d7d69074a5b399a (diff) | |
Closed range `...` (both inclusive); Type comparisons with == and !=
Diffstat (limited to 'src/ir.c')
| -rw-r--r-- | src/ir.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -4115,7 +4115,13 @@ void ir_build_range_interval(irProcedure *proc, AstNodeIntervalExpr *node, Type upper = ir_build_expr(proc, node->right); - irValue *cond = ir_emit_comp(proc, Token_Lt, ir_emit_load(proc, value), upper); + TokenKind op = Token_Lt; + switch (node->op.kind) { + case Token_HalfOpenRange: op = Token_Lt; break; + case Token_Ellipsis: op = Token_LtEq; break; + default: GB_PANIC("Invalid interval operator"); break; + } + irValue *cond = ir_emit_comp(proc, op, ir_emit_load(proc, value), upper); ir_emit_if(proc, cond, body, done); proc->curr_block = body; |