mirror of
https://github.com/NixOS/nix
synced 2025-06-27 21:01:16 +02:00
position for stdin, string; (string) for trace; fix tests
This commit is contained in:
parent
6a420d672c
commit
0e49de6a2b
5 changed files with 60 additions and 38 deletions
|
@ -197,7 +197,22 @@ std::ostream & operator << (std::ostream & str, const Pos & pos)
|
|||
if (!pos)
|
||||
str << "undefined position";
|
||||
else
|
||||
str << (format(ANSI_BOLD "%1%" ANSI_NORMAL ":%2%:%3%") % (string) pos.file % pos.line % pos.column).str();
|
||||
{
|
||||
auto f = format(ANSI_BOLD "%1%" ANSI_NORMAL ":%2%:%3%");
|
||||
switch (pos.origin) {
|
||||
case foFile:
|
||||
f % (string) pos.file;
|
||||
break;
|
||||
case foStdin:
|
||||
case foString:
|
||||
f % "(string)";
|
||||
break;
|
||||
default:
|
||||
throw Error("unhandled Pos origin!");
|
||||
}
|
||||
str << (f % pos.line % pos.column).str();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue