aboutsummaryrefslogtreecommitdiff
path: root/src/ir.c
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-01-19 11:29:15 +0000
committerGinger Bill <bill@gingerbill.org>2017-01-19 11:29:15 +0000
commit4603d2525ebdfa57522ec60db4a86cbc99251ee5 (patch)
tree9d5e22bbe6f93d7a5ebd3e404c7588243c22addb /src/ir.c
parent2af9fb79dc528830aa2b57943d7d69074a5b399a (diff)
Closed range `...` (both inclusive); Type comparisons with == and !=
Diffstat (limited to 'src/ir.c')
-rw-r--r--src/ir.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ir.c b/src/ir.c
index eb4506ce7..b7d41817c 100644
--- a/src/ir.c
+++ b/src/ir.c
@@ -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;