1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 04:00:59 +01:00

Merged R8864

This commit is contained in:
Wouter den Breejen 2007-10-08 10:26:21 +00:00
parent 854e155b2c
commit 546ca6e8bc
17 changed files with 113 additions and 50 deletions

View file

@ -116,6 +116,18 @@ static Expr prim_isNull(EvalState & state, const ATermVector & args)
}
/* Determine whether the argument is a function. */
static Expr prim_isFunction(EvalState & state, const ATermVector & args)
{
Expr e = evalExpr(state, args[0]);
ATermList formals;
ATerm name, body, pos;
return makeBool(
matchFunction(e, formals, body, pos) ||
matchFunction1(e, name, body, pos));
}
static Path findDependency(Path dir, string dep)
{
if (dep[0] == '/') throw EvalError(
@ -1032,6 +1044,7 @@ void EvalState::addPrimOps()
// Miscellaneous
addPrimOp("import", 1, prim_import);
addPrimOp("isNull", 1, prim_isNull);
addPrimOp("__isFunction", 1, prim_isFunction);
addPrimOp("dependencyClosure", 1, prim_dependencyClosure);
addPrimOp("abort", 1, prim_abort);
addPrimOp("throw", 1, prim_throw);