diff --git a/lix/libexpr/eval-error.cc b/lix/libexpr/eval-error.cc index cf2cdc424..62165ff4b 100644 --- a/lix/libexpr/eval-error.cc +++ b/lix/libexpr/eval-error.cc @@ -85,6 +85,12 @@ void EvalErrorBuilder::debugThrow() && throw *error; } +template +void EvalErrorBuilder::throw_() && +{ + throw *error; +} + template class EvalErrorBuilder; template class EvalErrorBuilder; template class EvalErrorBuilder; diff --git a/lix/libexpr/eval-error.hh b/lix/libexpr/eval-error.hh index 2ae775753..8e1a7c25e 100644 --- a/lix/libexpr/eval-error.hh +++ b/lix/libexpr/eval-error.hh @@ -89,9 +89,14 @@ public: addTrace(PosIdx pos, std::string_view formatString, const Args &... formatArgs) &&; /** - * Throw the underlying exception. + * Throw the underlying exception, invoking the debug state callback. */ [[gnu::noinline, gnu::noreturn]] void debugThrow() &&; + + /** + * Throw the underlying exception, bypassing the debug state callback. + */ + [[gnu::noinline, gnu::noreturn]] void throw_() &&; }; } diff --git a/lix/libexpr/nixexpr.cc b/lix/libexpr/nixexpr.cc index db1014050..bdc858558 100644 --- a/lix/libexpr/nixexpr.cc +++ b/lix/libexpr/nixexpr.cc @@ -362,7 +362,7 @@ void ExprVar::bindVars(Evaluator & es, const std::shared_ptr & es.errors.make( "undefined variable '%1%'", es.symbols[name] - ).atPos(pos).debugThrow(); + ).atPos(pos).throw_(); for (auto * e = env.get(); e && !fromWith; e = e->up) fromWith = e->isWith; this->level = withLevel;