1
Fork 0

Stop parsing old operator overloading syntax

This commit is contained in:
Brian Anderson 2012-08-13 17:42:06 -07:00
parent 2e1b98d34f
commit 6b43c0c1ad
11 changed files with 3 additions and 105 deletions

View file

@ -123,13 +123,6 @@ pure fn from_elem<T: copy>(n_elts: uint, t: T) -> @[T] {
} }
} }
impl<T: copy> @[T]: vec_concat<T> {
#[inline(always)]
pure fn +(rhs: &[const T]) -> @[T] {
append(self, rhs)
}
}
#[cfg(notest)] #[cfg(notest)]
impl<T: copy> @[T]: add<&[const T],@[T]> { impl<T: copy> @[T]: add<&[const T],@[T]> {
#[inline(always)] #[inline(always)]

View file

@ -8,7 +8,7 @@ import path = path::path;
import tuple::{tuple_ops, extended_tuple_ops}; import tuple::{tuple_ops, extended_tuple_ops};
import str::{str_slice, unique_str}; import str::{str_slice, unique_str};
import vec::{const_vector, copyable_vector, immutable_vector}; import vec::{const_vector, copyable_vector, immutable_vector};
import vec::{immutable_copyable_vector, iter_trait_extensions, vec_concat}; import vec::{immutable_copyable_vector, iter_trait_extensions};
import iter::{base_iter, extended_iter, copyable_iter, times, timesi}; import iter::{base_iter, extended_iter, copyable_iter, times, timesi};
import num::num; import num::num;
import ptr::ptr; import ptr::ptr;
@ -21,7 +21,7 @@ export num, times, timesi;
// The following exports are the common traits // The following exports are the common traits
export str_slice, unique_str; export str_slice, unique_str;
export const_vector, copyable_vector, immutable_vector; export const_vector, copyable_vector, immutable_vector;
export immutable_copyable_vector, iter_trait_extensions, vec_concat; export immutable_copyable_vector, iter_trait_extensions;
export base_iter, copyable_iter, extended_iter; export base_iter, copyable_iter, extended_iter;
export tuple_ops, extended_tuple_ops; export tuple_ops, extended_tuple_ops;
export ptr; export ptr;

View file

@ -256,12 +256,6 @@ impl<A: copy> dvec<A> {
} }
} }
/// Copy out an individual element
#[inline(always)]
pure fn [](idx: uint) -> A {
self.get_elt(idx)
}
/// Copy out an individual element /// Copy out an individual element
#[inline(always)] #[inline(always)]
pure fn get_elt(idx: uint) -> A { pure fn get_elt(idx: uint) -> A {

View file

@ -275,9 +275,6 @@ mod linear {
option::unwrap(value) option::unwrap(value)
} }
fn [](k: &K) -> V {
self.get(k)
}
} }
impl<K,V> &linear_map<K,V> { impl<K,V> &linear_map<K,V> {

View file

@ -1911,12 +1911,6 @@ impl ~str: unique_str {
/// Returns a string with trailing whitespace removed /// Returns a string with trailing whitespace removed
#[inline] #[inline]
fn trim_right() -> ~str { trim_right(self) } fn trim_right() -> ~str { trim_right(self) }
/// Concatenate two strings: operator version
#[inline(always)]
pure fn +(rhs: &str) -> ~str {
append(self, rhs)
}
} }
#[cfg(notest)] #[cfg(notest)]

View file

@ -1289,17 +1289,6 @@ pure fn as_mut_buf<T,U>(s: &[mut T],
} }
} }
trait vec_concat<T> {
pure fn +(rhs: &[const T]) -> self;
}
impl<T: copy> ~[T]: vec_concat<T> {
#[inline(always)]
pure fn +(rhs: &[const T]) -> ~[T] {
append(self, rhs)
}
}
#[cfg(notest)] #[cfg(notest)]
impl<T: copy> ~[T]: add<&[const T],~[T]> { impl<T: copy> ~[T]: add<&[const T],~[T]> {
#[inline(always)] #[inline(always)]
@ -1308,13 +1297,6 @@ impl<T: copy> ~[T]: add<&[const T],~[T]> {
} }
} }
impl<T: copy> ~[mut T]: vec_concat<T> {
#[inline(always)]
pure fn +(rhs: &[const T]) -> ~[mut T] {
append_mut(self, rhs)
}
}
impl<T: copy> ~[mut T]: add<&[const T],~[mut T]> { impl<T: copy> ~[mut T]: add<&[const T],~[mut T]> {
#[inline(always)] #[inline(always)]
pure fn add(rhs: &[const T]) -> ~[mut T] { pure fn add(rhs: &[const T]) -> ~[mut T] {

View file

@ -42,16 +42,6 @@ type doc = {data: @~[u8], start: uint, end: uint};
type tagged_doc = {tag: uint, doc: doc}; type tagged_doc = {tag: uint, doc: doc};
trait get_doc {
fn [](tag: uint) -> doc;
}
impl doc: get_doc {
fn [](tag: uint) -> doc {
get_doc(self, tag)
}
}
impl doc: ops::index<uint,doc> { impl doc: ops::index<uint,doc> {
pure fn index(&&tag: uint) -> doc { pure fn index(&&tag: uint) -> doc {
unchecked { unchecked {

View file

@ -821,34 +821,12 @@ pure fn empty_span() -> span {
// Convenience implementations // Convenience implementations
// Remove after snapshot!
trait path_concat {
pure fn +(&&id: ident) -> @path;
}
// Remove after snapshot!
impl ident: path_concat {
pure fn +(&&id: ident) -> @path {
simple_path(self, empty_span()) + id
}
}
impl ident: ops::add<ident,@path> { impl ident: ops::add<ident,@path> {
pure fn add(&&id: ident) -> @path { pure fn add(&&id: ident) -> @path {
simple_path(self, empty_span()) + id simple_path(self, empty_span()) + id
} }
} }
// Remove after snapshot!
impl @path: path_concat {
pure fn +(&&id: ident) -> @path {
@{
idents: vec::append_one(self.idents, id)
with *self
}
}
}
impl @path: ops::add<ident,@path> { impl @path: ops::add<ident,@path> {
pure fn add(&&id: ident) -> @path { pure fn add(&&id: ident) -> @path {
@{ @{

View file

@ -2391,22 +2391,7 @@ class parser {
} }
fn parse_method_name() -> ident { fn parse_method_name() -> ident {
match copy self.token { self.parse_value_ident()
token::BINOP(op) => { self.bump(); @token::binop_to_str(op) }
token::NOT => { self.bump(); @~"!" }
token::LBRACKET => {
self.bump();
self.expect(token::RBRACKET);
@~"[]"
}
_ => {
let id = self.parse_value_ident();
if id == @~"unary" && self.eat(token::BINOP(token::MINUS)) {
@~"unary-"
}
else { id }
}
}
} }
fn parse_method(pr: visibility) -> @method { fn parse_method(pr: visibility) -> @method {

View file

@ -1522,20 +1522,6 @@ fn remove_copyable(k: kind) -> kind {
k - kind_(KIND_MASK_COPY) k - kind_(KIND_MASK_COPY)
} }
impl kind {
fn &(other: kind) -> kind {
lower_kind(self, other)
}
fn |(other: kind) -> kind {
raise_kind(self, other)
}
fn -(other: kind) -> kind {
kind_(*self & !*other)
}
}
impl kind: ops::bitand<kind,kind> { impl kind: ops::bitand<kind,kind> {
pure fn bitand(other: kind) -> kind { pure fn bitand(other: kind) -> kind {
unchecked { unchecked {

View file

@ -53,7 +53,6 @@ class cat<T: copy> : map<int, T> {
none => { fail ~"epic fail"; } none => { fail ~"epic fail"; }
} }
} }
fn [](&&k:int) -> T { self.get(k) }
fn find(+k:int) -> option<T> { if k <= self.meows { fn find(+k:int) -> option<T> { if k <= self.meows {
some(self.name) some(self.name)
} }