aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorBen Burdette <bburdette@protonmail.com>2022-05-20 10:33:50 -0600
committerBen Burdette <bburdette@protonmail.com>2022-05-20 10:33:50 -0600
commit884d59178735bcb5d5db7db97a05ad62a175493b (patch)
tree9dd9356cca8f7fc882bb8962ab3a0f156ea3488a /src/libexpr/eval.cc
parent0600df86b8bc59633457f7ceb79e84c8ea3fed17 (diff)
debugRepl ftn pointer
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 1cde4a9ab..5faecdbe3 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -463,7 +463,7 @@ EvalState::EvalState(
, emptyBindings(0)
, store(store)
, buildStore(buildStore ? buildStore : store)
- , debugMode(false)
+ , debugRepl(0)
, debugStop(false)
, debugQuit(false)
, regexCache(makeRegexCache())
@@ -811,8 +811,12 @@ std::unique_ptr<ValMap> mapStaticEnvBindings(const SymbolTable & st, const Stati
return vm;
}
-void EvalState::debugRepl(const Error * error, const Env & env, const Expr & expr)
+void EvalState::runDebugRepl(const Error * error, const Env & env, const Expr & expr)
{
+ // double check we've got the debugRepl ftn pointer.
+ if (!debugRepl)
+ return;
+
auto dts =
error && expr.getPos()
? std::make_unique<DebugTraceStacker>(
@@ -832,7 +836,7 @@ void EvalState::debugRepl(const Error * error, const Env & env, const Expr & exp
auto se = getStaticEnv(expr);
if (se) {
auto vm = mapStaticEnvBindings(symbols, *se.get(), env);
- runRepl(*this, *vm);
+ (debugRepl)(*this, *vm);
}
}
@@ -1070,7 +1074,7 @@ DebugTraceStacker::DebugTraceStacker(EvalState & evalState, DebugTrace t)
{
evalState.debugTraces.push_front(trace);
if (evalState.debugStop && evalState.debugMode)
- evalState.debugRepl(nullptr, trace.env, trace.expr);
+ evalState.runDebugRepl(nullptr, trace.env, trace.expr);
}
void Value::mkString(std::string_view s)