diff options
author | John Hodge <tpg@mutabah.net> | 2016-11-19 22:46:14 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-11-19 22:46:14 +0800 |
commit | cf499efccf021db06630b76224bcb68dcf923975 (patch) | |
tree | f64e891cb31ed6f886a83b110b94fed718cb9011 /src/hir/hir.cpp | |
parent | 5fe7fcc580db497b267ca0f820e5d3268fe8aafb (diff) | |
download | mrust-cf499efccf021db06630b76224bcb68dcf923975.tar.gz |
HIR - Union handling
Diffstat (limited to 'src/hir/hir.cpp')
-rw-r--r-- | src/hir/hir.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/hir/hir.cpp b/src/hir/hir.cpp index 0c42ba05..512f6c5d 100644 --- a/src/hir/hir.cpp +++ b/src/hir/hir.cpp @@ -522,6 +522,16 @@ const ::HIR::Struct& ::HIR::Crate::get_struct_by_path(const Span& sp, const ::HI BUG(sp, "Struct path " << path << " didn't point to a struct"); } } +const ::HIR::Union& ::HIR::Crate::get_union_by_path(const Span& sp, const ::HIR::SimplePath& path) const +{ + const auto& ti = this->get_typeitem_by_path(sp, path); + TU_IFLET(::HIR::TypeItem, ti, Union, e, + return e; + ) + else { + BUG(sp, "Path " << path << " didn't point to a union"); + } +} const ::HIR::Enum& ::HIR::Crate::get_enum_by_path(const Span& sp, const ::HIR::SimplePath& path) const { const auto& ti = this->get_typeitem_by_path(sp, path); |