rustc: Use coherence for operator overloading.
The only use of the old-style impls is now placement new.
This commit is contained in:
parent
e6d2e49852
commit
93c2f5e0e4
23 changed files with 348 additions and 295 deletions
|
@ -87,6 +87,22 @@ pure fn binop_to_str(op: binop) -> ~str {
|
|||
}
|
||||
}
|
||||
|
||||
pure fn binop_to_method_name(op: binop) -> option<~str> {
|
||||
alt op {
|
||||
add { ret some(~"add"); }
|
||||
subtract { ret some(~"sub"); }
|
||||
mul { ret some(~"mul"); }
|
||||
div { ret some(~"div"); }
|
||||
rem { ret some(~"modulo"); }
|
||||
bitxor { ret some(~"bitxor"); }
|
||||
bitand { ret some(~"bitand"); }
|
||||
bitor { ret some(~"bitor"); }
|
||||
shl { ret some(~"shl"); }
|
||||
shr { ret some(~"shr"); }
|
||||
and | or | eq | lt | le | ne | ge | gt { ret none; }
|
||||
}
|
||||
}
|
||||
|
||||
pure fn lazy_binop(b: binop) -> bool {
|
||||
alt b { and { true } or { true } _ { false } }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue