Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [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 | ||||
Fariborz Jahanian | 6fc9e7a | 2013-03-11 22:26:33 +0000 | [diff] [blame] | 12 | @property(readonly) int p0; |
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 13 | @end |
14 | |||||
15 | @interface A : Root <P1> { | ||||
16 | int iv0; | ||||
17 | B *iv1; | ||||
Daniel Dunbar | 45e8423 | 2009-10-27 19:21:30 +0000 | [diff] [blame] | 18 | B<P1> *iv2; |
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 19 | } |
20 | |||||
Fariborz Jahanian | 567c8df | 2008-12-06 01:12:43 +0000 | [diff] [blame] | 21 | @property(readonly) int p0; |
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 22 | @property(assign,nonatomic,readwrite) int p1; |
23 | @property(copy) id p2; | ||||
24 | @property(retain) id p3; | ||||
25 | @property(assign, getter=getme, setter=setme:) id p4; | ||||
Daniel Dunbar | 45e8423 | 2009-10-27 19:21:30 +0000 | [diff] [blame] | 26 | @property(assign, readwrite) id p5; |
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 27 | @end |
28 | |||||
29 | @implementation A | ||||
30 | @dynamic p0; | ||||
31 | @synthesize p1 = iv0; | ||||
Daniel Dunbar | 45e8423 | 2009-10-27 19:21:30 +0000 | [diff] [blame] | 32 | |
33 | // Property type can differ from ivar type. | ||||
34 | @synthesize p5 = iv2; | ||||
35 | |||||
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 36 | +(void) fm0 { |
37 | [super fm0]; | ||||
38 | } | ||||
39 | -(void) im0 { | ||||
Daniel Dunbar | 8de8c36 | 2008-10-24 08:39:46 +0000 | [diff] [blame] | 40 | const char *s0 = __func__; |
41 | const char *s1 = __FUNCTION__; | ||||
42 | const char *s2 = __PRETTY_FUNCTION__; | ||||
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 43 | [super im0]; |
Daniel Dunbar | 63c3a5f | 2008-10-17 23:04:32 +0000 | [diff] [blame] | 44 | int x = super.p0; |
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 45 | } |
46 | -(void) im1: (int) x, ... { | ||||
47 | } | ||||
48 | @end | ||||
49 | |||||
50 | @implementation C : A | ||||
51 | @end | ||||
52 | |||||
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 53 | @interface A (Cat) |
54 | @end | ||||
55 | |||||
56 | @implementation A (Cat) | ||||
57 | @end | ||||
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 58 | |
Daniel Dunbar | fe34557 | 2009-03-05 22:59:19 +0000 | [diff] [blame] | 59 | @interface B |
60 | @end | ||||
61 | |||||
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 62 | int f0(id x) { |
63 | @synchronized(x) { | ||||
64 | } | ||||
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 65 | |
66 | @try { | ||||
67 | @throw x; | ||||
Daniel Dunbar | fe34557 | 2009-03-05 22:59:19 +0000 | [diff] [blame] | 68 | |
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 69 | } @catch(A *e) { |
70 | @throw; | ||||
Daniel Dunbar | fe34557 | 2009-03-05 22:59:19 +0000 | [diff] [blame] | 71 | |
72 | // @catch param doesn't require name. | ||||
73 | } @catch(B *) { | ||||
74 | |||||
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 75 | } @finally { |
76 | ; | ||||
77 | } | ||||
78 | |||||
79 | for (id y in x) { | ||||
80 | break; | ||||
81 | } | ||||
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 82 | } |
83 | |||||
Daniel Dunbar | bd5e5a5 | 2009-04-21 21:16:23 +0000 | [diff] [blame] | 84 | #ifndef __OBJC2__ |
Daniel Dunbar | 417dd17 | 2008-10-04 23:47:28 +0000 | [diff] [blame] | 85 | struct s0 { |
86 | @defs(A); | ||||
87 | }; | ||||
Daniel Dunbar | bd5e5a5 | 2009-04-21 21:16:23 +0000 | [diff] [blame] | 88 | #endif |