aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index d4593b5c0..9a6d414db 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -140,6 +140,15 @@ bool evalBool(EvalState & state, Expr e)
}
+ATermList evalList(EvalState & state, Expr e)
+{
+ e = evalExpr(state, e);
+ ATermList list;
+ if (!matchList(e, list)) throw Error("list expected");
+ return list;
+}
+
+
Expr evalExpr2(EvalState & state, Expr e)
{
Expr e1, e2, e3, e4;
@@ -336,6 +345,13 @@ Expr evalExpr2(EvalState & state, Expr e)
else throw Error("wrong argument types in `+' operator");
}
+ /* List concatenation. */
+ if (matchOpConcat(e, e1, e2)) {
+ ATermList l1 = evalList(state, e1);
+ ATermList l2 = evalList(state, e2);
+ return makeList(ATconcat(l1, l2));
+ }
+
/* Barf. */
throw badTerm("invalid expression", e);
}