Shih-wei Liao | f8fd82b | 2010-02-10 11:10:31 -0800 | [diff] [blame^] | 1 | //-*- 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; |
| 17 | B<P1> *iv2; |
| 18 | } |
| 19 | |
| 20 | @property(readonly) int p0; |
| 21 | @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; |
| 25 | @property(assign, readwrite) id p5; |
| 26 | @end |
| 27 | |
| 28 | @implementation A |
| 29 | @dynamic p0; |
| 30 | @synthesize p1 = iv0; |
| 31 | |
| 32 | // Property type can differ from ivar type. |
| 33 | @synthesize p5 = iv2; |
| 34 | |
| 35 | +(void) fm0 { |
| 36 | [super fm0]; |
| 37 | } |
| 38 | -(void) im0 { |
| 39 | const char *s0 = __func__; |
| 40 | const char *s1 = __FUNCTION__; |
| 41 | const char *s2 = __PRETTY_FUNCTION__; |
| 42 | [super im0]; |
| 43 | int x = super.p0; |
| 44 | } |
| 45 | -(void) im1: (int) x, ... { |
| 46 | } |
| 47 | @end |
| 48 | |
| 49 | @implementation C : A |
| 50 | @end |
| 51 | |
| 52 | @interface A (Cat) |
| 53 | @end |
| 54 | |
| 55 | @implementation A (Cat) |
| 56 | @end |
| 57 | |
| 58 | @interface B |
| 59 | @end |
| 60 | |
| 61 | int f0(id x) { |
| 62 | @synchronized(x) { |
| 63 | } |
| 64 | |
| 65 | @try { |
| 66 | @throw x; |
| 67 | |
| 68 | } @catch(A *e) { |
| 69 | @throw; |
| 70 | |
| 71 | // @catch param doesn't require name. |
| 72 | } @catch(B *) { |
| 73 | |
| 74 | } @finally { |
| 75 | ; |
| 76 | } |
| 77 | |
| 78 | for (id y in x) { |
| 79 | break; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | #ifndef __OBJC2__ |
| 84 | struct s0 { |
| 85 | @defs(A); |
| 86 | }; |
| 87 | #endif |