Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DISABLE_SWIZZLING compilation #1805

Merged
merged 1 commit into from
Dec 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs to be included, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we just need to expose

/// Returns `YES` in case method has `void` return type.
BOOL RX_is_method_with_description_void(struct objc_method_description method);
 /// Extracts arguments for `invocation`.
NSArray * __nonnull RX_extract_arguments(NSInvocation * __nonnull invocation);
 /// Returns `YES` in case methodSignature has `void` return type.
BOOL RX_is_method_signature_void(NSMethodSignature * __nonnull methodSignature);


#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