Skip to content

Commit 3bd0c8a

Browse files
committed
---
yaml --- r: 48087 b: refs/heads/incoming c: 256afb8 h: refs/heads/master i: 48085: 0d79c0c 48083: a8219c0 48079: c772c31 v: v3
1 parent 407d5f8 commit 3bd0c8a

File tree

10 files changed

+182
-195
lines changed

10 files changed

+182
-195
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 2a8fb58d79e685d5ca07b039badcf2ae3ef077ea
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 97fd421319fda45d0d4c6a0906f29a228ec57b42
9+
refs/heads/incoming: 256afb8a1057fdbe7bca2860af1ddb6ef0768d5c
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libsyntax/ast_util.rs

Lines changed: 22 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@ pub fn empty(range: id_range) -> bool {
396396
range.min >= range.max
397397
}
398398

399-
pub fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
400-
let visit_generics = fn@(generics: &Generics) {
399+
pub fn id_visitor(vfn: @fn(node_id)) -> visit::vt<()> {
400+
let visit_generics: @fn(&Generics) = |generics| {
401401
for generics.ty_params.each |p| {
402402
vfn(p.id);
403403
}
@@ -408,7 +408,7 @@ pub fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
408408
visit::mk_simple_visitor(@visit::SimpleVisitor {
409409
visit_mod: |_m, _sp, id| vfn(id),
410410

411-
visit_view_item: fn@(vi: @view_item) {
411+
visit_view_item: |vi| {
412412
match vi.node {
413413
view_item_extern_mod(_, _, id) => vfn(id),
414414
view_item_use(ref vps) => {
@@ -423,11 +423,9 @@ pub fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
423423
}
424424
},
425425

426-
visit_foreign_item: fn@(ni: @foreign_item) {
427-
vfn(ni.id)
428-
},
426+
visit_foreign_item: |ni| vfn(ni.id),
429427

430-
visit_item: fn@(i: @item) {
428+
visit_item: |i| {
431429
vfn(i.id);
432430
match i.node {
433431
item_enum(ref enum_definition, _) =>
@@ -436,36 +434,21 @@ pub fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
436434
}
437435
},
438436

439-
visit_local: fn@(l: @local) {
440-
vfn(l.node.id);
441-
},
442-
443-
visit_block: fn@(b: &blk) {
444-
vfn(b.node.id);
445-
},
446-
447-
visit_stmt: fn@(s: @stmt) {
448-
vfn(ast_util::stmt_id(*s));
449-
},
450-
451-
visit_arm: fn@(_a: &arm) { },
452-
453-
visit_pat: fn@(p: @pat) {
454-
vfn(p.id)
455-
},
456-
457-
visit_decl: fn@(_d: @decl) {
458-
},
437+
visit_local: |l| vfn(l.node.id),
438+
visit_block: |b| vfn(b.node.id),
439+
visit_stmt: |s| vfn(ast_util::stmt_id(*s)),
440+
visit_arm: |_| {},
441+
visit_pat: |p| vfn(p.id),
442+
visit_decl: |_| {},
459443

460-
visit_expr: fn@(e: @expr) {
444+
visit_expr: |e| {
461445
vfn(e.callee_id);
462446
vfn(e.id);
463447
},
464448

465-
visit_expr_post: fn@(_e: @expr) {
466-
},
449+
visit_expr_post: |_| {},
467450

468-
visit_ty: fn@(t: @Ty) {
451+
visit_ty: |t| {
469452
match t.node {
470453
ty_path(_, id) => vfn(id),
471454
_ => { /* fall through */ }
@@ -474,8 +457,7 @@ pub fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
474457

475458
visit_generics: visit_generics,
476459

477-
visit_fn: fn@(fk: &visit::fn_kind, d: &ast::fn_decl,
478-
_b: &ast::blk, _sp: span, id: ast::node_id) {
460+
visit_fn: |fk, d, _, _, id| {
479461
vfn(id);
480462

481463
match *fk {
@@ -502,32 +484,19 @@ pub fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
502484
}
503485
},
504486

505-
visit_ty_method: fn@(_ty_m: &ty_method) {
506-
},
507-
508-
visit_trait_method: fn@(_ty_m: &trait_method) {
509-
},
510-
511-
visit_struct_def: fn@(_sd: @struct_def,
512-
_id: ident,
513-
_generics: &Generics,
514-
_id: node_id) {
515-
},
516-
517-
visit_struct_field: fn@(f: @struct_field) {
518-
vfn(f.node.id);
519-
},
520-
521-
visit_struct_method: fn@(_m: @method) {
522-
}
487+
visit_ty_method: |_| {},
488+
visit_trait_method: |_| {},
489+
visit_struct_def: |_, _, _, _| {},
490+
visit_struct_field: |f| vfn(f.node.id),
491+
visit_struct_method: |_| {}
523492
})
524493
}
525494

526-
pub fn visit_ids_for_inlined_item(item: inlined_item, vfn: fn@(node_id)) {
495+
pub fn visit_ids_for_inlined_item(item: inlined_item, vfn: @fn(node_id)) {
527496
item.accept((), id_visitor(vfn));
528497
}
529498

530-
pub fn compute_id_range(visit_ids_fn: fn(fn@(node_id))) -> id_range {
499+
pub fn compute_id_range(visit_ids_fn: &fn(@fn(node_id))) -> id_range {
531500
let min = @mut int::max_value;
532501
let max = @mut int::min_value;
533502
do visit_ids_fn |id| {

branches/incoming/src/libsyntax/diagnostic.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ use core::dvec::DVec;
2323

2424
use std::term;
2525

26-
pub type Emitter = fn@(cmsp: Option<(@codemap::CodeMap, span)>,
27-
msg: &str, lvl: level);
26+
pub type Emitter = @fn(cmsp: Option<(@codemap::CodeMap, span)>,
27+
msg: &str,
28+
lvl: level);
2829

2930
// a handler deals with errors; certain errors
3031
// (fatal, bug, unimpl) may cause immediate exit,
@@ -204,8 +205,7 @@ fn print_diagnostic(topic: ~str, lvl: level, msg: &str) {
204205
}
205206

206207
pub fn collect(messages: @DVec<~str>)
207-
-> fn@(Option<(@codemap::CodeMap, span)>, &str, level)
208-
{
208+
-> @fn(Option<(@codemap::CodeMap, span)>, &str, level) {
209209
let f: @fn(Option<(@codemap::CodeMap, span)>, &str, level) =
210210
|_o, msg: &str, _l| { messages.push(msg.to_str()); };
211211
f

branches/incoming/src/libsyntax/ext/base.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,39 @@ pub struct MacroDef {
3737
ext: SyntaxExtension
3838
}
3939

40-
pub type ItemDecorator =
41-
fn@(ext_ctxt, span, @ast::meta_item, ~[@ast::item]) -> ~[@ast::item];
40+
pub type ItemDecorator = @fn(ext_ctxt,
41+
span,
42+
@ast::meta_item,
43+
~[@ast::item])
44+
-> ~[@ast::item];
4245

4346
pub struct SyntaxExpanderTT {
4447
expander: SyntaxExpanderTTFun,
4548
span: Option<span>
4649
}
4750

48-
pub type SyntaxExpanderTTFun
49-
= fn@(ext_ctxt, span, &[ast::token_tree]) -> MacResult;
51+
pub type SyntaxExpanderTTFun = @fn(ext_ctxt,
52+
span,
53+
&[ast::token_tree])
54+
-> MacResult;
5055

5156
pub struct SyntaxExpanderTTItem {
5257
expander: SyntaxExpanderTTItemFun,
5358
span: Option<span>
5459
}
5560

56-
pub type SyntaxExpanderTTItemFun
57-
= fn@(ext_ctxt, span, ast::ident, ~[ast::token_tree]) -> MacResult;
61+
pub type SyntaxExpanderTTItemFun = @fn(ext_ctxt,
62+
span,
63+
ast::ident,
64+
~[ast::token_tree])
65+
-> MacResult;
5866

5967
pub enum MacResult {
6068
MRExpr(@ast::expr),
6169
MRItem(@ast::item),
62-
MRAny(fn@()-> @ast::expr, fn@()-> Option<@ast::item>, fn@()->@ast::stmt),
70+
MRAny(@fn() -> @ast::expr,
71+
@fn() -> Option<@ast::item>,
72+
@fn() -> @ast::stmt),
6373
MRDef(MacroDef)
6474
}
6575

branches/incoming/src/libsyntax/ext/expand.rs

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ use core::option;
2626
use core::vec;
2727
use core::hashmap::LinearMap;
2828

29-
pub fn expand_expr(extsbox: @mut SyntaxEnv, cx: ext_ctxt,
30-
e: &expr_, s: span, fld: ast_fold,
31-
orig: fn@(&expr_, span, ast_fold) -> (expr_, span))
29+
pub fn expand_expr(extsbox: @mut SyntaxEnv,
30+
cx: ext_ctxt,
31+
e: &expr_,
32+
s: span,
33+
fld: ast_fold,
34+
orig: @fn(&expr_, span, ast_fold) -> (expr_, span))
3235
-> (expr_, span) {
3336
match *e {
3437
// expr_mac should really be expr_ext or something; it's the
@@ -105,9 +108,11 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, cx: ext_ctxt,
105108
//
106109
// NB: there is some redundancy between this and expand_item, below, and
107110
// they might benefit from some amount of semantic and language-UI merger.
108-
pub fn expand_mod_items(extsbox: @mut SyntaxEnv, cx: ext_ctxt,
109-
module_: &ast::_mod, fld: ast_fold,
110-
orig: fn@(&ast::_mod, ast_fold) -> ast::_mod)
111+
pub fn expand_mod_items(extsbox: @mut SyntaxEnv,
112+
cx: ext_ctxt,
113+
module_: &ast::_mod,
114+
fld: ast_fold,
115+
orig: @fn(&ast::_mod, ast_fold) -> ast::_mod)
111116
-> ast::_mod {
112117
// Fold the contents first:
113118
let module_ = orig(module_, fld);
@@ -155,8 +160,10 @@ macro_rules! with_exts_frame (
155160

156161
// When we enter a module, record it, for the sake of `module!`
157162
pub fn expand_item(extsbox: @mut SyntaxEnv,
158-
cx: ext_ctxt, it: @ast::item, fld: ast_fold,
159-
orig: fn@(@ast::item, ast_fold) -> Option<@ast::item>)
163+
cx: ext_ctxt,
164+
it: @ast::item,
165+
fld: ast_fold,
166+
orig: @fn(@ast::item, ast_fold) -> Option<@ast::item>)
160167
-> Option<@ast::item> {
161168
// need to do expansion first... it might turn out to be a module.
162169
let maybe_it = match it.node {
@@ -296,11 +303,13 @@ pub fn expand_item_mac(+extsbox: @mut SyntaxEnv,
296303
}
297304
298305
// expand a stmt
299-
pub fn expand_stmt(extsbox: @mut SyntaxEnv, cx: ext_ctxt,
300-
s: &stmt_, sp: span, fld: ast_fold,
301-
orig: fn@(s: &stmt_, span, ast_fold) -> (stmt_, span))
306+
pub fn expand_stmt(extsbox: @mut SyntaxEnv,
307+
cx: ext_ctxt,
308+
s: &stmt_,
309+
sp: span,
310+
fld: ast_fold,
311+
orig: @fn(&stmt_, span, ast_fold) -> (stmt_, span))
302312
-> (stmt_, span) {
303-
304313
let (mac, pth, tts, semi) = match *s {
305314
stmt_mac(ref mac, semi) => {
306315
match mac.node {
@@ -356,10 +365,13 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv, cx: ext_ctxt,
356365

357366

358367

359-
pub fn expand_block(extsbox: @mut SyntaxEnv, cx: ext_ctxt,
360-
blk: &blk_, sp: span, fld: ast_fold,
361-
orig: fn@(&blk_, span, ast_fold) -> (blk_, span))
362-
-> (blk_, span) {
368+
pub fn expand_block(extsbox: @mut SyntaxEnv,
369+
cx: ext_ctxt,
370+
blk: &blk_,
371+
sp: span,
372+
fld: ast_fold,
373+
orig: @fn(&blk_, span, ast_fold) -> (blk_, span))
374+
-> (blk_, span) {
363375
match (*extsbox).find(&@~" block") {
364376
// no scope limit on macros in this block, no need
365377
// to push an exts frame:

branches/incoming/src/libsyntax/ext/fmt.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
4242
fn parse_fmt_err_(cx: ext_ctxt, sp: span, msg: &str) -> ! {
4343
cx.span_fatal(sp, msg);
4444
}
45-
let parse_fmt_err = fn@(s: &str) -> ! {
46-
parse_fmt_err_(cx, fmtspan, s)
47-
};
45+
let parse_fmt_err: @fn(&str) -> ! = |s| parse_fmt_err_(cx, fmtspan, s);
4846
let pieces = parse_fmt_string(fmt, parse_fmt_err);
4947
MRExpr(pieces_to_expr(cx, sp, pieces, args))
5048
}

0 commit comments

Comments
 (0)