diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-10 17:39:08 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-13 17:24:08 -0700 |
| commit | 12375304524ffe732752f5a29551c2caf0b14b4f (patch) | |
| tree | 6beaf94e318a5586ad1c3d8429f37eb80bbbadcd /src/libsyntax/ext | |
| parent | ce8c467bd2062edc1410f54c8efafbc5ae245358 (diff) | |
| download | rust-12375304524ffe732752f5a29551c2caf0b14b4f.tar.gz rust-12375304524ffe732752f5a29551c2caf0b14b4f.zip | |
Touch up and rebase previous commits
* Added `// no-pretty-expanded` to pretty-print a test, but not run it through the `expanded` variant. * Removed #[deriving] and other expanded attributes after they are expanded * Removed hacks around &str and &&str and friends (from both the parser and the pretty printer). * Un-ignored a bunch of tests
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index ccc9d73d544..1898e8bf000 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -262,7 +262,8 @@ pub fn expand_item(it: @ast::Item, fld: &mut MacroExpander) let it = expand_item_modifiers(it, fld); let mut decorator_items = SmallVector::zero(); - for attr in it.attrs.iter().rev() { + let mut new_attrs = Vec::new(); + for attr in it.attrs.iter() { let mname = attr.name(); match fld.extsbox.find(&intern(mname.get())) { @@ -286,7 +287,7 @@ pub fn expand_item(it: @ast::Item, fld: &mut MacroExpander) fld.cx.bt_pop(); } - _ => {} + _ => new_attrs.push((*attr).clone()), } } @@ -294,14 +295,21 @@ pub fn expand_item(it: @ast::Item, fld: &mut MacroExpander) ast::ItemMac(..) => expand_item_mac(it, fld), ast::ItemMod(_) | ast::ItemForeignMod(_) => { fld.cx.mod_push(it.ident); - let macro_escape = contains_macro_escape(it.attrs.as_slice()); + let macro_escape = contains_macro_escape(new_attrs.as_slice()); let result = with_exts_frame!(fld.extsbox, macro_escape, noop_fold_item(it, fld)); fld.cx.mod_pop(); result }, - _ => noop_fold_item(it, fld) + _ => { + let it = @ast::Item { + attrs: new_attrs, + ..(*it).clone() + + }; + noop_fold_item(it, fld) + } }; new_items.push_all(decorator_items); |
