forked from lix-project/lix
Merge pull request #5191 from hercules-ci/evalstate-lifetime-hygiene
EvalState lifetime hygiene
This commit is contained in:
commit
323cafcb4e
|
@ -100,6 +100,8 @@ public:
|
||||||
/* Store used to build stuff. */
|
/* Store used to build stuff. */
|
||||||
const ref<Store> buildStore;
|
const ref<Store> buildStore;
|
||||||
|
|
||||||
|
RootValue vCallFlake = nullptr;
|
||||||
|
RootValue vImportedDrvToDerivation = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SrcToStore srcToStore;
|
SrcToStore srcToStore;
|
||||||
|
|
|
@ -663,16 +663,14 @@ void callFlake(EvalState & state,
|
||||||
|
|
||||||
mkString(*vRootSubdir, lockedFlake.flake.lockedRef.subdir);
|
mkString(*vRootSubdir, lockedFlake.flake.lockedRef.subdir);
|
||||||
|
|
||||||
static RootValue vCallFlake = nullptr;
|
if (!state.vCallFlake) {
|
||||||
|
state.vCallFlake = allocRootValue(state.allocValue());
|
||||||
if (!vCallFlake) {
|
|
||||||
vCallFlake = allocRootValue(state.allocValue());
|
|
||||||
state.eval(state.parseExprFromString(
|
state.eval(state.parseExprFromString(
|
||||||
#include "call-flake.nix.gen.hh"
|
#include "call-flake.nix.gen.hh"
|
||||||
, "/"), **vCallFlake);
|
, "/"), **state.vCallFlake);
|
||||||
}
|
}
|
||||||
|
|
||||||
state.callFunction(**vCallFlake, *vLocks, *vTmp1, noPos);
|
state.callFunction(**state.vCallFlake, *vLocks, *vTmp1, noPos);
|
||||||
state.callFunction(*vTmp1, *vRootSrc, *vTmp2, noPos);
|
state.callFunction(*vTmp1, *vRootSrc, *vTmp2, noPos);
|
||||||
state.callFunction(*vTmp2, *vRootSubdir, vRes, noPos);
|
state.callFunction(*vTmp2, *vRootSubdir, vRes, noPos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,16 +160,15 @@ static void import(EvalState & state, const Pos & pos, Value & vPath, Value * vS
|
||||||
}
|
}
|
||||||
w.attrs->sort();
|
w.attrs->sort();
|
||||||
|
|
||||||
static RootValue fun;
|
if (!state.vImportedDrvToDerivation) {
|
||||||
if (!fun) {
|
state.vImportedDrvToDerivation = allocRootValue(state.allocValue());
|
||||||
fun = allocRootValue(state.allocValue());
|
|
||||||
state.eval(state.parseExprFromString(
|
state.eval(state.parseExprFromString(
|
||||||
#include "imported-drv-to-derivation.nix.gen.hh"
|
#include "imported-drv-to-derivation.nix.gen.hh"
|
||||||
, "/"), **fun);
|
, "/"), **state.vImportedDrvToDerivation);
|
||||||
}
|
}
|
||||||
|
|
||||||
state.forceFunction(**fun, pos);
|
state.forceFunction(**state.vImportedDrvToDerivation, pos);
|
||||||
mkApp(v, **fun, w);
|
mkApp(v, **state.vImportedDrvToDerivation, w);
|
||||||
state.forceAttrs(v, pos);
|
state.forceAttrs(v, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue