1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

* Refactoring: get the selection path stuff out of getDerivations()

and put it into a separate function findAlongAttrPath().
This commit is contained in:
Eelco Dolstra 2006-07-26 15:05:15 +00:00
parent 2317d8f671
commit ca2238cf81
9 changed files with 170 additions and 119 deletions

View file

@ -287,6 +287,24 @@ static ATerm concatStrings(EvalState & state, const ATermVector & args)
}
Expr autoCallFunction(Expr e)
{
ATermList formals;
ATerm body, pos;
if (matchFunction(e, formals, body, pos)) {
for (ATermIterator i(formals); i; ++i) {
Expr name, def; ATerm values, def2;
if (!matchFormal(*i, name, values, def2)) abort();
if (!matchDefaultValue(def2, def))
throw TypeError(format("cannot auto-call a function that has an argument without a default value (`%1%')")
% aterm2String(name));
}
e = makeCall(e, makeAttrs(ATermMap(0)));
}
return e;
}
Expr evalExpr2(EvalState & state, Expr e)
{
Expr e1, e2, e3, e4;
@ -380,7 +398,9 @@ Expr evalExpr2(EvalState & state, Expr e)
}
}
else throw TypeError("the left-hand side of the function call is neither a function nor a primop (built-in operation)");
else throw TypeError(
format("the left-hand side of the function call is neither a function nor a primop (built-in operation) but %1%")
% showType(e1));
}
/* Attribute selection. */