diff options
author | dramforever <dramforever@live.com> | 2023-01-30 23:56:27 +0800 |
---|---|---|
committer | dramforever <dramforever@live.com> | 2023-01-31 00:04:05 +0800 |
commit | 377d5eb38815d8290ab444c81c7826f46ba79844 (patch) | |
tree | ca4d2d06dbbd5744fb5815084e15a9d5752d822e /src/libcmd/installables.hh | |
parent | b26562c629604b76c58b789ee520581cc5549433 (diff) |
Installable::getCursors: Cleanup
- Clarify doc comments, Installables::getCursors returns non-empty
vector
- Use vector::at in Installable::getCursor instead of checking for empty
vector and throwing an exception with error message.
Diffstat (limited to 'src/libcmd/installables.hh')
-rw-r--r-- | src/libcmd/installables.hh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libcmd/installables.hh b/src/libcmd/installables.hh index d489315df..da6a3addd 100644 --- a/src/libcmd/installables.hh +++ b/src/libcmd/installables.hh @@ -103,9 +103,13 @@ struct Installable return {}; } + /* Get a cursor to each value this Installable could refer to. However + if none exists, throw exception instead of returning empty vector. */ virtual std::vector<ref<eval_cache::AttrCursor>> getCursors(EvalState & state); + /* Get the first and most preferred cursor this Installable could refer + to, or throw an exception if none exists. */ virtual ref<eval_cache::AttrCursor> getCursor(EvalState & state); @@ -193,8 +197,8 @@ struct InstallableFlake : InstallableValue std::pair<Value *, PosIdx> toValue(EvalState & state) override; - /* Get a cursor to every attrpath in getActualAttrPaths() that - exists. */ + /* Get a cursor to every attrpath in getActualAttrPaths() + that exists. However if none exists, throw an exception. */ std::vector<ref<eval_cache::AttrCursor>> getCursors(EvalState & state) override; |