1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 02:21:16 +02:00

Add EvalState::getBuiltins

This commit is contained in:
Robert Hensing 2024-11-19 18:23:05 +01:00
parent a58e38dab7
commit 8a36d2d8a7
4 changed files with 43 additions and 2 deletions

View file

@ -523,13 +523,19 @@ Value * EvalState::addPrimOp(PrimOp && primOp)
}
Value & EvalState::getBuiltins()
{
return *baseEnv.values[0];
}
Value & EvalState::getBuiltin(const std::string & name)
{
auto it = baseEnv.values[0]->attrs()->get(symbols.create(name));
if (it)
return *it->value;
else
throw EvalError("builtin '%1%' not found", name);
error<EvalError>("builtin '%1%' not found", name).debugThrow();
}