mirror of
https://github.com/NixOS/nix
synced 2025-06-25 02:21:16 +02:00
Add EvalState::getBuiltins
This commit is contained in:
parent
a58e38dab7
commit
8a36d2d8a7
4 changed files with 43 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue