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/check_stmt.c | |
| parent | 2af9fb79dc528830aa2b57943d7d69074a5b399a (diff) | |
Closed range `...` (both inclusive); Type comparisons with == and !=
Diffstat (limited to 'src/check_stmt.c')
| -rw-r--r-- | src/check_stmt.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/check_stmt.c b/src/check_stmt.c index b1f2a6d97..f9315c321 100644 --- a/src/check_stmt.c +++ b/src/check_stmt.c @@ -310,12 +310,13 @@ void check_stmt(Checker *c, AstNode *node, u32 flags) { u32 in = node->stmt_state_flags; u32 out = c->context.stmt_state_flags; - if (in & StmtStateFlag_bounds_check) { - out |= StmtStateFlag_bounds_check; - out &= ~StmtStateFlag_no_bounds_check; - } else if (in & StmtStateFlag_no_bounds_check) { + if (in & StmtStateFlag_no_bounds_check) { out |= StmtStateFlag_no_bounds_check; out &= ~StmtStateFlag_bounds_check; + } else { + // if (in & StmtStateFlag_bounds_check) { + out |= StmtStateFlag_bounds_check; + out &= ~StmtStateFlag_no_bounds_check; } c->context.stmt_state_flags = out; @@ -648,6 +649,12 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) { GB_ASSERT(are_types_identical(x.type, y.type)); + TokenKind op = Token_Lt; + switch (ie->op.kind) { + case Token_HalfOpenRange: op = Token_Lt; break; + case Token_Ellipsis: op = Token_LtEq; break; + default: error(ie->op, "Invalid range operator"); break; + } bool ok = compare_exact_values(Token_Lt, a, b); if (!ok) { // TODO(bill): Better error message |