about summary refs log tree commit diff
path: root/src/libexpr/parser.y
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-03T10·56+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-03T11·01+0200
commit6f809194d7448c4ad50174bed9ba2419e2114352 (patch)
tree03e493977baf95671cb652b197772376c68fe130 /src/libexpr/parser.y
parent57d18df7d0005cf822368d9f1d0c33396c6b9f9f (diff)
Get rid of the parse tree cache
Since we already cache files in normal form (fileEvalCache), caching
parse trees is redundant.

Note that getting rid of this cache doesn't actually save much memory
at the moment, because parse trees are currently not freed / GC'ed.
Diffstat (limited to 'src/libexpr/parser.y')
-rw-r--r--src/libexpr/parser.y16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 623ac641cca9..c63043c4d122 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -505,7 +505,7 @@ Expr * EvalState::parse(const char * text,
 }
 
 
-Expr * EvalState::parseExprFromFile(Path path)
+Path resolveExprPath(Path path)
 {
     assert(path[0] == '/');
 
@@ -523,15 +523,13 @@ Expr * EvalState::parseExprFromFile(Path path)
     if (S_ISDIR(st.st_mode))
         path = canonPath(path + "/default.nix");
 
-    /* Read and parse the input file, unless it's already in the parse
-       tree cache. */
-    Expr * e = parseTrees[path];
-    if (!e) {
-        e = parse(readFile(path).c_str(), path, dirOf(path), staticBaseEnv);
-        parseTrees[path] = e;
-    }
+    return path;
+}
 
-    return e;
+
+Expr * EvalState::parseExprFromFile(const Path & path)
+{
+    return parse(readFile(path).c_str(), path, dirOf(path), staticBaseEnv);
 }