From 22f06dca23ea90cece12b75896b33d49d11a5b74 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 4 Oct 2016 03:24:44 +0200 Subject: [PATCH] Bugfix: must init TreeMutator explicitly now as consequence of previous fix. Also, when building the preconfigured TreeMutator for GenNode, the init hook must be called explicitly now. --- src/lib/diff/tree-diff-application.hpp | 2 +- src/lib/diff/tree-mutator-collection-binding.hpp | 1 + tests/library/diff/tree-mutator-test.cpp | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/diff/tree-diff-application.hpp b/src/lib/diff/tree-diff-application.hpp index 8c3415d38..642cd9d09 100644 --- a/src/lib/diff/tree-diff-application.hpp +++ b/src/lib/diff/tree-diff-application.hpp @@ -379,7 +379,7 @@ namespace diff{ using Target = typename TreeDiffTraits::Ret; Target target = mutatorBinding (subject_); - buildMutator (target)->init(); + buildMutator(target)->init(); TreeDiffMutatorBinding::scopeManger_ = &scopes_; TreeDiffMutatorBinding::treeMutator_ = &scopes_.currentScope(); REQUIRE (this->treeMutator_); diff --git a/src/lib/diff/tree-mutator-collection-binding.hpp b/src/lib/diff/tree-mutator-collection-binding.hpp index e2c1654fc..a556519fb 100644 --- a/src/lib/diff/tree-mutator-collection-binding.hpp +++ b/src/lib/diff/tree-mutator-collection-binding.hpp @@ -654,6 +654,7 @@ namespace diff{ { mutateInPlace (target.data.get()) .buildMutator(buff); + buff.get()->init(); return true; } else diff --git a/tests/library/diff/tree-mutator-test.cpp b/tests/library/diff/tree-mutator-test.cpp index f1104fec4..34ceb4b87 100644 --- a/tests/library/diff/tree-mutator-test.cpp +++ b/tests/library/diff/tree-mutator-test.cpp @@ -89,6 +89,8 @@ namespace test{ << " type="<< typeStr(mutator) << endl; + mutator.init(); + CHECK (isnil (localData)); string testValue{"that would be acceptable"}; mutator.assignElm ({"lore", testValue}); @@ -120,6 +122,8 @@ namespace test{ << " type="<< typeStr(mutator) << endl; + mutator.init(); + CHECK (isnil (values)); CHECK (mutator.matchSrc (GenNode("a"))); mutator.skipSrc (GenNode("a"));