diff --git a/src/lib/diff/tree-mutator.hpp b/src/lib/diff/tree-mutator.hpp index 072c7409b..f0bb4713c 100644 --- a/src/lib/diff/tree-mutator.hpp +++ b/src/lib/diff/tree-mutator.hpp @@ -77,7 +77,6 @@ namespace diff{ template class Builder; - ////////TODO only preliminary.... typedef Literal ID; using Attribute = DataCap; } @@ -124,11 +123,7 @@ namespace diff{ UNIMPLEMENTED("expose a recursive TreeMutator to transform the denoted child"); } - virtual void - setAttribute (ID id, Attribute& newValue) - { - std::cout << "Empty Base Impl: apply a value change to the named attribute"< change_; virtual void setAttribute (ID id, Attribute& newValue) { - // Decorator-style chained invocation of inherited implementation - PAR::setAttribute(id, newValue); + if (id == attribID_) + change_(newValue.get()); - change_(newValue.get()); + else // delegate to other closures (Decorator-style) + PAR::setAttribute(id, newValue); } - ChangeOperation(function clo, PAR const& chain) + ChangeOperation(ID id, function clo, PAR const& chain) : PAR(chain) + , attribID_(id) , change_(clo) { } }; @@ -177,7 +175,7 @@ namespace diff{ Builder change (Literal attributeID, function closure) { - return Change (closure, *this); + return Change (attributeID, closure, *this); } }; diff --git a/tests/15library.tests b/tests/15library.tests index ec70b550a..d9720dd6b 100644 --- a/tests/15library.tests +++ b/tests/15library.tests @@ -222,7 +222,10 @@ return: 0 END -PLANNED "GenericTreeMutator_test" GenericTreeMutator_test <