mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
* Simplify the implementation of `with'. This gives a 7% speedup in
evaluating the NixOS system configuration.
This commit is contained in:
parent
ee0384fb96
commit
0bc468f195
4 changed files with 15 additions and 30 deletions
|
@ -278,12 +278,12 @@ void ExprLet::bindVars(const StaticEnv & env)
|
|||
void ExprWith::bindVars(const StaticEnv & env)
|
||||
{
|
||||
/* Does this `with' have an enclosing `with'? If so, record its
|
||||
level so that we can copy the attributes of the enclosing
|
||||
`with'. */
|
||||
level so that `lookupVar' can look up variables in the previous
|
||||
`with' if this one doesn't contain the desired attribute. */
|
||||
const StaticEnv * curEnv;
|
||||
unsigned int level;
|
||||
prevWith = -1;
|
||||
for (curEnv = &env, level = 0; curEnv; curEnv = curEnv->up, level++)
|
||||
prevWith = 0;
|
||||
for (curEnv = &env, level = 1; curEnv; curEnv = curEnv->up, level++)
|
||||
if (curEnv->isWith) {
|
||||
prevWith = level;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue