Convert rustc::syntax::ext::base to istrs. Issue #855
This commit is contained in:
parent
9857048929
commit
7efbfea8d0
7 changed files with 87 additions and 82 deletions
|
@ -17,17 +17,17 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
|
|||
alt arg.node {
|
||||
ast::expr_vec(elts, _) { elts }
|
||||
_ {
|
||||
cx.span_fatal(sp, "#env requires arguments of the form `[...]`.")
|
||||
cx.span_fatal(sp, ~"#env requires arguments of the form `[...]`.")
|
||||
}
|
||||
};
|
||||
if vec::len::<@ast::expr>(args) != 1u {
|
||||
cx.span_fatal(sp, "malformed #env call");
|
||||
cx.span_fatal(sp, ~"malformed #env call");
|
||||
}
|
||||
// FIXME: if this was more thorough it would manufacture an
|
||||
// option::t<str> rather than just an maybe-empty string.
|
||||
|
||||
let var = expr_to_str(cx, args[0], "#env requires a string");
|
||||
alt generic_os::getenv(istr::from_estr(var)) {
|
||||
let var = expr_to_str(cx, args[0], ~"#env requires a string");
|
||||
alt generic_os::getenv(var) {
|
||||
option::none. { ret make_new_str(cx, sp, ""); }
|
||||
option::some(s) {
|
||||
ret make_new_str(cx, sp, istr::to_estr(s));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue