libsyntax: Remove some multi-gigabyte clones that were preventing bootstrapping on Windows.

This commit is contained in:
Patrick Walton 2013-07-16 14:54:29 -07:00
parent dc4bf173f8
commit 66a9b7d5bd
9 changed files with 44 additions and 38 deletions

View File

@ -429,6 +429,18 @@ impl<D:Decoder,T:Decodable<D>> Decodable<D> for @T {
}
}
impl<S:Encoder,T:Encodable<S>> Encodable<S> for @mut T {
fn encode(&self, s: &mut S) {
(**self).encode(s)
}
}
impl<D:Decoder,T:Decodable<D>> Decodable<D> for @mut T {
fn decode(d: &mut D) -> @mut T {
@mut Decodable::decode(d)
}
}
impl<'self, S:Encoder,T:Encodable<S>> Encodable<S> for &'self [T] {
fn encode(&self, s: &mut S) {
do s.emit_seq(self.len()) |s| {
@ -650,18 +662,6 @@ impl<
}
}
impl<S: Encoder, T: Encodable<S>> Encodable<S> for @mut DList<T> {
fn encode(&self, s: &mut S) {
do s.emit_seq(self.len()) |s| {
let mut i = 0;
for self.iter().advance |e| {
s.emit_seq_elt(i, |s| e.encode(s));
i += 1;
}
}
}
}
impl<D:Decoder,T:Decodable<D>> Decodable<D> for DList<T> {
fn decode(d: &mut D) -> DList<T> {
let mut list = DList::new();

View File

@ -319,6 +319,13 @@ impl<A:IterBytes> IterBytes for @A {
}
}
impl<A:IterBytes> IterBytes for @mut A {
#[inline]
fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
(**self).iter_bytes(lsb0, f)
}
}
impl<A:IterBytes> IterBytes for ~A {
#[inline]
fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {

View File

@ -505,13 +505,13 @@ pub enum token_tree {
tt_tok(span, ::parse::token::Token),
// a delimited sequence (the delimiters appear as the first
// and last elements of the vector)
tt_delim(~[token_tree]),
tt_delim(@mut ~[token_tree]),
// These only make sense for right-hand-sides of MBE macros:
// a kleene-style repetition sequence with a span, a tt_forest,
// an optional separator (?), and a boolean where true indicates
// zero or more (*), and false indicates one or more (+).
tt_seq(span, ~[token_tree], Option<::parse::token::Token>, bool),
tt_seq(span, @mut ~[token_tree], Option<::parse::token::Token>, bool),
// a syntactic variable that will be filled in by macro expansion.
tt_nonterminal(span, ident)

View File

@ -25,7 +25,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt,
cx.print_backtrace();
io::stdout().write_line(
print::pprust::tt_to_str(
&ast::tt_delim(tt.to_owned()),
&ast::tt_delim(@mut tt.to_owned()),
get_ident_interner()));
//trivial expression

View File

@ -605,7 +605,7 @@ fn mk_tt(cx: @ExtCtxt, sp: span, tt: &ast::token_tree)
~[cx.stmt_expr(e_push)]
}
ast::tt_delim(ref tts) => mk_tts(cx, sp, *tts),
ast::tt_delim(ref tts) => mk_tts(cx, sp, **tts),
ast::tt_seq(*) => fail!("tt_seq in quote!"),
ast::tt_nonterminal(sp, ident) => {

View File

@ -85,7 +85,7 @@ pub fn add_new_extension(cx: @ExtCtxt,
io::println(fmt!("%s! { %s }",
cx.str_of(name),
print::pprust::tt_to_str(
&ast::tt_delim(arg.to_owned()),
&ast::tt_delim(@mut arg.to_owned()),
get_ident_interner())));
}

View File

@ -219,7 +219,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
match r.stack.forest[r.stack.idx].clone() {
tt_delim(tts) => {
r.stack = @mut TtFrame {
forest: @mut tts,
forest: tts,
idx: 0u,
dotdotdoted: false,
sep: None,
@ -235,7 +235,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
}
tt_seq(sp, tts, sep, zerok) => {
// XXX(pcwalton): Bad copy.
let t = tt_seq(sp, tts.clone(), sep.clone(), zerok);
let t = tt_seq(sp, tts, sep.clone(), zerok);
match lockstep_iter_size(&t, r) {
lis_unconstrained => {
r.sp_diag.span_fatal(
@ -263,7 +263,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
r.repeat_len.push(len);
r.repeat_idx.push(0u);
r.stack = @mut TtFrame {
forest: @mut tts,
forest: tts,
idx: 0u,
dotdotdoted: true,
sep: sep,

View File

@ -131,10 +131,10 @@ fn fold_tts(tts : &[token_tree], fld: @ast_fold) -> ~[token_tree] {
tt_tok(span, ref tok) =>
tt_tok(span,maybe_fold_ident(tok,fld)),
tt_delim(ref tts) =>
tt_delim(fold_tts(*tts,fld)),
tt_delim(@mut fold_tts(**tts, fld)),
tt_seq(span, ref pattern, ref sep, is_optional) =>
tt_seq(span,
fold_tts(*pattern,fld),
@mut fold_tts(**pattern, fld),
sep.map(|tok|maybe_fold_ident(tok,fld)),
is_optional),
tt_nonterminal(sp,ref ident) =>

View File

@ -1925,7 +1925,7 @@ impl Parser {
};
tt_seq(
mk_sp(sp.lo, p.span.hi),
seq,
@mut seq,
s,
z
)
@ -1950,21 +1950,20 @@ impl Parser {
}
token::LPAREN | token::LBRACE | token::LBRACKET => {
let close_delim = token::flip_delimiter(&*self.token);
tt_delim(
vec::append(
// the open delimiter:
~[parse_any_tt_tok(self)],
vec::append(
self.parse_seq_to_before_end(
&close_delim,
seq_sep_none(),
|p| p.parse_token_tree()
),
// the close delimiter:
[parse_any_tt_tok(self)]
)
)
)
// Parse the open delimiter.
let mut result = ~[parse_any_tt_tok(self)];
let trees =
self.parse_seq_to_before_end(&close_delim,
seq_sep_none(),
|p| p.parse_token_tree());
result.push_all_move(trees);
// Parse the close delimiter.
result.push(parse_any_tt_tok(self));
tt_delim(@mut result)
}
_ => parse_non_delim_tt_tok(self)
}