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.
51 lines
956 B
51 lines
956 B
9 years ago
|
/*
|
||
6 years ago
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
9 years ago
|
*
|
||
7 years ago
|
* This source code is licensed under the MIT license found in the
|
||
|
* LICENSE file in the root directory of this source tree.
|
||
9 years ago
|
*/
|
||
9 years ago
|
|
||
|
#import <Foundation/NSObject.h>
|
||
|
|
||
8 years ago
|
@interface ExplicitIvarNameA : NSObject
|
||
9 years ago
|
|
||
9 years ago
|
@property(nonatomic) int x;
|
||
9 years ago
|
|
||
|
@end
|
||
|
|
||
8 years ago
|
@interface ExplicitIvarNameB : NSObject
|
||
9 years ago
|
|
||
9 years ago
|
@property(nonatomic) int y;
|
||
9 years ago
|
|
||
|
@end
|
||
|
|
||
8 years ago
|
@implementation ExplicitIvarNameA
|
||
|
|
||
|
- init {
|
||
|
return self;
|
||
|
}
|
||
9 years ago
|
|
||
|
@synthesize x;
|
||
|
|
||
8 years ago
|
- (int)testExplicit {
|
||
9 years ago
|
int* p = 0;
|
||
|
self->x = 5;
|
||
|
if (self.x == 5) { // If NPE is found, means that getter is using the correct
|
||
|
// ivar name x
|
||
|
// rather than the default _x
|
||
|
return *p;
|
||
|
};
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
- (int)testDefaultName {
|
||
|
int* p = 0;
|
||
8 years ago
|
ExplicitIvarNameB* b = [[ExplicitIvarNameB alloc] init];
|
||
9 years ago
|
b.y = 5;
|
||
|
if (b.y == 5) { // If NPE is found, means that getter is using default name _y
|
||
|
// that is
|
||
|
// added to the tenv, so there is no Missing_fld beforehand.
|
||
|
return *p;
|
||
|
};
|
||
9 years ago
|
}
|
||
|
@end
|