Skip to content

Commit 8330411

Browse files
committed
fixed a bug that caused double-expand-traversal of macros that expand into modules.
1 parent fddc815 commit 8330411

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

src/libsyntax/ext/expand.rs

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -342,25 +342,16 @@ pub fn expand_item(extsbox: @mut SyntaxEnv,
342342
fld: @ast_fold,
343343
orig: @fn(@ast::item, @ast_fold) -> Option<@ast::item>)
344344
-> Option<@ast::item> {
345-
// need to do expansion first... it might turn out to be a module.
346-
let maybe_it = match it.node {
347-
ast::item_mac(*) => expand_item_mac(extsbox, cx, it, fld),
348-
_ => Some(it)
349-
};
350-
match maybe_it {
351-
Some(it) => {
352-
match it.node {
353-
ast::item_mod(_) | ast::item_foreign_mod(_) => {
354-
cx.mod_push(it.ident);
355-
let macro_escape = contains_macro_escape(it.attrs);
356-
let result = with_exts_frame!(extsbox,macro_escape,orig(it,fld));
357-
cx.mod_pop();
358-
result
359-
}
360-
_ => orig(it,fld)
361-
}
362-
}
363-
None => None
345+
match it.node {
346+
ast::item_mac(*) => expand_item_mac(extsbox, cx, it, fld),
347+
ast::item_mod(_) | ast::item_foreign_mod(_) => {
348+
cx.mod_push(it.ident);
349+
let macro_escape = contains_macro_escape(it.attrs);
350+
let result = with_exts_frame!(extsbox,macro_escape,orig(it,fld));
351+
cx.mod_pop();
352+
result
353+
},
354+
_ => orig(it,fld)
364355
}
365356
}
366357

0 commit comments

Comments
 (0)