summary refs log tree commit diff
path: root/src/libsyntax/ext/ident_to_str.rs
blob: 2cff86d98a7e879a34a3c3b767af029d944d7697 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import base::*;
import build::mk_lit;
import option;

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(cx,sp,arg,1u,option::some(1u),"ident_to_str");

    ret mk_lit(cx, sp,
               ast::lit_str(expr_to_ident(cx, args[0u],
                                          "expected an ident")));
}