diff options
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; |