diff --git a/src/lib/diff/test-mutation-target.hpp b/src/lib/diff/test-mutation-target.hpp index 87a36421d..892931745 100644 --- a/src/lib/diff/test-mutation-target.hpp +++ b/src/lib/diff/test-mutation-target.hpp @@ -402,11 +402,11 @@ namespace diff{ * that a new child element is * being inserted at current position */ - virtual void + virtual bool injectNew (GenNode const& n) override { target_.inject (GenNode{n}, "injectNew"); - PAR::injectNew (n); + return PAR::injectNew (n); } virtual bool diff --git a/src/lib/diff/tree-mutator-attribute-binding.hpp b/src/lib/diff/tree-mutator-attribute-binding.hpp index 9a69edc55..1a3c0e878 100644 --- a/src/lib/diff/tree-mutator-attribute-binding.hpp +++ b/src/lib/diff/tree-mutator-attribute-binding.hpp @@ -141,18 +141,15 @@ * present in the class definition underlying this binding. In such * a case, we just assign the given value. This implementation leeway * is deliberate to support classes with optional / defaultable properties. - * @throw error::Invalid on attempt to insert an unknown attribute / field. */ - virtual void + virtual bool injectNew (GenNode const& spec) override { if (not isApplicable(spec)) - PAR::injectNew(spec); ////////////////////////////////////////TODO change interface, so we can find out if anyone was able to handle this request. This allows us then to throw otherwise - else - { - change_(spec.data.get()); - // return true; - } + return PAR::injectNew(spec); + + change_(spec.data.get()); + return true; } /** has no meaning, since object fields have no notion of "order". @@ -195,11 +192,9 @@ { if (not isApplicable(spec)) return PAR::assignElm(spec); - else - { - change_(spec.data.get()); - return true; - } + + change_(spec.data.get()); + return true; } /** locate the designated target element and build a suitable diff --git a/src/lib/diff/tree-mutator-collection-binding.hpp b/src/lib/diff/tree-mutator-collection-binding.hpp index db93c23e8..c0eef8e2b 100644 --- a/src/lib/diff/tree-mutator-collection-binding.hpp +++ b/src/lib/diff/tree-mutator-collection-binding.hpp @@ -218,10 +218,11 @@ * and insert it at current position * into the target sequence. */ - virtual void + virtual bool injectNew (GenNode const& n) override { binding_.inject (binding_.construct(n)); + return true; /////////////////////////////////////////////////////////TODO with all these operations: need to invoke selector and possibly delegate to parent.... } virtual bool diff --git a/src/lib/diff/tree-mutator.hpp b/src/lib/diff/tree-mutator.hpp index 3c8d66c90..a727a3153 100644 --- a/src/lib/diff/tree-mutator.hpp +++ b/src/lib/diff/tree-mutator.hpp @@ -214,11 +214,13 @@ namespace diff{ // do nothing by default } - /** establish new element at current position */ - virtual void + /** establish new element at current position + * @return `true` when successfully inserted something */ + virtual bool injectNew (GenNode const&) { // do nothing by default + return false; } /** ensure the next source element matches with given spec */ diff --git a/tests/library/diff/tree-mutator-binding-test.cpp b/tests/library/diff/tree-mutator-binding-test.cpp index bface56a9..5aebf81e2 100644 --- a/tests/library/diff/tree-mutator-binding-test.cpp +++ b/tests/library/diff/tree-mutator-binding-test.cpp @@ -56,7 +56,6 @@ namespace diff{ namespace test{ using lumiera::error::LUMIERA_ERROR_LOGIC; - using lumiera::error::LUMIERA_ERROR_INVALID; namespace {//Test fixture.... @@ -726,7 +725,7 @@ namespace test{ CHECK (-1 == beta); CHECK (3.45 == gamma); - VERIFY_ERROR (INVALID, mutator1.injectNew (ATTRIB2)); // ...because we didn't define a binding for ATTRIB2 (aka "beta") + CHECK (not mutator1.injectNew (ATTRIB2)); // ...because we didn't define a binding for ATTRIB2 (aka "beta") // any changes to something other than attributes are just delegated to the next "onion layer" // since in this case here, there is only one layer (our attribute binding), these other changes will be silently ignored diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index d8b7ca912..200b29556 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -3967,6 +3967,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +