intern identifiers
This commit is contained in:
@@ -21,13 +21,14 @@ pure fn mk_sp(lo: uint, hi: uint) -> span {
|
||||
// make this a const, once the compiler supports it
|
||||
pure fn dummy_sp() -> span { return mk_sp(0u, 0u); }
|
||||
|
||||
pure fn path_name(p: @path) -> ~str { path_name_i(p.idents) }
|
||||
|
||||
pure fn path_name_i(idents: ~[ident]) -> ~str {
|
||||
|
||||
pure fn path_name_i(idents: ~[ident], intr: token::ident_interner) -> ~str {
|
||||
// FIXME: Bad copies (#2543 -- same for everything else that says "bad")
|
||||
str::connect(idents.map(|i|*i), ~"::")
|
||||
str::connect(idents.map(|i| *intr.get(i)), ~"::")
|
||||
}
|
||||
|
||||
|
||||
pure fn path_to_ident(p: @path) -> ident { vec::last(p.idents) }
|
||||
|
||||
pure fn local_def(id: node_id) -> def_id { {crate: local_crate, node: id} }
|
||||
@@ -408,7 +409,8 @@ fn dtor_dec() -> fn_decl {
|
||||
let nil_t = @{id: 0, node: ty_nil, span: dummy_sp()};
|
||||
// dtor has one argument, of type ()
|
||||
{inputs: ~[{mode: ast::expl(ast::by_ref),
|
||||
ty: nil_t, ident: @~"_", id: 0}],
|
||||
ty: nil_t, ident: parse::token::special_idents::underscore,
|
||||
id: 0}],
|
||||
output: nil_t, purity: impure_fn, cf: return_val}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user