Skip to content

Commit 22ec209

Browse files
committed
Fix trace_macros so that it works.
1 parent 0c8a009 commit 22ec209

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/libsyntax/ext/trace_macros.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ fn expand_trace_macros(cx: ext_ctxt, sp: span,
1515
let rdr = tt_rdr as reader;
1616
let rust_parser = Parser(sess, cfg, rdr.dup());
1717

18-
let arg = cx.str_of(rust_parser.parse_ident());
19-
match arg {
20-
~"true" => cx.set_trace_macros(true),
21-
~"false" => cx.set_trace_macros(false),
22-
_ => cx.span_fatal(sp, ~"trace_macros! only accepts `true` or `false`")
18+
if rust_parser.is_keyword(~"true") {
19+
cx.set_trace_macros(true);
20+
} else if rust_parser.is_keyword(~"false") {
21+
cx.set_trace_macros(false);
22+
} else {
23+
cx.span_fatal(sp, ~"trace_macros! only accepts `true` or `false`")
2324
}
25+
26+
rust_parser.bump();
27+
2428
let rust_parser = Parser(sess, cfg, rdr.dup());
2529
let result = rust_parser.parse_expr();
2630
base::mr_expr(result)

0 commit comments

Comments
 (0)