aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-12-27 10:18:32 +0000
committergingerBill <bill@gingerbill.org>2019-12-27 10:18:32 +0000
commiteea403d0abea5db849a7e383c76d53d5c181b5e6 (patch)
tree6014b65fd43cdef20ccf7659eed1a05c2b9a62df /src/ir.cpp
parent2cc5c4eed354e7842f37eca61f9a55f6a428930a (diff)
Fix #514
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 79b19cabf..4d29396a3 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -6697,6 +6697,19 @@ irValue *ir_build_builtin_proc(irProcedure *proc, Ast *expr, TypeAndValue tv, Bu
irValue *val = ir_build_expr(proc, ce->args[0]);
Type *t = base_type(ir_type(val));
+ if (!is_type_tuple(tv.type)) {
+ if (t->kind == Type_Struct) {
+ GB_ASSERT(t->Struct.fields.count == 1);
+ return ir_emit_struct_ev(proc, val, 0);
+ } else if (t->kind == Type_Array) {
+ GB_ASSERT(t->Array.count == 1);
+ return ir_emit_array_epi(proc, val, 0);
+ } else {
+ GB_PANIC("Unknown type of expand_to_tuple");
+ }
+
+ }
+
GB_ASSERT(is_type_tuple(tv.type));
// NOTE(bill): Doesn't need to be zero because it will be initialized in the loops
irValue *tuple = ir_add_local_generated(proc, tv.type, false);