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

Show the exact position of undefined variables

In particular, undefined variable errors in a "with" previously didn't
show *any* position information, so this should help a lot in those
cases.
This commit is contained in:
Eelco Dolstra 2013-10-08 14:40:51 +02:00
parent a5e0f64db3
commit 6b47de580f
4 changed files with 18 additions and 21 deletions

View file

@ -315,7 +315,7 @@ inline Value * EvalState::lookupVar(Env * env, const ExprVar & var, bool noEval)
return j->value;
}
if (!env->prevWith)
throwEvalError("undefined variable `%1%'", var.name);
throw EvalError(format("undefined variable `%1%' at %2%") % var.name % var.pos);
for (unsigned int l = env->prevWith; l; --l, env = env->up) ;
}
}