about summary refs log tree commit diff
path: root/src/nix-env
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-08-06T13·02+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-08-06T13·02+0000
commit54945a2950174ded83d58336061b4a9990cdbbfd (patch)
tree8789c505f73551e9a40d745cbb2858ddc683cd9c /src/nix-env
parentc8606664abe952f74985503c831d31ae7a7369bc (diff)
* Refactoring: move parseExprFromFile() and parseExprFromString() into
  the EvalState class.

Diffstat (limited to 'src/nix-env')
-rw-r--r--src/nix-env/nix-env.cc7
-rw-r--r--src/nix-env/user-env.cc5
2 files changed, 5 insertions, 7 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 9cfc69547a5b..4ea301def077 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -3,7 +3,6 @@
 #include "globals.hh"
 #include "misc.hh"
 #include "shared.hh"
-#include "parser.hh"
 #include "eval.hh"
 #include "help.txt.hh"
 #include "get-drvs.hh"
@@ -129,7 +128,7 @@ static void getAllExprs(EvalState & state,
             if (hasSuffix(attrName, ".nix"))
                 attrName = string(attrName, 0, attrName.size() - 4);
             attrs.attrs[state.symbols.create(attrName)] =
-                ExprAttrs::AttrDef(parseExprFromFile(state, absPath(path2)), noPos);
+                ExprAttrs::AttrDef(state.parseExprFromFile(absPath(path2)), noPos);
         }
         else
             /* `path2' is a directory (with no default.nix in it);
@@ -141,7 +140,7 @@ static void getAllExprs(EvalState & state,
 
 static Expr * loadSourceExpr(EvalState & state, const Path & path)
 {
-    if (isNixExpr(path)) return parseExprFromFile(state, absPath(path));
+    if (isNixExpr(path)) return state.parseExprFromFile(absPath(path));
 
     /* The path is a directory.  Put the Nix expressions in the
        directory in an attribute set, with the file name of each
@@ -354,7 +353,7 @@ static void queryInstSources(EvalState & state,
             Expr * e1 = loadSourceExpr(state, instSource.nixExprPath);
 
             foreach (Strings::const_iterator, i, args) {
-                Expr * e2 = parseExprFromString(state, *i, absPath("."));
+                Expr * e2 = state.parseExprFromString(*i, absPath("."));
                 Expr * call = new ExprApp(e2, e1);
                 Value v; state.eval(call, v);
                 getDerivations(state, v, "", instSource.autoArgs, elems);
diff --git a/src/nix-env/user-env.cc b/src/nix-env/user-env.cc
index 865d24e2f919..670052bcbb6d 100644
--- a/src/nix-env/user-env.cc
+++ b/src/nix-env/user-env.cc
@@ -5,7 +5,6 @@
 #include "globals.hh"
 #include "shared.hh"
 #include "eval.hh"
-#include "parser.hh"
 #include "profiles.hh"
 
 
@@ -24,7 +23,7 @@ DrvInfos queryInstalled(EvalState & state, const Path & userEnv)
 
     if (pathExists(manifestFile)) {
         Value v;
-        state.eval(parseExprFromFile(state, manifestFile), v);
+        state.evalFile(manifestFile, v);
         Bindings bindings;
         getDerivations(state, v, "", bindings, elems);
     } else if (pathExists(oldManifestFile))
@@ -113,7 +112,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
 
     /* Get the environment builder expression. */
     Value envBuilder;
-    state.eval(parseExprFromFile(state, nixDataDir + "/nix/corepkgs/buildenv"), envBuilder);
+    state.evalFile(nixDataDir + "/nix/corepkgs/buildenv", envBuilder);
 
     /* Construct a Nix expression that calls the user environment
        builder with the manifest as argument. */