diff options
| author | bors <bors@rust-lang.org> | 2013-09-08 01:05:59 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-08 01:05:59 -0700 |
| commit | b609d022c4df307e4d68499b063c81a9ecb1e9cf (patch) | |
| tree | d241f3b7721b5eb5e32e690b2f3f26aed1723f14 /src/libsyntax | |
| parent | 5591dce52eb35730e89070c7e104e1f1bf0a8ab3 (diff) | |
| parent | 13d33064a6c8b8f9c167250ec9a84fc8daaf56d5 (diff) | |
| download | rust-b609d022c4df307e4d68499b063c81a9ecb1e9cf.tar.gz rust-b609d022c4df307e4d68499b063c81a9ecb1e9cf.zip | |
auto merge of #9035 : alexcrichton/rust/fewer-clownshoes, r=huonw
This removes another large chunk of this odd 'clownshoes' identifier showing up
in symbol names. These all originated from external crates because the encoded
items were encoded independently of the paths calculated in ast_map. The
encoding of these paths now uses the helper function in ast_map to calculate the
"pretty name" for an impl block.
Unfortunately there is still no information about generics in the symbol name,
but it's certainly vastly better than before
hash::__extensions__::write::_version::v0.8
becomes
hash::Writer$SipState::write::hversion::v0.8
This also fixes bugs in which lots of methods would show up as `meth_XXX`, they
now only show up as `meth` and throw some extra characters onto the version
string.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_map.rs | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index dd991b065e9..16e80560cc8 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -72,6 +72,28 @@ pub fn path_elt_to_str(pe: path_elt, itr: @ident_interner) -> ~str { } } +pub fn impl_pretty_name(trait_ref: &Option<trait_ref>, + ty: &Ty, default: Ident) -> path_elt { + let itr = get_ident_interner(); + let ty_ident = match ty.node { + ty_path(ref path, _, _) => path.segments.last().identifier, + _ => default + }; + let hash = (trait_ref, ty).hash(); + match *trait_ref { + None => path_pretty_name(ty_ident, hash), + Some(ref trait_ref) => { + // XXX: this dollar sign is actually a relic of being one of the + // very few valid symbol names on unix. These kinds of + // details shouldn't be exposed way up here in the ast. + let s = fmt!("%s$%s", + itr.get(trait_ref.path.segments.last().identifier.name), + itr.get(ty_ident.name)); + path_pretty_name(Ident::new(itr.gensym(s)), hash) + } + } +} + #[deriving(Clone)] pub enum ast_node { node_item(@item, @path), @@ -216,28 +238,6 @@ impl Ctx { visit::walk_pat(self, pat, ()); } - - fn impl_pretty_name(&self, trait_ref: &Option<trait_ref>, - ty: &Ty, default: Ident) -> path_elt { - let itr = get_ident_interner(); - let ty_ident = match ty.node { - ty_path(ref path, _, _) => path.segments.last().identifier, - _ => default - }; - let hash = (trait_ref, ty).hash(); - match *trait_ref { - None => path_pretty_name(ty_ident, hash), - Some(ref trait_ref) => { - // XXX: this dollar sign is actually a relic of being one of the - // very few valid symbol names on unix. These kinds of - // details shouldn't be exposed way up here in the ast. - let s = fmt!("%s$%s", - itr.get(trait_ref.path.segments.last().identifier.name), - itr.get(ty_ident.name)); - path_pretty_name(Ident::new(itr.gensym(s)), hash) - } - } - } } impl Visitor<()> for Ctx { @@ -250,7 +250,7 @@ impl Visitor<()> for Ctx { // Right now the ident on impls is __extensions__ which isn't // very pretty when debugging, so attempt to select a better // name to use. - let elt = self.impl_pretty_name(maybe_trait, ty, i.ident); + let elt = impl_pretty_name(maybe_trait, ty, i.ident); let impl_did = ast_util::local_def(i.id); for m in ms.iter() { |
