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.
81 lines
1.3 KiB
81 lines
1.3 KiB
9 years ago
|
/*
|
||
9 years ago
|
* Copyright (c) 2015 - present Facebook, Inc.
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
* This source code is licensed under the BSD style license found in the
|
||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||
|
*/
|
||
9 years ago
|
|
||
|
#import <Foundation/Foundation.h>
|
||
|
|
||
9 years ago
|
void bad1(NSNumber* isNum) {
|
||
9 years ago
|
if (isNum) {
|
||
|
}
|
||
|
}
|
||
|
|
||
9 years ago
|
void bad2(NSNumber* isNum) {
|
||
9 years ago
|
if (!isNum) {
|
||
|
}
|
||
|
}
|
||
|
|
||
8 years ago
|
void bad3(NSNumber* number1, NSNumber* number2) {
|
||
|
if (number1 == nil || number2) {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@interface TestClass : NSObject
|
||
|
|
||
|
@property(atomic) int value;
|
||
|
|
||
|
- (BOOL)doStuff:(NSNumber*)number;
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation TestClass
|
||
|
|
||
|
- (BOOL)doStuff:(NSNumber*)number {
|
||
|
return YES;
|
||
|
}
|
||
|
|
||
|
@end
|
||
|
|
||
|
void bad4(NSNumber* number, TestClass* t) { t.value = number ? 1 : 0; }
|
||
|
|
||
|
void ok1(NSNumber* number, TestClass* t) { t.value = number == nil ? 1 : 0; }
|
||
|
|
||
|
void ok2(NSNumber* number, TestClass* t) {
|
||
|
if ([t doStuff:number]) {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ok3(NSNumber* isNum) {
|
||
9 years ago
|
if (isNum != nil) {
|
||
|
}
|
||
|
}
|
||
|
|
||
8 years ago
|
void ok4(NSNumber* isNum) {
|
||
9 years ago
|
if (nil != isNum) {
|
||
|
}
|
||
|
}
|
||
|
|
||
8 years ago
|
void ok5(NSNumber* isNum) {
|
||
9 years ago
|
if (nil == isNum) {
|
||
|
}
|
||
|
}
|
||
|
|
||
8 years ago
|
void ok6(NSNumber* isNum) {
|
||
9 years ago
|
if (isNum == nil) {
|
||
|
}
|
||
|
}
|
||
|
|
||
9 years ago
|
void accessor_ok1(NSNumber* num) {
|
||
9 years ago
|
if (![num boolValue]) {
|
||
|
}
|
||
|
}
|
||
|
|
||
9 years ago
|
void accessor_ok2(NSNumber* num) {
|
||
9 years ago
|
if ([num boolValue]) {
|
||
|
}
|
||
|
}
|