about summary refs log tree commit diff
path: root/src/libsyntax/ext/expand.rs
diff options
context:
space:
mode:
authorJohn Clements <clements@racket-lang.org>2014-07-06 15:10:57 -0700
committerJohn Clements <clements@racket-lang.org>2014-07-08 16:28:21 -0700
commit19e718b34def6c3f98372a40352ab9c889ff9f7a (patch)
tree7fded5374fe2a5baa57fb3422ba8a4fccb0685ca /src/libsyntax/ext/expand.rs
parent69c27546ee37ac2d0384748a21c7dad00642a223 (diff)
downloadrust-19e718b34def6c3f98372a40352ab9c889ff9f7a.tar.gz
rust-19e718b34def6c3f98372a40352ab9c889ff9f7a.zip
carry self ident forward through re-parsing
formerly, the self identifier was being discarded during parsing, which
stymies hygiene. The best fix here seems to be to attach a self identifier
to ExplicitSelf_, a change that rippled through the rest of the compiler,
but without any obvious damage.
Diffstat (limited to 'src/libsyntax/ext/expand.rs')
-rw-r--r--src/libsyntax/ext/expand.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index d5a9f34dcb9..9fe431cfb6c 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -1501,8 +1501,8 @@ mod test {
             0)
     }
 
-    // macro_rules in method position
-    #[test] fn macro_in_method_posn(){
+    // macro_rules in method position. Sadly, unimplemented.
+    #[ignore] #[test] fn macro_in_method_posn(){
         expand_crate_str(
             "macro_rules! my_method (() => fn thirteen(&self) -> int {13})
             struct A;
@@ -1510,6 +1510,19 @@ mod test {
             fn f(){A.thirteen;}".to_string());
     }
 
+    // another nested macro
+    // expands to impl Entries {fn size_hint(&self_1) {self_1;}
+    #[test] fn item_macro_workaround(){
+        run_renaming_test(
+            &("macro_rules! item { ($i:item) => {$i}}
+              struct Entries;
+              macro_rules! iterator_impl {
+              () => { item!( impl Entries { fn size_hint(&self) { self;}})}}
+              iterator_impl! { }",
+              vec!(vec!(0)), true),
+            0)
+    }
+
     // run one of the renaming tests
     fn run_renaming_test(t: &RenamingTest, test_idx: uint) {
         let invalid_name = token::special_idents::invalid.name;