libexpr: make undefined var errors non-debuggable in the parser

this only affects undefined names outside of with scopes. sending those
errors to the debugger when enabled seems rather less useful; unlike in
the case of with scopes there's nothing meaningful to inspect. avoiding
the debugger also lets us avoid marking the entire parser `NeverAsync`.

cf #761

Change-Id: I3599b826ff5b101acf9a3ba70dcdf9e8e02067f0
This commit is contained in:
eldritch horrors
2025-03-25 20:14:45 +01:00
parent 6bf8c8a4f2
commit 0ff8c2b06f
3 changed files with 13 additions and 2 deletions
+6
View File
@@ -85,6 +85,12 @@ void EvalErrorBuilder<T>::debugThrow() &&
throw *error;
}
template<class T>
void EvalErrorBuilder<T>::throw_() &&
{
throw *error;
}
template class EvalErrorBuilder<EvalError>;
template class EvalErrorBuilder<AssertionError>;
template class EvalErrorBuilder<ThrownError>;
+6 -1
View File
@@ -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_() &&;
};
}
+1 -1
View File
@@ -362,7 +362,7 @@ void ExprVar::bindVars(Evaluator & es, const std::shared_ptr<const StaticEnv> &
es.errors.make<UndefinedVarError>(
"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;