Skip to content

Commit a8a7a66

Browse files
committed
---
yaml --- r: 6699 b: refs/heads/master c: 1869306 h: refs/heads/master i: 6697: ef0ea20 6695: cbe2111 v: v3
1 parent 322dbf7 commit a8a7a66

File tree

5 files changed

+16
-83
lines changed

5 files changed

+16
-83
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: f512e67fb97bf9d1cbf9337c8c6e877c91faea06
2+
refs/heads/master: 1869306a7e3d94aaf474b6f27671d3844db088a1

trunk/src/comp/front/test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ fn mk_test_wrapper(cx: test_ctxt,
349349

350350
let wrapper_capture: @ast::capture = @{
351351
node: {
352-
is_send: false,
353352
copies: [],
354353
moves: []
355354
},

trunk/src/comp/syntax/ast.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ tag expr_ {
255255

256256
// At the moment, one can only capture local variables.
257257
type capture_ = {
258-
is_send: bool,
259258
copies: [spanned<ident>],
260259
moves: [spanned<ident>]
261260
};

trunk/src/comp/syntax/parse/parser.rs

Lines changed: 14 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ tag restriction { UNRESTRICTED; RESTRICT_NO_CALL_EXPRS; RESTRICT_NO_BAR_OP; }
1414

1515
tag file_type { CRATE_FILE; SOURCE_FILE; }
1616

17-
tag fn_kw {
18-
fn_kw_fn;
19-
fn_kw_fn_at;
20-
fn_kw_lambda;
21-
fn_kw_block;
22-
}
23-
2417
type parse_sess = @{cm: codemap::codemap, mutable next_id: node_id};
2518

2619
fn next_node_id(sess: parse_sess) -> node_id {
@@ -544,13 +537,9 @@ fn parse_ty(p: parser, colons_before_params: bool) -> @ast::ty {
544537
} else if eat_word(p, "block") {
545538
t = parse_ty_fn(ast::proto_block, p);
546539
} else if eat_word(p, "lambda") {
547-
if eat(p, token::LBRACKET) { // lambda[send](...)
548-
expect_word(p, "send");
549-
expect(p, token::RBRACKET);
550-
t = parse_ty_fn(ast::proto_send, p);
551-
} else { // lambda(...)
552-
t = parse_ty_fn(ast::proto_shared(ast::sugar_sexy), p);
553-
}
540+
t = parse_ty_fn(ast::proto_shared(ast::sugar_sexy), p);
541+
} else if eat_word(p, "sendfn") {
542+
t = parse_ty_fn(ast::proto_send, p);
554543
} else if eat_word(p, "obj") {
555544
t = parse_ty_obj(p);
556545
} else if p.peek() == token::MOD_SEP || is_ident(p.peek()) {
@@ -844,12 +833,14 @@ fn parse_bottom_expr(p: parser) -> @ast::expr {
844833
ret parse_spawn_expr(p);
845834
*/
846835
} else if eat_word(p, "fn") {
847-
let kw = parse_fn_anon_kw(p);
848-
ret parse_fn_expr(p, kw);
836+
let proto = parse_fn_ty_proto(p);
837+
ret parse_fn_expr(p, proto);
849838
} else if eat_word(p, "block") {
850-
ret parse_fn_expr(p, fn_kw_block);
839+
ret parse_fn_expr(p, ast::proto_block);
851840
} else if eat_word(p, "lambda") {
852-
ret parse_fn_expr(p, fn_kw_lambda);
841+
ret parse_fn_expr(p, ast::proto_shared(ast::sugar_sexy));
842+
} else if eat_word(p, "sendfn") {
843+
ret parse_fn_expr(p, ast::proto_send);
853844
} else if eat_word(p, "unchecked") {
854845
ret parse_block_expr(p, lo, ast::unchecked_blk);
855846
} else if eat_word(p, "unsafe") {
@@ -1290,7 +1281,7 @@ fn parse_if_expr(p: parser) -> @ast::expr {
12901281

12911282
// Parses:
12921283
//
1293-
// CC := [send; copy ID*; move ID*]
1284+
// CC := [copy ID*; move ID*]
12941285
//
12951286
// where any part is optional and trailing ; is permitted.
12961287
fn parse_capture_clause(p: parser) -> @ast::capture {
@@ -1322,17 +1313,13 @@ fn parse_capture_clause(p: parser) -> @ast::capture {
13221313
std::util::unreachable();
13231314
}
13241315

1325-
let is_send = false;
13261316
let copies = [];
13271317
let moves = [];
13281318

13291319
let lo = p.get_lo_pos();
13301320
if eat(p, token::LBRACKET) {
13311321
while !eat(p, token::RBRACKET) {
1332-
if eat_word(p, "send") {
1333-
is_send = true;
1334-
expect_opt_trailing_semi(p);
1335-
} else if eat_word(p, "copy") {
1322+
if eat_word(p, "copy") {
13361323
copies += eat_ident_list(p);
13371324
expect_opt_trailing_semi(p);
13381325
} else if eat_word(p, "move") {
@@ -1346,68 +1333,25 @@ fn parse_capture_clause(p: parser) -> @ast::capture {
13461333
}
13471334
let hi = p.get_last_hi_pos();
13481335

1349-
ret @spanned(lo, hi, {is_send: is_send, copies: copies, moves: moves});
1336+
ret @spanned(lo, hi, {copies: copies, moves: moves});
13501337
}
13511338

1352-
fn select_proto(p: parser, kw: fn_kw, is_send: bool) -> ast::proto {
1353-
ret alt (kw, is_send) {
1354-
(fn_kw_fn., true) { ast::proto_bare }
1355-
(fn_kw_fn_at., true) { ast::proto_send }
1356-
(fn_kw_lambda., true) { ast::proto_send }
1357-
(fn_kw_block., true) { p.fatal("block cannot be declared sendable") }
1358-
(fn_kw_fn., false) { ast::proto_bare }
1359-
(fn_kw_fn_at., false) { ast::proto_shared(ast::sugar_normal) }
1360-
(fn_kw_lambda., false) { ast::proto_shared(ast::sugar_sexy) }
1361-
(fn_kw_block., false) { ast::proto_block }
1362-
};
1363-
}
1364-
1365-
fn parse_fn_expr(p: parser, kw: fn_kw) -> @ast::expr {
1339+
fn parse_fn_expr(p: parser, proto: ast::proto) -> @ast::expr {
13661340
let lo = p.get_last_lo_pos();
13671341
let captures = parse_capture_clause(p);
1368-
let is_send = captures.node.is_send;
1369-
let proto = select_proto(p, kw, is_send);
13701342
let decl = parse_fn_decl(p, ast::impure_fn, ast::il_normal);
13711343
let body = parse_block(p);
13721344
let _fn = {decl: decl, proto: proto, body: body};
13731345
ret mk_expr(p, lo, body.span.hi, ast::expr_fn(_fn, captures));
13741346
}
13751347

1376-
/*
1377-
** This version triggers an LLVM bug: **
1378-
1379-
fn parse_fn_expr(p: parser, kw: fn_kw) -> @ast::expr {
1380-
let lo = p.get_last_lo_pos();
1381-
let captures = parse_capture_clause(p);
1382-
let is_send = captures.node.is_send;
1383-
//let proto = select_proto(p, kw, is_send);
1384-
log_err (kw, captures, is_send);
1385-
let proto = alt (kw, is_send) {
1386-
(fn_kw_fn., true) { ast::proto_bare }
1387-
(fn_kw_fn_at., true) { ast::proto_send }
1388-
(fn_kw_lambda., true) { ast::proto_send }
1389-
(fn_kw_block., true) { p.fatal("block cannot be declared sendable") }
1390-
(fn_kw_fn., false) { ast::proto_bare }
1391-
(fn_kw_fn_at., false) { ast::proto_shared(ast::sugar_normal) }
1392-
(fn_kw_lambda., false) { ast::proto_shared(ast::sugar_sexy) }
1393-
(fn_kw_block., false) { ast::proto_block }
1394-
};
1395-
fail "foo";
1396-
//let decl = parse_fn_decl(p, ast::impure_fn, ast::il_normal);
1397-
//let body = parse_block(p);
1398-
//let _fn = {decl: decl, proto: proto, body: body};
1399-
//ret mk_expr(p, lo, body.span.hi, ast::expr_fn(_fn, captures));
1400-
}
1401-
*/
1402-
1403-
14041348
fn parse_fn_block_expr(p: parser) -> @ast::expr {
14051349
let lo = p.get_last_lo_pos();
14061350
let decl = parse_fn_block_decl(p);
14071351
let mid = p.get_last_hi_pos();
14081352
let body = parse_block_tail(p, lo, ast::default_blk);
14091353
let _fn = {decl: decl, proto: ast::proto_block, body: body};
1410-
let captures = @spanned(lo, mid, {is_send: false, copies: [], moves: []});
1354+
let captures = @spanned(lo, mid, {copies: [], moves: []});
14111355
ret mk_expr(p, lo, body.span.hi, ast::expr_fn(_fn, captures));
14121356
}
14131357

@@ -2191,15 +2135,6 @@ fn parse_fn_ty_proto(p: parser) -> ast::proto {
21912135
}
21922136
}
21932137

2194-
fn parse_fn_anon_kw(p: parser) -> fn_kw {
2195-
if p.peek() == token::AT {
2196-
p.bump();
2197-
fn_kw_fn_at
2198-
} else {
2199-
fn_kw_fn
2200-
}
2201-
}
2202-
22032138
fn parse_method_proto(p: parser) -> ast::proto {
22042139
if eat_word(p, "fn") {
22052140
ret ast::proto_bare;

trunk/src/comp/syntax/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ fn proto_to_str(p: ast::proto) -> str {
16001600
ret alt p {
16011601
ast::proto_bare. { "fn" }
16021602
ast::proto_block. { "block" }
1603-
ast::proto_send. { "lambda[send]" }
1603+
ast::proto_send. { "sendfn" }
16041604
ast::proto_shared(ast::sugar_normal.) { "fn@" }
16051605
ast::proto_shared(ast::sugar_sexy.) { "lambda" }
16061606
};

0 commit comments

Comments
 (0)