4feb7d9f71
Also move `SourcePath` into `libutil`. These changes allow `error.hh` and `error.cc` to access source path and position information, which we can use to produce better error messages (for example, we could consider omitting filenames when two or more consecutive stack frames originate from the same file).
24 lines
523 B
C++
24 lines
523 B
C++
#include "memory-input-accessor.hh"
|
|
#include "memory-source-accessor.hh"
|
|
#include "source-path.hh"
|
|
|
|
namespace nix {
|
|
|
|
struct MemoryInputAccessorImpl : MemoryInputAccessor, MemorySourceAccessor
|
|
{
|
|
SourcePath addFile(CanonPath path, std::string && contents) override
|
|
{
|
|
return {
|
|
ref(shared_from_this()),
|
|
MemorySourceAccessor::addFile(path, std::move(contents))
|
|
};
|
|
}
|
|
};
|
|
|
|
ref<MemoryInputAccessor> makeMemoryInputAccessor()
|
|
{
|
|
return make_ref<MemoryInputAccessorImpl>();
|
|
}
|
|
|
|
}
|