mirror of
https://github.com/NixOS/nix.git
synced 2025-11-20 09:19:36 +01:00
Cache the evaluation errors
Doesn’t seem to make much of a difference on `nix search`, but we’ll need it at some point
This commit is contained in:
parent
9102508f33
commit
8d2be51d19
1 changed files with 13 additions and 1 deletions
|
|
@ -1261,7 +1261,12 @@ bool EvalState::getAttrField(Value & attrs, const std::vector<Symbol> & selector
|
|||
}
|
||||
vAttrs = j->value;
|
||||
pos2 = j->pos;
|
||||
try {
|
||||
forceValue(*vAttrs, pos2 != NULL ? *pos2 : pos );
|
||||
} catch (EvalError & e) {
|
||||
resultingCursor.addFailedChild(name, e);
|
||||
throw;
|
||||
}
|
||||
if (cacheResult.returnCode == ValueCache::CacheMiss) {
|
||||
resultingCursor = resultingCursor.addChild(name, *vAttrs);
|
||||
vAttrs->setEvalCache(resultingCursor);
|
||||
|
|
@ -1984,6 +1989,13 @@ ValueCache ValueCache::addChild(const Symbol& name, Value& value)
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
ValueCache ValueCache::addFailedChild(const Symbol& name, const Error & error)
|
||||
{
|
||||
if (!rawCache) return ValueCache::empty;
|
||||
return ValueCache(rawCache->addChild(name, tree_cache::failed_t{ .error = error.msg() }));
|
||||
}
|
||||
|
||||
void ValueCache::addAttrSetChilds(Bindings & children)
|
||||
{
|
||||
if (!rawCache) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue