mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
traces: Add _NIX_DEVELOPER_SHOW_UNKNOWN_LOCATIONS
This commit is contained in:
parent
f1aeeea32b
commit
477bc617bb
1 changed files with 11 additions and 0 deletions
|
@ -155,6 +155,15 @@ static std::string indent(std::string_view indentFirst, std::string_view indentR
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A development aid for finding missing positions, to improve error messages. Example use:
|
||||||
|
*
|
||||||
|
* NIX_DEVELOPER_SHOW_UNKNOWN_LOCATIONS=1 _NIX_TEST_ACCEPT=1 make tests/lang.sh.test
|
||||||
|
* git diff -U20 tests
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static bool printUnknownLocations = getEnv("_NIX_DEVELOPER_SHOW_UNKNOWN_LOCATIONS").has_value();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a position, if it is known.
|
* Print a position, if it is known.
|
||||||
*
|
*
|
||||||
|
@ -170,6 +179,8 @@ static bool printPosMaybe(std::ostream & oss, std::string_view indent, const std
|
||||||
printCodeLines(oss, "", *pos, *loc);
|
printCodeLines(oss, "", *pos, *loc);
|
||||||
oss << "\n";
|
oss << "\n";
|
||||||
}
|
}
|
||||||
|
} else if (printUnknownLocations) {
|
||||||
|
oss << "\n" << indent << ANSI_BLUE << "at " ANSI_RED << "UNKNOWN LOCATION" << ANSI_NORMAL << "\n";
|
||||||
}
|
}
|
||||||
return hasPos;
|
return hasPos;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue