summaryrefslogtreecommitdiff
path: root/src/hir/type.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-06-11 20:55:37 +0800
committerJohn Hodge <tpg@mutabah.net>2016-06-11 20:55:37 +0800
commit75e5245e0adace314adcb457a9943fc749c22a5e (patch)
treed941025ce2e8cec6191f398779d1e34a7bc57217 /src/hir/type.cpp
parent555676e4e3576d83cfe23562b686a043a4d2b81f (diff)
downloadmrust-75e5245e0adace314adcb457a9943fc749c22a5e.tar.gz
HIR Typecheck - Fields working
Diffstat (limited to 'src/hir/type.cpp')
-rw-r--r--src/hir/type.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/hir/type.cpp b/src/hir/type.cpp
index b57dcc7c..6e85b1aa 100644
--- a/src/hir/type.cpp
+++ b/src/hir/type.cpp
@@ -62,6 +62,12 @@ void ::HIR::TypeRef::fmt(::std::ostream& os) const
),
(Path,
os << e.path;
+ TU_MATCH(::HIR::TypeRef::TypePathBinding, (e.binding), (be),
+ (Unbound, os << "/*U*/";),
+ (Opaque, os << "/*O*/";),
+ (Struct, os << "/*S/";),
+ (Enum, os << "/*E*/";)
+ )
),
(Generic,
os << e.name << "/*";
@@ -397,18 +403,17 @@ bool ::HIR::TypeRef::match_test_generics(const Span& sp, const ::HIR::TypeRef& x
return true;
}
-namespace {
- ::HIR::TypeRef::TypePathBinding clone_binding(const ::HIR::TypeRef::TypePathBinding& x) {
- TU_MATCH(::HIR::TypeRef::TypePathBinding, (x), (e),
- (Unbound, return ::HIR::TypeRef::TypePathBinding::make_Unbound({}); ),
- (Opaque , return ::HIR::TypeRef::TypePathBinding::make_Opaque({}); ),
- (Struct , return ::HIR::TypeRef::TypePathBinding(e); ),
- (Enum , return ::HIR::TypeRef::TypePathBinding(e); )
- )
- assert(!"Fell off end of clone_binding");
- }
+::HIR::TypeRef::TypePathBinding HIR::TypeRef::TypePathBinding::clone() const {
+ TU_MATCH(::HIR::TypeRef::TypePathBinding, (*this), (e),
+ (Unbound, return ::HIR::TypeRef::TypePathBinding::make_Unbound({}); ),
+ (Opaque , return ::HIR::TypeRef::TypePathBinding::make_Opaque({}); ),
+ (Struct , return ::HIR::TypeRef::TypePathBinding(e); ),
+ (Enum , return ::HIR::TypeRef::TypePathBinding(e); )
+ )
+ assert(!"Fell off end of clone_binding");
}
+
::HIR::TypeRef HIR::TypeRef::clone() const
{
TU_MATCH(::HIR::TypeRef::Data, (m_data), (e),
@@ -424,7 +429,7 @@ namespace {
(Path,
return ::HIR::TypeRef( Data::make_Path({
e.path.clone(),
- clone_binding(e.binding)
+ e.binding.clone()
}) );
),
(Generic,