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.

53 lines
1.1 KiB

/*
* 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.
*/
#import <Foundation/NSObject.h>
@interface ExplicitIvarNameA : NSObject
@property(nonatomic) int x;
@end
@interface ExplicitIvarNameB : NSObject
@property(nonatomic) int y;
@end
@implementation ExplicitIvarNameA
- init {
return self;
}
@synthesize x;
- (int)testExplicit {
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;
};
}
- (int)testDefaultName {
int* p = 0;
ExplicitIvarNameB* b = [[ExplicitIvarNameB alloc] init];
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;
};
}
@end