diff options
| author | John Clements <clements@racket-lang.org> | 2013-07-26 12:57:30 -0400 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2013-09-06 13:35:13 -0700 |
| commit | 8330411688b038b95695f9823d3937ad2ebf6152 (patch) | |
| tree | 86b707009f5c09af343c852d0c5e85534a5b9da1 | |
| parent | fddc815adaabb87c23e74c2bce41cddb5d433326 (diff) | |
| download | rust-8330411688b038b95695f9823d3937ad2ebf6152.tar.gz rust-8330411688b038b95695f9823d3937ad2ebf6152.zip | |
fixed a bug that caused double-expand-traversal of macros that expand into modules.
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index ad07d166f45..ad1420f35cd 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -342,25 +342,16 @@ pub fn expand_item(extsbox: @mut SyntaxEnv, fld: @ast_fold, orig: @fn(@ast::item, @ast_fold) -> Option<@ast::item>) -> Option<@ast::item> { - // need to do expansion first... it might turn out to be a module. - let maybe_it = match it.node { - ast::item_mac(*) => expand_item_mac(extsbox, cx, it, fld), - _ => Some(it) - }; - match maybe_it { - Some(it) => { - match it.node { - ast::item_mod(_) | ast::item_foreign_mod(_) => { - cx.mod_push(it.ident); - let macro_escape = contains_macro_escape(it.attrs); - let result = with_exts_frame!(extsbox,macro_escape,orig(it,fld)); - cx.mod_pop(); - result - } - _ => orig(it,fld) - } - } - None => None + match it.node { + ast::item_mac(*) => expand_item_mac(extsbox, cx, it, fld), + ast::item_mod(_) | ast::item_foreign_mod(_) => { + cx.mod_push(it.ident); + let macro_escape = contains_macro_escape(it.attrs); + let result = with_exts_frame!(extsbox,macro_escape,orig(it,fld)); + cx.mod_pop(); + result + }, + _ => orig(it,fld) } } |
