From df7d376d257858debdc29c954c6d2fb3d9ef2334 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Sun, 13 Jan 2013 11:05:40 -0800 Subject: Convert ast::def_id into a struct. --- src/libsyntax/ast.rs | 5 ++++- src/libsyntax/ast_util.rs | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index f5fbb11655b..6c4e2b283a6 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -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 { diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index d2012637b02..113556e3895 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -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 } -- cgit 1.4.1-3-g733a5