aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorJonathan Marler <jonathan.j.marler@hp.com>2019-09-04 11:08:49 -0600
committerAndrew Kelley <andrew@ziglang.org>2019-09-05 13:08:45 -0400
commit9a358d2d33b0ecdec38ba3698acf8b239c43b667 (patch)
tree8174259bea6cfe1b82ada4e8808f23403f73a073 /src/ir.cpp
parent847a262efdf5f3a359b00f13c101236dc0747f1b (diff)
downloadzig-9a358d2d33b0ecdec38ba3698acf8b239c43b667.tar.gz
zig-9a358d2d33b0ecdec38ba3698acf8b239c43b667.zip
Add Array support to @Type
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 054fbf0073..03e084e5ce 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -20942,6 +20942,13 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInstruction *instruction, Zi
return ptr_type;
return get_slice_type(ira->codegen, ptr_type);
}
+ case ZigTypeIdArray:
+ assert(payload->special == ConstValSpecialStatic);
+ assert(payload->type == ir_type_info_get_type(ira, "Array", nullptr));
+ return get_array_type(ira->codegen,
+ get_const_field_meta_type(ira, payload, "child", 1),
+ bigint_as_u64(get_const_field_lit_int(ira, payload, "len", 0))
+ );
case ZigTypeIdComptimeFloat:
return ira->codegen->builtin_types.entry_num_lit_float;
case ZigTypeIdComptimeInt:
@@ -20950,7 +20957,6 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInstruction *instruction, Zi
return ira->codegen->builtin_types.entry_undef;
case ZigTypeIdNull:
return ira->codegen->builtin_types.entry_null;
- case ZigTypeIdArray:
case ZigTypeIdOptional:
case ZigTypeIdErrorUnion:
case ZigTypeIdErrorSet: