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:
parent
2317d8f671
commit
ca2238cf81
9 changed files with 170 additions and 119 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue