mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-08 09:37:21 +08:00
Fabric: Improved prettyprinting of TreeMutationInstruction
Summary: @public Quite trivial... and nice. Reviewed By: mdvacca Differential Revision: D8709951 fbshipit-source-id: 63e53eb85361fe3a0a0ecd7f21bf4c7db049d5bf
This commit is contained in:
committed by
Facebook Github Bot
parent
de09fd53bd
commit
e0e9c1549e
@@ -150,6 +150,21 @@ std::string TreeMutationInstruction::getDebugName() const {
|
||||
}
|
||||
};
|
||||
|
||||
std::string TreeMutationInstruction::getDebugValue() const {
|
||||
switch (type_) {
|
||||
case Creation:
|
||||
return "[*" + folly::to<std::string>(newChildNode_->getTag()) + "]";
|
||||
case Deletion:
|
||||
return "[~" + folly::to<std::string>(oldChildNode_->getTag()) + "]";
|
||||
case Insertion:
|
||||
return "[" + folly::to<std::string>(newChildNode_->getTag()) + "->" + folly::to<std::string>(parentNode_->getTag()) + "]";
|
||||
case Removal:
|
||||
return "[" + folly::to<std::string>(oldChildNode_->getTag()) + "<~" + folly::to<std::string>(parentNode_->getTag()) + "]";
|
||||
case Replacement:
|
||||
return "[=" + folly::to<std::string>(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<DebugStringConvertibleItem>("parentNode", parentNode_->getDebugDescription(options)),
|
||||
std::make_shared<DebugStringConvertibleItem>("parentNode", parentNode_ ? parentNode_->getDebugDescription(options) : "nullptr"),
|
||||
std::make_shared<DebugStringConvertibleItem>("oldChildNode", oldChildNode_->getDebugDescription(options)),
|
||||
std::make_shared<DebugStringConvertibleItem>("newChildNode", newChildNode_->getDebugDescription(options)),
|
||||
std::make_shared<DebugStringConvertibleItem>("index", folly::to<std::string>(index_))
|
||||
|
||||
@@ -96,6 +96,7 @@ public:
|
||||
#pragma mark - DebugStringConvertible
|
||||
|
||||
std::string getDebugName() const override;
|
||||
std::string getDebugValue() const override;
|
||||
SharedDebugStringConvertibleList getDebugProps() const override;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user