about summary refs log tree commit diff
path: root/src/comp/syntax/ext
diff options
context:
space:
mode:
authorKevin Atkinson <kevina@cs.utah.edu>2012-01-21 18:49:51 -0700
committerBrian Anderson <banderson@mozilla.com>2012-01-23 17:37:15 -0800
commit4795e19d6d997143a855b8ac6b5cb288e8caea35 (patch)
tree5d84f40408b4738fcb1f8c34b7cb5f7bfe134fdc /src/comp/syntax/ext
parent20ab47fe499b255498268198279fc3df11a29f3f (diff)
downloadrust-4795e19d6d997143a855b8ac6b5cb288e8caea35.tar.gz
rust-4795e19d6d997143a855b8ac6b5cb288e8caea35.zip
When replacing a pattern variable in macro expansion use the span of
the replacement and not the span of the pattern variable.

Fixes issue #1448, and #1387.
Diffstat (limited to 'src/comp/syntax/ext')
-rw-r--r--src/comp/syntax/ext/simplext.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs
index a8fe5504897..dcaf16c973e 100644
--- a/src/comp/syntax/ext/simplext.rs
+++ b/src/comp/syntax/ext/simplext.rs
@@ -338,9 +338,9 @@ fn transcribe_path(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
     if vec::len(p.types) > 0u || vec::len(p.idents) != 1u { ret (p, s); }
     ret alt follow_for_trans(cx, b.find(p.idents[0]), idx_path) {
           some(match_ident(id)) {
-            ({global: false, idents: [id.node], types: []}, s)
+            ({global: false, idents: [id.node], types: []}, id.span)
           }
-          some(match_path(a_pth)) { (a_pth.node, s) }
+          some(match_path(a_pth)) { (a_pth.node, a_pth.span) }
           some(m) { match_error(cx, m, "a path") }
           none { (p, s) }
         }
@@ -363,10 +363,10 @@ fn transcribe_expr(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
                 (expr_path(@respan(id.span,
                                    {global: false,
                                     idents: [id.node],
-                                    types: []})), s)
+                                    types: []})), id.span)
               }
               some(match_path(a_pth)) { (expr_path(a_pth), s) }
-              some(match_expr(a_exp)) { (a_exp.node, s) }
+              some(match_expr(a_exp)) { (a_exp.node, a_exp.span) }
               some(m) { match_error(cx, m, "an expression") }
               none { orig(e, s, fld) }
             }
@@ -385,7 +385,7 @@ fn transcribe_type(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
             alt path_to_ident(pth) {
               some(id) {
                 alt follow_for_trans(cx, b.find(id), idx_path) {
-                  some(match_ty(ty)) { (ty.node, s) }
+                  some(match_ty(ty)) { (ty.node, ty.span) }
                   some(m) { match_error(cx, m, "a type") }
                   none { orig(t, s, fld) }
                 }
@@ -409,7 +409,7 @@ fn transcribe_block(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
     ret alt block_to_ident(blk) {
           some(id) {
             alt follow_for_trans(cx, b.find(id), idx_path) {
-              some(match_block(new_blk)) { (new_blk.node, s) }
+              some(match_block(new_blk)) { (new_blk.node, new_blk.span) }