Move the world over to using the new style string literals and types. Closes #2907.
This commit is contained in:
parent
5c5065e8bd
commit
92743dc2a6
424 changed files with 8132 additions and 8064 deletions
|
@ -16,7 +16,7 @@ export expand_include_bin;
|
|||
/* #line(): expands to the current line number */
|
||||
fn expand_line(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||
_body: ast::mac_body) -> @ast::expr {
|
||||
get_mac_args(cx, sp, arg, 0u, option::some(0u), "line");
|
||||
get_mac_args(cx, sp, arg, 0u, option::some(0u), ~"line");
|
||||
let loc = codemap::lookup_char_pos(cx.codemap(), sp.lo);
|
||||
ret mk_uint(cx, sp, loc.line);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ fn expand_line(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
|||
/* #col(): expands to the current column number */
|
||||
fn expand_col(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||
_body: ast::mac_body) -> @ast::expr {
|
||||
get_mac_args(cx, sp, arg, 0u, option::some(0u), "col");
|
||||
get_mac_args(cx, sp, arg, 0u, option::some(0u), ~"col");
|
||||
let loc = codemap::lookup_char_pos(cx.codemap(), sp.lo);
|
||||
ret mk_uint(cx, sp, loc.col);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ fn expand_col(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
|||
* out if we wanted. */
|
||||
fn expand_file(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||
_body: ast::mac_body) -> @ast::expr {
|
||||
get_mac_args(cx, sp, arg, 0u, option::some(0u), "file");
|
||||
get_mac_args(cx, sp, arg, 0u, option::some(0u), ~"file");
|
||||
let { file: @{ name: filename, _ }, _ } =
|
||||
codemap::lookup_char_pos(cx.codemap(), sp.lo);
|
||||
ret mk_uniq_str(cx, sp, filename);
|
||||
|
@ -42,21 +42,21 @@ fn expand_file(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
|||
|
||||
fn expand_stringify(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||
_body: ast::mac_body) -> @ast::expr {
|
||||
let args = get_mac_args(cx, sp, arg, 1u, option::some(1u), "stringify");
|
||||
let args = get_mac_args(cx, sp, arg, 1u, option::some(1u), ~"stringify");
|
||||
ret mk_uniq_str(cx, sp, pprust::expr_to_str(args[0]));
|
||||
}
|
||||
|
||||
fn expand_mod(cx: ext_ctxt, sp: span, arg: ast::mac_arg, _body: ast::mac_body)
|
||||
-> @ast::expr {
|
||||
get_mac_args(cx, sp, arg, 0u, option::some(0u), "file");
|
||||
get_mac_args(cx, sp, arg, 0u, option::some(0u), ~"file");
|
||||
ret mk_uniq_str(cx, sp,
|
||||
str::connect(cx.mod_path().map(|x|*x), "::"));
|
||||
str::connect(cx.mod_path().map(|x|*x), ~"::"));
|
||||
}
|
||||
|
||||
fn expand_include(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||
_body: ast::mac_body) -> @ast::expr {
|
||||
let args = get_mac_args(cx, sp, arg, 1u, option::some(1u), "include");
|
||||
let file = expr_to_str(cx, args[0], "#include_str requires a string");
|
||||
let args = get_mac_args(cx, sp, arg, 1u, option::some(1u), ~"include");
|
||||
let file = expr_to_str(cx, args[0], ~"#include_str requires a string");
|
||||
let p = parse::new_parser_from_file(cx.parse_sess(), cx.cfg(),
|
||||
res_rel_file(cx, sp, file),
|
||||
parse::parser::SOURCE_FILE);
|
||||
|
@ -65,9 +65,9 @@ fn expand_include(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
|||
|
||||
fn expand_include_str(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),"include_str");
|
||||
let args = get_mac_args(cx,sp,arg,1u,option::some(1u),~"include_str");
|
||||
|
||||
let file = expr_to_str(cx, args[0], "#include_str requires a string");
|
||||
let file = expr_to_str(cx, args[0], ~"#include_str requires a string");
|
||||
|
||||
let res = io::read_whole_file_str(res_rel_file(cx, sp, file));
|
||||
alt res {
|
||||
|
@ -82,9 +82,9 @@ fn expand_include_str(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
|
|||
|
||||
fn expand_include_bin(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),"include_bin");
|
||||
let args = get_mac_args(cx,sp,arg,1u,option::some(1u),~"include_bin");
|
||||
|
||||
let file = expr_to_str(cx, args[0], "#include_bin requires a string");
|
||||
let file = expr_to_str(cx, args[0], ~"#include_bin requires a string");
|
||||
|
||||
alt io::read_whole_file(res_rel_file(cx, sp, file)) {
|
||||
result::ok(src) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue