* Builtin function `add' to add integers.
* Put common test functions in tests/lang/lib.nix.
This commit is contained in:
@@ -176,6 +176,16 @@ Path evalPath(EvalState & state, Expr e)
|
||||
}
|
||||
|
||||
|
||||
int evalInt(EvalState & state, Expr e)
|
||||
{
|
||||
e = evalExpr(state, e);
|
||||
int i;
|
||||
if (!matchInt(e, i))
|
||||
throw TypeError(format("value is %1% while an integer was expected") % showType(e));
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
bool evalBool(EvalState & state, Expr e)
|
||||
{
|
||||
e = evalExpr(state, e);
|
||||
|
||||
Reference in New Issue
Block a user