Fix log_syntax of unexpanded code.

This commit is contained in:
Paul Stansifer
2012-08-06 17:50:45 -07:00
parent a4cedd9598
commit c0f7ed68e2
3 changed files with 44 additions and 18 deletions

View File

@@ -1,16 +1,15 @@
import base::*;
import io::writer_util;
fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
_body: ast::mac_body) -> @ast::expr {
let args = get_mac_args_no_max(cx,sp,arg,0u,~"log_syntax");
fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, tt: ~[ast::token_tree])
-> base::mac_result {
cx.print_backtrace();
io::stdout().write_line(
str::connect(vec::map(args,
|&&ex| print::pprust::expr_to_str(ex)), ~", ")
);
print::pprust::unexpanded_tt_to_str(ast::tt_delim(tt),
cx.parse_sess().interner));
//trivial expression
return @{id: cx.next_id(), callee_id: cx.next_id(),
node: ast::expr_rec(~[], option::none), span: sp};
return mr_expr(@{id: cx.next_id(), callee_id: cx.next_id(),
node: ast::expr_rec(~[], option::none), span: sp});
}