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

* Cache parse trees to prevent repeated parsing of imported Nix

expressions.
This commit is contained in:
Eelco Dolstra 2010-03-31 16:14:32 +00:00
parent 3d94be61ea
commit 55e207b2dc
3 changed files with 10 additions and 7 deletions

View file

@ -272,7 +272,14 @@ void EvalState::cloneAttrs(Value & src, Value & dst)
void EvalState::evalFile(const Path & path, Value & v)
{
startNest(nest, lvlTalkative, format("evaluating file `%1%'") % path);
Expr e = parseExprFromFile(*this, path);
Expr e = parseTrees.get(toATerm(path));
if (!e) {
e = parseExprFromFile(*this, path);
parseTrees.set(toATerm(path), e);
}
try {
eval(e, v);
} catch (Error & e) {