summaryrefslogtreecommitdiff
path: root/src/hir/type.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-29 13:26:52 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-29 13:26:52 +0800
commitf5420b8174f7acf062f4c5d682820019d79cbdaf (patch)
treed6c6cdb63a0be8b754d618395d0ffa7443eb2352 /src/hir/type.hpp
parentd8fed3a1def1ae667c1471f44b19749a1f88cc42 (diff)
downloadmrust-f5420b8174f7acf062f4c5d682820019d79cbdaf.tar.gz
HIR Types - Store array size expr as a shared_ptr to allow cloning
Diffstat (limited to 'src/hir/type.hpp')
-rw-r--r--src/hir/type.hpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/hir/type.hpp b/src/hir/type.hpp
index 63a87059..60ea04bd 100644
--- a/src/hir/type.hpp
+++ b/src/hir/type.hpp
@@ -1,4 +1,10 @@
-
+/*
+ * MRustC - Rust Compiler
+ * - By John Hodge (Mutabah/thePowersGang)
+ *
+ * hir/type.hpp
+ * - HIR Type representation
+ */
#ifndef _HIR_TYPE_HPP_
#define _HIR_TYPE_HPP_
#pragma once
@@ -140,7 +146,7 @@ public:
}),
(Array, struct {
::std::unique_ptr<TypeRef> inner;
- ::HIR::ExprPtr size;
+ ::std::shared_ptr<::HIR::ExprPtr> size;
size_t size_val;
}),
(Slice, struct {
@@ -209,10 +215,10 @@ public:
}
static TypeRef new_array(TypeRef inner, unsigned int size) {
assert(size != ~0u);
- return TypeRef(Data::make_Array({box$(mv$(inner)), ::HIR::ExprPtr(), size}));
+ return TypeRef(Data::make_Array({box$(mv$(inner)), nullptr, size}));
}
static TypeRef new_array(TypeRef inner, ::HIR::ExprPtr size_expr) {
- return TypeRef(Data::make_Array({box$(mv$(inner)), mv$(size_expr), ~0u}));
+ return TypeRef(Data::make_Array({box$(mv$(inner)), ::std::shared_ptr< ::HIR::ExprPtr>( new ::HIR::ExprPtr(mv$(size_expr)) ), ~0u}));
}
static TypeRef new_path(::HIR::Path path, TypePathBinding binding) {
return TypeRef(Data::make_Path({ mv$(path), mv$(binding) }));