mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Add :doc support for __functor
This commit is contained in:
parent
6068e32aa7
commit
72a4d1f52d
5 changed files with 232 additions and 0 deletions
|
@ -616,6 +616,20 @@ std::optional<EvalState::Doc> EvalState::getDoc(Value & v)
|
|||
strdup(ss.data()),
|
||||
};
|
||||
}
|
||||
if (isFunctor(v)) {
|
||||
try {
|
||||
Value & functor = *v.attrs()->find(sFunctor)->value;
|
||||
Value * vp = &v;
|
||||
Value partiallyApplied;
|
||||
callFunction(functor, 1, &vp, partiallyApplied, noPos);
|
||||
auto _level = addCallDepth(noPos);
|
||||
return getDoc(partiallyApplied);
|
||||
}
|
||||
catch (Error & e) {
|
||||
e.addTrace(nullptr, "while partially calling '%1%' to retrieve documentation", "__functor");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue