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

libexpr: Make getAttr a member function of EvalState

This commit is contained in:
Sergei Zimmerman 2025-05-25 15:14:31 +00:00
parent 128750225d
commit a76c76a9d5
No known key found for this signature in database
GPG key ID: A9B0B557CA632325
3 changed files with 25 additions and 25 deletions

View file

@ -2243,6 +2243,16 @@ bool EvalState::forceBool(Value & v, const PosIdx pos, std::string_view errorCtx
return v.boolean();
}
Bindings::const_iterator EvalState::getAttr(Symbol attrSym, const Bindings * attrSet, std::string_view errorCtx)
{
auto value = attrSet->find(attrSym);
if (value == attrSet->end()) {
error<TypeError>("attribute '%s' missing", symbols[attrSym])
.withTrace(noPos, errorCtx)
.debugThrow();
}
return value;
}
bool EvalState::isFunctor(const Value & fun) const
{