diff options
| author | John Clements <clements@racket-lang.org> | 2014-07-07 15:12:31 -0700 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2014-07-08 16:27:34 -0700 |
| commit | 8f34b21375017aece4ae08fcf13f0dfcc8aca96e (patch) | |
| tree | 53aa0d5a303888dc7025f801f6298ffa8febc1a9 /src/libsyntax/ext | |
| parent | 9ee9c49cb4823c5bddbd9ec1ece6dfafa9e833ea (diff) | |
| download | rust-8f34b21375017aece4ae08fcf13f0dfcc8aca96e.tar.gz rust-8f34b21375017aece4ae08fcf13f0dfcc8aca96e.zip | |
test case for expansion of method macro
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 709db52262d..47c86f1c9f5 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -512,8 +512,10 @@ fn expand_item_mac(it: Gc<ast::Item>, fld: &mut MacroExpander) let items = match expanded.make_def() { Some(MacroDef { name, ext }) => { - // yikes... no idea how to apply the mark to this. I'm afraid - // we're going to have to wait-and-see on this one. + // hidden invariant: this should only be possible as the + // result of expanding a LetSyntaxTT, and thus doesn't + // need to be marked. Not that it could be marked anyway. + // create issue to recommend refactoring here? fld.extsbox.insert(intern(name.as_slice()), ext); if attr::contains_name(it.attrs.as_slice(), "macro_export") { SmallVector::one(it) @@ -1466,6 +1468,15 @@ mod test { 0) } + // macro_rules in method position + #[test] fn macro_in_method_posn(){ + expand_crate_str( + "macro_rules! my_method (() => fn thirteen(&self) -> int {13}) + struct A; + impl A{ my_method!()} + fn f(){A.thirteen;}".to_string()); + } + // run one of the renaming tests fn run_renaming_test(t: &RenamingTest, test_idx: uint) { let invalid_name = token::special_idents::invalid.name; |
