mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 15:26:17 +02:00
commit
5c05c238e6
3 changed files with 17 additions and 0 deletions
|
@ -861,6 +861,14 @@ x: x + 456</programlisting>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry><term><function>builtins.isPath</function>
|
||||||
|
<replaceable>e</replaceable></term>
|
||||||
|
|
||||||
|
<listitem><para>Return <literal>true</literal> if
|
||||||
|
<replaceable>e</replaceable> evaluates to a path, and
|
||||||
|
<literal>false</literal> otherwise.</para></listitem>
|
||||||
|
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry xml:id='builtin-isNull'>
|
<varlistentry xml:id='builtin-isNull'>
|
||||||
<term><function>isNull</function>
|
<term><function>isNull</function>
|
||||||
|
|
|
@ -315,6 +315,12 @@ static void prim_isBool(EvalState & state, const Pos & pos, Value * * args, Valu
|
||||||
mkBool(v, args[0]->type == tBool);
|
mkBool(v, args[0]->type == tBool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Determine whether the argument is a path. */
|
||||||
|
static void prim_isPath(EvalState & state, const Pos & pos, Value * * args, Value & v)
|
||||||
|
{
|
||||||
|
state.forceValue(*args[0]);
|
||||||
|
mkBool(v, args[0]->type == tPath);
|
||||||
|
}
|
||||||
|
|
||||||
struct CompareValues
|
struct CompareValues
|
||||||
{
|
{
|
||||||
|
@ -2169,6 +2175,7 @@ void EvalState::createBaseEnv()
|
||||||
addPrimOp("__isInt", 1, prim_isInt);
|
addPrimOp("__isInt", 1, prim_isInt);
|
||||||
addPrimOp("__isFloat", 1, prim_isFloat);
|
addPrimOp("__isFloat", 1, prim_isFloat);
|
||||||
addPrimOp("__isBool", 1, prim_isBool);
|
addPrimOp("__isBool", 1, prim_isBool);
|
||||||
|
addPrimOp("__isPath", 1, prim_isPath);
|
||||||
addPrimOp("__genericClosure", 1, prim_genericClosure);
|
addPrimOp("__genericClosure", 1, prim_genericClosure);
|
||||||
addPrimOp("abort", 1, prim_abort);
|
addPrimOp("abort", 1, prim_abort);
|
||||||
addPrimOp("__addErrorContext", 2, prim_addErrorContext);
|
addPrimOp("__addErrorContext", 2, prim_addErrorContext);
|
||||||
|
|
|
@ -20,6 +20,8 @@ with builtins;
|
||||||
(isFloat (1 - 2.0))
|
(isFloat (1 - 2.0))
|
||||||
(isBool (true && false))
|
(isBool (true && false))
|
||||||
(isBool null)
|
(isBool null)
|
||||||
|
(isPath /nix/store)
|
||||||
|
(isPath ./.)
|
||||||
(isAttrs { x = 123; })
|
(isAttrs { x = 123; })
|
||||||
(isAttrs null)
|
(isAttrs null)
|
||||||
(typeOf (3 * 4))
|
(typeOf (3 * 4))
|
||||||
|
|
Loading…
Reference in a new issue