aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r--src/libexpr/eval.hh18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index c7a19e100..2f8cc82b0 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -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);