forked from lix-project/lix
de-const evalState exceptions
This commit is contained in:
parent
f9cdb6af8d
commit
7ddef73d02
7 changed files with 54 additions and 50 deletions
|
@ -118,9 +118,10 @@ ref<EvalState> EvalCommand::getEvalState()
|
||||||
searchPath, getEvalStore(), getStore())
|
searchPath, getEvalStore(), getStore())
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
// TODO move this somewhere else. Its only here to get the evalState ptr!
|
||||||
if (startReplOnEvalErrors)
|
if (startReplOnEvalErrors)
|
||||||
// debuggerHook = [evalState{ref<EvalState>(evalState)}](const Error * error, const Env & env, const Expr & expr) {
|
// debuggerHook = [evalState{ref<EvalState>(evalState)}](const Error * error, const Env & env, const Expr & expr) {
|
||||||
debuggerHook = [](const EvalState & evalState, const Error * error, const Env & env, const Expr & expr) {
|
debuggerHook = [](EvalState & evalState, const Error * error, const Env & env, const Expr & expr) {
|
||||||
auto dts =
|
auto dts =
|
||||||
error && expr.getPos()
|
error && expr.getPos()
|
||||||
? std::make_unique<DebugTraceStacker>(
|
? std::make_unique<DebugTraceStacker>(
|
||||||
|
@ -137,9 +138,9 @@ ref<EvalState> EvalCommand::getEvalState()
|
||||||
if (error)
|
if (error)
|
||||||
printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error->what());
|
printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error->what());
|
||||||
|
|
||||||
auto se = evalState->getStaticEnv(expr);
|
auto se = evalState.getStaticEnv(expr);
|
||||||
if (se) {
|
if (se) {
|
||||||
auto vm = mapStaticEnvBindings(evalState->symbols, *se.get(), env);
|
auto vm = mapStaticEnvBindings(evalState.symbols, *se.get(), env);
|
||||||
runRepl(evalState, *vm);
|
runRepl(evalState, *vm);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -274,7 +274,8 @@ void printClosureDiff(
|
||||||
|
|
||||||
|
|
||||||
void runRepl(
|
void runRepl(
|
||||||
EvalState & evalState,
|
ref<EvalState> evalState,
|
||||||
|
// EvalState & evalState,
|
||||||
const ValMap & extraEnv);
|
const ValMap & extraEnv);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,7 @@ std::string removeWhitespace(std::string s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// NixRepl::NixRepl(ref<EvalState> state)
|
||||||
NixRepl::NixRepl(ref<EvalState> state)
|
NixRepl::NixRepl(ref<EvalState> state)
|
||||||
: state(state)
|
: state(state)
|
||||||
, debugTraceIndex(0)
|
, debugTraceIndex(0)
|
||||||
|
@ -1012,7 +1013,8 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
|
||||||
}
|
}
|
||||||
|
|
||||||
void runRepl(
|
void runRepl(
|
||||||
EvalState& evalState,
|
ref<EvalState> evalState,
|
||||||
|
// EvalState& evalState,
|
||||||
const ValMap & extraEnv)
|
const ValMap & extraEnv)
|
||||||
{
|
{
|
||||||
auto repl = std::make_unique<NixRepl>(evalState);
|
auto repl = std::make_unique<NixRepl>(evalState);
|
||||||
|
|
|
@ -814,7 +814,7 @@ std::unique_ptr<ValMap> mapStaticEnvBindings(const SymbolTable & st, const Stati
|
||||||
of stack space, which is a real killer in the recursive
|
of stack space, which is a real killer in the recursive
|
||||||
evaluator. So here are some helper functions for throwing
|
evaluator. So here are some helper functions for throwing
|
||||||
exceptions. */
|
exceptions. */
|
||||||
void EvalState::throwEvalError(const PosIdx pos, const char * s, Env & env, Expr & expr) const
|
void EvalState::throwEvalError(const PosIdx pos, const char * s, Env & env, Expr & expr)
|
||||||
{
|
{
|
||||||
auto error = EvalError({
|
auto error = EvalError({
|
||||||
.msg = hintfmt(s),
|
.msg = hintfmt(s),
|
||||||
|
@ -824,7 +824,7 @@ void EvalState::throwEvalError(const PosIdx pos, const char * s, Env & env, Expr
|
||||||
debugThrow(error, env, expr);
|
debugThrow(error, env, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwEvalError(const PosIdx pos, const char * s) const
|
void EvalState::throwEvalError(const PosIdx pos, const char * s)
|
||||||
{
|
{
|
||||||
auto error = EvalError({
|
auto error = EvalError({
|
||||||
.msg = hintfmt(s),
|
.msg = hintfmt(s),
|
||||||
|
@ -834,7 +834,7 @@ void EvalState::throwEvalError(const PosIdx pos, const char * s) const
|
||||||
debugThrowLastTrace(error);
|
debugThrowLastTrace(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwEvalError(const char * s, const std::string & s2) const
|
void EvalState::throwEvalError(const char * s, const std::string & s2)
|
||||||
{
|
{
|
||||||
auto error = EvalError(s, s2);
|
auto error = EvalError(s, s2);
|
||||||
|
|
||||||
|
@ -842,7 +842,7 @@ void EvalState::throwEvalError(const char * s, const std::string & s2) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwEvalError(const PosIdx pos, const Suggestions & suggestions, const char * s,
|
void EvalState::throwEvalError(const PosIdx pos, const Suggestions & suggestions, const char * s,
|
||||||
const std::string & s2, Env & env, Expr & expr) const
|
const std::string & s2, Env & env, Expr & expr)
|
||||||
{
|
{
|
||||||
auto error = EvalError(ErrorInfo{
|
auto error = EvalError(ErrorInfo{
|
||||||
.msg = hintfmt(s, s2),
|
.msg = hintfmt(s, s2),
|
||||||
|
@ -853,7 +853,7 @@ void EvalState::throwEvalError(const PosIdx pos, const Suggestions & suggestions
|
||||||
debugThrow(error, env, expr);
|
debugThrow(error, env, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwEvalError(const PosIdx pos, const char * s, const std::string & s2) const
|
void EvalState::throwEvalError(const PosIdx pos, const char * s, const std::string & s2)
|
||||||
{
|
{
|
||||||
auto error = EvalError({
|
auto error = EvalError({
|
||||||
.msg = hintfmt(s, s2),
|
.msg = hintfmt(s, s2),
|
||||||
|
@ -863,7 +863,7 @@ void EvalState::throwEvalError(const PosIdx pos, const char * s, const std::stri
|
||||||
debugThrowLastTrace(error);
|
debugThrowLastTrace(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwEvalError(const PosIdx pos, const char * s, const std::string & s2, Env & env, Expr & expr) const
|
void EvalState::throwEvalError(const PosIdx pos, const char * s, const std::string & s2, Env & env, Expr & expr)
|
||||||
{
|
{
|
||||||
auto error = EvalError({
|
auto error = EvalError({
|
||||||
.msg = hintfmt(s, s2),
|
.msg = hintfmt(s, s2),
|
||||||
|
@ -874,7 +874,7 @@ void EvalState::throwEvalError(const PosIdx pos, const char * s, const std::stri
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwEvalError(const char * s, const std::string & s2,
|
void EvalState::throwEvalError(const char * s, const std::string & s2,
|
||||||
const std::string & s3) const
|
const std::string & s3)
|
||||||
{
|
{
|
||||||
auto error = EvalError({
|
auto error = EvalError({
|
||||||
.msg = hintfmt(s, s2),
|
.msg = hintfmt(s, s2),
|
||||||
|
@ -885,7 +885,7 @@ void EvalState::throwEvalError(const char * s, const std::string & s2,
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwEvalError(const PosIdx pos, const char * s, const std::string & s2,
|
void EvalState::throwEvalError(const PosIdx pos, const char * s, const std::string & s2,
|
||||||
const std::string & s3) const
|
const std::string & s3)
|
||||||
{
|
{
|
||||||
auto error = EvalError({
|
auto error = EvalError({
|
||||||
.msg = hintfmt(s, s2),
|
.msg = hintfmt(s, s2),
|
||||||
|
@ -896,7 +896,7 @@ void EvalState::throwEvalError(const PosIdx pos, const char * s, const std::stri
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwEvalError(const PosIdx pos, const char * s, const std::string & s2,
|
void EvalState::throwEvalError(const PosIdx pos, const char * s, const std::string & s2,
|
||||||
const std::string & s3, Env & env, Expr & expr) const
|
const std::string & s3, Env & env, Expr & expr)
|
||||||
{
|
{
|
||||||
auto error = EvalError({
|
auto error = EvalError({
|
||||||
.msg = hintfmt(s, s2),
|
.msg = hintfmt(s, s2),
|
||||||
|
@ -906,7 +906,7 @@ void EvalState::throwEvalError(const PosIdx pos, const char * s, const std::stri
|
||||||
debugThrow(error, env, expr);
|
debugThrow(error, env, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwEvalError(const PosIdx p1, const char * s, const Symbol sym, const PosIdx p2, Env & env, Expr & expr) const
|
void EvalState::throwEvalError(const PosIdx p1, const char * s, const Symbol sym, const PosIdx p2, Env & env, Expr & expr)
|
||||||
{
|
{
|
||||||
// p1 is where the error occurred; p2 is a position mentioned in the message.
|
// p1 is where the error occurred; p2 is a position mentioned in the message.
|
||||||
auto error = EvalError({
|
auto error = EvalError({
|
||||||
|
@ -917,7 +917,7 @@ void EvalState::throwEvalError(const PosIdx p1, const char * s, const Symbol sym
|
||||||
debugThrow(error, env, expr);
|
debugThrow(error, env, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwTypeError(const PosIdx pos, const char * s, const Value & v) const
|
void EvalState::throwTypeError(const PosIdx pos, const char * s, const Value & v)
|
||||||
{
|
{
|
||||||
auto error = TypeError({
|
auto error = TypeError({
|
||||||
.msg = hintfmt(s, showType(v)),
|
.msg = hintfmt(s, showType(v)),
|
||||||
|
@ -927,7 +927,7 @@ void EvalState::throwTypeError(const PosIdx pos, const char * s, const Value & v
|
||||||
debugThrowLastTrace(error);
|
debugThrowLastTrace(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwTypeError(const PosIdx pos, const char * s, const Value & v, Env & env, Expr & expr) const
|
void EvalState::throwTypeError(const PosIdx pos, const char * s, const Value & v, Env & env, Expr & expr)
|
||||||
{
|
{
|
||||||
auto error = TypeError({
|
auto error = TypeError({
|
||||||
.msg = hintfmt(s, showType(v)),
|
.msg = hintfmt(s, showType(v)),
|
||||||
|
@ -937,7 +937,7 @@ void EvalState::throwTypeError(const PosIdx pos, const char * s, const Value & v
|
||||||
debugThrow(error, env, expr);
|
debugThrow(error, env, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwTypeError(const PosIdx pos, const char * s) const
|
void EvalState::throwTypeError(const PosIdx pos, const char * s)
|
||||||
{
|
{
|
||||||
auto error = TypeError({
|
auto error = TypeError({
|
||||||
.msg = hintfmt(s),
|
.msg = hintfmt(s),
|
||||||
|
@ -948,7 +948,7 @@ void EvalState::throwTypeError(const PosIdx pos, const char * s) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwTypeError(const PosIdx pos, const char * s, const ExprLambda & fun,
|
void EvalState::throwTypeError(const PosIdx pos, const char * s, const ExprLambda & fun,
|
||||||
const Symbol s2, Env & env, Expr &expr) const
|
const Symbol s2, Env & env, Expr &expr)
|
||||||
{
|
{
|
||||||
auto error = TypeError({
|
auto error = TypeError({
|
||||||
.msg = hintfmt(s, fun.showNamePos(*this), symbols[s2]),
|
.msg = hintfmt(s, fun.showNamePos(*this), symbols[s2]),
|
||||||
|
@ -959,7 +959,7 @@ void EvalState::throwTypeError(const PosIdx pos, const char * s, const ExprLambd
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwTypeError(const PosIdx pos, const Suggestions & suggestions, const char * s,
|
void EvalState::throwTypeError(const PosIdx pos, const Suggestions & suggestions, const char * s,
|
||||||
const ExprLambda & fun, const Symbol s2, Env & env, Expr &expr) const
|
const ExprLambda & fun, const Symbol s2, Env & env, Expr &expr)
|
||||||
{
|
{
|
||||||
auto error = TypeError(ErrorInfo {
|
auto error = TypeError(ErrorInfo {
|
||||||
.msg = hintfmt(s, fun.showNamePos(*this), symbols[s2]),
|
.msg = hintfmt(s, fun.showNamePos(*this), symbols[s2]),
|
||||||
|
@ -970,7 +970,7 @@ void EvalState::throwTypeError(const PosIdx pos, const Suggestions & suggestions
|
||||||
debugThrow(error, env, expr);
|
debugThrow(error, env, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwTypeError(const char * s, const Value & v, Env & env, Expr &expr) const
|
void EvalState::throwTypeError(const char * s, const Value & v, Env & env, Expr &expr)
|
||||||
{
|
{
|
||||||
auto error = TypeError({
|
auto error = TypeError({
|
||||||
.msg = hintfmt(s, showType(v)),
|
.msg = hintfmt(s, showType(v)),
|
||||||
|
@ -980,7 +980,7 @@ void EvalState::throwTypeError(const char * s, const Value & v, Env & env, Expr
|
||||||
debugThrow(error, env, expr);
|
debugThrow(error, env, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwAssertionError(const PosIdx pos, const char * s, const std::string & s1, Env & env, Expr &expr) const
|
void EvalState::throwAssertionError(const PosIdx pos, const char * s, const std::string & s1, Env & env, Expr &expr)
|
||||||
{
|
{
|
||||||
auto error = AssertionError({
|
auto error = AssertionError({
|
||||||
.msg = hintfmt(s, s1),
|
.msg = hintfmt(s, s1),
|
||||||
|
@ -990,7 +990,7 @@ void EvalState::throwAssertionError(const PosIdx pos, const char * s, const std:
|
||||||
debugThrow(error, env, expr);
|
debugThrow(error, env, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwUndefinedVarError(const PosIdx pos, const char * s, const std::string & s1, Env & env, Expr &expr) const
|
void EvalState::throwUndefinedVarError(const PosIdx pos, const char * s, const std::string & s1, Env & env, Expr &expr)
|
||||||
{
|
{
|
||||||
auto error = UndefinedVarError({
|
auto error = UndefinedVarError({
|
||||||
.msg = hintfmt(s, s1),
|
.msg = hintfmt(s, s1),
|
||||||
|
@ -1000,7 +1000,7 @@ void EvalState::throwUndefinedVarError(const PosIdx pos, const char * s, const s
|
||||||
debugThrow(error, env, expr);
|
debugThrow(error, env, expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvalState::throwMissingArgumentError(const PosIdx pos, const char * s, const std::string & s1, Env & env, Expr &expr) const
|
void EvalState::throwMissingArgumentError(const PosIdx pos, const char * s, const std::string & s1, Env & env, Expr &expr)
|
||||||
{
|
{
|
||||||
auto error = MissingArgumentError({
|
auto error = MissingArgumentError({
|
||||||
.msg = hintfmt(s, s1),
|
.msg = hintfmt(s, s1),
|
||||||
|
|
|
@ -143,7 +143,7 @@ public:
|
||||||
|
|
||||||
template<class E>
|
template<class E>
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void debugThrow(const E &error, const Env & env, const Expr & expr) const
|
void debugThrow(const E &error, const Env & env, const Expr & expr)
|
||||||
{
|
{
|
||||||
if (debuggerHook)
|
if (debuggerHook)
|
||||||
debuggerHook(*this, &error, env, expr);
|
debuggerHook(*this, &error, env, expr);
|
||||||
|
@ -153,7 +153,7 @@ public:
|
||||||
|
|
||||||
template<class E>
|
template<class E>
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void debugThrowLastTrace(E & e) const
|
void debugThrowLastTrace(E & e)
|
||||||
{
|
{
|
||||||
// Call this in the situation where Expr and Env are inaccessible.
|
// Call this in the situation where Expr and Env are inaccessible.
|
||||||
// The debugger will start in the last context that's in the
|
// The debugger will start in the last context that's in the
|
||||||
|
@ -312,68 +312,68 @@ public:
|
||||||
std::string_view forceStringNoCtx(Value & v, const PosIdx pos = noPos);
|
std::string_view forceStringNoCtx(Value & v, const PosIdx pos = noPos);
|
||||||
|
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwEvalError(const PosIdx pos, const char * s) const;
|
void throwEvalError(const PosIdx pos, const char * s);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwEvalError(const PosIdx pos, const char * s,
|
void throwEvalError(const PosIdx pos, const char * s,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwEvalError(const char * s, const std::string & s2) const;
|
void throwEvalError(const char * s, const std::string & s2);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwEvalError(const PosIdx pos, const char * s, const std::string & s2) const;
|
void throwEvalError(const PosIdx pos, const char * s, const std::string & s2);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwEvalError(const char * s, const std::string & s2,
|
void throwEvalError(const char * s, const std::string & s2,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwEvalError(const PosIdx pos, const char * s, const std::string & s2,
|
void throwEvalError(const PosIdx pos, const char * s, const std::string & s2,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwEvalError(const char * s, const std::string & s2, const std::string & s3,
|
void throwEvalError(const char * s, const std::string & s2, const std::string & s3,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwEvalError(const PosIdx pos, const char * s, const std::string & s2, const std::string & s3,
|
void throwEvalError(const PosIdx pos, const char * s, const std::string & s2, const std::string & s3,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwEvalError(const PosIdx pos, const char * s, const std::string & s2, const std::string & s3) const;
|
void throwEvalError(const PosIdx pos, const char * s, const std::string & s2, const std::string & s3);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwEvalError(const char * s, const std::string & s2, const std::string & s3) const;
|
void throwEvalError(const char * s, const std::string & s2, const std::string & s3);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwEvalError(const PosIdx pos, const Suggestions & suggestions, const char * s, const std::string & s2,
|
void throwEvalError(const PosIdx pos, const Suggestions & suggestions, const char * s, const std::string & s2,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwEvalError(const PosIdx p1, const char * s, const Symbol sym, const PosIdx p2,
|
void throwEvalError(const PosIdx p1, const char * s, const Symbol sym, const PosIdx p2,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
|
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwTypeError(const PosIdx pos, const char * s, const Value & v) const;
|
void throwTypeError(const PosIdx pos, const char * s, const Value & v);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwTypeError(const PosIdx pos, const char * s, const Value & v,
|
void throwTypeError(const PosIdx pos, const char * s, const Value & v,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwTypeError(const PosIdx pos, const char * s) const;
|
void throwTypeError(const PosIdx pos, const char * s);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwTypeError(const PosIdx pos, const char * s,
|
void throwTypeError(const PosIdx pos, const char * s,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwTypeError(const PosIdx pos, const char * s, const ExprLambda & fun, const Symbol s2,
|
void throwTypeError(const PosIdx pos, const char * s, const ExprLambda & fun, const Symbol s2,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwTypeError(const PosIdx pos, const Suggestions & suggestions, const char * s, const ExprLambda & fun, const Symbol s2,
|
void throwTypeError(const PosIdx pos, const Suggestions & suggestions, const char * s, const ExprLambda & fun, const Symbol s2,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwTypeError(const char * s, const Value & v,
|
void throwTypeError(const char * s, const Value & v,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
|
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwAssertionError(const PosIdx pos, const char * s, const std::string & s1,
|
void throwAssertionError(const PosIdx pos, const char * s, const std::string & s1,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
|
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwUndefinedVarError(const PosIdx pos, const char * s, const std::string & s1,
|
void throwUndefinedVarError(const PosIdx pos, const char * s, const std::string & s1,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
|
|
||||||
[[gnu::noinline, gnu::noreturn]]
|
[[gnu::noinline, gnu::noreturn]]
|
||||||
void throwMissingArgumentError(const PosIdx pos, const char * s, const std::string & s1,
|
void throwMissingArgumentError(const PosIdx pos, const char * s, const std::string & s1,
|
||||||
Env & env, Expr & expr) const;
|
Env & env, Expr & expr);
|
||||||
|
|
||||||
[[gnu::noinline]]
|
[[gnu::noinline]]
|
||||||
void addErrorTrace(Error & e, const char * s, const std::string & s2) const;
|
void addErrorTrace(Error & e, const char * s, const std::string & s2) const;
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace nix {
|
||||||
|
|
||||||
/* Launch the nix debugger */
|
/* Launch the nix debugger */
|
||||||
|
|
||||||
std::function<void(const EvalState & evalState,const Error * error, const Env & env, const Expr & expr)> debuggerHook;
|
std::function<void(EvalState & evalState,const Error * error, const Env & env, const Expr & expr)> debuggerHook;
|
||||||
|
|
||||||
/* Displaying abstract syntax trees. */
|
/* Displaying abstract syntax trees. */
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ MakeError(UndefinedVarError, Error);
|
||||||
MakeError(MissingArgumentError, EvalError);
|
MakeError(MissingArgumentError, EvalError);
|
||||||
MakeError(RestrictedPathError, Error);
|
MakeError(RestrictedPathError, Error);
|
||||||
|
|
||||||
extern std::function<void(const EvalState & evalState, const Error * error, const Env & env, const Expr & expr)> debuggerHook;
|
extern std::function<void(EvalState & evalState, const Error * error, const Env & env, const Expr & expr)> debuggerHook;
|
||||||
|
|
||||||
/* Position objects. */
|
/* Position objects. */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue