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

Output line number on infinite recursion

This commit is contained in:
Iwan Aucamp 2015-07-31 17:32:25 +02:00 committed by Eelco Dolstra
parent 76cc8e97a2
commit 75837651f1
4 changed files with 17 additions and 13 deletions

View file

@ -1,15 +1,16 @@
#pragma once
#include "eval.hh"
#include "shared.hh"
#define LocalNoInline(f) static f __attribute__((noinline)); f
#define LocalNoInlineNoReturn(f) static f __attribute__((noinline, noreturn)); f
namespace nix {
LocalNoInlineNoReturn(void throwEvalError(const char * s))
LocalNoInlineNoReturn(void throwEvalError(const FormatOrString & fs))
{
throw EvalError(s);
throw EvalError(fs);
}
LocalNoInlineNoReturn(void throwTypeError(const char * s, const Value & v))
@ -24,7 +25,7 @@ LocalNoInlineNoReturn(void throwTypeError(const char * s, const Value & v, const
}
void EvalState::forceValue(Value & v)
void EvalState::forceValue(Value & v, const Pos & pos)
{
if (v.type == tThunk) {
Env * env = v.thunk.env;
@ -43,7 +44,7 @@ void EvalState::forceValue(Value & v)
else if (v.type == tApp)
callFunction(*v.app.left, *v.app.right, v, noPos);
else if (v.type == tBlackhole)
throwEvalError("infinite recursion encountered");
throwEvalError(format("infinite recursion encountered, at %1%") % pos);
}