Skip to content

Commit ef0ea20

Browse files
committed
---
yaml --- r: 6697 b: refs/heads/master c: 85f381f h: refs/heads/master i: 6695: cbe2111 v: v3
1 parent 83250da commit ef0ea20

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
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: eaaa3c30bf132a3f67ac0a925853e5a2f6f6baf7
2+
refs/heads/master: 85f381fb8ac129878ce0e9139c9fa01390a1265e

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

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
187187
words.insert("const", ());
188188
words.insert("log", ());
189189
words.insert("log_err", ());
190+
words.insert("sendfn", ());
190191
words.insert("tag", ());
191192
words.insert("obj", ());
192193
words.insert("copy", ());
@@ -1348,12 +1349,40 @@ fn parse_capture_clause(p: parser) -> @ast::capture {
13481349
ret @spanned(lo, hi, {is_send: is_send, copies: copies, moves: moves});
13491350
}
13501351

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+
13511365
fn parse_fn_expr(p: parser, kw: fn_kw) -> @ast::expr {
13521366
let lo = p.get_last_lo_pos();
13531367
let captures = parse_capture_clause(p);
1368+
let is_send = captures.node.is_send;
1369+
let proto = select_proto(p, kw, is_send);
13541370
let decl = parse_fn_decl(p, ast::impure_fn, ast::il_normal);
13551371
let body = parse_block(p);
1356-
let proto = alt (kw, captures.node.is_send) {
1372+
let _fn = {decl: decl, proto: proto, body: body};
1373+
ret mk_expr(p, lo, body.span.hi, ast::expr_fn(_fn, captures));
1374+
}
1375+
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) {
13571386
(fn_kw_fn., true) { ast::proto_bare }
13581387
(fn_kw_fn_at., true) { ast::proto_send }
13591388
(fn_kw_lambda., true) { ast::proto_send }
@@ -1363,9 +1392,14 @@ fn parse_fn_expr(p: parser, kw: fn_kw) -> @ast::expr {
13631392
(fn_kw_lambda., false) { ast::proto_shared(ast::sugar_sexy) }
13641393
(fn_kw_block., false) { ast::proto_block }
13651394
};
1366-
let _fn = {decl: decl, proto: proto, body: body};
1367-
ret mk_expr(p, lo, body.span.hi, ast::expr_fn(_fn, captures));
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));
13681400
}
1401+
*/
1402+
13691403

13701404
fn parse_fn_block_expr(p: parser) -> @ast::expr {
13711405
let lo = p.get_last_lo_pos();

0 commit comments

Comments
 (0)