about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorJohn Clements <clements@racket-lang.org>2013-07-08 10:37:07 -0700
committerJohn Clements <clements@racket-lang.org>2013-09-06 13:35:11 -0700
commit2c51e262f367f0f079135a5a176706ea5ef78f78 (patch)
tree40ab5e84fad45e9db709ccbb6de2551ed13b4e5a /src/libsyntax/ext
parentdfa04cecca1d7128cc4d8e3868f0b237f6266911 (diff)
downloadrust-2c51e262f367f0f079135a5a176706ea5ef78f78.tar.gz
rust-2c51e262f367f0f079135a5a176706ea5ef78f78.zip
add fold_mac clause to fun_to_ctxt_folder
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/expand.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 228a9ba03a2..a62b015c6cb 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -1454,13 +1454,20 @@ pub fn fun_to_ctxt_folder<T : 'static + CtxtFn>(cf: @T) -> @AstFoldFns {
         |ast::Ident{name, ctxt}, _| {
         ast::Ident{name:name,ctxt:cf.f(ctxt)}
     };
-    // we've also got to pick up macro invocations; they can
-    // appear as exprs, stmts, items, and types. urg, it's going
-    // to be easier just to add a fold_mac, I think.
-    //let fold_ex : @
+    let fm : @fn(&ast::mac_, span, @ast_fold) -> (ast::mac_,span) =
+        |m, sp, fld| {
+        match *m {
+            mac_invoc_tt(ref path, ref tts, ctxt) =>
+            (mac_invoc_tt(fld.fold_path(path),
+                         fold_tts(*tts,fld),
+                         cf.f(ctxt)),
+            sp)
+        }
+
+    };
     @AstFoldFns{
         fold_ident : fi,
-        // check that it works, then add the fold_expr clause....
+        fold_mac : fm,
         .. *afp
     }
 }