mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
* @-patterns as in Haskell. For instance, in a function definition
f = args @ {x, y, z}: ...; `args' refers to the argument as a whole, which is further pattern-matched against the attribute set pattern {x, y, z}.
This commit is contained in:
parent
e818838412
commit
1b962fc720
10 changed files with 106 additions and 46 deletions
|
@ -114,6 +114,7 @@ static void varsBoundByPattern(ATermMap & map, Pattern pat)
|
|||
{
|
||||
ATerm name;
|
||||
ATermList formals;
|
||||
Pattern pat1, pat2;
|
||||
/* Use makeRemoved() so that it can be used directly in
|
||||
substitute(). */
|
||||
if (matchVarPat(pat, name))
|
||||
|
@ -125,6 +126,10 @@ static void varsBoundByPattern(ATermMap & map, Pattern pat)
|
|||
map.set(name, makeRemoved());
|
||||
}
|
||||
}
|
||||
else if (matchAtPat(pat, pat1, pat2)) {
|
||||
varsBoundByPattern(map, pat1);
|
||||
varsBoundByPattern(map, pat2);
|
||||
}
|
||||
else abort();
|
||||
}
|
||||
|
||||
|
@ -354,7 +359,7 @@ Expr makeStr(const string & s, const PathSet & context)
|
|||
|
||||
string showType(Expr e)
|
||||
{
|
||||
ATerm t1, t2, t3;
|
||||
ATerm t1, t2;
|
||||
ATermList l1;
|
||||
ATermBlob b1;
|
||||
int i1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue