Skip to content

Commit 1a22abd

Browse files
committed
RFC 110: Add "inherit-as-list" language construct
Initial MVP implementation for [RFC 110](NixOS/rfcs#110)
1 parent 5a0c8c6 commit 1a22abd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/libexpr/parser.y

+9
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,15 @@ expr_function
343343
});
344344
$$ = new ExprLet($2, $4);
345345
}
346+
| INHERIT '(' expr ')' '[' attrs ']'
347+
{ auto ret = new ExprList;
348+
ret->elems.reserve($6->size());
349+
/* !!! Should ensure sharing of the expression in $3. */
350+
for (auto & i : *$6) {
351+
ret->elems.push_back(new ExprSelect(makeCurPos(@6, data), $3, i.symbol));
352+
}
353+
$$ = ret;
354+
}
346355
| expr_if
347356
;
348357

0 commit comments

Comments
 (0)