A collection of refactorings that I found it hard/tiresome to divide:
- Make `extern fn()` assignable to any closure type, rather than a subtype. - Remove unused int_ty_set and float_ty_set - Refactor variable unification and make it more DRY - Do fn sub/lub/glb on the level of fn_sig - Rename infer::to_str::ToStr to infer::to_str::InferStr - Capitalize names of various types - Correct hashing of FnMeta - Convert various records-of-fns into structs-of-fns. This is both eliminating use of deprecated features and more forwards compatible with fn reform. r=pcwalton
This commit is contained in:
parent
11a307294a
commit
2b92962aa2
87 changed files with 1642 additions and 1661 deletions
|
@ -19,6 +19,7 @@ use core::option::{None, Option, Some};
|
|||
use core::ptr;
|
||||
use core::task;
|
||||
use core::to_bytes;
|
||||
use core::to_str::ToStr;
|
||||
use std::serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
#[auto_encode]
|
||||
|
@ -415,6 +416,7 @@ impl mutability : cmp::Eq {
|
|||
|
||||
#[auto_encode]
|
||||
#[auto_decode]
|
||||
#[deriving_eq]
|
||||
pub enum Proto {
|
||||
ProtoBare, // bare functions (deprecated)
|
||||
ProtoUniq, // ~fn
|
||||
|
@ -422,13 +424,6 @@ pub enum Proto {
|
|||
ProtoBorrowed, // &fn
|
||||
}
|
||||
|
||||
impl Proto : cmp::Eq {
|
||||
pure fn eq(&self, other: &Proto) -> bool {
|
||||
((*self) as uint) == ((*other) as uint)
|
||||
}
|
||||
pure fn ne(&self, other: &Proto) -> bool { !(*self).eq(other) }
|
||||
}
|
||||
|
||||
impl Proto : to_bytes::IterBytes {
|
||||
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
(*self as uint).iter_bytes(lsb0, f);
|
||||
|
@ -1068,20 +1063,24 @@ enum region_ {
|
|||
|
||||
#[auto_encode]
|
||||
#[auto_decode]
|
||||
#[deriving_eq]
|
||||
enum Onceness {
|
||||
Once,
|
||||
Many
|
||||
}
|
||||
|
||||
impl Onceness : cmp::Eq {
|
||||
pure fn eq(&self, other: &Onceness) -> bool {
|
||||
match ((*self), *other) {
|
||||
(Once, Once) | (Many, Many) => true,
|
||||
_ => false
|
||||
impl Onceness : ToStr {
|
||||
pure fn to_str() -> ~str {
|
||||
match self {
|
||||
ast::Once => ~"once",
|
||||
ast::Many => ~"many"
|
||||
}
|
||||
}
|
||||
pure fn ne(&self, other: &Onceness) -> bool {
|
||||
!(*self).eq(other)
|
||||
}
|
||||
|
||||
impl Onceness : to_bytes::IterBytes {
|
||||
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
(*self as uint).iter_bytes(lsb0, f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1156,6 +1155,17 @@ pub enum purity {
|
|||
extern_fn, // declared with "extern fn"
|
||||
}
|
||||
|
||||
impl purity : ToStr {
|
||||
pure fn to_str() -> ~str {
|
||||
match self {
|
||||
impure_fn => ~"impure",
|
||||
unsafe_fn => ~"unsafe",
|
||||
pure_fn => ~"pure",
|
||||
extern_fn => ~"extern"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl purity : to_bytes::IterBytes {
|
||||
pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
(*self as u8).iter_bytes(lsb0, f)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue