Skip to content

Commit

Permalink
Change #infndef NDEBUG to #if DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper Blues committed Dec 8, 2014
1 parent af50b60 commit d18c27d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Expand Up @@ -64,10 +64,11 @@ - (void)createInvocationOnClass:(Class)clazz withContext:(TyphoonInjectionContex
}];
}

//TODO: Why does this method cause a crash on Swift in release mode. (Its not needed in release mode, but *why* )

- (void)checkParametersCount
{
#ifndef NDEBUG
//TODO: Why does this method cause a crash on Swift in release mode. (Its not needed in release mode, but *why* )
#if DEBUG
NSUInteger numberOfArgumentsInSelector = [TyphoonIntrospectionUtils numberOfArgumentsInSelector:_selector];
if (numberOfArgumentsInSelector != [_injectedParameters count]) {
NSString *suggestion = @"";
Expand All @@ -78,7 +79,7 @@ - (void)checkParametersCount
}
[NSException raise:NSInternalInconsistencyException format:@"Method '%@' has %d parameters, but %d was injected. %@", NSStringFromSelector(_selector), (int)numberOfArgumentsInSelector, (int)[_injectedParameters count], suggestion];
}
#endif
#endif
}

//-------------------------------------------------------------------------------------------
Expand Down
16 changes: 8 additions & 8 deletions Source/Definition/TyphoonDefinition.m
Expand Up @@ -143,9 +143,9 @@ - (void)injectMethod:(SEL)selector parameters:(void(^)(TyphoonMethod *method))pa
if (parametersBlock) {
parametersBlock(method);
}
#ifndef NDEBUG
#if DEBUG
[method checkParametersCount];
#endif
#endif
[_injectedMethods addObject:method];
}

Expand All @@ -155,9 +155,9 @@ - (void)useInitializer:(SEL)selector parameters:(void(^)(TyphoonMethod *initiali
if (parametersBlock) {
parametersBlock(initializer);
}
#ifndef NDEBUG
#if DEBUG
[initializer checkParametersCount];
#endif
#endif
_initializer = initializer;
}

Expand All @@ -177,9 +177,9 @@ - (void)performBeforeInjections:(SEL)sel parameters:(void (^)(TyphoonMethod *par
if (parametersBlock) {
parametersBlock(_beforeInjections);
}
#ifndef NDEBUG
#if DEBUG
[_beforeInjections checkParametersCount];
#endif
#endif
}

- (void)performAfterInjections:(SEL)sel
Expand All @@ -193,9 +193,9 @@ - (void)performAfterInjections:(SEL)sel parameters:(void (^)(TyphoonMethod *para
if (parameterBlock) {
parameterBlock(_afterInjections);
}
#ifndef NDEBUG
#if DEBUG
[_afterInjections checkParametersCount];
#endif
#endif
}

//-------------------------------------------------------------------------------------------
Expand Down

0 comments on commit d18c27d

Please sign in to comment.