Skip to content

Commit

Permalink
Fix DISABLE_SWIZZLING compilation
Browse files Browse the repository at this point in the history
Some methods under the compiler flag are being used by RxCocoa's proxy
delegate. So this commit is moving these outside the conditional.
  • Loading branch information
Reflejo committed Nov 18, 2018
1 parent e8aa1d8 commit 7b6e2a8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
18 changes: 11 additions & 7 deletions RxCocoa/Runtime/_RXObjCRuntime.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
#import "include/_RX.h"
#import "include/_RXObjCRuntime.h"

// self + cmd
#define HIDDEN_ARGUMENT_COUNT 2

#if !DISABLE_SWIZZLING

#define NSErrorParam NSError *__autoreleasing __nullable * __nullable

// self + cmd
#define HIDDEN_ARGUMENT_COUNT 2

@class RXObjCRuntime;

BOOL RXAbortOnThreadingHazard = NO;
Expand Down Expand Up @@ -130,6 +130,8 @@ SEL __nonnull RX_selector(SEL __nonnull selector) {
return NSSelectorFromString([RX_PREFIX stringByAppendingString:selectorString]);
}

#endif

BOOL RX_is_method_signature_void(NSMethodSignature * __nonnull methodSignature) {
const char *methodReturnType = methodSignature.methodReturnType;
return strcmp(methodReturnType, @encode(void)) == 0;
Expand Down Expand Up @@ -202,6 +204,12 @@ id __nonnull RX_extract_argument_at_index(NSInvocation * __nonnull invocation, N
return arguments;
}

IMP __nonnull RX_default_target_implementation(void) {
return _objc_msgForward;
}

#if !DISABLE_SWIZZLING

void * __nonnull RX_reference_from_selector(SEL __nonnull selector) {
return selector;
}
Expand Down Expand Up @@ -316,10 +324,6 @@ IMP __nullable RX_ensure_observing(id __nonnull target, SEL __nonnull selector,
return targetImplementation;
}

IMP __nonnull RX_default_target_implementation(void) {
return _objc_msgForward;
}

// bodies

#define FORWARD_BODY(invocation) if (RX_forward_invocation(self, NAME_CAT(_, 0, invocation))) { return; }
Expand Down
4 changes: 2 additions & 2 deletions RxCocoa/Runtime/include/_RXObjCRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ void * __nonnull RX_reference_from_selector(SEL __nonnull selector);
/// Ensures interceptor is installed on target object.
IMP __nullable RX_ensure_observing(id __nonnull target, SEL __nonnull selector, NSError *__autoreleasing __nullable * __nullable error);

#endif

/// Extracts arguments for `invocation`.
NSArray * __nonnull RX_extract_arguments(NSInvocation * __nonnull invocation);

Expand All @@ -98,5 +100,3 @@ BOOL RX_is_method_signature_void(NSMethodSignature * __nonnull methodSignature);

/// Default value for `RXInterceptionObserver.targetImplementation`.
IMP __nonnull RX_default_target_implementation(void);

#endif
4 changes: 2 additions & 2 deletions Sources/RxCocoaRuntime/include/_RXObjCRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ void * __nonnull RX_reference_from_selector(SEL __nonnull selector);
/// Ensures interceptor is installed on target object.
IMP __nullable RX_ensure_observing(id __nonnull target, SEL __nonnull selector, NSError *__autoreleasing __nullable * __nullable error);

#endif

/// Extracts arguments for `invocation`.
NSArray * __nonnull RX_extract_arguments(NSInvocation * __nonnull invocation);

Expand All @@ -98,5 +100,3 @@ BOOL RX_is_method_signature_void(NSMethodSignature * __nonnull methodSignature);

/// Default value for `RXInterceptionObserver.targetImplementation`.
IMP __nonnull RX_default_target_implementation(void);

#endif

0 comments on commit 7b6e2a8

Please sign in to comment.