Skip to content

Commit

Permalink
review feedback: common-subexpression-elim across functions in pushpo…
Browse files Browse the repository at this point in the history
…p_safe impl.
  • Loading branch information
pnkfelix committed Jul 23, 2015
1 parent 44bb0dd commit 2d68d09
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libsyntax/ext/pushpop_safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
_ => {
Expand Down

0 comments on commit 2d68d09

Please sign in to comment.