diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-07-23 16:22:05 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-07-23 23:39:28 +0200 |
| commit | 2d68d09b4679018d0ba3faf41d239251991bf17b (patch) | |
| tree | 727bd98426f6eb7b1b5150215362f5d45bbb6822 /src/libsyntax/ext | |
| parent | 44bb0dd4a3bdd84b81dcf537d161a9dd9e9068ea (diff) | |
| download | rust-2d68d09b4679018d0ba3faf41d239251991bf17b.tar.gz rust-2d68d09b4679018d0ba3faf41d239251991bf17b.zip | |
review feedback: common-subexpression-elim across functions in pushpop_safe impl.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/pushpop_safe.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/ext/pushpop_safe.rs b/src/libsyntax/ext/pushpop_safe.rs index fee445cd31a..a67d550d3cd 100644 --- a/src/libsyntax/ext/pushpop_safe.rs +++ b/src/libsyntax/ext/pushpop_safe.rs @@ -48,24 +48,24 @@ enum PushPop { Push, Pop } pub fn expand_push_unsafe<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box<base::MacResult+'cx> { - feature_gate::check_for_pushpop_syntax( - cx.ecfg.features, &cx.parse_sess.span_diagnostic, sp); expand_pushpop_unsafe(cx, sp, tts, PushPop::Push) } pub fn expand_pop_unsafe<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box<base::MacResult+'cx> { - feature_gate::check_for_pushpop_syntax( - cx.ecfg.features, &cx.parse_sess.span_diagnostic, sp); expand_pushpop_unsafe(cx, sp, tts, PushPop::Pop) } fn expand_pushpop_unsafe<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree], pp: PushPop) -> Box<base::MacResult+'cx> { + feature_gate::check_for_pushpop_syntax( + cx.ecfg.features, &cx.parse_sess.span_diagnostic, sp); + let mut exprs = match get_exprs_from_tts(cx, sp, tts) { Some(exprs) => exprs.into_iter(), None => return DummyResult::expr(sp), }; + let expr = match (exprs.next(), exprs.next()) { (Some(expr), None) => expr, _ => { |
