You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
956 B
44 lines
956 B
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
#import <Foundation/NSObject.h>
|
|
|
|
@interface MyClass : NSObject
|
|
|
|
- (instancetype)initWithBlock:(void (^)(NSString*))block;
|
|
|
|
@end
|
|
|
|
@implementation MyClass {
|
|
void (^_success_block)(NSString*);
|
|
void (^_failure_block)(NSString*);
|
|
}
|
|
|
|
- (instancetype)initWithBlock:(void (^)(NSString*))block {
|
|
if (self = [super init]) {
|
|
_success_block = block;
|
|
_failure_block = nil;
|
|
return self;
|
|
}
|
|
}
|
|
|
|
- (void)no_constructor_assignment:(void (^)(NSString*))block {
|
|
_failure_block = block;
|
|
}
|
|
|
|
- (int)no_ivar_npe {
|
|
self->_success_block(@"Yay"); // No IVAR_NOT_NULL_CHECKED reported because of
|
|
// the preanalysis.
|
|
return 0;
|
|
}
|
|
|
|
- (int)ivar_npe {
|
|
self->_failure_block(@"Failure!"); // IVAR_NOT_NULL_CHECKED reported.
|
|
return 0;
|
|
}
|
|
|
|
@end
|