diff options
Diffstat (limited to 'src/comp/front')
| -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. |