diff --git a/ReactCommon/fabric/uimanager/TreeMutationInstruction.cpp b/ReactCommon/fabric/uimanager/TreeMutationInstruction.cpp index c5f074537..630e13202 100644 --- a/ReactCommon/fabric/uimanager/TreeMutationInstruction.cpp +++ b/ReactCommon/fabric/uimanager/TreeMutationInstruction.cpp @@ -150,6 +150,21 @@ std::string TreeMutationInstruction::getDebugName() const { } }; +std::string TreeMutationInstruction::getDebugValue() const { + switch (type_) { + case Creation: + return "[*" + folly::to(newChildNode_->getTag()) + "]"; + case Deletion: + return "[~" + folly::to(oldChildNode_->getTag()) + "]"; + case Insertion: + return "[" + folly::to(newChildNode_->getTag()) + "->" + folly::to(parentNode_->getTag()) + "]"; + case Removal: + return "[" + folly::to(oldChildNode_->getTag()) + "<~" + folly::to(parentNode_->getTag()) + "]"; + case Replacement: + return "[=" + folly::to(oldChildNode_->getTag()) + "]"; + } +}; + SharedDebugStringConvertibleList TreeMutationInstruction::getDebugProps() const { DebugStringConvertibleOptions options = {.maximumDepth = 1, .format = false}; @@ -176,7 +191,7 @@ SharedDebugStringConvertibleList TreeMutationInstruction::getDebugProps() const }; case Replacement: return SharedDebugStringConvertibleList { - std::make_shared("parentNode", parentNode_->getDebugDescription(options)), + std::make_shared("parentNode", parentNode_ ? parentNode_->getDebugDescription(options) : "nullptr"), std::make_shared("oldChildNode", oldChildNode_->getDebugDescription(options)), std::make_shared("newChildNode", newChildNode_->getDebugDescription(options)), std::make_shared("index", folly::to(index_)) diff --git a/ReactCommon/fabric/uimanager/TreeMutationInstruction.h b/ReactCommon/fabric/uimanager/TreeMutationInstruction.h index 920cd27f8..c27e6f71f 100644 --- a/ReactCommon/fabric/uimanager/TreeMutationInstruction.h +++ b/ReactCommon/fabric/uimanager/TreeMutationInstruction.h @@ -96,6 +96,7 @@ public: #pragma mark - DebugStringConvertible std::string getDebugName() const override; + std::string getDebugValue() const override; SharedDebugStringConvertibleList getDebugProps() const override; private: