Kernel-Announcements.deploy.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. smalltalk.addPackage('Kernel-Announcements', {});
  2. smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['block', 'announcementClass'], 'Kernel-Announcements');
  3. smalltalk.addMethod(
  4. "_announcementClass",
  5. smalltalk.method({
  6. selector: "announcementClass",
  7. fn: function (){
  8. var self=this;
  9. return self["@announcementClass"];
  10. }
  11. }),
  12. smalltalk.AnnouncementSubscription);
  13. smalltalk.addMethod(
  14. "_announcementClass_",
  15. smalltalk.method({
  16. selector: "announcementClass:",
  17. fn: function (aClass){
  18. var self=this;
  19. self["@announcementClass"]=aClass;
  20. return self}
  21. }),
  22. smalltalk.AnnouncementSubscription);
  23. smalltalk.addMethod(
  24. "_block",
  25. smalltalk.method({
  26. selector: "block",
  27. fn: function (){
  28. var self=this;
  29. return self["@block"];
  30. }
  31. }),
  32. smalltalk.AnnouncementSubscription);
  33. smalltalk.addMethod(
  34. "_block_",
  35. smalltalk.method({
  36. selector: "block:",
  37. fn: function (aBlock){
  38. var self=this;
  39. self["@block"]=aBlock;
  40. return self}
  41. }),
  42. smalltalk.AnnouncementSubscription);
  43. smalltalk.addMethod(
  44. "_deliver_",
  45. smalltalk.method({
  46. selector: "deliver:",
  47. fn: function (anAnnouncement){
  48. var self=this;
  49. var $1;
  50. $1=smalltalk.send(self,"_handlesAnnouncement_",[anAnnouncement]);
  51. if(smalltalk.assert($1)){
  52. smalltalk.send(smalltalk.send(self,"_block",[]),"_value_",[anAnnouncement]);
  53. };
  54. return self}
  55. }),
  56. smalltalk.AnnouncementSubscription);
  57. smalltalk.addMethod(
  58. "_handlesAnnouncement_",
  59. smalltalk.method({
  60. selector: "handlesAnnouncement:",
  61. fn: function (anAnnouncement){
  62. var self=this;
  63. var $1;
  64. $1=smalltalk.send(anAnnouncement,"_isKindOf_",[smalltalk.send(self,"_announcementClass",[])]);
  65. return $1;
  66. }
  67. }),
  68. smalltalk.AnnouncementSubscription);
  69. smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  70. smalltalk.addMethod(
  71. "_announce_",
  72. smalltalk.method({
  73. selector: "announce:",
  74. fn: function (anAnnouncement){
  75. var self=this;
  76. smalltalk.send(self["@subscriptions"],"_do_",[(function(each){
  77. return smalltalk.send(each,"_deliver_",[anAnnouncement]);
  78. })]);
  79. return self}
  80. }),
  81. smalltalk.Announcer);
  82. smalltalk.addMethod(
  83. "_initialize",
  84. smalltalk.method({
  85. selector: "initialize",
  86. fn: function (){
  87. var self=this;
  88. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  89. self["@subscriptions"]=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  90. return self}
  91. }),
  92. smalltalk.Announcer);
  93. smalltalk.addMethod(
  94. "_on_do_",
  95. smalltalk.method({
  96. selector: "on:do:",
  97. fn: function (aClass,aBlock){
  98. var self=this;
  99. var $1,$2;
  100. $1=smalltalk.send((smalltalk.AnnouncementSubscription || AnnouncementSubscription),"_new",[]);
  101. smalltalk.send($1,"_block_",[aBlock]);
  102. smalltalk.send($1,"_announcementClass_",[aClass]);
  103. $2=smalltalk.send($1,"_yourself",[]);
  104. smalltalk.send(self["@subscriptions"],"_add_",[$2]);
  105. return self}
  106. }),
  107. smalltalk.Announcer);
  108. smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
  109. smalltalk.SystemAnnouncer.klass.iVarNames = ['current'];
  110. smalltalk.addMethod(
  111. "_current",
  112. smalltalk.method({
  113. selector: "current",
  114. fn: function (){
  115. var self=this;
  116. var $1;
  117. if(($receiver = self["@current"]) == nil || $receiver == undefined){
  118. self["@current"]=smalltalk.send(self,"_new",[],smalltalk.Announcer.klass);
  119. $1=self["@current"];
  120. } else {
  121. $1=self["@current"];
  122. };
  123. return $1;
  124. }
  125. }),
  126. smalltalk.SystemAnnouncer.klass);
  127. smalltalk.addMethod(
  128. "_new",
  129. smalltalk.method({
  130. selector: "new",
  131. fn: function (){
  132. var self=this;
  133. smalltalk.send(self,"_shouldNotImplement",[]);
  134. return self}
  135. }),
  136. smalltalk.SystemAnnouncer.klass);
  137. smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
  138. smalltalk.addMethod(
  139. "_theClass",
  140. smalltalk.method({
  141. selector: "theClass",
  142. fn: function (){
  143. var self=this;
  144. return self["@theClass"];
  145. }
  146. }),
  147. smalltalk.SystemAnnouncement);
  148. smalltalk.addMethod(
  149. "_theClass_",
  150. smalltalk.method({
  151. selector: "theClass:",
  152. fn: function (aClass){
  153. var self=this;
  154. self["@theClass"]=aClass;
  155. return self}
  156. }),
  157. smalltalk.SystemAnnouncement);
  158. smalltalk.addClass('ClassAdded', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  159. smalltalk.addClass('ClassCommentChanged', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  160. smalltalk.addClass('ClassDefinitionChanged', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  161. smalltalk.addClass('ClassRemoved', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  162. smalltalk.addClass('ClassRenamed', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  163. smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  164. smalltalk.addMethod(
  165. "_method",
  166. smalltalk.method({
  167. selector: "method",
  168. fn: function (){
  169. var self=this;
  170. return self["@method"];
  171. }
  172. }),
  173. smalltalk.MethodAnnouncement);
  174. smalltalk.addMethod(
  175. "_method_",
  176. smalltalk.method({
  177. selector: "method:",
  178. fn: function (aCompiledMethod){
  179. var self=this;
  180. self["@method"]=aCompiledMethod;
  181. return self}
  182. }),
  183. smalltalk.MethodAnnouncement);
  184. smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  185. smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');