finish deriving_eq in ast

This commit is contained in:
John Clements 2013-02-07 14:39:49 -08:00
parent 819c6d1c04
commit 0419e36b76

View File

@ -783,6 +783,7 @@ pub impl float_ty : to_bytes::IterBytes {
// NB Eq method appears below.
#[auto_encode]
#[auto_decode]
#[deriving_eq]
pub struct Ty {
id: node_id,
node: ty_,
@ -855,6 +856,7 @@ pub struct TyClosure {
#[auto_encode]
#[auto_decode]
#[deriving_eq]
pub struct TyBareFn {
purity: purity,
abi: Abi,
@ -885,17 +887,6 @@ pub enum ty_ {
ty_infer,
}
// Equality and byte-iter (hashing) can be quite approximate for AST types.
// since we only care about this for normalizing them to "real" types.
pub impl Ty : cmp::Eq {
pure fn eq(&self, other: &Ty) -> bool {
ptr::addr_of(&(*self)) == ptr::addr_of(&(*other))
}
pure fn ne(&self, other: &Ty) -> bool {
ptr::addr_of(&(*self)) != ptr::addr_of(&(*other))
}
}
pub impl Ty : to_bytes::IterBytes {
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
to_bytes::iter_bytes_2(&self.span.lo, &self.span.hi, lsb0, f);