From cf26a7d7b952cf94fb4bb185c2eb0cb47e4551ce Mon Sep 17 00:00:00 2001 From: Paul Stansifer Date: Mon, 19 Nov 2012 20:31:22 -0500 Subject: Make it possible to expand stmt macros. --- src/libsyntax/ext/tt/macro_rules.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/libsyntax/ext/tt/macro_rules.rs') diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 012e421718a..1c62c9b2a6d 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -1,4 +1,4 @@ -use base::{ext_ctxt, mac_result, mr_expr_or_item, mr_def, normal_tt}; +use base::{ext_ctxt, mac_result, mr_any, mr_def, normal_tt}; use codemap::span; use ast::{ident, matcher_, matcher, match_tok, match_nonterminal, match_seq, tt_delim}; @@ -92,8 +92,9 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident, // Let the context choose how to interpret the result. // Weird, but useful for X-macros. - return mr_expr_or_item(|| p.parse_expr(), - || p.parse_item(~[/* no attrs*/])); + return mr_any(|| p.parse_expr(), + || p.parse_item(~[/* no attrs*/]), + || p.parse_stmt(~[/* no attrs*/])); } failure(sp, msg) => if sp.lo >= best_fail_spot.lo { best_fail_spot = sp; -- cgit 1.4.1-3-g733a5