about summary refs log tree commit diff
path: root/src/libexpr/nixexpr.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-03-25T12·19+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-03-25T12·19+0000
commit8a10360c912bc344ea9ce7f8871a47a6e036552f (patch)
tree09ed76a3e11754ee09c48cd491782848df169063 /src/libexpr/nixexpr.cc
parent7482349fe8ba9f285f6c7e53d8573fc367ecff8b (diff)
* Simplify @-patterns: only `{attrs}@name' or `name@{attrs}' are now
  allowed.  So `name1@name2', `{attrs1}@{attrs2}' and so on are now no
  longer legal.  This is no big loss because they were not useful
  anyway.

  This also changes the output of builtins.toXML for @-patterns
  slightly.

Diffstat (limited to 'src/libexpr/nixexpr.cc')
-rw-r--r--src/libexpr/nixexpr.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index 3675dcceaf66..e581b1329c88 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -114,23 +114,19 @@ static void varsBoundByPattern(ATermMap & map, Pattern pat)
 {
     ATerm name;
     ATermList formals;
-    Pattern pat1, pat2;
     ATermBool ellipsis;
     /* Use makeRemoved() so that it can be used directly in
        substitute(). */
     if (matchVarPat(pat, name))
         map.set(name, makeRemoved());
-    else if (matchAttrsPat(pat, formals, ellipsis)) { 
+    else if (matchAttrsPat(pat, formals, ellipsis, name)) {
+        if (name != sNoAlias) map.set(name, makeRemoved());
         for (ATermIterator i(formals); i; ++i) {
             ATerm d1;
             if (!matchFormal(*i, name, d1)) abort();
             map.set(name, makeRemoved());
         }
     }
-    else if (matchAtPat(pat, pat1, pat2)) {
-        varsBoundByPattern(map, pat1);
-        varsBoundByPattern(map, pat2);
-    }
     else abort();
 }