diff options
| author | gingerBill <bill@gingerbill.org> | 2017-11-26 22:49:31 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-11-26 22:49:31 +0000 |
| commit | 65945dac099aff7d8d86468f4100a363b9b4ad1b (patch) | |
| tree | fd4107da6481b3476734f7d673820e4ec7201420 /src/ir.cpp | |
| parent | 1608da2dc855da476ed432935a75b0cc332f5a2b (diff) | |
Fix comparison against nil for slices
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index f7db49cbf..bd2d3ca9e 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -2373,7 +2373,7 @@ irValue *ir_emit_comp_against_nil(irProcedure *proc, TokenKind op_kind, irValue } } else if (is_type_slice(t)) { irValue *data = ir_emit_struct_ev(proc, x, 0); - irValue *cap = ir_emit_struct_ev(proc, x, 2); + irValue *cap = ir_emit_struct_ev(proc, x, 1); if (op_kind == Token_CmpEq) { irValue *a = ir_emit_comp(proc, Token_CmpEq, data, v_raw_nil); irValue *b = ir_emit_comp(proc, Token_CmpEq, cap, v_zero); @@ -2700,7 +2700,7 @@ irValue *ir_emit_struct_ev(irProcedure *proc, irValue *s, i32 index) { break; } - GB_ASSERT(result_type != nullptr); + GB_ASSERT_MSG(result_type != nullptr, "%s, %d", type_to_string(ir_type(s)), index); return ir_emit(proc, ir_instr_struct_extract_value(proc, s, index, result_type)); } |