diff --git a/src/lib/diff/gen-node.hpp b/src/lib/diff/gen-node.hpp index fb3d2d2ca..270b37f75 100644 --- a/src/lib/diff/gen-node.hpp +++ b/src/lib/diff/gen-node.hpp @@ -692,7 +692,7 @@ namespace diff{ /** * @return either the contents of a nested record's type field - * or the Rec::TYPE_NIL marker. + * or the util::BOTTOM_INDICATOR, when not a record. * @remarks this function never raises an error, even if the element * in fact doesn't constitute a nested scope. Effectively this * allows to "peek" into the contents to some degree. @@ -709,7 +709,7 @@ namespace diff{ } return nested? nested->getType() - : Rec::TYPE_NIL; + : util::BOTTOM_INDICATOR; } diff --git a/src/lib/diff/test-mutation-target.hpp b/src/lib/diff/test-mutation-target.hpp index fcc19449c..808f06a8b 100644 --- a/src/lib/diff/test-mutation-target.hpp +++ b/src/lib/diff/test-mutation-target.hpp @@ -133,18 +133,13 @@ namespace diff{ inline string render (DataCap const& content) { - class StringRenderer - : public string - , public Variant::Visitor + struct StringRenderer + : public Variant::Visitor { - void - renderAs (string const& representation) - { - string::operator= (representation); - } + string representation{""}; #define STRINGIFY_CONTENT(_TY_) \ - virtual void handle (_TY_& val) override { renderAs (util::toString (val)); } + virtual void handle (_TY_& val) override { representation = util::toString (val); } STRINGIFY_CONTENT (int) STRINGIFY_CONTENT (int64_t) @@ -164,22 +159,22 @@ namespace diff{ virtual void handle (Rec & rec) override { - renderAs (renderRecord (rec)); + representation = renderRecord (rec); } virtual void handle (RecRef & ref) override { if (ref) - renderAs (renderRecord (ref)); + representation = renderRecord (ref); else - renderAs (util::BOTTOM_INDICATOR); + representation = util::BOTTOM_INDICATOR; } }; StringRenderer visitor; unConst(content).accept (visitor); - return string(visitor); + return visitor.representation; } }//(End)diagnostic helpers diff --git a/tests/library/diff/diff-virtualised-application-test.cpp b/tests/library/diff/diff-virtualised-application-test.cpp index e2d964389..5de017cb6 100644 --- a/tests/library/diff/diff-virtualised-application-test.cpp +++ b/tests/library/diff/diff-virtualised-application-test.cpp @@ -46,6 +46,7 @@ using std::make_unique; using std::string; using std::vector; using lib::time::Time; +using util::BOTTOM_INDICATOR; namespace lib { @@ -166,6 +167,10 @@ namespace test{ { return not spec.isNamed(); // »Selector« : accept anything unnamed value-like }) + .constructFrom ([&](GenNode const& spec) -> string + { + return string(spec); + }) .assignElement ([&](string& target, GenNode const& spec) -> bool { target = render(spec.data); @@ -174,7 +179,7 @@ namespace test{ .attach (collection(nestedObj_) .isApplicableIf ([&](GenNode const& spec) -> bool { - return type_ == spec.data.recordType(); // »Selector« : require object-like sub scope with matching typeID + return BOTTOM_INDICATOR != spec.data.recordType(); // »Selector« : require object-like sub scope }) .constructFrom ([&](GenNode const& spec) -> Opaque {