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:
parent
69505c84e1
commit
512afd8b7a
3 changed files with 13 additions and 10 deletions
|
|
@ -428,12 +428,10 @@ Value * InstallableFlake::getFlakeOutputs(EvalState & state, const flake::Locked
|
||||||
|
|
||||||
callFlake(state, lockedFlake, *vFlake);
|
callFlake(state, lockedFlake, *vFlake);
|
||||||
|
|
||||||
auto aOutputs = vFlake->attrs->get(state.symbols.create("outputs"));
|
auto vRes = state.allocValue();
|
||||||
assert(aOutputs);
|
auto gotField = state.getAttrField(*vFlake, {state.symbols.create("outputs")}, noPos, *vRes);
|
||||||
|
assert(gotField);
|
||||||
state.forceValue(*aOutputs->value);
|
return vRes;
|
||||||
|
|
||||||
return aOutputs->value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ref<eval_cache::EvalCache> openEvalCache(
|
ref<eval_cache::EvalCache> openEvalCache(
|
||||||
|
|
|
||||||
|
|
@ -73,11 +73,14 @@ std::pair<Value *, Pos> findAlongAttrPath(EvalState & state, const string & attr
|
||||||
if (attr.empty())
|
if (attr.empty())
|
||||||
throw Error("empty attribute name in selection path '%1%'", attrPath);
|
throw Error("empty attribute name in selection path '%1%'", attrPath);
|
||||||
|
|
||||||
Bindings::iterator a = v->attrs->find(state.symbols.create(attr));
|
auto v2 = state.allocValue();
|
||||||
if (a == v->attrs->end())
|
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);
|
throw AttrPathNotFound("attribute '%1%' in selection path '%2%' not found", attr, attrPath);
|
||||||
v = &*a->value;
|
v = v2;
|
||||||
pos = *a->pos;
|
/* Bindings::iterator a = v->attrs->find(state.symbols.create(attr)); */
|
||||||
|
/* v = &*a->value; */
|
||||||
|
/* pos = *a->pos; */
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -353,6 +353,8 @@ private:
|
||||||
friend void prim_getAttr(EvalState & state, const Pos & pos, Value * * args, Value & v);
|
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);
|
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);
|
bool getAttrField(Value & attrs, const std::vector<Symbol> & selector, const Pos & pos, Value & dest);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue