about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-07-17 09:49:43 -0700
committerbors <bors@rust-lang.org>2013-07-17 09:49:43 -0700
commit9c1e530bde3a8123f4da645a92b8a2b12fd3ecab (patch)
treee440e06f5647de72b7d7c8b44ab2b29eb47b1ea2 /src/libsyntax/ext
parent93c270c63d158805a068b8e7ced660df1051c3ca (diff)
parent0cc70743d2cf6edb782c1daa9b0f554484ed21eb (diff)
downloadrust-9c1e530bde3a8123f4da645a92b8a2b12fd3ecab.tar.gz
rust-9c1e530bde3a8123f4da645a92b8a2b12fd3ecab.zip
auto merge of #7826 : michaelwoerister/rust/end_of_spanned, r=cmr
This is the first of a series of refactorings to get rid of the `codemap::spanned<T>` struct (see this thread for more information: https://mail.mozilla.org/pipermail/rust-dev/2013-July/004798.html).

The changes in this PR should not change any semantics, just rename `ast::blk_` to `ast::blk` and add a span field to it. 95% of the changes were of the form `block.node.id` -> `block.id`. Only some transformations in `libsyntax::fold` where not entirely trivial.


Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/build.rs16
-rw-r--r--src/libsyntax/ext/expand.rs15
2 files changed, 15 insertions, 16 deletions
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 73220ec2881..83fce24bef8 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -400,14 +400,14 @@ impl AstBuilder for @ExtCtxt {
                view_items: ~[ast::view_item],
                stmts: ~[@ast::stmt],
                expr: Option<@ast::expr>) -> ast::blk {
-        respan(span,
-               ast::blk_ {
-                   view_items: view_items,
-                   stmts: stmts,
-                   expr: expr,
-                   id: self.next_id(),
-                   rules: ast::default_blk,
-               })
+           ast::blk {
+               view_items: view_items,
+               stmts: stmts,
+               expr: expr,
+               id: self.next_id(),
+               rules: ast::default_blk,
+               span: span,
+           }
     }
 
     fn expr(&self, span: span, node: ast::expr_) -> @ast::expr {
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index c421da06795..3f7579c7691 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use ast::{blk_, crate, expr_, expr_mac, mac_invoc_tt};
+use ast::{blk, crate, expr_, expr_mac, mac_invoc_tt};
 use ast::{item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi};
 use ast::{illegal_ctxt};
 use ast;
@@ -394,13 +394,12 @@ pub fn new_name_finder() -> @Visitor<@mut ~[ast::ident]> {
 
 pub fn expand_block(extsbox: @mut SyntaxEnv,
                     _cx: @ExtCtxt,
-                    blk: &blk_,
-                    sp: span,
+                    blk: &blk,
                     fld: @ast_fold,
-                    orig: @fn(&blk_, span, @ast_fold) -> (blk_, span))
-                 -> (blk_, span) {
+                    orig: @fn(&blk, @ast_fold) -> blk)
+                 -> blk {
     // see note below about treatment of exts table
-    with_exts_frame!(extsbox,false,orig(blk,sp,fld))
+    with_exts_frame!(extsbox,false,orig(blk,fld))
 }
 
 
@@ -736,8 +735,8 @@ pub fn expand_crate(parse_sess: @mut parse::ParseSess,
             expand_item(extsbox, cx, item, recur, afp.fold_item),
         fold_stmt: |stmt,span,recur|
             expand_stmt(extsbox, cx, stmt, span, recur, afp.fold_stmt),
-        fold_block: |blk,span,recur|
-            expand_block(extsbox, cx, blk, span, recur, afp.fold_block),
+        fold_block: |blk,recur|
+            expand_block(extsbox, cx, blk, recur, afp.fold_block),
         new_span: |a| new_span(cx, a),
         .. *afp};
     let f = make_fold(f_pre);