about summary refs log tree commit diff
path: root/src/libexpr/nixexpr.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-07-24T16·35+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-07-24T16·35+0000
commitf4c5531d928caadee75d66bba40994f55f839be7 (patch)
tree04ed6655b0cf1043761b6d3978ff35b3794a6c42 /src/libexpr/nixexpr.cc
parent88acffa20ac45fd13b65a1d9143e0400ae0bde47 (diff)
* 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.

Diffstat (limited to 'src/libexpr/nixexpr.cc')
-rw-r--r--src/libexpr/nixexpr.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index cbcaec584339..56b23cc62211 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -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);