turn ast::ident into a struct

This will help with the auto_serialize2 migration. We have to change
ident from a type alias to uint into a unique type. We need to use
a struct instead of a "enum ident = token::str_num" because structs
support constants, but newtypes do not.
This commit is contained in:
Erick Tryzelaar
2012-09-19 18:50:24 -07:00
committed by Graydon Hoare
parent c0b9986c8f
commit b96af73159
20 changed files with 152 additions and 122 deletions

View File

@@ -34,7 +34,7 @@ impl path_elt : cmp::Eq {
type path = ~[path_elt];
/* FIXMEs that say "bad" are as per #2543 */
fn path_to_str_with_sep(p: path, sep: ~str, itr: ident_interner) -> ~str {
fn path_to_str_with_sep(p: path, sep: ~str, itr: @ident_interner) -> ~str {
let strs = do vec::map(p) |e| {
match *e {
path_mod(s) => *itr.get(s),
@@ -44,7 +44,7 @@ fn path_to_str_with_sep(p: path, sep: ~str, itr: ident_interner) -> ~str {
str::connect(strs, sep)
}
fn path_ident_to_str(p: path, i: ident, itr: ident_interner) -> ~str {
fn path_ident_to_str(p: path, i: ident, itr: @ident_interner) -> ~str {
if vec::is_empty(p) {
//FIXME /* FIXME (#2543) */ copy *i
*itr.get(i)
@@ -53,7 +53,7 @@ fn path_ident_to_str(p: path, i: ident, itr: ident_interner) -> ~str {
}
}
fn path_to_str(p: path, itr: ident_interner) -> ~str {
fn path_to_str(p: path, itr: @ident_interner) -> ~str {
path_to_str_with_sep(p, ~"::", itr)
}
@@ -326,7 +326,7 @@ fn map_stmt(stmt: @stmt, cx: ctx, v: vt) {
visit::visit_stmt(stmt, cx, v);
}
fn node_id_to_str(map: map, id: node_id, itr: ident_interner) -> ~str {
fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str {
match map.find(id) {
None => {
fmt!("unknown node (id=%d)", id)