1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-19 08:49:35 +01:00

Use the cache in the outer shell

Make sure that we don’t discard it before entering the evaluator proper
This commit is contained in:
regnat 2021-06-03 15:29:43 +02:00
parent 69505c84e1
commit 512afd8b7a
3 changed files with 13 additions and 10 deletions

View file

@ -428,12 +428,10 @@ Value * InstallableFlake::getFlakeOutputs(EvalState & state, const flake::Locked
callFlake(state, lockedFlake, *vFlake);
auto aOutputs = vFlake->attrs->get(state.symbols.create("outputs"));
assert(aOutputs);
state.forceValue(*aOutputs->value);
return aOutputs->value;
auto vRes = state.allocValue();
auto gotField = state.getAttrField(*vFlake, {state.symbols.create("outputs")}, noPos, *vRes);
assert(gotField);
return vRes;
}
ref<eval_cache::EvalCache> openEvalCache(

View file

@ -73,11 +73,14 @@ std::pair<Value *, Pos> findAlongAttrPath(EvalState & state, const string & attr
if (attr.empty())
throw Error("empty attribute name in selection path '%1%'", attrPath);
Bindings::iterator a = v->attrs->find(state.symbols.create(attr));
if (a == v->attrs->end())
auto v2 = state.allocValue();
auto gotField = state.getAttrField(*v, {state.symbols.create(attr)}, pos, *v2);
if (!gotField)
throw AttrPathNotFound("attribute '%1%' in selection path '%2%' not found", attr, attrPath);
v = &*a->value;
pos = *a->pos;
v = v2;
/* Bindings::iterator a = v->attrs->find(state.symbols.create(attr)); */
/* v = &*a->value; */
/* pos = *a->pos; */
}
else {

View file

@ -353,6 +353,8 @@ private:
friend void prim_getAttr(EvalState & state, const Pos & pos, Value * * args, Value & v);
friend void prim_match(EvalState & state, const Pos & pos, Value * * args, Value & v);
public:
bool getAttrField(Value & attrs, const std::vector<Symbol> & selector, const Pos & pos, Value & dest);
};