mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
ReactCommon/renderer/core: Migrate uses of NDEBUG to REACT_NATIVE_DEBUG + react_native_assert
Summary: For better cross-platform consistency, migrate usages of NDEBUG to REACT_NATIVE_DEBUG. See flags.h for explanation. Changelog: [Internal] Reviewed By: PeteTheHeat Differential Revision: D26695162 fbshipit-source-id: 5615355f76b9c78d0f8981b3443b7c5900939ede
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4326cb1527
commit
7f792c8376
@@ -80,6 +80,7 @@ fb_xplat_cxx_test(
|
||||
deps = [
|
||||
"//xplat/folly:molly",
|
||||
"//xplat/js/react-native-github/ReactCommon/react/renderer/element:element",
|
||||
react_native_xplat_target("react/debug:debug"),
|
||||
react_native_xplat_target("react/renderer/components/view:view"),
|
||||
react_native_xplat_target("react/renderer/components/scrollview:scrollview"),
|
||||
react_native_xplat_target("react/renderer/components/text:text"),
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "Sealable.h"
|
||||
|
||||
#include <react/debug/flags.h>
|
||||
#include <react/debug/react_native_assert.h>
|
||||
|
||||
namespace facebook {
|
||||
@@ -24,7 +25,7 @@ namespace react {
|
||||
* http://en.cppreference.com/w/cpp/language/rule_of_three
|
||||
*/
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef REACT_NATIVE_DEBUG
|
||||
|
||||
Sealable::Sealable() : sealed_(false) {}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include <react/debug/flags.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
@@ -42,8 +44,9 @@ namespace react {
|
||||
* must be prevented.
|
||||
*/
|
||||
|
||||
#ifdef NDEBUG
|
||||
#ifndef REACT_NATIVE_DEBUG
|
||||
|
||||
// Release-mode, production version
|
||||
class Sealable {
|
||||
public:
|
||||
inline void seal() const {}
|
||||
@@ -55,6 +58,7 @@ class Sealable {
|
||||
|
||||
#else
|
||||
|
||||
// Debug version
|
||||
class Sealable {
|
||||
public:
|
||||
Sealable();
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <react/debug/flags.h>
|
||||
#include <react/renderer/core/ConcreteShadowNode.h>
|
||||
#include <react/renderer/core/ShadowNode.h>
|
||||
#include <react/renderer/core/propsConversions.h>
|
||||
@@ -275,7 +276,7 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypesIncomplete) {
|
||||
EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42);
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef REACT_NATIVE_DEBUG
|
||||
TEST(RawPropsTest, handleRawPropsPrimitiveTypesIncorrectLookup) {
|
||||
const auto &raw = RawProps(folly::dynamic::object("intValue", (int)42));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user