blob: dbbf205fcd6b04dc0342af8fda7451354b57ecc1 [file] [log] [blame]
Daniel Dunbar417dd172008-10-04 23:47:28 +00001//-*- ObjC -*-
2
3@protocol P0;
4
5@protocol P1
6-(void) fm0;
7@end
8
9@class B;
10
11@interface Root
12@end
13
14@interface A : Root <P1> {
15 int iv0;
16 B *iv1;
Daniel Dunbar45e84232009-10-27 19:21:30 +000017 B<P1> *iv2;
Daniel Dunbar417dd172008-10-04 23:47:28 +000018}
19
Fariborz Jahanian567c8df2008-12-06 01:12:43 +000020@property(readonly) int p0;
Daniel Dunbar417dd172008-10-04 23:47:28 +000021@property(assign,nonatomic,readwrite) int p1;
22@property(copy) id p2;
23@property(retain) id p3;
24@property(assign, getter=getme, setter=setme:) id p4;
Daniel Dunbar45e84232009-10-27 19:21:30 +000025@property(assign, readwrite) id p5;
Daniel Dunbar417dd172008-10-04 23:47:28 +000026@end
27
28@implementation A
29@dynamic p0;
30@synthesize p1 = iv0;
Daniel Dunbar45e84232009-10-27 19:21:30 +000031
32// Property type can differ from ivar type.
33@synthesize p5 = iv2;
34
Daniel Dunbar417dd172008-10-04 23:47:28 +000035+(void) fm0 {
36 [super fm0];
37}
38-(void) im0 {
Daniel Dunbar8de8c362008-10-24 08:39:46 +000039 const char *s0 = __func__;
40 const char *s1 = __FUNCTION__;
41 const char *s2 = __PRETTY_FUNCTION__;
Daniel Dunbar417dd172008-10-04 23:47:28 +000042 [super im0];
Daniel Dunbar63c3a5f2008-10-17 23:04:32 +000043 int x = super.p0;
Daniel Dunbar417dd172008-10-04 23:47:28 +000044}
45-(void) im1: (int) x, ... {
46}
47@end
48
49@implementation C : A
50@end
51
Daniel Dunbar417dd172008-10-04 23:47:28 +000052@interface A (Cat)
53@end
54
55@implementation A (Cat)
56@end
Daniel Dunbar417dd172008-10-04 23:47:28 +000057
Daniel Dunbarfe345572009-03-05 22:59:19 +000058@interface B
59@end
60
Daniel Dunbar417dd172008-10-04 23:47:28 +000061int f0(id x) {
62 @synchronized(x) {
63 }
Daniel Dunbar417dd172008-10-04 23:47:28 +000064
65 @try {
66 @throw x;
Daniel Dunbarfe345572009-03-05 22:59:19 +000067
Daniel Dunbar417dd172008-10-04 23:47:28 +000068 } @catch(A *e) {
69 @throw;
Daniel Dunbarfe345572009-03-05 22:59:19 +000070
71 // @catch param doesn't require name.
72 } @catch(B *) {
73
Daniel Dunbar417dd172008-10-04 23:47:28 +000074 } @finally {
75 ;
76 }
77
78 for (id y in x) {
79 break;
80 }
Daniel Dunbar417dd172008-10-04 23:47:28 +000081}
82
Daniel Dunbarbd5e5a52009-04-21 21:16:23 +000083#ifndef __OBJC2__
Daniel Dunbar417dd172008-10-04 23:47:28 +000084struct s0 {
85 @defs(A);
86};
Daniel Dunbarbd5e5a52009-04-21 21:16:23 +000087#endif