summaryrefslogtreecommitdiff
path: root/src/hir/type.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-06-11 11:45:07 +0800
committerJohn Hodge <tpg@mutabah.net>2016-06-11 11:45:07 +0800
commit556cf732e28ae68185f778a4c5c63d0d2bec032a (patch)
tree2374dd3759eff5dfdc34961f7079752035776adc /src/hir/type.hpp
parent5ff701687158949de63a493af110f47d9175b41a (diff)
downloadmrust-556cf732e28ae68185f778a4c5c63d0d2bec032a.tar.gz
HIR - (cleanup) Make method to handle creating new array types
Diffstat (limited to 'src/hir/type.hpp')
-rw-r--r--src/hir/type.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/hir/type.hpp b/src/hir/type.hpp
index 4f7e97a5..6dd02804 100644
--- a/src/hir/type.hpp
+++ b/src/hir/type.hpp
@@ -170,6 +170,13 @@ public:
static TypeRef new_pointer(BorrowType bt, TypeRef inner) {
return TypeRef(Data::make_Pointer({bt, box$(mv$(inner))}));
}
+ static TypeRef new_array(TypeRef inner, unsigned int size) {
+ assert(size != ~0u);
+ return TypeRef(Data::make_Array({box$(mv$(inner)), ::HIR::ExprPtr(), size}));
+ }
+ static TypeRef new_array(TypeRef inner, ::HIR::ExprPtr size_expr) {
+ return TypeRef(Data::make_Array({box$(mv$(inner)), mv$(size_expr), ~0u}));
+ }
TypeRef clone() const;