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

Pass position information to primop calls

For example:

  error: `tail' called on an empty list, at
    /home/eelco/Dev/nixpkgs/pkgs/applications/misc/hello/ex-2/default.nix:13:7
This commit is contained in:
Eelco Dolstra 2014-04-04 18:51:01 +02:00
parent 8b31ffd10d
commit c28de6d96e
5 changed files with 105 additions and 105 deletions

View file

@ -794,7 +794,7 @@ void ExprApp::eval(EvalState & state, Env & env, Value & v)
}
void EvalState::callPrimOp(Value & fun, Value & arg, Value & v)
void EvalState::callPrimOp(Value & fun, Value & arg, Value & v, const Pos & pos)
{
/* Figure out the number of arguments still needed. */
unsigned int argsDone = 0;
@ -820,7 +820,7 @@ void EvalState::callPrimOp(Value & fun, Value & arg, Value & v)
/* And call the primop. */
nrPrimOpCalls++;
if (countCalls) primOpCalls[primOp->primOp->name]++;
primOp->primOp->fun(*this, vArgs, v);
primOp->primOp->fun(*this, pos, vArgs, v);
} else {
Value * fun2 = allocValue();
*fun2 = fun;
@ -834,7 +834,7 @@ void EvalState::callPrimOp(Value & fun, Value & arg, Value & v)
void EvalState::callFunction(Value & fun, Value & arg, Value & v, const Pos & pos)
{
if (fun.type == tPrimOp || fun.type == tPrimOpApp) {
callPrimOp(fun, arg, v);
callPrimOp(fun, arg, v, pos);
return;
}