2
0

Kernel-Announcements.js 24 KB

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