deriving_eq for tokens and binops

Note that the replaced definition of equality on tokens
contains a *huge* shortcut on INTERPOLATED tokens (those
that contain ASTs), whereby any two INTERPOLATED tokens
are considered equal. This seems like a really broken
notion of equality, but it appears that the existing
test cases and the compiler don't depend on it. Niko
noticed this, BTW.

Replace long definition of Eq on tokens and binops
w
This commit is contained in:
John Clements 2013-02-08 18:50:12 -08:00
parent 16da4e15af
commit ded95d2c28
1 changed files with 1 additions and 6 deletions

View File

@ -25,6 +25,7 @@ use std::oldmap::HashMap;
#[auto_encode]
#[auto_decode]
#[deriving_eq]
pub enum binop {
PLUS,
MINUS,
@ -518,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 {