Convert ast::def_id into a struct.

This commit is contained in:
Erick Tryzelaar
2013-01-13 11:05:40 -08:00
parent bea67bde21
commit df7d376d25
11 changed files with 39 additions and 28 deletions

View File

@@ -93,7 +93,10 @@ type node_id = int;
#[auto_encode]
#[auto_decode]
type def_id = {crate: crate_num, node: node_id};
struct def_id {
crate: crate_num,
node: node_id,
}
impl def_id : cmp::Eq {
pure fn eq(&self, other: &def_id) -> bool {

View File

@@ -54,7 +54,9 @@ pure fn path_name_i(idents: &[ident], intr: @token::ident_interner) -> ~str {
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} }
pure fn local_def(id: node_id) -> def_id {
ast::def_id { crate: local_crate, node: id }
}
pure fn is_local(did: ast::def_id) -> bool { did.crate == local_crate }