about summary refs log tree commit diff
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 802b83aa160d..eaa4b4ea444c 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -134,6 +134,18 @@ ATerm expandRec(ATerm e, ATermList rbnds, ATermList nrbnds)
 }
 
 
+static Expr updateAttrs(Expr e1, Expr e2)
+{
+    /* Note: e1 and e2 should be in normal form. */
+
+    ATermMap attrs;
+    queryAllAttrs(e1, attrs);
+    queryAllAttrs(e2, attrs);
+
+    return makeAttrs(attrs);
+}
+
+
 string evalString(EvalState & state, Expr e)
 {
     e = evalExpr(state, e);
@@ -264,6 +276,10 @@ Expr evalExpr2(EvalState & state, Expr e)
     if (atMatch(m, e) >> "OpOr" >> e1 >> e2)
         return makeBool(evalBool(state, e1) || evalBool(state, e2));
 
+    /* Attribut set update (//). */
+    if (atMatch(m, e) >> "OpUpdate" >> e1 >> e2)
+        return updateAttrs(evalExpr(state, e1), evalExpr(state, e2));
+
     /* Barf. */
     throw badTerm("invalid expression", e);
 }