objc-language-features.inc 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //-*- ObjC -*-
  2. @protocol P0;
  3. @protocol P1
  4. -(void) fm0;
  5. @end
  6. @class B;
  7. @interface Root
  8. @property(readonly) int p0;
  9. @end
  10. @interface A : Root <P1> {
  11. int iv0;
  12. B *iv1;
  13. B<P1> *iv2;
  14. }
  15. @property(readonly) int p0;
  16. @property(assign,nonatomic,readwrite) int p1;
  17. @property(copy) id p2;
  18. @property(retain) id p3;
  19. @property(assign, getter=getme, setter=setme:) id p4;
  20. @property(assign, readwrite) id p5;
  21. @end
  22. @implementation A
  23. @dynamic p0;
  24. @synthesize p1 = iv0;
  25. // Property type can differ from ivar type.
  26. @synthesize p5 = iv2;
  27. +(void) fm0 {
  28. [super fm0];
  29. }
  30. -(void) im0 {
  31. const char *s0 = __func__;
  32. const char *s1 = __FUNCTION__;
  33. const char *s2 = __PRETTY_FUNCTION__;
  34. [super im0];
  35. int x = super.p0;
  36. }
  37. -(void) im1: (int) x, ... {
  38. }
  39. @end
  40. @implementation C : A
  41. @end
  42. @interface A (Cat)
  43. @end
  44. @implementation A (Cat)
  45. @end
  46. @interface B
  47. @end
  48. int f0(id x) {
  49. @synchronized(x) {
  50. }
  51. @try {
  52. @throw x;
  53. } @catch(A *e) {
  54. @throw;
  55. // @catch param doesn't require name.
  56. } @catch(B *) {
  57. } @finally {
  58. ;
  59. }
  60. for (id y in x) {
  61. break;
  62. }
  63. }
  64. #ifndef __OBJC2__
  65. struct s0 {
  66. @defs(A);
  67. };
  68. #endif