diff options
author | John Hodge <tpg@mutabah.net> | 2016-12-25 17:35:00 +1100 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-12-25 17:35:00 +1100 |
commit | 69537686be13f6ff84ce79e84374351e943ab21b (patch) | |
tree | de4bef9b5ace623b59751447b9131046483d2388 /src/hir/item_path.hpp | |
parent | 27b0292ca6828eed7e782a57ad4d641f0ebf7357 (diff) | |
parent | 753a2f44cc4c00b952cddae2ceed066ebb18a470 (diff) | |
download | mrust-69537686be13f6ff84ce79e84374351e943ab21b.tar.gz |
Merge branch 'master' of https://github.com/thepowersgang/mrustc
Diffstat (limited to 'src/hir/item_path.hpp')
-rw-r--r-- | src/hir/item_path.hpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/hir/item_path.hpp b/src/hir/item_path.hpp index 8ed140af..606c6817 100644 --- a/src/hir/item_path.hpp +++ b/src/hir/item_path.hpp @@ -17,7 +17,7 @@ public: const ::HIR::SimplePath* trait = nullptr; const ::HIR::PathParams* trait_params = nullptr; const char* name = nullptr; - + ItemPath() {} ItemPath(const ItemPath& p, const char* n): parent(&p), @@ -34,10 +34,10 @@ public: ItemPath(const ::HIR::SimplePath& path): trait(&path) {} - + const ::HIR::SimplePath* trait_path() const { return trait; } const ::HIR::PathParams* trait_args() const { return trait_params; } - + ::HIR::SimplePath get_simple_path() const { if( parent ) { assert(name); @@ -51,7 +51,7 @@ public: ::HIR::Path get_full_path() const { assert(parent); assert(name); - + if( parent->name ) { return get_simple_path(); } @@ -65,14 +65,14 @@ public: const char* get_name() const { return name ? name : ""; } - + ItemPath operator+(const ::std::string& name) const { return ItemPath(*this, name.c_str()); } - + bool operator==(const ::HIR::SimplePath& sp) const { if( sp.m_crate_name != "" ) return false; - + unsigned int i = sp.m_components.size(); const auto* n = this; while( n && i -- ) @@ -87,7 +87,7 @@ public: return false; return true; } - + friend ::std::ostream& operator<<(::std::ostream& os, const ItemPath& x) { if( x.parent ) { os << *x.parent; |