1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 21:01:16 +02:00

* Change the right-hand side of the ‘.’ operator from an attribute to

an attribute path.  This is a refactoring to support default values.
This commit is contained in:
Eelco Dolstra 2011-07-06 12:28:57 +00:00
parent 5580f3817c
commit 2b9e29b1c8
4 changed files with 33 additions and 18 deletions

View file

@ -325,8 +325,8 @@ expr_app
;
expr_select
: expr_select '.' ID
{ $$ = new ExprSelect($1, data->symbols.create($3)); }
: expr_simple '.' attrpath
{ $$ = new ExprSelect($1, *$3); }
| expr_simple { $$ = $1; }
;
@ -382,7 +382,7 @@ binds
| binds INHERIT '(' expr ')' ids ';'
{ $$ = $1;
/* !!! Should ensure sharing of the expression in $4. */
foreach (AttrPath::iterator, i, *$6) {
foreach (vector<Symbol>::iterator, i, *$6) {
if ($$->attrs.find(*i) != $$->attrs.end())
dupAttr(*i, makeCurPos(@6, data), $$->attrs[*i].pos);
$$->attrs[*i] = ExprAttrs::AttrDef(new ExprSelect($4, *i), makeCurPos(@6, data));