diff options
| author | gingerBill <bill@gingerbill.org> | 2017-11-21 22:32:41 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-11-21 22:32:41 +0000 |
| commit | 976415ff9df68ef8b6ecd06d271bef14d63ea90c (patch) | |
| tree | 4a5c134f79e0b91f16e7da4f1ff458a0a3379c88 | |
| parent | bcca3bf3221e1b83f804029e53855cbfc2450baf (diff) | |
Fix key lookup of pointer to map
| -rw-r--r-- | core/fmt.odin | 2 | ||||
| -rw-r--r-- | src/check_stmt.cpp | 2 | ||||
| -rw-r--r-- | src/ir.cpp | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/core/fmt.odin b/core/fmt.odin index 5b2ce6eb1..78465cbe0 100644 --- a/core/fmt.odin +++ b/core/fmt.odin @@ -939,7 +939,7 @@ fmt_value :: proc(fi: ^Fmt_Info, v: any, verb: rune) { } if data == nil || tag <= 0 { - write_string(fi.buf, "(union)"); + write_string(fi.buf, "nil"); } else { ti := info.variants[tag-1]; fmt_arg(fi, any{data, ti}, verb); diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 13c3f2624..a04679b3a 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -1281,7 +1281,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) { if (!is_type_ordered(x.type)) { gbString str = type_to_string(x.type); - error(x.expr, "Unordered type '%s', is invalid for an interval expression", str); + error(expr, "Unordered type '%s', is invalid for an interval expression", str); gb_string_free(str); continue; } diff --git a/src/ir.cpp b/src/ir.cpp index aa4bd86b0..bf7c8c260 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -5531,6 +5531,10 @@ irAddr ir_build_addr(irProcedure *proc, AstNode *expr) { if (is_type_map(t)) { irValue *map_val = ir_build_addr_ptr(proc, ie->expr); + if (deref) { + map_val = ir_emit_load(proc, map_val); + } + irValue *key = ir_build_expr(proc, ie->index); key = ir_emit_conv(proc, key, t->Map.key); |