1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 03:56:01 +01:00

Merge pull request #14231 from roberth/code-docs

Code docs
This commit is contained in:
John Ericson 2025-10-13 15:05:30 +00:00 committed by GitHub
commit 3f876bcb61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 4 deletions

View file

@ -508,8 +508,15 @@ private:
public: public:
/**
* @param lookupPath Only used during construction.
* @param store The store to use for instantiation
* @param fetchSettings Must outlive the lifetime of this EvalState!
* @param settings Must outlive the lifetime of this EvalState!
* @param buildStore The store to use for builds ("import from derivation", C API `nix_string_realise`)
*/
EvalState( EvalState(
const LookupPath & _lookupPath, const LookupPath & lookupPath,
ref<Store> store, ref<Store> store,
const fetchers::Settings & fetchSettings, const fetchers::Settings & fetchSettings,
const EvalSettings & settings, const EvalSettings & settings,

View file

@ -192,13 +192,27 @@ public:
err.traces.push_front(trace); err.traces.push_front(trace);
} }
/**
* Prepends an item to the error trace, as is usual for extra context.
*
* @param pos Nullable source position to put in trace item
* @param fs Format string, see `HintFmt`
* @param args... Format string arguments.
*/
template<typename... Args> template<typename... Args>
void addTrace(std::shared_ptr<const Pos> && e, std::string_view fs, const Args &... args) void addTrace(std::shared_ptr<const Pos> && pos, std::string_view fs, const Args &... args)
{ {
addTrace(std::move(e), HintFmt(std::string(fs), args...)); addTrace(std::move(pos), HintFmt(std::string(fs), args...));
} }
void addTrace(std::shared_ptr<const Pos> && e, HintFmt hint, TracePrint print = TracePrint::Default); /**
* Prepends an item to the error trace, as is usual for extra context.
*
* @param pos Nullable source position to put in trace item
* @param hint Formatted error message
* @param print Optional, whether to always print (used by `addErrorContext`)
*/
void addTrace(std::shared_ptr<const Pos> && pos, HintFmt hint, TracePrint print = TracePrint::Default);
bool hasTrace() const bool hasTrace() const
{ {