mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Fix for in for pointer to map expressions
This commit is contained in:
+5
-1
@@ -3967,6 +3967,10 @@ irValue *ir_map_entries(irProcedure *proc, irValue *value) {
|
|||||||
irValue *ir_map_entries_ptr(irProcedure *proc, irValue *value) {
|
irValue *ir_map_entries_ptr(irProcedure *proc, irValue *value) {
|
||||||
gbAllocator a = ir_allocator();
|
gbAllocator a = ir_allocator();
|
||||||
Type *t = base_type(type_deref(ir_type(value)));
|
Type *t = base_type(type_deref(ir_type(value)));
|
||||||
|
if (is_type_pointer(t)) {
|
||||||
|
value = ir_emit_load(proc, value);
|
||||||
|
t = base_type(type_deref(t));
|
||||||
|
}
|
||||||
GB_ASSERT_MSG(t->kind == Type_Map, "%s", type_to_string(t));
|
GB_ASSERT_MSG(t->kind == Type_Map, "%s", type_to_string(t));
|
||||||
init_map_internal_types(t);
|
init_map_internal_types(t);
|
||||||
Type *gst = t->Map.generated_struct_type;
|
Type *gst = t->Map.generated_struct_type;
|
||||||
@@ -10020,7 +10024,7 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) {
|
|||||||
gbAllocator a = ir_allocator();
|
gbAllocator a = ir_allocator();
|
||||||
irAddr addr = ir_build_addr(proc, expr);
|
irAddr addr = ir_build_addr(proc, expr);
|
||||||
irValue *map = ir_addr_get_ptr(proc, addr);
|
irValue *map = ir_addr_get_ptr(proc, addr);
|
||||||
if (is_type_pointer(type_deref(ir_addr_type(addr)))) {
|
if (is_type_pointer(ir_addr_type(addr))) {
|
||||||
map = ir_addr_load(proc, addr);
|
map = ir_addr_load(proc, addr);
|
||||||
}
|
}
|
||||||
irValue *entries_ptr = ir_map_entries_ptr(proc, map);
|
irValue *entries_ptr = ir_map_entries_ptr(proc, map);
|
||||||
|
|||||||
Reference in New Issue
Block a user