Convert most Fabric Cxx code to use react_native_assert instead of assert

Summary:
See react_native_assert.{h,cpp}. Because of the BUCK+Android issue where NDEBUG is always defined, we use react_native_assert instead of assert to enable xplat asserts in debug/dev mode.

This migrates most of the codebase, but probably not 100%. The goal is to increase assertion coverage on Android, not to get to 100% (yet).

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D26562866

fbshipit-source-id: a7bf2055b973e1d3650ed8d68a6d02d556604af9
This commit is contained in:
Joshua Gross
2021-02-19 20:52:52 -08:00
committed by Facebook GitHub Bot
parent 2d51f4b499
commit b3930f935f
56 changed files with 293 additions and 201 deletions
@@ -7,6 +7,8 @@
#include "AttributedStringBox.h"
#include <react/debug/react_native_assert.h>
namespace facebook {
namespace react {
@@ -37,14 +39,14 @@ AttributedStringBox::Mode AttributedStringBox::getMode() const {
}
AttributedString const &AttributedStringBox::getValue() const {
assert(mode_ == AttributedStringBox::Mode::Value);
assert(value_);
react_native_assert(mode_ == AttributedStringBox::Mode::Value);
react_native_assert(value_);
return *value_;
}
std::shared_ptr<void> AttributedStringBox::getOpaquePointer() const {
assert(mode_ == AttributedStringBox::Mode::OpaquePointer);
assert(opaquePointer_);
react_native_assert(mode_ == AttributedStringBox::Mode::OpaquePointer);
react_native_assert(opaquePointer_);
return opaquePointer_;
}