about summary refs log tree commit diff
path: root/src/libexpr/nixexpr.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-03-28T20·34+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-03-28T20·34+0000
commitdb3e644c1ce7d856dbaca7718fa0af8231c486d2 (patch)
tree96639187d411cdab9aa597eed170e08029236aaa /src/libexpr/nixexpr.cc
parentf8cd904e05b95c5a3ca7cf570c0503a25a2095ca (diff)
* Added plain lambdas, e.g., `let { id = x: x; const = x: y: x; }'.
  `bla:' is now no longer parsed as a URL.

* Re-enabled support for the `args' attribute in derivations to
  specify command line arguments to the builder, e.g.,

    ...
    builder = /usr/bin/python;
    args = ["-c" ./builder.py];
    ...

Diffstat (limited to 'src/libexpr/nixexpr.cc')
-rw-r--r--src/libexpr/nixexpr.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index 8fe5d379af71..0d14623ccca0 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -194,10 +194,18 @@ Expr substitute(const ATermMap & subs, Expr e)
                 abort();
             subs2.remove(name);
         }
-        return ATmake("Function(<term>, <term>)", formals,
+        return ATmake("Function(<term>, <term>)",
+            substitute(subs, (ATerm) formals),
             substitute(subs2, body));
     }
 
+    if (atMatch(m, e) >> "Function" >> name >> body) {
+        ATermMap subs2(subs);
+        subs2.remove(name);
+        return ATmake("Function1(<term>, <term>)", name,
+            substitute(subs2, body));
+    }
+        
     /* Idem for a mutually recursive attribute set. */
     ATermList rbnds, nrbnds;
     if (atMatch(m, e) >> "Rec" >> rbnds >> nrbnds) {
@@ -249,7 +257,6 @@ void checkVarDefs(const ATermMap & defs, Expr e)
         if (!defs.get(name))
             throw Error(format("undefined variable `%1%'")
                 % aterm2String(name));
-        return;
     }
 
     else if (atMatch(m, e) >> "Function" >> formals >> body) {
@@ -263,7 +270,13 @@ void checkVarDefs(const ATermMap & defs, Expr e)
                     abort();
             defs2.set(name, (ATerm) ATempty);
         }
-        return checkVarDefs(defs2, body);
+        checkVarDefs(defs2, body);
+    }
+        
+    else if (atMatch(m, e) >> "Function1" >> name >> body) {
+        ATermMap defs2(defs);
+        defs2.set(name, (ATerm) ATempty);
+        checkVarDefs(defs2, body);
     }
         
     else if (atMatch(m, e) >> "Rec" >> rbnds >> nrbnds) {