@@ -143,7 +143,8 @@ typedef NS_ENUM(NSUInteger, RCTBridgeFields) {
143143
144144 // Get data entry
145145 NSString *entry = @(*(const char **)(mach_header + addr));
146- NSArray *parts = [[entry substringWithRange: (NSRange ){2 , entry.length - 3 }] componentsSeparatedByString: @" " ];
146+ NSArray *parts = [[entry substringWithRange: (NSRange ){2 , entry.length - 3 }]
147+ componentsSeparatedByString: @" " ];
147148
148149 // Parse class name
149150 NSString *moduleClassName = parts[0 ];
@@ -164,33 +165,32 @@ typedef NS_ENUM(NSUInteger, RCTBridgeFields) {
164165 }
165166 }
166167
167- # if DEBUG
168+ if (RCT_DEBUG) {
168169
169- // We may be able to get rid of this check in future, once people
170- // get used to the new registration system. That would potentially
171- // allow you to create modules that are not automatically registered
170+ // We may be able to get rid of this check in future, once people
171+ // get used to the new registration system. That would potentially
172+ // allow you to create modules that are not automatically registered
172173
173- static unsigned int classCount;
174- Class *classes = objc_copyClassList (&classCount);
175- for (unsigned int i = 0 ; i < classCount; i++)
176- {
177- Class cls = classes[i];
178- Class superclass = cls;
179- while (superclass)
174+ static unsigned int classCount;
175+ Class *classes = objc_copyClassList (&classCount);
176+ for (unsigned int i = 0 ; i < classCount; i++)
180177 {
181- if (class_conformsToProtocol (superclass, @protocol (RCTBridgeModule)))
178+ Class cls = classes[i];
179+ Class superclass = cls;
180+ while (superclass)
182181 {
183- if (![RCTModuleClassesByID containsObject: cls]) {
184- RCTLogError (@" Class %@ was not exported. Did you forget to use RCT_EXPORT_MODULE()?" , NSStringFromClass (cls));
182+ if (class_conformsToProtocol (superclass, @protocol (RCTBridgeModule)))
183+ {
184+ if (![RCTModuleClassesByID containsObject: cls]) {
185+ RCTLogError (@" Class %@ was not exported. Did you forget to use RCT_EXPORT_MODULE()?" , NSStringFromClass (cls));
186+ }
187+ break ;
185188 }
186- break ;
189+ superclass = class_getSuperclass (superclass) ;
187190 }
188- superclass = class_getSuperclass (superclass);
189191 }
190192 }
191193
192- #endif
193-
194194 });
195195
196196 return RCTModuleClassesByID;
@@ -289,13 +289,13 @@ - (instancetype)initWithReactMethodName:(NSString *)reactMethodName
289289 _isClassMethod = [reactMethodName characterAtIndex: 0 ] == ' +' ;
290290 _moduleClass = NSClassFromString (_moduleClassName);
291291
292- # if DEBUG
292+ if (RCT_DEBUG) {
293293
294- // Sanity check
295- RCTAssert ([_moduleClass conformsToProtocol: @protocol (RCTBridgeModule)],
296- @" You are attempting to export the method %@ , but %@ does not \
297- conform to the RCTBridgeModule Protocol" , objCMethodName, _moduleClassName);
298- # endif
294+ // Sanity check
295+ RCTAssert ([_moduleClass conformsToProtocol: @protocol (RCTBridgeModule)],
296+ @" You are attempting to export the method %@ , but %@ does not \
297+ conform to the RCTBridgeModule Protocol" , objCMethodName, _moduleClassName);
298+ }
299299
300300 // Get method signature
301301 _methodSignature = _isClassMethod ?
@@ -449,20 +449,19 @@ - (void)invokeWithBridge:(RCTBridge *)bridge
449449 arguments : (NSArray *)arguments
450450 context : (NSNumber *)context
451451{
452+ if (RCT_DEBUG) {
452453
453- #if DEBUG
454-
455- // Sanity check
456- RCTAssert ([module class ] == _moduleClass, @" Attempted to invoke method \
457- %@ on a module of class %@ " , _methodName, [module class ]);
458- #endif
459-
460- // Safety check
461- if (arguments.count != _argumentBlocks.count ) {
462- RCTLogError (@" %@ .%@ was called with %zd arguments, but expects %zd " ,
463- RCTBridgeModuleNameForClass (_moduleClass), _JSMethodName,
464- arguments.count , _argumentBlocks.count );
465- return ;
454+ // Sanity check
455+ RCTAssert ([module class ] == _moduleClass, @" Attempted to invoke method \
456+ %@ on a module of class %@ " , _methodName, [module class ]);
457+
458+ // Safety check
459+ if (arguments.count != _argumentBlocks.count ) {
460+ RCTLogError (@" %@ .%@ was called with %zd arguments, but expects %zd " ,
461+ RCTBridgeModuleNameForClass (_moduleClass), _JSMethodName,
462+ arguments.count , _argumentBlocks.count );
463+ return ;
464+ }
466465 }
467466
468467 // Create invocation (we can't re-use this as it wouldn't be thread-safe)
0 commit comments