mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-26 05:15:49 +08:00
Disable RCTAssert completely in production builds
Reviewed By: @tadeuzagallo, @jspahrsummers Differential Revision: D2521700 fb-gh-sync-id: f769afd98bb662e8bbe773adb45990f2175cdfe4
This commit is contained in:
committed by
facebook-github-bot-4
parent
63a37be1dd
commit
6ca8f4836d
@@ -28,8 +28,10 @@ typedef void (^RCTAssertFunction)(
|
||||
);
|
||||
|
||||
/**
|
||||
* This is the main assert macro that you should use.
|
||||
* This is the main assert macro that you should use. Asserts should be compiled out
|
||||
* in production builds
|
||||
*/
|
||||
#ifndef NS_BLOCK_ASSERTIONS
|
||||
#define RCTAssert(condition, ...) do { \
|
||||
if ((condition) == 0) { \
|
||||
_RCTAssertFormat(#condition, __FILE__, __LINE__, __func__, __VA_ARGS__); \
|
||||
@@ -39,6 +41,9 @@ typedef void (^RCTAssertFunction)(
|
||||
} \
|
||||
} \
|
||||
} while (false)
|
||||
#else
|
||||
#define RCTAssert(condition, ...) do {} while (false)
|
||||
#endif
|
||||
RCT_EXTERN void _RCTAssertFormat(
|
||||
const char *, const char *, int, const char *, NSString *, ...
|
||||
) NS_FORMAT_FUNCTION(5,6);
|
||||
|
||||
@@ -104,7 +104,6 @@ void _RCTAssertFormat(
|
||||
{
|
||||
RCTAssertFunction assertFunction = RCTGetLocalAssertFunction();
|
||||
if (assertFunction) {
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
NSString *message = [[NSString alloc] initWithFormat:format arguments:args];
|
||||
|
||||
Reference in New Issue
Block a user