1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 22:01:15 +02:00

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.
This commit is contained in:
Eelco Dolstra 2013-09-03 12:56:33 +02:00
parent 57d18df7d0
commit 6f809194d7
6 changed files with 35 additions and 34 deletions

View file

@ -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);
}