diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-09-22 15:29:21 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-09-22 15:29:21 +0000 |
commit | 2ab4bc44c780d2e28647f7559664675b756f38b9 (patch) | |
tree | 39ecb0e001cf6c031e15b0246559b3f8f7a06ed9 /src/libexpr/eval.cc | |
parent | d315210612a8d5eb52654407903544b72222130b (diff) |
* Builtin function `add' to add integers.
* Put common test functions in tests/lang/lib.nix.
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r-- | src/libexpr/eval.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 02df4a4a3..3334e4bbd 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -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); |