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:
@@ -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>;
|
||||
|
||||
@@ -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_() &&;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user