1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 10:31:15 +02:00

Introduce AbstractPos

This commit is contained in:
Eelco Dolstra 2022-07-05 15:58:04 +02:00
parent a04ca0a522
commit 9e9170a92e
21 changed files with 158 additions and 182 deletions

View file

@ -210,17 +210,16 @@ static std::ostream & showDebugTrace(std::ostream & out, const PosTable & positi
out << dt.hint.str() << "\n";
// prefer direct pos, but if noPos then try the expr.
auto pos = *dt.pos
? *dt.pos
: positions[dt.expr.getPos() ? dt.expr.getPos() : noPos];
auto pos = dt.pos
? dt.pos
: (std::shared_ptr<AbstractPos>) positions[dt.expr.getPos() ? dt.expr.getPos() : noPos];
if (pos) {
printAtPos(pos, out);
pos->print(out);
auto loc = getCodeLines(pos);
if (loc.has_value()) {
if (auto loc = pos->getCodeLines()) {;
out << "\n";
printCodeLines(out, "", pos, *loc);
printCodeLines(out, "", *pos, *loc);
out << "\n";
}
}