mirror of
https://github.com/NixOS/nix
synced 2025-06-27 00:11:17 +02:00
* 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.
This commit is contained in:
parent
7482349fe8
commit
8a10360c91
13 changed files with 83 additions and 173 deletions
|
@ -846,19 +846,14 @@ static void attrsInPattern(ATermMap & map, Pattern pat)
|
|||
{
|
||||
ATerm name;
|
||||
ATermList formals;
|
||||
Pattern pat1, pat2;
|
||||
ATermBool ellipsis;
|
||||
if (matchAttrsPat(pat, formals, ellipsis)) {
|
||||
if (matchAttrsPat(pat, formals, ellipsis, name)) {
|
||||
for (ATermIterator i(formals); i; ++i) {
|
||||
ATerm def;
|
||||
if (!matchFormal(*i, name, def)) abort();
|
||||
map.set(name, makeAttrRHS(makeBool(def != constNoDefaultValue), makeNoPos()));
|
||||
}
|
||||
}
|
||||
else if (matchAtPat(pat, pat1, pat2)) {
|
||||
attrsInPattern(map, pat1);
|
||||
attrsInPattern(map, pat2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue