diff options
Diffstat (limited to 'src/libexpr/common-opts.cc')
-rw-r--r-- | src/libexpr/common-opts.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libexpr/common-opts.cc b/src/libexpr/common-opts.cc index 0ef488373..5a4856568 100644 --- a/src/libexpr/common-opts.cc +++ b/src/libexpr/common-opts.cc @@ -2,7 +2,6 @@ #include "../libmain/shared.hh" #include "util.hh" #include "parser.hh" -#include "aterm.hh" namespace nix { @@ -10,7 +9,7 @@ namespace nix { bool parseOptionArg(const string & arg, Strings::iterator & i, const Strings::iterator & argsEnd, EvalState & state, - ATermMap & autoArgs) + Bindings & autoArgs) { if (arg != "--arg" && arg != "--argstr") return false; @@ -20,11 +19,13 @@ bool parseOptionArg(const string & arg, Strings::iterator & i, string name = *i++; if (i == argsEnd) throw error; string value = *i++; - - Expr e = arg == "--arg" - ? parseExprFromString(state, value, absPath(".")) - : makeStr(value); - autoArgs.set(toATerm(name), e); + + Value & v(autoArgs[state.symbols.create(name)].value); + + if (arg == "--arg") + state.mkThunk_( v, parseExprFromString(state, value, absPath("."))); + else + mkString(v, value); return true; } |