1
Fork 0

Fix trace_macros so that it works.

This commit is contained in:
Paul Stansifer 2012-11-26 22:12:31 -05:00 committed by Graydon Hoare
parent a88f9ac732
commit 9ff8d18766

View file

@ -15,12 +15,16 @@ fn expand_trace_macros(cx: ext_ctxt, sp: span,
let rdr = tt_rdr as reader; let rdr = tt_rdr as reader;
let rust_parser = Parser(sess, cfg, rdr.dup()); let rust_parser = Parser(sess, cfg, rdr.dup());
let arg = cx.str_of(rust_parser.parse_ident()); if rust_parser.is_keyword(~"true") {
match arg { cx.set_trace_macros(true);
~"true" => cx.set_trace_macros(true), } else if rust_parser.is_keyword(~"false") {
~"false" => cx.set_trace_macros(false), cx.set_trace_macros(false);
_ => cx.span_fatal(sp, ~"trace_macros! only accepts `true` or `false`") } else {
cx.span_fatal(sp, ~"trace_macros! only accepts `true` or `false`")
} }
rust_parser.bump();
let rust_parser = Parser(sess, cfg, rdr.dup()); let rust_parser = Parser(sess, cfg, rdr.dup());
let result = rust_parser.parse_expr(); let result = rust_parser.parse_expr();
base::mr_expr(result) base::mr_expr(result)