Kernel-Announcements.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  1. define("amber_core/Kernel-Announcements", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Announcements');
  3. smalltalk.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  5. smalltalk.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "announcementClass",
  9. category: 'accessing',
  10. fn: function (){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. var $1;
  14. $1=self["@announcementClass"];
  15. return $1;
  16. }, function($ctx1) {$ctx1.fill(self,"announcementClass",{},smalltalk.AnnouncementSubscription)})},
  17. args: [],
  18. source: "announcementClass\x0a\x09^ announcementClass",
  19. messageSends: [],
  20. referencedClasses: []
  21. }),
  22. smalltalk.AnnouncementSubscription);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "announcementClass:",
  26. category: 'accessing',
  27. fn: function (aClass){
  28. var self=this;
  29. return smalltalk.withContext(function($ctx1) {
  30. self["@announcementClass"]=aClass;
  31. return self}, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},smalltalk.AnnouncementSubscription)})},
  32. args: ["aClass"],
  33. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  34. messageSends: [],
  35. referencedClasses: []
  36. }),
  37. smalltalk.AnnouncementSubscription);
  38. smalltalk.addMethod(
  39. smalltalk.method({
  40. selector: "block",
  41. category: 'accessing',
  42. fn: function (){
  43. var self=this;
  44. return smalltalk.withContext(function($ctx1) {
  45. var $1;
  46. self._deprecatedAPI();
  47. $1=self._valuable();
  48. return $1;
  49. }, function($ctx1) {$ctx1.fill(self,"block",{},smalltalk.AnnouncementSubscription)})},
  50. args: [],
  51. source: "block\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09^ self valuable",
  52. messageSends: ["deprecatedAPI", "valuable"],
  53. referencedClasses: []
  54. }),
  55. smalltalk.AnnouncementSubscription);
  56. smalltalk.addMethod(
  57. smalltalk.method({
  58. selector: "block:",
  59. category: 'accessing',
  60. fn: function (aValuable){
  61. var self=this;
  62. return smalltalk.withContext(function($ctx1) {
  63. self._deprecatedAPI();
  64. self._valuable_(aValuable);
  65. return self}, function($ctx1) {$ctx1.fill(self,"block:",{aValuable:aValuable},smalltalk.AnnouncementSubscription)})},
  66. args: ["aValuable"],
  67. source: "block: aValuable\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09self valuable: aValuable",
  68. messageSends: ["deprecatedAPI", "valuable:"],
  69. referencedClasses: []
  70. }),
  71. smalltalk.AnnouncementSubscription);
  72. smalltalk.addMethod(
  73. smalltalk.method({
  74. selector: "deliver:",
  75. category: 'announcing',
  76. fn: function (anAnnouncement){
  77. var self=this;
  78. return smalltalk.withContext(function($ctx1) {
  79. var $1;
  80. $1=self._handlesAnnouncement_(anAnnouncement);
  81. if(smalltalk.assert($1)){
  82. _st(self._valuable())._value_(anAnnouncement);
  83. };
  84. return self}, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
  85. args: ["anAnnouncement"],
  86. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  87. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"],
  88. referencedClasses: []
  89. }),
  90. smalltalk.AnnouncementSubscription);
  91. smalltalk.addMethod(
  92. smalltalk.method({
  93. selector: "handlesAnnouncement:",
  94. category: 'announcing',
  95. fn: function (anAnnouncement){
  96. var self=this;
  97. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  98. return smalltalk.withContext(function($ctx1) {
  99. var $3,$4,$2,$1;
  100. $3=_st($Smalltalk())._current();
  101. $ctx1.sendIdx["current"]=1;
  102. $4=_st(self._announcementClass())._name();
  103. $ctx1.sendIdx["name"]=1;
  104. $2=_st($3)._at_($4);
  105. $ctx1.sendIdx["at:"]=1;
  106. if(($receiver = $2) == nil || $receiver == null){
  107. return false;
  108. } else {
  109. var class_;
  110. class_=$receiver;
  111. $1=_st(_st(_st($Smalltalk())._current())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  112. };
  113. return $1;
  114. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
  115. args: ["anAnnouncement"],
  116. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk current at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk current at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  117. messageSends: ["ifNil:ifNotNil:", "at:", "current", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"],
  118. referencedClasses: ["Smalltalk"]
  119. }),
  120. smalltalk.AnnouncementSubscription);
  121. smalltalk.addMethod(
  122. smalltalk.method({
  123. selector: "receiver",
  124. category: 'accessing',
  125. fn: function (){
  126. var self=this;
  127. return smalltalk.withContext(function($ctx1) {
  128. var $1;
  129. $1=_st(self._valuable())._receiver();
  130. return $1;
  131. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AnnouncementSubscription)})},
  132. args: [],
  133. source: "receiver\x0a\x09^ self valuable receiver",
  134. messageSends: ["receiver", "valuable"],
  135. referencedClasses: []
  136. }),
  137. smalltalk.AnnouncementSubscription);
  138. smalltalk.addMethod(
  139. smalltalk.method({
  140. selector: "valuable",
  141. category: 'accessing',
  142. fn: function (){
  143. var self=this;
  144. return smalltalk.withContext(function($ctx1) {
  145. var $1;
  146. $1=self["@valuable"];
  147. return $1;
  148. }, function($ctx1) {$ctx1.fill(self,"valuable",{},smalltalk.AnnouncementSubscription)})},
  149. args: [],
  150. source: "valuable\x0a\x09^ valuable",
  151. messageSends: [],
  152. referencedClasses: []
  153. }),
  154. smalltalk.AnnouncementSubscription);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "valuable:",
  158. category: 'accessing',
  159. fn: function (aValuable){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self["@valuable"]=aValuable;
  163. return self}, function($ctx1) {$ctx1.fill(self,"valuable:",{aValuable:aValuable},smalltalk.AnnouncementSubscription)})},
  164. args: ["aValuable"],
  165. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  166. messageSends: [],
  167. referencedClasses: []
  168. }),
  169. smalltalk.AnnouncementSubscription);
  170. smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  171. smalltalk.Announcer.comment="I hold annoncement subscriptions (instances of `AnnouncementSubscription`) in a private registry.\x0aI announce (trigger) announces, which are then dispatched to all subscriptions.\x0a\x0aThe code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0a\x0a## API\x0a\x0aUse `#announce:` to trigger an announcement.\x0a\x0aUse `#on:do:` or `#on:send:to:` to register subscriptions.\x0a\x0aWhen using `#on:send:to:`, unregistration can be done with `#unregister:`.\x0a\x0a## Usage example:\x0a\x0a SystemAnnouncer current\x0a on: ClassAdded\x0a do: [ :ann | window alert: ann theClass name, ' added' ].";
  172. smalltalk.addMethod(
  173. smalltalk.method({
  174. selector: "announce:",
  175. category: 'announcing',
  176. fn: function (anAnnouncement){
  177. var self=this;
  178. return smalltalk.withContext(function($ctx1) {
  179. _st(self["@subscriptions"])._do_((function(each){
  180. return smalltalk.withContext(function($ctx2) {
  181. return _st(each)._deliver_(anAnnouncement);
  182. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  183. return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},smalltalk.Announcer)})},
  184. args: ["anAnnouncement"],
  185. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  186. messageSends: ["do:", "deliver:"],
  187. referencedClasses: []
  188. }),
  189. smalltalk.Announcer);
  190. smalltalk.addMethod(
  191. smalltalk.method({
  192. selector: "initialize",
  193. category: 'initialization',
  194. fn: function (){
  195. var self=this;
  196. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  197. return smalltalk.withContext(function($ctx1) {
  198. smalltalk.Announcer.superclass.fn.prototype._initialize.apply(_st(self), []);
  199. self["@subscriptions"]=_st($OrderedCollection())._new();
  200. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Announcer)})},
  201. args: [],
  202. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  203. messageSends: ["initialize", "new"],
  204. referencedClasses: ["OrderedCollection"]
  205. }),
  206. smalltalk.Announcer);
  207. smalltalk.addMethod(
  208. smalltalk.method({
  209. selector: "on:do:",
  210. category: 'subscribing',
  211. fn: function (aClass,aBlock){
  212. var self=this;
  213. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  214. return smalltalk.withContext(function($ctx1) {
  215. var $1,$2;
  216. $1=_st($AnnouncementSubscription())._new();
  217. _st($1)._valuable_(aBlock);
  218. _st($1)._announcementClass_(aClass);
  219. $2=_st($1)._yourself();
  220. _st(self["@subscriptions"])._add_($2);
  221. return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},smalltalk.Announcer)})},
  222. args: ["aClass", "aBlock"],
  223. source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  224. messageSends: ["add:", "valuable:", "new", "announcementClass:", "yourself"],
  225. referencedClasses: ["AnnouncementSubscription"]
  226. }),
  227. smalltalk.Announcer);
  228. smalltalk.addMethod(
  229. smalltalk.method({
  230. selector: "on:doOnce:",
  231. category: 'subscribing',
  232. fn: function (aClass,aBlock){
  233. var self=this;
  234. var subscription;
  235. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  236. return smalltalk.withContext(function($ctx1) {
  237. var $1,$2;
  238. $1=_st($AnnouncementSubscription())._new();
  239. _st($1)._announcementClass_(aClass);
  240. $2=_st($1)._yourself();
  241. subscription=$2;
  242. _st(subscription)._block_((function(ann){
  243. return smalltalk.withContext(function($ctx2) {
  244. _st(self["@subscriptions"])._remove_(subscription);
  245. return _st(aBlock)._value_(ann);
  246. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)})}));
  247. _st(self["@subscriptions"])._add_(subscription);
  248. return self}, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},smalltalk.Announcer)})},
  249. args: ["aClass", "aBlock"],
  250. source: "on: aClass doOnce: aBlock\x0a\x09| subscription |\x0a\x09\x0a\x09subscription := AnnouncementSubscription new\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself.\x0a\x09subscription block: [ :ann |\x0a\x09\x09subscriptions remove: subscription.\x0a\x09\x09aBlock value: ann ].\x0a\x0a\x09subscriptions add: subscription",
  251. messageSends: ["announcementClass:", "new", "yourself", "block:", "remove:", "value:", "add:"],
  252. referencedClasses: ["AnnouncementSubscription"]
  253. }),
  254. smalltalk.Announcer);
  255. smalltalk.addMethod(
  256. smalltalk.method({
  257. selector: "on:send:to:",
  258. category: 'subscribing',
  259. fn: function (aClass,aSelector,anObject){
  260. var self=this;
  261. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  262. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  263. return smalltalk.withContext(function($ctx1) {
  264. var $1,$3,$4,$6,$7,$5,$8,$2;
  265. $1=self["@subscriptions"];
  266. $3=_st($AnnouncementSubscription())._new();
  267. $ctx1.sendIdx["new"]=1;
  268. $4=$3;
  269. $6=_st($MessageSend())._new();
  270. _st($6)._receiver_(anObject);
  271. _st($6)._selector_(aSelector);
  272. $7=_st($6)._yourself();
  273. $ctx1.sendIdx["yourself"]=1;
  274. $5=$7;
  275. _st($4)._valuable_($5);
  276. _st($3)._announcementClass_(aClass);
  277. $8=_st($3)._yourself();
  278. $2=$8;
  279. _st($1)._add_($2);
  280. return self}, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},smalltalk.Announcer)})},
  281. args: ["aClass", "aSelector", "anObject"],
  282. source: "on: aClass send: aSelector to: anObject\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (MessageSend new\x0a\x09\x09\x09receiver: anObject;\x0a\x09\x09\x09selector: aSelector;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  283. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"],
  284. referencedClasses: ["AnnouncementSubscription", "MessageSend"]
  285. }),
  286. smalltalk.Announcer);
  287. smalltalk.addMethod(
  288. smalltalk.method({
  289. selector: "unsubscribe:",
  290. category: 'subscribing',
  291. fn: function (anObject){
  292. var self=this;
  293. return smalltalk.withContext(function($ctx1) {
  294. self["@subscriptions"]=_st(self["@subscriptions"])._reject_((function(each){
  295. return smalltalk.withContext(function($ctx2) {
  296. return _st(_st(each)._receiver()).__eq(anObject);
  297. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  298. return self}, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},smalltalk.Announcer)})},
  299. args: ["anObject"],
  300. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  301. messageSends: ["reject:", "=", "receiver"],
  302. referencedClasses: []
  303. }),
  304. smalltalk.Announcer);
  305. smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
  306. smalltalk.SystemAnnouncer.comment="My unique instance is the global announcer handling all Amber system-related announces.\x0a\x0a## API\x0a\x0aAccess to the unique instance is done via `#current`";
  307. smalltalk.SystemAnnouncer.klass.iVarNames = ['current'];
  308. smalltalk.addMethod(
  309. smalltalk.method({
  310. selector: "current",
  311. category: 'accessing',
  312. fn: function (){
  313. var self=this;
  314. return smalltalk.withContext(function($ctx1) {
  315. var $2,$1;
  316. $2=self["@current"];
  317. if(($receiver = $2) == nil || $receiver == null){
  318. self["@current"]=smalltalk.SystemAnnouncer.klass.superclass.fn.prototype._new.apply(_st(self), []);
  319. $1=self["@current"];
  320. } else {
  321. $1=$2;
  322. };
  323. return $1;
  324. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.SystemAnnouncer.klass)})},
  325. args: [],
  326. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  327. messageSends: ["ifNil:", "new"],
  328. referencedClasses: []
  329. }),
  330. smalltalk.SystemAnnouncer.klass);
  331. smalltalk.addMethod(
  332. smalltalk.method({
  333. selector: "new",
  334. category: 'instance creation',
  335. fn: function (){
  336. var self=this;
  337. return smalltalk.withContext(function($ctx1) {
  338. self._shouldNotImplement();
  339. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.SystemAnnouncer.klass)})},
  340. args: [],
  341. source: "new\x0a\x09self shouldNotImplement",
  342. messageSends: ["shouldNotImplement"],
  343. referencedClasses: []
  344. }),
  345. smalltalk.SystemAnnouncer.klass);
  346. smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
  347. smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements";
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "theClass",
  351. category: 'accessing',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=self["@theClass"];
  357. return $1;
  358. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SystemAnnouncement)})},
  359. args: [],
  360. source: "theClass\x0a\x09^ theClass",
  361. messageSends: [],
  362. referencedClasses: []
  363. }),
  364. smalltalk.SystemAnnouncement);
  365. smalltalk.addMethod(
  366. smalltalk.method({
  367. selector: "theClass:",
  368. category: 'accessing',
  369. fn: function (aClass){
  370. var self=this;
  371. return smalltalk.withContext(function($ctx1) {
  372. self["@theClass"]=aClass;
  373. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SystemAnnouncement)})},
  374. args: ["aClass"],
  375. source: "theClass: aClass\x0a\x09theClass := aClass",
  376. messageSends: [],
  377. referencedClasses: []
  378. }),
  379. smalltalk.SystemAnnouncement);
  380. smalltalk.addMethod(
  381. smalltalk.method({
  382. selector: "heliosClass",
  383. category: 'helios',
  384. fn: function (){
  385. var self=this;
  386. return smalltalk.withContext(function($ctx1) {
  387. return "announcement";
  388. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.SystemAnnouncement.klass)})},
  389. args: [],
  390. source: "heliosClass\x0a\x09^ 'announcement'",
  391. messageSends: [],
  392. referencedClasses: []
  393. }),
  394. smalltalk.SystemAnnouncement.klass);
  395. smalltalk.addClass('ClassAnnouncement', smalltalk.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  396. smalltalk.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  397. smalltalk.addMethod(
  398. smalltalk.method({
  399. selector: "theClass",
  400. category: 'accessing',
  401. fn: function (){
  402. var self=this;
  403. return smalltalk.withContext(function($ctx1) {
  404. var $1;
  405. $1=self["@theClass"];
  406. return $1;
  407. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassAnnouncement)})},
  408. args: [],
  409. source: "theClass\x0a\x09^ theClass",
  410. messageSends: [],
  411. referencedClasses: []
  412. }),
  413. smalltalk.ClassAnnouncement);
  414. smalltalk.addMethod(
  415. smalltalk.method({
  416. selector: "theClass:",
  417. category: 'accessing',
  418. fn: function (aClass){
  419. var self=this;
  420. return smalltalk.withContext(function($ctx1) {
  421. self["@theClass"]=aClass;
  422. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassAnnouncement)})},
  423. args: ["aClass"],
  424. source: "theClass: aClass\x0a\x09theClass := aClass",
  425. messageSends: [],
  426. referencedClasses: []
  427. }),
  428. smalltalk.ClassAnnouncement);
  429. smalltalk.addClass('ClassAdded', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  430. smalltalk.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  431. smalltalk.addClass('ClassCommentChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  432. smalltalk.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  433. smalltalk.addClass('ClassDefinitionChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  434. smalltalk.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  435. smalltalk.addClass('ClassMigrated', smalltalk.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  436. smalltalk.ClassMigrated.comment="I am emitted when a class is migrated.";
  437. smalltalk.addMethod(
  438. smalltalk.method({
  439. selector: "oldClass",
  440. category: 'accessing',
  441. fn: function (){
  442. var self=this;
  443. return smalltalk.withContext(function($ctx1) {
  444. var $1;
  445. $1=self["@oldClass"];
  446. return $1;
  447. }, function($ctx1) {$ctx1.fill(self,"oldClass",{},smalltalk.ClassMigrated)})},
  448. args: [],
  449. source: "oldClass\x0a\x09^ oldClass",
  450. messageSends: [],
  451. referencedClasses: []
  452. }),
  453. smalltalk.ClassMigrated);
  454. smalltalk.addMethod(
  455. smalltalk.method({
  456. selector: "oldClass:",
  457. category: 'accessing',
  458. fn: function (aClass){
  459. var self=this;
  460. return smalltalk.withContext(function($ctx1) {
  461. self["@oldClass"]=aClass;
  462. return self}, function($ctx1) {$ctx1.fill(self,"oldClass:",{aClass:aClass},smalltalk.ClassMigrated)})},
  463. args: ["aClass"],
  464. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  465. messageSends: [],
  466. referencedClasses: []
  467. }),
  468. smalltalk.ClassMigrated);
  469. smalltalk.addClass('ClassMoved', smalltalk.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  470. smalltalk.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  471. smalltalk.addMethod(
  472. smalltalk.method({
  473. selector: "oldPackage",
  474. category: 'accessing',
  475. fn: function (){
  476. var self=this;
  477. return smalltalk.withContext(function($ctx1) {
  478. var $1;
  479. $1=self["@oldPackage"];
  480. return $1;
  481. }, function($ctx1) {$ctx1.fill(self,"oldPackage",{},smalltalk.ClassMoved)})},
  482. args: [],
  483. source: "oldPackage\x0a\x09^ oldPackage",
  484. messageSends: [],
  485. referencedClasses: []
  486. }),
  487. smalltalk.ClassMoved);
  488. smalltalk.addMethod(
  489. smalltalk.method({
  490. selector: "oldPackage:",
  491. category: 'accessing',
  492. fn: function (aPackage){
  493. var self=this;
  494. return smalltalk.withContext(function($ctx1) {
  495. self["@oldPackage"]=aPackage;
  496. return self}, function($ctx1) {$ctx1.fill(self,"oldPackage:",{aPackage:aPackage},smalltalk.ClassMoved)})},
  497. args: ["aPackage"],
  498. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  499. messageSends: [],
  500. referencedClasses: []
  501. }),
  502. smalltalk.ClassMoved);
  503. smalltalk.addClass('ClassRemoved', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  504. smalltalk.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  505. smalltalk.addClass('ClassRenamed', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  506. smalltalk.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  507. smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  508. smalltalk.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  509. smalltalk.addMethod(
  510. smalltalk.method({
  511. selector: "method",
  512. category: 'accessing',
  513. fn: function (){
  514. var self=this;
  515. return smalltalk.withContext(function($ctx1) {
  516. var $1;
  517. $1=self["@method"];
  518. return $1;
  519. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodAnnouncement)})},
  520. args: [],
  521. source: "method\x0a\x09^ method",
  522. messageSends: [],
  523. referencedClasses: []
  524. }),
  525. smalltalk.MethodAnnouncement);
  526. smalltalk.addMethod(
  527. smalltalk.method({
  528. selector: "method:",
  529. category: 'accessing',
  530. fn: function (aCompiledMethod){
  531. var self=this;
  532. return smalltalk.withContext(function($ctx1) {
  533. self["@method"]=aCompiledMethod;
  534. return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.MethodAnnouncement)})},
  535. args: ["aCompiledMethod"],
  536. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  537. messageSends: [],
  538. referencedClasses: []
  539. }),
  540. smalltalk.MethodAnnouncement);
  541. smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  542. smalltalk.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  543. smalltalk.addClass('MethodModified', smalltalk.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  544. smalltalk.MethodModified.comment="I am emitted when a `CompiledMethod` is modified (a new method is installed). I hold a reference to the old method being replaced.";
  545. smalltalk.addMethod(
  546. smalltalk.method({
  547. selector: "oldMethod",
  548. category: 'accessing',
  549. fn: function (){
  550. var self=this;
  551. return smalltalk.withContext(function($ctx1) {
  552. var $1;
  553. $1=self["@oldMethod"];
  554. return $1;
  555. }, function($ctx1) {$ctx1.fill(self,"oldMethod",{},smalltalk.MethodModified)})},
  556. args: [],
  557. source: "oldMethod\x0a\x09^ oldMethod",
  558. messageSends: [],
  559. referencedClasses: []
  560. }),
  561. smalltalk.MethodModified);
  562. smalltalk.addMethod(
  563. smalltalk.method({
  564. selector: "oldMethod:",
  565. category: 'accessing',
  566. fn: function (aMethod){
  567. var self=this;
  568. return smalltalk.withContext(function($ctx1) {
  569. self["@oldMethod"]=aMethod;
  570. return self}, function($ctx1) {$ctx1.fill(self,"oldMethod:",{aMethod:aMethod},smalltalk.MethodModified)})},
  571. args: ["aMethod"],
  572. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  573. messageSends: [],
  574. referencedClasses: []
  575. }),
  576. smalltalk.MethodModified);
  577. smalltalk.addClass('MethodMoved', smalltalk.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  578. smalltalk.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method.";
  579. smalltalk.addMethod(
  580. smalltalk.method({
  581. selector: "oldProtocol",
  582. category: 'accessing',
  583. fn: function (){
  584. var self=this;
  585. return smalltalk.withContext(function($ctx1) {
  586. var $1;
  587. $1=self["@oldProtocol"];
  588. return $1;
  589. }, function($ctx1) {$ctx1.fill(self,"oldProtocol",{},smalltalk.MethodMoved)})},
  590. args: [],
  591. source: "oldProtocol\x0a\x09^ oldProtocol",
  592. messageSends: [],
  593. referencedClasses: []
  594. }),
  595. smalltalk.MethodMoved);
  596. smalltalk.addMethod(
  597. smalltalk.method({
  598. selector: "oldProtocol:",
  599. category: 'accessing',
  600. fn: function (aString){
  601. var self=this;
  602. return smalltalk.withContext(function($ctx1) {
  603. self["@oldProtocol"]=aString;
  604. return self}, function($ctx1) {$ctx1.fill(self,"oldProtocol:",{aString:aString},smalltalk.MethodMoved)})},
  605. args: ["aString"],
  606. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  607. messageSends: [],
  608. referencedClasses: []
  609. }),
  610. smalltalk.MethodMoved);
  611. smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  612. smalltalk.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  613. smalltalk.addClass('PackageAnnouncement', smalltalk.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  614. smalltalk.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  615. smalltalk.addMethod(
  616. smalltalk.method({
  617. selector: "package",
  618. category: 'accessing',
  619. fn: function (){
  620. var self=this;
  621. return smalltalk.withContext(function($ctx1) {
  622. var $1;
  623. $1=self["@package"];
  624. return $1;
  625. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.PackageAnnouncement)})},
  626. args: [],
  627. source: "package\x0a\x09^ package",
  628. messageSends: [],
  629. referencedClasses: []
  630. }),
  631. smalltalk.PackageAnnouncement);
  632. smalltalk.addMethod(
  633. smalltalk.method({
  634. selector: "package:",
  635. category: 'accessing',
  636. fn: function (aPackage){
  637. var self=this;
  638. return smalltalk.withContext(function($ctx1) {
  639. self["@package"]=aPackage;
  640. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage},smalltalk.PackageAnnouncement)})},
  641. args: ["aPackage"],
  642. source: "package: aPackage\x0a\x09package := aPackage",
  643. messageSends: [],
  644. referencedClasses: []
  645. }),
  646. smalltalk.PackageAnnouncement);
  647. smalltalk.addClass('PackageAdded', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
  648. smalltalk.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  649. smalltalk.addClass('PackageRemoved', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
  650. smalltalk.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  651. smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  652. smalltalk.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  653. smalltalk.addMethod(
  654. smalltalk.method({
  655. selector: "protocol",
  656. category: 'accessing',
  657. fn: function (){
  658. var self=this;
  659. return smalltalk.withContext(function($ctx1) {
  660. var $1;
  661. $1=self["@protocol"];
  662. return $1;
  663. }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.ProtocolAnnouncement)})},
  664. args: [],
  665. source: "protocol\x0a\x09^ protocol",
  666. messageSends: [],
  667. referencedClasses: []
  668. }),
  669. smalltalk.ProtocolAnnouncement);
  670. smalltalk.addMethod(
  671. smalltalk.method({
  672. selector: "protocol:",
  673. category: 'accessing',
  674. fn: function (aString){
  675. var self=this;
  676. return smalltalk.withContext(function($ctx1) {
  677. self["@protocol"]=aString;
  678. return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.ProtocolAnnouncement)})},
  679. args: ["aString"],
  680. source: "protocol: aString\x0a\x09protocol := aString",
  681. messageSends: [],
  682. referencedClasses: []
  683. }),
  684. smalltalk.ProtocolAnnouncement);
  685. smalltalk.addMethod(
  686. smalltalk.method({
  687. selector: "theClass",
  688. category: 'accessing',
  689. fn: function (){
  690. var self=this;
  691. return smalltalk.withContext(function($ctx1) {
  692. var $1;
  693. $1=self["@theClass"];
  694. return $1;
  695. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ProtocolAnnouncement)})},
  696. args: [],
  697. source: "theClass\x0a\x09^ theClass",
  698. messageSends: [],
  699. referencedClasses: []
  700. }),
  701. smalltalk.ProtocolAnnouncement);
  702. smalltalk.addMethod(
  703. smalltalk.method({
  704. selector: "theClass:",
  705. category: 'accessing',
  706. fn: function (aClass){
  707. var self=this;
  708. return smalltalk.withContext(function($ctx1) {
  709. self["@theClass"]=aClass;
  710. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ProtocolAnnouncement)})},
  711. args: ["aClass"],
  712. source: "theClass: aClass\x0a\x09theClass := aClass",
  713. messageSends: [],
  714. referencedClasses: []
  715. }),
  716. smalltalk.ProtocolAnnouncement);
  717. smalltalk.addClass('ProtocolAdded', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
  718. smalltalk.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  719. smalltalk.addClass('ProtocolRemoved', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
  720. smalltalk.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  721. });