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

add DebugTrace for the current error

This commit is contained in:
Ben Burdette 2021-12-27 17:35:27 -07:00
parent 6801a423fc
commit 9760fa8661
5 changed files with 30 additions and 19 deletions

View file

@ -76,11 +76,10 @@ std::shared_ptr<RegexCache> makeRegexCache();
struct DebugTrace {
std::optional<ErrPos> pos;
Expr &expr;
const Expr &expr;
hintformat hint;
};
class EvalState
{
public:
@ -406,6 +405,21 @@ private:
friend void prim_match(EvalState & state, const Pos & pos, Value * * args, Value & v);
};
class DebugTraceStacker {
public:
DebugTraceStacker(EvalState &evalState, DebugTrace t)
:evalState(evalState), trace(t)
{
evalState.debugTraces.push_front(t);
}
~DebugTraceStacker()
{
// assert(evalState.debugTraces.front() == trace);
evalState.debugTraces.pop_front();
}
EvalState &evalState;
DebugTrace trace;
};
/* Return a string representing the type of the value `v'. */
string showType(ValueType type);