mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 06:42:28 +00:00
Store ref<EvalState> in CachedEvalError
This makes the previous commits work. Newer versions store it in all EvalErrors.
This commit is contained in:
parent
ef63ba10a2
commit
5bcc7069be
@ -6,9 +6,9 @@
|
||||
|
||||
namespace nix::eval_cache {
|
||||
|
||||
CachedEvalError::CachedEvalError(ref<AttrCursor> cursor, Symbol attr)
|
||||
CachedEvalError::CachedEvalError(ref<EvalState> state, ref<AttrCursor> cursor, Symbol attr)
|
||||
: EvalError("cached failure of attribute '%s'", cursor->getAttrPathStr(attr))
|
||||
, cursor(cursor), attr(attr)
|
||||
, state(state), cursor(cursor), attr(attr)
|
||||
{ }
|
||||
|
||||
void CachedEvalError::force()
|
||||
@ -18,7 +18,7 @@ void CachedEvalError::force()
|
||||
if (v.type() == nAttrs) {
|
||||
auto a = v.attrs->get(this->attr);
|
||||
|
||||
state.forceValue(*a->value, a->pos);
|
||||
state->forceValue(*a->value, a->pos);
|
||||
}
|
||||
|
||||
// Shouldn't happen.
|
||||
@ -506,7 +506,7 @@ std::shared_ptr<AttrCursor> AttrCursor::maybeGetAttr(Symbol name)
|
||||
if (std::get_if<missing_t>(&attr->second))
|
||||
return nullptr;
|
||||
else if (std::get_if<failed_t>(&attr->second))
|
||||
throw CachedEvalError(ref(shared_from_this()), name);
|
||||
throw CachedEvalError(ref(root->state.shared_from_this()), ref(shared_from_this()), name);
|
||||
else
|
||||
return std::make_shared<AttrCursor>(root,
|
||||
std::make_pair(shared_from_this(), name), nullptr, std::move(attr));
|
||||
|
@ -15,10 +15,11 @@ class AttrCursor;
|
||||
|
||||
struct CachedEvalError : EvalError
|
||||
{
|
||||
const ref<EvalState> state;
|
||||
const ref<AttrCursor> cursor;
|
||||
const Symbol attr;
|
||||
|
||||
CachedEvalError(ref<AttrCursor> cursor, Symbol attr);
|
||||
CachedEvalError(ref<EvalState>, ref<AttrCursor> cursor, Symbol attr);
|
||||
|
||||
/**
|
||||
* Evaluate this attribute, which should result in a regular
|
||||
|
Loading…
Reference in New Issue
Block a user