diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-03-25 12:19:41 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-03-25 12:19:41 +0000 |
commit | 8a10360c912bc344ea9ce7f8871a47a6e036552f (patch) | |
tree | 09ed76a3e11754ee09c48cd491782848df169063 /src/libexpr/nixexpr.cc | |
parent | 7482349fe8ba9f285f6c7e53d8573fc367ecff8b (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.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 3675dccea..e581b1329 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(); } |