auto merge of #4922 : jbclements/rust/add-deriving-eq-to-asts, r=catamorphism
r? Apply deriving_eq to the data structures in ast.rs, and get rid of the custom definitions of eq that were everywhere. resulting ast.rs is about 400 lines shorter. Also: add a few test cases and a bunch of comments. Also: change ast_ty_to_ty_cache to use node ids rather than ast::ty's. I believe this was a suggestion related to my changes, and it appears to pass all tests. Also: tiny doc fix, remove references to crate keywords.
This commit is contained in:
commit
6efa3543a8
10 changed files with 242 additions and 556 deletions
|
@ -25,6 +25,7 @@ use std::oldmap::HashMap;
|
|||
|
||||
#[auto_encode]
|
||||
#[auto_decode]
|
||||
#[deriving_eq]
|
||||
pub enum binop {
|
||||
PLUS,
|
||||
MINUS,
|
||||
|
@ -86,6 +87,7 @@ pub enum Token {
|
|||
LIT_STR(ast::ident),
|
||||
|
||||
/* Name components */
|
||||
// an identifier contains an "is_mod_name" boolean.
|
||||
IDENT(ast::ident, bool),
|
||||
UNDERSCORE,
|
||||
LIFETIME(ast::ident),
|
||||
|
@ -517,12 +519,6 @@ pub fn reserved_keyword_table() -> HashMap<~str, ()> {
|
|||
words
|
||||
}
|
||||
|
||||
impl binop : cmp::Eq {
|
||||
pure fn eq(&self, other: &binop) -> bool {
|
||||
((*self) as uint) == ((*other) as uint)
|
||||
}
|
||||
pure fn ne(&self, other: &binop) -> bool { !(*self).eq(other) }
|
||||
}
|
||||
|
||||
impl Token : cmp::Eq {
|
||||
pure fn eq(&self, other: &Token) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue