mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
* New language feature: domain checks, which check whether a function
argument has a valid value, i.e., is in a certain domain. E.g., { foo : [true false] , bar : ["a" "b" "c"] }: ... This previously could be done using assertions, but domain checks will allow the buildfarm to automatically extract the configuration space from functions.
This commit is contained in:
parent
88acffa20a
commit
f4c5531d92
4 changed files with 40 additions and 13 deletions
|
@ -220,15 +220,16 @@ static void checkVarDefs2(set<Expr> & done, const ATermMap & defs, Expr e)
|
|||
else if (matchFunction(e, formals, body, pos)) {
|
||||
ATermMap defs2(defs);
|
||||
for (ATermIterator i(formals); i; ++i) {
|
||||
Expr d1, d2;
|
||||
ATerm d1, d2;
|
||||
if (!matchFormal(*i, name, d1, d2)) abort();
|
||||
defs2.set(name, (ATerm) ATempty);
|
||||
}
|
||||
for (ATermIterator i(formals); i; ++i) {
|
||||
Expr dummy, deflt;
|
||||
ATerm valids, deflt;
|
||||
set<Expr> done2;
|
||||
if (matchFormal(*i, name, dummy, deflt)) /* !!! check dummy */
|
||||
checkVarDefs2(done2, defs2, deflt);
|
||||
matchFormal(*i, name, valids, deflt);
|
||||
checkVarDefs2(done, defs, valids);
|
||||
checkVarDefs2(done2, defs2, deflt);
|
||||
}
|
||||
set<Expr> done2;
|
||||
checkVarDefs2(done2, defs2, body);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue