Skip to content

Commit

Permalink
RFC 110: Add "inherit-as-list" language construct
Browse files Browse the repository at this point in the history
Initial MVP implementation for [RFC 110](NixOS/rfcs#110)
  • Loading branch information
r-burns committed Oct 18, 2021
1 parent 5a0c8c6 commit 1a22abd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/libexpr/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,15 @@ expr_function
});
$$ = new ExprLet($2, $4);
}
| INHERIT '(' expr ')' '[' attrs ']'
{ auto ret = new ExprList;
ret->elems.reserve($6->size());
/* !!! Should ensure sharing of the expression in $3. */
for (auto & i : *$6) {
ret->elems.push_back(new ExprSelect(makeCurPos(@6, data), $3, i.symbol));
}
$$ = ret;
}
| expr_if
;

Expand Down

0 comments on commit 1a22abd

Please sign in to comment.