Remove transitional code

This commit is contained in:
Brian Anderson 2012-12-09 17:59:21 -08:00
parent 55a3a5fcc9
commit 9723d3ac2f
12 changed files with 0 additions and 253 deletions

View File

@ -145,16 +145,6 @@ pub pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> @[T] {
#[cfg(notest)]
pub mod traits {
#[cfg(stage0)]
pub impl<T: Copy> @[T] : Add<&[const T],@[T]> {
#[inline(always)]
pure fn add(rhs: & &self/[const T]) -> @[T] {
append(self, (*rhs))
}
}
#[cfg(stage1)]
#[cfg(stage2)]
pub impl<T: Copy> @[T] : Add<&[const T],@[T]> {
#[inline(always)]
pure fn add(&self, rhs: & &self/[const T]) -> @[T] {

View File

@ -358,15 +358,6 @@ impl<A: Copy> DVec<A> {
}
}
#[cfg(stage0)]
impl<A:Copy> DVec<A>: Index<uint,A> {
#[inline(always)]
pure fn index(idx: uint) -> A {
self.get_elt(idx)
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl<A:Copy> DVec<A>: Index<uint,A> {
#[inline(always)]
pure fn index(&self, idx: uint) -> A {

View File

@ -18,14 +18,6 @@ pub trait Drop {
fn finalize(&self); // XXX: Rename to "drop"? --pcwalton
}
#[cfg(stage0)]
#[lang="add"]
pub trait Add<RHS,Result> {
pure fn add(rhs: &RHS) -> Result;
}
#[cfg(stage1)]
#[cfg(stage2)]
#[lang="add"]
pub trait Add<RHS,Result> {
pure fn add(&self, rhs: &RHS) -> Result;
@ -81,14 +73,6 @@ pub trait Shr<RHS,Result> {
pure fn shr(&self, rhs: &RHS) -> Result;
}
#[cfg(stage0)]
#[lang="index"]
pub trait Index<Index,Result> {
pure fn index(index: Index) -> Result;
}
#[cfg(stage1)]
#[cfg(stage2)]
#[lang="index"]
pub trait Index<Index,Result> {
pure fn index(&self, index: Index) -> Result;

View File

@ -2107,15 +2107,6 @@ impl ~str: Trimmable {
#[cfg(notest)]
pub mod traits {
#[cfg(stage0)]
impl ~str : Add<&str,~str> {
#[inline(always)]
pure fn add(rhs: & &self/str) -> ~str {
append(copy self, (*rhs))
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl ~str : Add<&str,~str> {
#[inline(always)]
pure fn add(&self, rhs: & &self/str) -> ~str {

View File

@ -1439,15 +1439,6 @@ impl<T: Ord> @[T] : Ord {
#[cfg(notest)]
pub mod traits {
#[cfg(stage0)]
impl<T: Copy> ~[T] : Add<&[const T],~[T]> {
#[inline(always)]
pure fn add(rhs: & &self/[const T]) -> ~[T] {
append(copy self, (*rhs))
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl<T: Copy> ~[T] : Add<&[const T],~[T]> {
#[inline(always)]
pure fn add(&self, rhs: & &self/[const T]) -> ~[T] {
@ -1455,15 +1446,6 @@ pub mod traits {
}
}
#[cfg(stage0)]
impl<T: Copy> ~[mut T] : Add<&[const T],~[mut T]> {
#[inline(always)]
pure fn add(rhs: & &self/[const T]) -> ~[mut T] {
append_mut(copy self, (*rhs))
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl<T: Copy> ~[mut T] : Add<&[const T],~[mut T]> {
#[inline(always)]
pure fn add(&self, rhs: & &self/[const T]) -> ~[mut T] {

View File

@ -565,14 +565,6 @@ pure fn land(w0: uint, w1: uint) -> uint { return w0 & w1; }
pure fn right(_w0: uint, w1: uint) -> uint { return w1; }
#[cfg(stage0)]
impl Bitv: ops::Index<uint,bool> {
pure fn index(i: uint) -> bool {
self.get(i)
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl Bitv: ops::Index<uint,bool> {
pure fn index(&self, i: uint) -> bool {
self.get(i)

View File

@ -57,16 +57,6 @@ pub mod reader {
// ebml reading
#[cfg(stage0)]
impl Doc: ops::Index<uint,Doc> {
pure fn index(tag: uint) -> Doc {
unsafe {
get_doc(self, tag)
}
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl Doc: ops::Index<uint,Doc> {
pure fn index(&self, tag: uint) -> Doc {
unsafe {

View File

@ -429,16 +429,6 @@ pub mod chained {
}
}
#[cfg(stage0)]
impl<K:Eq IterBytes Hash Copy, V: Copy> T<K, V>: ops::Index<K, V> {
pure fn index(k: K) -> V {
unsafe {
self.get(k)
}
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl<K:Eq IterBytes Hash Copy, V: Copy> T<K, V>: ops::Index<K, V> {
pure fn index(&self, k: K) -> V {
unsafe {

View File

@ -150,16 +150,6 @@ impl<V: Copy> SmallIntMap<V>: map::Map<uint, V> {
}
}
#[cfg(stage0)]
impl<V: Copy> SmallIntMap<V>: ops::Index<uint, V> {
pure fn index(key: uint) -> V {
unsafe {
get(self, key)
}
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl<V: Copy> SmallIntMap<V>: ops::Index<uint, V> {
pure fn index(&self, key: uint) -> V {
unsafe {

View File

@ -59,15 +59,6 @@ impl BytePos: cmp::Ord {
pure fn gt(&self, other: &BytePos) -> bool { **self > **other }
}
#[cfg(stage0)]
impl BytePos: Add<BytePos, BytePos> {
pure fn add(rhs: &BytePos) -> BytePos {
BytePos(*self + **rhs)
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl BytePos: Add<BytePos, BytePos> {
pure fn add(&self, rhs: &BytePos) -> BytePos {
BytePos(**self + **rhs)
@ -109,15 +100,6 @@ impl CharPos: to_bytes::IterBytes {
}
}
#[cfg(stage0)]
impl CharPos: Add<CharPos, CharPos> {
pure fn add(rhs: &CharPos) -> CharPos {
CharPos(*self + **rhs)
}
}
#[cfg(stage1)]
#[cfg(stage2)]
impl CharPos: Add<CharPos, CharPos> {
pure fn add(&self, rhs: &CharPos) -> CharPos {
CharPos(**self + **rhs)

View File

@ -122,32 +122,6 @@ impl ext_ctxt: ext_ctxt_ast_builder {
span: dummy_sp()}
}
#[cfg(stage0)]
fn stmt_let(ident: ident, e: @ast::expr) -> @ast::stmt {
// If the quasiquoter could interpolate idents, this is all
// we'd need.
//
//let ext_cx = self;
//#ast[stmt] { let $(ident) = $(e) }
@{node: ast::stmt_decl(@{node: ast::decl_local(~[
@{node: {is_mutbl: false,
ty: self.ty_infer(),
pat: @{id: self.next_id(),
node: ast::pat_ident(ast::bind_infer,
path(~[ident],
dummy_sp()),
None),
span: dummy_sp()},
init: Some(self.move_expr(e)),
id: self.next_id()},
span: dummy_sp()}]),
span: dummy_sp()}, self.next_id()),
span: dummy_sp()}
}
#[cfg(stage1)]
#[cfg(stage2)]
fn stmt_let(ident: ident, e: @ast::expr) -> @ast::stmt {
let ext_cx = self;
quote_stmt!( let $ident = $e; )

View File

@ -302,47 +302,6 @@ impl state: to_type_decls {
impl protocol: gen_init {
#[cfg(stage0)]
fn gen_init(cx: ext_ctxt) -> @ast::item {
let ext_cx = cx;
debug!("gen_init");
let start_state = self.states[0];
let body = if !self.is_bounded() {
match start_state.dir {
send => #ast { pipes::entangle() },
recv => {
#ast {{
let (s, c) = pipes::entangle();
(move c, move s)
}}
}
}
}
else {
let body = self.gen_init_bounded(ext_cx);
match start_state.dir {
send => body,
recv => {
#ast {{
let (s, c) = $(body);
(move c, move s)
}}
}
}
};
cx.parse_item(fmt!("pub fn init%s() -> (client::%s, server::%s)\
{ use pipes::HasBuffer; %s }",
start_state.ty_params.to_source(cx),
start_state.to_ty(cx).to_source(cx),
start_state.to_ty(cx).to_source(cx),
body.to_source(cx)))
}
#[cfg(stage1)]
#[cfg(stage2)]
fn gen_init(cx: ext_ctxt) -> @ast::item {
let ext_cx = cx;
@ -381,17 +340,6 @@ impl protocol: gen_init {
body.to_source(cx)))
}
#[cfg(stage0)]
fn gen_buffer_init(ext_cx: ext_ctxt) -> @ast::expr {
ext_cx.rec(self.states.map_to_vec(|s| {
let fty = s.to_ty(ext_cx);
ext_cx.field_imm(ext_cx.ident_of(s.name),
#ast { pipes::mk_packet::<$(fty)>() })
}))
}
#[cfg(stage1)]
#[cfg(stage2)]
fn gen_buffer_init(ext_cx: ext_ctxt) -> @ast::expr {
ext_cx.rec(self.states.map_to_vec(|s| {
let fty = s.to_ty(ext_cx);
@ -402,35 +350,6 @@ impl protocol: gen_init {
}))
}
#[cfg(stage0)]
fn gen_init_bounded(ext_cx: ext_ctxt) -> @ast::expr {
debug!("gen_init_bounded");
let buffer_fields = self.gen_buffer_init(ext_cx);
let buffer = #ast {
~{header: pipes::BufferHeader(),
data: $(buffer_fields)}
};
let entangle_body = ext_cx.block_expr(
ext_cx.block(
self.states.map_to_vec(
|s| ext_cx.parse_stmt(
fmt!("data.%s.set_buffer_(buffer)",
s.name))),
ext_cx.parse_expr(
fmt!("ptr::addr_of(&(data.%s))",
self.states[0].name))));
#ast {{
let buffer = $(buffer);
do pipes::entangle_buffer(move buffer) |buffer, data| {
$(entangle_body)
}
}}
}
#[cfg(stage1)]
#[cfg(stage2)]
fn gen_init_bounded(ext_cx: ext_ctxt) -> @ast::expr {
debug!("gen_init_bounded");
let buffer_fields = self.gen_buffer_init(ext_cx);
@ -472,34 +391,6 @@ impl protocol: gen_init {
.add_tys(cx.ty_vars(params)))
}
#[cfg(stage0)]
fn gen_buffer_type(cx: ext_ctxt) -> @ast::item {
let ext_cx = cx;
let mut params: ~[ast::ty_param] = ~[];
let fields = do (copy self.states).map_to_vec |s| {
for s.ty_params.each |tp| {
match params.find(|tpp| tp.ident == tpp.ident) {
None => params.push(*tp),
_ => ()
}
}
let ty = s.to_ty(cx);
let fty = #ast[ty] {
pipes::Packet<$(ty)>
};
cx.ty_field_imm(cx.ident_of(s.name), fty)
};
cx.item_ty_poly(
cx.ident_of(~"__Buffer"),
dummy_sp(),
cx.ty_rec(fields),
params)
}
#[cfg(stage1)]
#[cfg(stage2)]
fn gen_buffer_type(cx: ext_ctxt) -> @ast::item {
let ext_cx = cx;
let mut params: ~[ast::ty_param] = ~[];