Skip to content

Commit

Permalink
libnixt: return concrete value for nixt::selectOptions (#473)
Browse files Browse the repository at this point in the history
Fixes: #469
  • Loading branch information
inclyc authored Apr 28, 2024
1 parent 8b412c7 commit 598a2c3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions libnixt/include/nixt/Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ nix::Value &selectAttrPath(nix::EvalState &State, nix::Value &V,
std::vector<nix::Symbol>::const_iterator End);

/// \brief Select the option declaration list, \p V, dive into "submodules".
nix::Value &selectOptions(nix::EvalState &State, nix::Value &V,
std::vector<nix::Symbol>::const_iterator Begin,
std::vector<nix::Symbol>::const_iterator End);
nix::Value selectOptions(nix::EvalState &State, nix::Value &V,
std::vector<nix::Symbol>::const_iterator Begin,
std::vector<nix::Symbol>::const_iterator End);

inline nix::Value &selectOptions(nix::EvalState &State, nix::Value &V,
const std::vector<nix::Symbol> &AttrPath) {
inline nix::Value selectOptions(nix::EvalState &State, nix::Value &V,
const std::vector<nix::Symbol> &AttrPath) {
return selectOptions(State, V, AttrPath.begin(), AttrPath.end());
}

Expand Down
6 changes: 3 additions & 3 deletions libnixt/lib/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ nix::Value &nixt::selectAttrPath(nix::EvalState &State, nix::Value &V,
return selectAttrPath(State, Nested, ++Begin, End);
}

nix::Value &nixt::selectOptions(nix::EvalState &State, nix::Value &V,
std::vector<nix::Symbol>::const_iterator Begin,
std::vector<nix::Symbol>::const_iterator End) {
nix::Value nixt::selectOptions(nix::EvalState &State, nix::Value &V,
std::vector<nix::Symbol>::const_iterator Begin,
std::vector<nix::Symbol>::const_iterator End) {
if (Begin == End)
return V;

Expand Down
4 changes: 2 additions & 2 deletions nixd/lib/Eval/AttrSetProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void AttrSetProvider::onOptionInfo(
return;
}

nix::Value &Option = nixt::selectOptions(
nix::Value Option = nixt::selectOptions(
state(), Nixpkgs, nixt::toSymbols(state().symbols, AttrPath));

OptionInfoResponse R;
Expand All @@ -254,7 +254,7 @@ void AttrSetProvider::onOptionComplete(
const AttrPathCompleteParams &Params,
lspserver::Callback<OptionCompleteResponse> Reply) {
try {
nix::Value &Scope = nixt::selectOptions(
nix::Value Scope = nixt::selectOptions(
state(), Nixpkgs, nixt::toSymbols(state().symbols, Params.Scope));

state().forceValue(Scope, nix::noPos);
Expand Down

0 comments on commit 598a2c3

Please sign in to comment.