diff options
Diffstat (limited to 'src/hir/item_path.hpp')
-rw-r--r-- | src/hir/item_path.hpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/hir/item_path.hpp b/src/hir/item_path.hpp index 9f9949e1..11e3b0f4 100644 --- a/src/hir/item_path.hpp +++ b/src/hir/item_path.hpp @@ -54,13 +54,17 @@ public: assert(parent); assert(name); - if( parent->name ) { + // If the parent has a name, or the parent is the crate root. + if( parent->name || !parent->ty ) { return get_simple_path(); } else if( parent->trait ) { + assert(parent->ty); + assert(parent->trait_params); return ::HIR::Path( parent->ty->clone(), ::HIR::GenericPath(parent->trait->clone(), parent->trait_params->clone()), ::std::string(name) ); } else { + assert(parent->ty); return ::HIR::Path( parent->ty->clone(), ::std::string(name) ); } } |