Skip to content

Commit 39d9c30

Browse files
committed
Remove code from parser that was awaiting snapshot
Remove old parser functions as well as support for old-style capture clauses. Remove remaining old-style capture clauses.
1 parent bc507c4 commit 39d9c30

File tree

8 files changed

+9
-69
lines changed

8 files changed

+9
-69
lines changed

src/libcore/task.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ fn test_avoid_copying_the_body_spawn() {
879879
#[test]
880880
fn test_avoid_copying_the_body_spawn_listener() {
881881
avoid_copying_the_body {|f|
882-
spawn_listener(fn~[move f](_po: comm::port<int>) {
882+
spawn_listener(fn~(move f, _po: comm::port<int>) {
883883
f();
884884
});
885885
}
@@ -899,7 +899,7 @@ fn test_avoid_copying_the_body_run() {
899899
fn test_avoid_copying_the_body_run_listener() {
900900
avoid_copying_the_body {|f|
901901
let buildr = builder();
902-
run_listener(buildr, fn~[move f](_po: comm::port<int>) {
902+
run_listener(buildr, fn~(move f, _po: comm::port<int>) {
903903
f();
904904
});
905905
}

src/libsyntax/ext/source_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn expand_include(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
5959
let p = parse::new_parser_from_file(cx.parse_sess(), cx.cfg(),
6060
res_rel_file(cx, sp, file),
6161
parse::parser::SOURCE_FILE);
62-
ret parse::parser::parse_expr(p)
62+
ret p.parse_expr();
6363
}
6464

6565
fn expand_include_str(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import dvec::{dvec, extensions};
1616

1717
export file_type;
1818
export parser;
19-
export parse_expr;
20-
export parse_pat;
2119

2220
// FIXME: #ast expects to find this here but it's actually defined in `parse`
2321
// Fixing this will be easier when we have export decls on individual items --
@@ -26,12 +24,6 @@ export parse_pat;
2624
import parse_from_source_str;
2725
export parse_from_source_str;
2826

29-
// TODO: remove these once we go around a snapshot cycle.
30-
// These are here for the old way that #ast (qquote.rs) worked
31-
fn parse_expr(p: parser) -> @ast::expr { p.parse_expr() }
32-
fn parse_pat(p: parser) -> @ast::pat { p.parse_pat() }
33-
34-
3527
enum restriction {
3628
UNRESTRICTED,
3729
RESTRICT_STMT_EXPR,
@@ -1231,8 +1223,6 @@ class parser {
12311223
fn parse_fn_expr(proto: proto) -> @expr {
12321224
let lo = self.last_span.lo;
12331225

1234-
let cc_old = self.parse_old_skool_capture_clause();
1235-
12361226
// if we want to allow fn expression argument types to be inferred in
12371227
// the future, just have to change parse_arg to parse_fn_block_arg.
12381228
let (decl, capture_clause) =
@@ -1241,8 +1231,7 @@ class parser {
12411231

12421232
let body = self.parse_block();
12431233
ret self.mk_expr(lo, body.span.hi,
1244-
expr_fn(proto, decl, body,
1245-
@(*capture_clause + cc_old)));
1234+
expr_fn(proto, decl, body, capture_clause));
12461235
}
12471236

12481237
fn parse_fn_block_expr() -> @expr {
@@ -1731,55 +1720,6 @@ class parser {
17311720
} else { [] }
17321721
}
17331722

1734-
// FIXME Remove after snapshot
1735-
fn parse_old_skool_capture_clause() -> [capture_item] {
1736-
fn expect_opt_trailing_semi(p: parser) {
1737-
if !p.eat(token::SEMI) {
1738-
if p.token != token::RBRACKET {
1739-
p.fatal("expecting ; or ]");
1740-
}
1741-
}
1742-
}
1743-
1744-
fn eat_ident_list(p: parser, is_move: bool) -> [capture_item] {
1745-
let mut res = [];
1746-
loop {
1747-
alt p.token {
1748-
token::IDENT(_, _) {
1749-
let id = p.get_id();
1750-
let sp = mk_sp(p.span.lo, p.span.hi);
1751-
let ident = p.parse_ident();
1752-
res += [@{id:id, is_move: is_move, name:ident, span:sp}];
1753-
if !p.eat(token::COMMA) {
1754-
ret res;
1755-
}
1756-
}
1757-
1758-
_ { ret res; }
1759-
}
1760-
};
1761-
}
1762-
1763-
let mut cap_items = [];
1764-
1765-
if self.eat(token::LBRACKET) {
1766-
while !self.eat(token::RBRACKET) {
1767-
if self.eat_keyword("copy") {
1768-
cap_items += eat_ident_list(self, false);
1769-
expect_opt_trailing_semi(self);
1770-
} else if self.eat_keyword("move") {
1771-
cap_items += eat_ident_list(self, true);
1772-
expect_opt_trailing_semi(self);
1773-
} else {
1774-
let s: str = "expecting send, copy, or move clause";
1775-
self.fatal(s);
1776-
}
1777-
}
1778-
}
1779-
1780-
ret cap_items;
1781-
}
1782-
17831723
fn parse_fn_decl(purity: purity,
17841724
parse_arg_fn: fn(parser) -> arg_or_capture_item)
17851725
-> (fn_decl, capture_clause) {

src/rustdoc/astsrv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ fn exec<T:send>(
9797
) -> T {
9898
let po = comm::port();
9999
let ch = comm::chan(po);
100-
let msg = handle_request(fn~[move f](ctxt: ctxt) {
100+
let msg = handle_request(fn~(move f, ctxt: ctxt) {
101101
comm::send(ch, f(ctxt))
102102
});
103103
comm::send(srv.ch, msg);

src/test/run-pass/issue-1895.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
fn main() {
22
let x = 1;
3-
let y = fn@[move x]() -> int {
3+
let y = fn@(move x) -> int {
44
x
55
}();
66
}

src/test/run-pass/sendfn-spawn-with-fn-arg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn test05() {
1515
log(error, *three + n); // will copy x into the closure
1616
assert(*three == 3);
1717
};
18-
task::spawn(fn~[move fn_to_send]() {
18+
task::spawn(fn~(move fn_to_send) {
1919
test05_start(fn_to_send);
2020
});
2121
}

src/test/run-pass/task-spawn-move-and-copy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn main() {
88
let y = ~2;
99
let y_in_parent = ptr::addr_of(*y) as uint;
1010

11-
task::spawn(fn~[copy ch, y; move x]() {
11+
task::spawn(fn~(copy ch, copy y, move x) {
1212
let x_in_child = ptr::addr_of(*x) as uint;
1313
comm::send(ch, x_in_child);
1414

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
22
let x = ~1;
3-
let lam_move = fn@[move x]() { };
3+
let lam_move = fn@(move x) { };
44
lam_move();
55
}

0 commit comments

Comments
 (0)