1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 14:51:16 +02:00

* Implemented withs.

This commit is contained in:
Eelco Dolstra 2010-04-14 15:01:04 +00:00
parent 9985230c00
commit 110d155778
4 changed files with 38 additions and 15 deletions

View file

@ -264,6 +264,18 @@ 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'. */
const StaticEnv * curEnv;
unsigned int level;
prevWith = -1;
for (curEnv = &env, level = 0; curEnv; curEnv = curEnv->up, level++)
if (curEnv->isWith) {
prevWith = level;
break;
}
attrs->bindVars(env);
StaticEnv newEnv(true, &env);
body->bindVars(newEnv);