Rename findDerivationFilename -> findPackageFilename

It does not operate on a derivation and does not return a
derivation path. Instead it works at the language level,
where a distinct term "package" is more appropriate to
distinguish the parent object of `meta.position`; an
attribute which doesn't even make it into the derivation.
This commit is contained in:
Robert Hensing 2021-07-19 18:07:17 +02:00
parent 58cb411db6
commit ad24921de8
4 changed files with 4 additions and 4 deletions

View file

@ -100,7 +100,7 @@ std::pair<Value *, Pos> findAlongAttrPath(EvalState & state, const string & attr
} }
Pos findDerivationFilename(EvalState & state, Value & v, std::string what) Pos findPackageFilename(EvalState & state, Value & v, std::string what)
{ {
Value * v2; Value * v2;
try { try {

View file

@ -14,7 +14,7 @@ std::pair<Value *, Pos> findAlongAttrPath(EvalState & state, const string & attr
Bindings & autoArgs, Value & vIn); Bindings & autoArgs, Value & vIn);
/* Heuristic to find the filename and lineno or a nix value. */ /* Heuristic to find the filename and lineno or a nix value. */
Pos findDerivationFilename(EvalState & state, Value & v, std::string what); Pos findPackageFilename(EvalState & state, Value & v, std::string what);
std::vector<Symbol> parseAttrPath(EvalState & state, std::string_view s); std::vector<Symbol> parseAttrPath(EvalState & state, std::string_view s);

View file

@ -31,7 +31,7 @@ struct CmdEdit : InstallableCommand
auto [v, pos] = installable->toValue(*state); auto [v, pos] = installable->toValue(*state);
try { try {
pos = findDerivationFilename(*state, *v, installable->what()); pos = findPackageFilename(*state, *v, installable->what());
} catch (NoPositionInfo &) { } catch (NoPositionInfo &) {
} }

View file

@ -454,7 +454,7 @@ bool NixRepl::processLine(string line)
pos = v.lambda.fun->pos; pos = v.lambda.fun->pos;
} else { } else {
// assume it's a derivation // assume it's a derivation
pos = findDerivationFilename(*state, v, arg); pos = findPackageFilename(*state, v, arg);
} }
// Open in EDITOR // Open in EDITOR