summaryrefslogtreecommitdiff
path: root/src/hir/item_path.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-05-19 22:15:02 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-05-19 22:15:02 +0800
commitb48167dec0c1c05b463991a8db5a8db70a5ae604 (patch)
treeeadc95ab546a617d298fb3a16fb080e1bc4355e8 /src/hir/item_path.hpp
parentdab5cf5462d8fce6d6fcaa1343df8f5f3b763b8a (diff)
downloadmrust-b48167dec0c1c05b463991a8db5a8db70a5ae604.tar.gz
All - Switch to using interned (de-duplicated) RcString-s instead of std::string for paths/identifiers
Diffstat (limited to 'src/hir/item_path.hpp')
-rw-r--r--src/hir/item_path.hpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/hir/item_path.hpp b/src/hir/item_path.hpp
index d93df9e8..290bf23b 100644
--- a/src/hir/item_path.hpp
+++ b/src/hir/item_path.hpp
@@ -54,12 +54,12 @@ public:
}
else if( parent ) {
assert(name);
- return parent->get_simple_path() + name;
+ return parent->get_simple_path() + RcString::new_interned(name);
}
else {
assert(!name);
assert(crate_name);
- return ::HIR::SimplePath(crate_name);
+ return ::HIR::SimplePath(RcString::new_interned(crate_name));
}
}
::HIR::Path get_full_path() const {
@@ -76,11 +76,11 @@ public:
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) );
+ return ::HIR::Path( parent->ty->clone(), ::HIR::GenericPath(parent->trait->clone(), parent->trait_params->clone()), RcString::new_interned(name) );
}
else {
assert(parent->ty);
- return ::HIR::Path( parent->ty->clone(), ::std::string(name) );
+ return ::HIR::Path( parent->ty->clone(), RcString::new_interned(name) );
}
}
const char* get_name() const {
@@ -95,6 +95,9 @@ public:
ItemPath operator+(const ::std::string& name) const {
return ItemPath(*this, name.c_str());
}
+ ItemPath operator+(const RcString& name) const {
+ return ItemPath(*this, name.c_str());
+ }
bool operator==(const ::HIR::SimplePath& sp) const {
if( sp.m_crate_name != "" ) return false;