@@ -187,6 +187,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
187
187
words. insert ( "const" , ( ) ) ;
188
188
words. insert ( "log" , ( ) ) ;
189
189
words. insert ( "log_err" , ( ) ) ;
190
+ words. insert ( "sendfn" , ( ) ) ;
190
191
words. insert ( "tag" , ( ) ) ;
191
192
words. insert ( "obj" , ( ) ) ;
192
193
words. insert ( "copy" , ( ) ) ;
@@ -1348,12 +1349,40 @@ fn parse_capture_clause(p: parser) -> @ast::capture {
1348
1349
ret @spanned ( lo, hi, { is_send: is_send, copies: copies, moves: moves} ) ;
1349
1350
}
1350
1351
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
+
1351
1365
fn parse_fn_expr ( p : parser , kw : fn_kw ) -> @ast:: expr {
1352
1366
let lo = p. get_last_lo_pos ( ) ;
1353
1367
let captures = parse_capture_clause ( p) ;
1368
+ let is_send = captures. node . is_send ;
1369
+ let proto = select_proto ( p, kw, is_send) ;
1354
1370
let decl = parse_fn_decl ( p, ast:: impure_fn, ast:: il_normal) ;
1355
1371
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) {
1357
1386
(fn_kw_fn., true) { ast::proto_bare }
1358
1387
(fn_kw_fn_at., true) { ast::proto_send }
1359
1388
(fn_kw_lambda., true) { ast::proto_send }
@@ -1363,9 +1392,14 @@ fn parse_fn_expr(p: parser, kw: fn_kw) -> @ast::expr {
1363
1392
(fn_kw_lambda., false) { ast::proto_shared(ast::sugar_sexy) }
1364
1393
(fn_kw_block., false) { ast::proto_block }
1365
1394
};
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));
1368
1400
}
1401
+ */
1402
+
1369
1403
1370
1404
fn parse_fn_block_expr ( p : parser ) -> @ast:: expr {
1371
1405
let lo = p. get_last_lo_pos ( ) ;
0 commit comments