diff options
| author | bors <bors@rust-lang.org> | 2013-03-02 19:18:37 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-03-02 19:18:37 -0800 |
| commit | 5655ae46a73723203edcf6a53c87560e0da7aaec (patch) | |
| tree | a7c5ca21cf001ff1847c16016822a4965f8d7758 /src/libsyntax/ext | |
| parent | 826644e8cb37363a4e44561a498e79acfeb77b6a (diff) | |
| parent | ccec510f392d5017a1da37c6b8327b5201dffd2a (diff) | |
| download | rust-5655ae46a73723203edcf6a53c87560e0da7aaec.tar.gz rust-5655ae46a73723203edcf6a53c87560e0da7aaec.zip | |
auto merge of #5197 : pcwalton/rust/fn-types, r=pcwalton
r? @catamorphism
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 24 | ||||
| -rw-r--r-- | src/libsyntax/ext/env.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 44 | ||||
| -rw-r--r-- | src/libsyntax/ext/fmt.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/ext/log_syntax.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/trace_macros.rs | 2 |
6 files changed, 51 insertions, 30 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 7d3c7cafa95..b3d3358e586 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -37,29 +37,39 @@ pub struct MacroDef { ext: SyntaxExtension } -pub type ItemDecorator = - fn@(ext_ctxt, span, @ast::meta_item, ~[@ast::item]) -> ~[@ast::item]; +pub type ItemDecorator = @fn(ext_ctxt, + span, + @ast::meta_item, + ~[@ast::item]) + -> ~[@ast::item]; pub struct SyntaxExpanderTT { expander: SyntaxExpanderTTFun, span: Option<span> } -pub type SyntaxExpanderTTFun - = fn@(ext_ctxt, span, &[ast::token_tree]) -> MacResult; +pub type SyntaxExpanderTTFun = @fn(ext_ctxt, + span, + &[ast::token_tree]) + -> MacResult; pub struct SyntaxExpanderTTItem { expander: SyntaxExpanderTTItemFun, span: Option<span> } -pub type SyntaxExpanderTTItemFun - = fn@(ext_ctxt, span, ast::ident, ~[ast::token_tree]) -> MacResult; +pub type SyntaxExpanderTTItemFun = @fn(ext_ctxt, + span, + ast::ident, + ~[ast::token_tree]) + -> MacResult; pub enum MacResult { MRExpr(@ast::expr), MRItem(@ast::item), - MRAny(fn@()-> @ast::expr, fn@()-> Option<@ast::item>, fn@()->@ast::stmt), + MRAny(@fn() -> @ast::expr, + @fn() -> Option<@ast::item>, + @fn() -> @ast::stmt), MRDef(MacroDef) } diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs index 91a9de9c051..c8fb83224ac 100644 --- a/src/libsyntax/ext/env.rs +++ b/src/libsyntax/ext/env.rs @@ -15,7 +15,7 @@ * interface. */ -use prelude::*; +use core::prelude::*; use ast; use codemap::span; diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index e3408a47c9a..858ce4b17a3 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -26,9 +26,12 @@ use core::option; use core::vec; use core::hashmap::LinearMap; -pub fn expand_expr(extsbox: @mut SyntaxEnv, cx: ext_ctxt, - e: &expr_, s: span, fld: ast_fold, - orig: fn@(&expr_, span, ast_fold) -> (expr_, span)) +pub fn expand_expr(extsbox: @mut SyntaxEnv, + cx: ext_ctxt, + e: &expr_, + s: span, + fld: ast_fold, + orig: @fn(&expr_, span, ast_fold) -> (expr_, span)) -> (expr_, span) { match *e { // 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, // // NB: there is some redundancy between this and expand_item, below, and // they might benefit from some amount of semantic and language-UI merger. -pub fn expand_mod_items(extsbox: @mut SyntaxEnv, cx: ext_ctxt, - module_: &ast::_mod, fld: ast_fold, - orig: fn@(&ast::_mod, ast_fold) -> ast::_mod) +pub fn expand_mod_items(extsbox: @mut SyntaxEnv, + cx: ext_ctxt, + module_: &ast::_mod, + fld: ast_fold, + orig: @fn(&ast::_mod, ast_fold) -> ast::_mod) -> ast::_mod { // Fold the contents first: let module_ = orig(module_, fld); @@ -155,8 +160,10 @@ macro_rules! with_exts_frame ( // When we enter a module, record it, for the sake of `module!` pub fn expand_item(extsbox: @mut SyntaxEnv, - cx: ext_ctxt, it: @ast::item, fld: ast_fold, - orig: fn@(@ast::item, ast_fold) -> Option<@ast::item>) + cx: ext_ctxt, + it: @ast::item, + fld: ast_fold, + orig: @fn(@ast::item, ast_fold) -> Option<@ast::item>) -> Option<@ast::item> { // need to do expansion first... it might turn out to be a module. let maybe_it = match it.node { @@ -296,11 +303,13 @@ pub fn expand_item_mac(+extsbox: @mut SyntaxEnv, } // expand a stmt -pub fn expand_stmt(extsbox: @mut SyntaxEnv, cx: ext_ctxt, - s: &stmt_, sp: span, fld: ast_fold, - orig: fn@(s: &stmt_, span, ast_fold) -> (stmt_, span)) +pub fn expand_stmt(extsbox: @mut SyntaxEnv, + cx: ext_ctxt, + s: &stmt_, + sp: span, + fld: ast_fold, + orig: @fn(&stmt_, span, ast_fold) -> (stmt_, span)) -> (stmt_, span) { - let (mac, pth, tts, semi) = match *s { stmt_mac(ref mac, semi) => { match mac.node { @@ -356,10 +365,13 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv, cx: ext_ctxt, -pub fn expand_block(extsbox: @mut SyntaxEnv, cx: ext_ctxt, - blk: &blk_, sp: span, fld: ast_fold, - orig: fn@(&blk_, span, ast_fold) -> (blk_, span)) - -> (blk_, span) { +pub fn expand_block(extsbox: @mut SyntaxEnv, + cx: ext_ctxt, + blk: &blk_, + sp: span, + fld: ast_fold, + orig: @fn(&blk_, span, ast_fold) -> (blk_, span)) + -> (blk_, span) { match (*extsbox).find(&@~" block") { // no scope limit on macros in this block, no need // to push an exts frame: diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index e06e43f6287..af558e6b330 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -24,7 +24,8 @@ use ext::base::*; use ext::base; use ext::build; use ext::build::*; -use unstable::extfmt::ct::*; + +use core::unstable::extfmt::ct::*; pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree]) -> base::MacResult { @@ -41,9 +42,7 @@ pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree]) fn parse_fmt_err_(cx: ext_ctxt, sp: span, msg: &str) -> ! { cx.span_fatal(sp, msg); } - let parse_fmt_err = fn@(s: &str) -> ! { - parse_fmt_err_(cx, fmtspan, s) - }; + let parse_fmt_err: @fn(&str) -> ! = |s| parse_fmt_err_(cx, fmtspan, s); let pieces = parse_fmt_string(fmt, parse_fmt_err); MRExpr(pieces_to_expr(cx, sp, pieces, args)) } diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs index 368520acd2d..9072f4bdd01 100644 --- a/src/libsyntax/ext/log_syntax.rs +++ b/src/libsyntax/ext/log_syntax.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::*; use core::io::WriterUtil; +use core::prelude::*; use ast; use codemap; diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs index bb6d656d5cc..d7f7f7c6510 100644 --- a/src/libsyntax/ext/trace_macros.rs +++ b/src/libsyntax/ext/trace_macros.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use prelude::*; +use core::prelude::*; use ast::tt_delim; use ast; |
