mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
* Allow a default value in attribute selection by writing
x.y.z or default (as originally proposed in https://mail.cs.uu.nl/pipermail/nix-dev/2009-September/002989.html). For instance, an expression like stdenv.lib.attrByPath ["features" "ckSched"] false args can now be written as args.features.ckSched or false
This commit is contained in:
parent
2b9e29b1c8
commit
0a623a10c7
9 changed files with 70 additions and 22 deletions
|
@ -44,6 +44,7 @@ void ExprVar::show(std::ostream & str)
|
|||
void ExprSelect::show(std::ostream & str)
|
||||
{
|
||||
str << "(" << *e << ")." << showAttrPath(attrPath);
|
||||
if (def) str << " or " << *def;
|
||||
}
|
||||
|
||||
void ExprOpHasAttr::show(std::ostream & str)
|
||||
|
@ -211,6 +212,7 @@ void ExprVar::bindVars(const StaticEnv & env)
|
|||
void ExprSelect::bindVars(const StaticEnv & env)
|
||||
{
|
||||
e->bindVars(env);
|
||||
if (def) def->bindVars(env);
|
||||
}
|
||||
|
||||
void ExprOpHasAttr::bindVars(const StaticEnv & env)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue