1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-15 15:02:42 +01:00

Checkpoint

This commit is contained in:
Eelco Dolstra 2019-04-23 00:39:14 +02:00
parent 7c716b4c49
commit ae5b76a5a4
3 changed files with 11 additions and 7 deletions

View file

@ -1330,8 +1330,9 @@ void ExprConcatStrings::eval(EvalState & state, Env & env, Value & v)
bool first = !forceString; bool first = !forceString;
Tag firstType = tString; Tag firstType = tString;
auto vTmp = state.allocValue();
for (auto & i : *es) { for (auto & i : *es) {
Root<Value> vTmp;
i->eval(state, env, vTmp); i->eval(state, env, vTmp);
/* If the first element is a path, then the result will also /* If the first element is a path, then the result will also
@ -1534,7 +1535,7 @@ string EvalState::coerceToString(const Pos & pos, Value & v, PathSet & context,
if (v.type == tAttrs) { if (v.type == tAttrs) {
auto i = v.attrs->find(sToString); auto i = v.attrs->find(sToString);
if (i != v.attrs->end()) { if (i != v.attrs->end()) {
Root<Value> v1; auto v1 = allocValue();
callFunction(*i->value, v, v1, pos); callFunction(*i->value, v, v1, pos);
return coerceToString(pos, v1, context, coerceMore, copyToStore); return coerceToString(pos, v1, context, coerceMore, copyToStore);
} }

View file

@ -225,7 +225,7 @@ private:
ArenaList(); ArenaList();
}; };
std::array<ArenaList, 2> arenaLists; std::array<ArenaList, 3> arenaLists;
public: public:
@ -235,7 +235,10 @@ public:
template<typename T, typename... Args> template<typename T, typename... Args>
Ptr<T> alloc(Size size, const Args & ... args) Ptr<T> alloc(Size size, const Args & ... args)
{ {
ArenaList & arenaList = size == 3 ? arenaLists[0] : arenaLists[1]; ArenaList & arenaList =
size == 3 ? arenaLists[0] :
size == 4 ? arenaLists[1] :
arenaLists[2];
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {

View file

@ -119,7 +119,7 @@ static void prim_scopedImport(EvalState & state, const Pos & pos, Value * * args
mkString(*(outputsVal->listElems()[outputs_index++]), o.first); mkString(*(outputsVal->listElems()[outputs_index++]), o.first);
} }
w->attrs->sort(); w->attrs->sort();
Root<Value> fun; auto fun = state.allocValue();
state.evalFile(settings.nixDataDir + "/nix/corepkgs/imported-drv-to-derivation.nix", fun); state.evalFile(settings.nixDataDir + "/nix/corepkgs/imported-drv-to-derivation.nix", fun);
state.forceFunction(fun, pos); state.forceFunction(fun, pos);
mkApp(v, fun, w); mkApp(v, fun, w);
@ -1497,7 +1497,7 @@ static void prim_foldlStrict(EvalState & state, const Pos & pos, Value * * args,
Ptr<Value> vCur = args[1]; Ptr<Value> vCur = args[1];
for (unsigned int n = 0; n < args[2]->listSize(); ++n) { for (unsigned int n = 0; n < args[2]->listSize(); ++n) {
Root<Value> vTmp; Root<Value> vTmp; // FIXME: correct?
state.callFunction(*args[0], *vCur, vTmp, pos); state.callFunction(*args[0], *vCur, vTmp, pos);
vCur = n == args[2]->listSize() - 1 ? Ptr(&v) : state.allocValue(); vCur = n == args[2]->listSize() - 1 ? Ptr(&v) : state.allocValue();
state.callFunction(vTmp, *args[2]->listElems()[n], *vCur, pos); state.callFunction(vTmp, *args[2]->listElems()[n], *vCur, pos);
@ -1580,7 +1580,7 @@ static void prim_sort(EvalState & state, const Pos & pos, Value * * args, Value
if (args[0]->type == tPrimOp && args[0]->primOp->fun == prim_lessThan) if (args[0]->type == tPrimOp && args[0]->primOp->fun == prim_lessThan)
return CompareValues()(a, b); return CompareValues()(a, b);
Root<Value> vTmp1, vTmp2; Root<Value> vTmp1, vTmp2; // FIXME
state.callFunction(*args[0], *a, vTmp1, pos); state.callFunction(*args[0], *a, vTmp1, pos);
state.callFunction(vTmp1, *b, vTmp2, pos); state.callFunction(vTmp1, *b, vTmp2, pos);
return state.forceBool(vTmp2, pos); return state.forceBool(vTmp2, pos);