diff options
| author | Graydon Hoare <[email protected]> | 2011-05-06 16:30:39 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-05-06 16:30:39 -0700 |
| commit | 0f23bbac0104fe4c51923eb09b7a98c3e6239571 (patch) | |
| tree | 0eab6391a37b71c753b5515358285163e93f76f2 /src/comp | |
| parent | Put out burning linux tinderbox. (diff) | |
| download | rust-0f23bbac0104fe4c51923eb09b7a98c3e6239571.tar.xz rust-0f23bbac0104fe4c51923eb09b7a98c3e6239571.zip | |
Fix GenericOS.getenv returning a raw str, return an Option.t[str] instead.
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/front/extenv.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/comp/front/extenv.rs b/src/comp/front/extenv.rs index a3fdde95..15483cec 100644 --- a/src/comp/front/extenv.rs +++ b/src/comp/front/extenv.rs @@ -23,9 +23,18 @@ fn expand_syntax_ext(parser.parser p, p.err("malformed #env call"); } + // FIXME: if this was more thorough it would manufacture an + // Option.t[str] rather than just an maybe-empty string. + auto var = expr_to_str(p, args.(0)); - auto val = GenericOS.getenv(var); - ret make_new_str(sp, val); + alt (GenericOS.getenv(var)) { + case (Option.none[str]) { + ret make_new_str(sp, ""); + } + case (Option.some[str](?s)) { + ret make_new_str(sp, s); + } + } } // FIXME: duplicate code copied from extfmt. |