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

Origin: Use SourcePath

This commit is contained in:
Eelco Dolstra 2023-04-06 15:25:06 +02:00
parent 94812cca98
commit a9759407e5
9 changed files with 22 additions and 23 deletions

View file

@ -31,9 +31,9 @@ struct PosAdapter : AbstractPos
// Get rid of the null terminators added by the parser.
return std::string(s.source->c_str());
},
[](const Path & path) -> std::optional<std::string> {
[](const SourcePath & path) -> std::optional<std::string> {
try {
return readFile(path);
return path.readFile();
} catch (Error &) {
return std::nullopt;
}
@ -47,7 +47,7 @@ struct PosAdapter : AbstractPos
[&](const Pos::none_tag &) { out << "«none»"; },
[&](const Pos::Stdin &) { out << "«stdin»"; },
[&](const Pos::String & s) { out << "«string»"; },
[&](const Path & path) { out << path; }
[&](const SourcePath & path) { out << path; }
}, origin);
}
};