Closed range ... (both inclusive); Type comparisons with == and !=

This commit is contained in:
Ginger Bill
2017-01-19 11:29:15 +00:00
parent 2af9fb79dc
commit 4603d2525e
7 changed files with 129 additions and 267 deletions
+7 -1
View File
@@ -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;