From ef4f5ba85e487f567115d60e3cb4b53d81af6ea1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 Sep 2013 13:17:51 +0000 Subject: Work on Values instead of Exprs This prevents some duplicate evaluation in nix-env and nix-instantiate. Also, when traversing ~/.nix-defexpr, only read regular files with the extension .nix. Previously it was reading files like .../channels/binary-caches/. The only reason this didn't cause problems is pure luck (namely, shadows an actual Nix expression, the binary-caches files happen to be syntactically valid Nix expressions, and we iterate over the directory contents in just the right order). --- src/nix-instantiate/nix-instantiate.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/nix-instantiate') diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index 0f0710d680cb..fd2c04eae444 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -44,9 +44,11 @@ void processExpr(EvalState & state, const Strings & attrPaths, return; } + Value vRoot; + state.eval(e, vRoot); + foreach (Strings::const_iterator, i, attrPaths) { - Value v; - findAlongAttrPath(state, *i, autoArgs, e, v); + Value & v(*findAlongAttrPath(state, *i, autoArgs, vRoot)); state.forceValue(v); PathSet context; -- cgit 1.4.1