mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: More precondition asserts in ConcreteShadowNode
Summary: That should help to fail early in situations when we lose critical class data members. Reviewed By: sammy-SC Differential Revision: D16179539 fbshipit-source-id: da73b81568c2f3657b9bc2bd1cc7ee6624e75626
This commit is contained in:
committed by
Facebook Github Bot
parent
e97a2a8535
commit
27009c1031
@@ -80,8 +80,11 @@ class ConcreteShadowNode : public ShadowNode {
|
||||
}
|
||||
|
||||
const SharedConcreteProps getProps() const {
|
||||
assert(std::dynamic_pointer_cast<const PropsT>(props_));
|
||||
return std::static_pointer_cast<const PropsT>(props_);
|
||||
assert(props_ && "Props must not be `nullptr`.");
|
||||
assert(
|
||||
std::dynamic_pointer_cast<ConcreteProps const>(props_) &&
|
||||
"Props must be an instance of ConcreteProps class.");
|
||||
return std::static_pointer_cast<ConcreteProps const>(props_);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -89,7 +92,11 @@ class ConcreteShadowNode : public ShadowNode {
|
||||
* Thread-safe after the node is sealed.
|
||||
*/
|
||||
ConcreteStateData const &getStateData() const {
|
||||
return std::static_pointer_cast<const ConcreteState>(state_)->getData();
|
||||
assert(state_ && "State must not be `nullptr`.");
|
||||
assert(
|
||||
std::dynamic_pointer_cast<ConcreteState const>(state_) &&
|
||||
"State must be an instance of ConcreteState class.");
|
||||
return std::static_pointer_cast<ConcreteState const>(state_)->getData();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user