tidy up debugtraces
This commit is contained in:
parent
1b6b33d43d
commit
a4d8a799b7
|
@ -1151,14 +1151,14 @@ void EvalState::cacheFile(
|
||||||
fileParseCache[resolvedPath] = e;
|
fileParseCache[resolvedPath] = e;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::unique_ptr<DebugTraceStacker> dts =
|
auto dts =
|
||||||
debuggerHook ?
|
debuggerHook ?
|
||||||
makeDebugTraceStacker(
|
makeDebugTraceStacker(
|
||||||
*this,
|
*this,
|
||||||
*e,
|
*e,
|
||||||
(e->getPos() ? std::optional(ErrPos(*e->getPos())) : std::nullopt),
|
(e->getPos() ? std::optional(ErrPos(*e->getPos())) : std::nullopt),
|
||||||
"while evaluating the file '%1%':", resolvedPath)
|
"while evaluating the file '%1%':", resolvedPath)
|
||||||
: std::unique_ptr<DebugTraceStacker>();
|
: nullptr;
|
||||||
|
|
||||||
// Enforce that 'flake.nix' is a direct attrset, not a
|
// Enforce that 'flake.nix' is a direct attrset, not a
|
||||||
// computation.
|
// computation.
|
||||||
|
@ -1384,7 +1384,7 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
|
||||||
e->eval(state, env, vTmp);
|
e->eval(state, env, vTmp);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::unique_ptr<DebugTraceStacker> dts =
|
auto dts =
|
||||||
debuggerHook ?
|
debuggerHook ?
|
||||||
makeDebugTraceStacker(
|
makeDebugTraceStacker(
|
||||||
state,
|
state,
|
||||||
|
@ -1392,7 +1392,7 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
|
||||||
*pos2,
|
*pos2,
|
||||||
"while evaluating the attribute '%1%'",
|
"while evaluating the attribute '%1%'",
|
||||||
showAttrPath(state, env, attrPath))
|
showAttrPath(state, env, attrPath))
|
||||||
: std::unique_ptr<DebugTraceStacker>();
|
: nullptr;
|
||||||
|
|
||||||
for (auto & i : attrPath) {
|
for (auto & i : attrPath) {
|
||||||
state.nrLookups++;
|
state.nrLookups++;
|
||||||
|
@ -1536,14 +1536,14 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value &
|
||||||
|
|
||||||
/* Evaluate the body. */
|
/* Evaluate the body. */
|
||||||
try {
|
try {
|
||||||
std::unique_ptr<DebugTraceStacker> dts =
|
auto dts =
|
||||||
debuggerHook ?
|
debuggerHook ?
|
||||||
makeDebugTraceStacker(*this, *lambda.body, lambda.pos,
|
makeDebugTraceStacker(*this, *lambda.body, lambda.pos,
|
||||||
"while evaluating %s",
|
"while evaluating %s",
|
||||||
(lambda.name.set()
|
(lambda.name.set()
|
||||||
? "'" + (string) lambda.name + "'"
|
? "'" + (string) lambda.name + "'"
|
||||||
: "anonymous lambda"))
|
: "anonymous lambda"))
|
||||||
: std::unique_ptr<DebugTraceStacker>();
|
: nullptr;
|
||||||
|
|
||||||
lambda.body->eval(*this, env2, vCur);
|
lambda.body->eval(*this, env2, vCur);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
|
@ -1939,14 +1939,14 @@ void EvalState::forceValueDeep(Value & v)
|
||||||
for (auto & i : *v.attrs)
|
for (auto & i : *v.attrs)
|
||||||
try {
|
try {
|
||||||
|
|
||||||
std::unique_ptr<DebugTraceStacker> dts =
|
auto dts =
|
||||||
debuggerHook ?
|
debuggerHook ?
|
||||||
// if the value is a thunk, we're evaling. otherwise no trace necessary.
|
// if the value is a thunk, we're evaling. otherwise no trace necessary.
|
||||||
(i.value->isThunk() ?
|
(i.value->isThunk() ?
|
||||||
makeDebugTraceStacker(*this, *v.thunk.expr, *i.pos,
|
makeDebugTraceStacker(*this, *v.thunk.expr, *i.pos,
|
||||||
"while evaluating the attribute '%1%'", i.name)
|
"while evaluating the attribute '%1%'", i.name)
|
||||||
: std::unique_ptr<DebugTraceStacker>())
|
: nullptr)
|
||||||
: std::unique_ptr<DebugTraceStacker>();
|
: nullptr;
|
||||||
|
|
||||||
recurse(*i.value);
|
recurse(*i.value);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
|
|
Loading…
Reference in a new issue