Kernel-Announcements.js 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139
  1. define(["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  3. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  4. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  5. $core.addPackage('Kernel-Announcements');
  6. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  7. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  8. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  9. //>>excludeStart("ide", pragmas.excludeIdeData);
  10. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  11. //>>excludeEnd("ide");
  12. $core.addMethod(
  13. $core.method({
  14. selector: "announcementClass",
  15. protocol: 'accessing',
  16. fn: function (){
  17. var self=this;
  18. return self["@announcementClass"];
  19. },
  20. //>>excludeStart("ide", pragmas.excludeIdeData);
  21. args: [],
  22. source: "announcementClass\x0a\x09^ announcementClass",
  23. referencedClasses: [],
  24. //>>excludeEnd("ide");
  25. messageSends: []
  26. }),
  27. $globals.AnnouncementSubscription);
  28. $core.addMethod(
  29. $core.method({
  30. selector: "announcementClass:",
  31. protocol: 'accessing',
  32. fn: function (aClass){
  33. var self=this;
  34. self["@announcementClass"]=aClass;
  35. return self;
  36. },
  37. //>>excludeStart("ide", pragmas.excludeIdeData);
  38. args: ["aClass"],
  39. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  40. referencedClasses: [],
  41. //>>excludeEnd("ide");
  42. messageSends: []
  43. }),
  44. $globals.AnnouncementSubscription);
  45. $core.addMethod(
  46. $core.method({
  47. selector: "deliver:",
  48. protocol: 'announcing',
  49. fn: function (anAnnouncement){
  50. var self=this;
  51. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  52. return $core.withContext(function($ctx1) {
  53. //>>excludeEnd("ctx");
  54. var $1;
  55. $1=self._handlesAnnouncement_(anAnnouncement);
  56. if($core.assert($1)){
  57. $recv(self._valuable())._value_(anAnnouncement);
  58. };
  59. return self;
  60. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  62. //>>excludeEnd("ctx");
  63. },
  64. //>>excludeStart("ide", pragmas.excludeIdeData);
  65. args: ["anAnnouncement"],
  66. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  67. referencedClasses: [],
  68. //>>excludeEnd("ide");
  69. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  70. }),
  71. $globals.AnnouncementSubscription);
  72. $core.addMethod(
  73. $core.method({
  74. selector: "handlesAnnouncement:",
  75. protocol: 'announcing',
  76. fn: function (anAnnouncement){
  77. var self=this;
  78. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79. return $core.withContext(function($ctx1) {
  80. //>>excludeEnd("ctx");
  81. var $2,$3,$1,$receiver;
  82. $2=$recv($globals.Smalltalk)._globals();
  83. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  84. $ctx1.sendIdx["globals"]=1;
  85. //>>excludeEnd("ctx");
  86. $3=$recv(self._announcementClass())._name();
  87. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  88. $ctx1.sendIdx["name"]=1;
  89. //>>excludeEnd("ctx");
  90. $1=$recv($2)._at_($3);
  91. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  92. $ctx1.sendIdx["at:"]=1;
  93. //>>excludeEnd("ctx");
  94. if(($receiver = $1) == null || $receiver.isNil){
  95. return false;
  96. } else {
  97. var class_;
  98. class_=$receiver;
  99. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  100. };
  101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  102. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  103. //>>excludeEnd("ctx");
  104. },
  105. //>>excludeStart("ide", pragmas.excludeIdeData);
  106. args: ["anAnnouncement"],
  107. 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 ]",
  108. referencedClasses: ["Smalltalk"],
  109. //>>excludeEnd("ide");
  110. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  111. }),
  112. $globals.AnnouncementSubscription);
  113. $core.addMethod(
  114. $core.method({
  115. selector: "receiver",
  116. protocol: 'accessing',
  117. fn: function (){
  118. var self=this;
  119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  120. return $core.withContext(function($ctx1) {
  121. //>>excludeEnd("ctx");
  122. return $recv(self._valuable())._receiver();
  123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  124. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  125. //>>excludeEnd("ctx");
  126. },
  127. //>>excludeStart("ide", pragmas.excludeIdeData);
  128. args: [],
  129. source: "receiver\x0a\x09^ self valuable receiver",
  130. referencedClasses: [],
  131. //>>excludeEnd("ide");
  132. messageSends: ["receiver", "valuable"]
  133. }),
  134. $globals.AnnouncementSubscription);
  135. $core.addMethod(
  136. $core.method({
  137. selector: "valuable",
  138. protocol: 'accessing',
  139. fn: function (){
  140. var self=this;
  141. return self["@valuable"];
  142. },
  143. //>>excludeStart("ide", pragmas.excludeIdeData);
  144. args: [],
  145. source: "valuable\x0a\x09^ valuable",
  146. referencedClasses: [],
  147. //>>excludeEnd("ide");
  148. messageSends: []
  149. }),
  150. $globals.AnnouncementSubscription);
  151. $core.addMethod(
  152. $core.method({
  153. selector: "valuable:",
  154. protocol: 'accessing',
  155. fn: function (aValuable){
  156. var self=this;
  157. self["@valuable"]=aValuable;
  158. return self;
  159. },
  160. //>>excludeStart("ide", pragmas.excludeIdeData);
  161. args: ["aValuable"],
  162. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  163. referencedClasses: [],
  164. //>>excludeEnd("ide");
  165. messageSends: []
  166. }),
  167. $globals.AnnouncementSubscription);
  168. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  169. //>>excludeStart("ide", pragmas.excludeIdeData);
  170. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  171. //>>excludeEnd("ide");
  172. $core.addMethod(
  173. $core.method({
  174. selector: "receiver",
  175. protocol: 'accessing',
  176. fn: function (){
  177. var self=this;
  178. return self["@receiver"];
  179. },
  180. //>>excludeStart("ide", pragmas.excludeIdeData);
  181. args: [],
  182. source: "receiver\x0a\x09^ receiver",
  183. referencedClasses: [],
  184. //>>excludeEnd("ide");
  185. messageSends: []
  186. }),
  187. $globals.AnnouncementValuable);
  188. $core.addMethod(
  189. $core.method({
  190. selector: "receiver:",
  191. protocol: 'accessing',
  192. fn: function (anObject){
  193. var self=this;
  194. self["@receiver"]=anObject;
  195. return self;
  196. },
  197. //>>excludeStart("ide", pragmas.excludeIdeData);
  198. args: ["anObject"],
  199. source: "receiver: anObject\x0a\x09receiver := anObject",
  200. referencedClasses: [],
  201. //>>excludeEnd("ide");
  202. messageSends: []
  203. }),
  204. $globals.AnnouncementValuable);
  205. $core.addMethod(
  206. $core.method({
  207. selector: "valuable",
  208. protocol: 'accessing',
  209. fn: function (){
  210. var self=this;
  211. return self["@valuable"];
  212. },
  213. //>>excludeStart("ide", pragmas.excludeIdeData);
  214. args: [],
  215. source: "valuable\x0a\x09^ valuable",
  216. referencedClasses: [],
  217. //>>excludeEnd("ide");
  218. messageSends: []
  219. }),
  220. $globals.AnnouncementValuable);
  221. $core.addMethod(
  222. $core.method({
  223. selector: "valuable:",
  224. protocol: 'accessing',
  225. fn: function (anObject){
  226. var self=this;
  227. self["@valuable"]=anObject;
  228. return self;
  229. },
  230. //>>excludeStart("ide", pragmas.excludeIdeData);
  231. args: ["anObject"],
  232. source: "valuable: anObject\x0a\x09valuable := anObject",
  233. referencedClasses: [],
  234. //>>excludeEnd("ide");
  235. messageSends: []
  236. }),
  237. $globals.AnnouncementValuable);
  238. $core.addMethod(
  239. $core.method({
  240. selector: "value",
  241. protocol: 'evaluating',
  242. fn: function (){
  243. var self=this;
  244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  245. return $core.withContext(function($ctx1) {
  246. //>>excludeEnd("ctx");
  247. return $recv(self._valuable())._value();
  248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  249. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  250. //>>excludeEnd("ctx");
  251. },
  252. //>>excludeStart("ide", pragmas.excludeIdeData);
  253. args: [],
  254. source: "value\x0a\x09^ self valuable value",
  255. referencedClasses: [],
  256. //>>excludeEnd("ide");
  257. messageSends: ["value", "valuable"]
  258. }),
  259. $globals.AnnouncementValuable);
  260. $core.addMethod(
  261. $core.method({
  262. selector: "value:",
  263. protocol: 'evaluating',
  264. fn: function (anObject){
  265. var self=this;
  266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  267. return $core.withContext(function($ctx1) {
  268. //>>excludeEnd("ctx");
  269. return $recv(self._valuable())._value_(anObject);
  270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  271. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  272. //>>excludeEnd("ctx");
  273. },
  274. //>>excludeStart("ide", pragmas.excludeIdeData);
  275. args: ["anObject"],
  276. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  277. referencedClasses: [],
  278. //>>excludeEnd("ide");
  279. messageSends: ["value:", "valuable"]
  280. }),
  281. $globals.AnnouncementValuable);
  282. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  283. //>>excludeStart("ide", pragmas.excludeIdeData);
  284. $globals.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' ].";
  285. //>>excludeEnd("ide");
  286. $core.addMethod(
  287. $core.method({
  288. selector: "announce:",
  289. protocol: 'announcing',
  290. fn: function (anAnnouncement){
  291. var self=this;
  292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  293. return $core.withContext(function($ctx1) {
  294. //>>excludeEnd("ctx");
  295. $recv(self["@subscriptions"])._do_((function(each){
  296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  297. return $core.withContext(function($ctx2) {
  298. //>>excludeEnd("ctx");
  299. return $recv(each)._deliver_(anAnnouncement);
  300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  301. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  302. //>>excludeEnd("ctx");
  303. }));
  304. return self;
  305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  306. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  307. //>>excludeEnd("ctx");
  308. },
  309. //>>excludeStart("ide", pragmas.excludeIdeData);
  310. args: ["anAnnouncement"],
  311. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  312. referencedClasses: [],
  313. //>>excludeEnd("ide");
  314. messageSends: ["do:", "deliver:"]
  315. }),
  316. $globals.Announcer);
  317. $core.addMethod(
  318. $core.method({
  319. selector: "initialize",
  320. protocol: 'initialization',
  321. fn: function (){
  322. var self=this;
  323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  324. return $core.withContext(function($ctx1) {
  325. //>>excludeEnd("ctx");
  326. (
  327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  328. $ctx1.supercall = true,
  329. //>>excludeEnd("ctx");
  330. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  332. $ctx1.supercall = false;
  333. //>>excludeEnd("ctx");;
  334. self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  335. return self;
  336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  337. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  338. //>>excludeEnd("ctx");
  339. },
  340. //>>excludeStart("ide", pragmas.excludeIdeData);
  341. args: [],
  342. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  343. referencedClasses: ["OrderedCollection"],
  344. //>>excludeEnd("ide");
  345. messageSends: ["initialize", "new"]
  346. }),
  347. $globals.Announcer);
  348. $core.addMethod(
  349. $core.method({
  350. selector: "on:do:",
  351. protocol: 'subscribing',
  352. fn: function (aClass,aBlock){
  353. var self=this;
  354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  355. return $core.withContext(function($ctx1) {
  356. //>>excludeEnd("ctx");
  357. self._on_do_for_(aClass,aBlock,nil);
  358. return self;
  359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  360. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  361. //>>excludeEnd("ctx");
  362. },
  363. //>>excludeStart("ide", pragmas.excludeIdeData);
  364. args: ["aClass", "aBlock"],
  365. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  366. referencedClasses: [],
  367. //>>excludeEnd("ide");
  368. messageSends: ["on:do:for:"]
  369. }),
  370. $globals.Announcer);
  371. $core.addMethod(
  372. $core.method({
  373. selector: "on:do:for:",
  374. protocol: 'subscribing',
  375. fn: function (aClass,aBlock,aReceiver){
  376. var self=this;
  377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  378. return $core.withContext(function($ctx1) {
  379. //>>excludeEnd("ctx");
  380. var $1,$3,$5,$6,$4,$2;
  381. $1=self["@subscriptions"];
  382. $3=$recv($globals.AnnouncementSubscription)._new();
  383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  384. $ctx1.sendIdx["new"]=1;
  385. //>>excludeEnd("ctx");
  386. $5=$recv($globals.AnnouncementValuable)._new();
  387. $recv($5)._valuable_(aBlock);
  388. $recv($5)._receiver_(aReceiver);
  389. $6=$recv($5)._yourself();
  390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  391. $ctx1.sendIdx["yourself"]=1;
  392. //>>excludeEnd("ctx");
  393. $4=$6;
  394. $recv($3)._valuable_($4);
  395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  396. $ctx1.sendIdx["valuable:"]=1;
  397. //>>excludeEnd("ctx");
  398. $recv($3)._announcementClass_(aClass);
  399. $2=$recv($3)._yourself();
  400. $recv($1)._add_($2);
  401. return self;
  402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  403. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  404. //>>excludeEnd("ctx");
  405. },
  406. //>>excludeStart("ide", pragmas.excludeIdeData);
  407. args: ["aClass", "aBlock", "aReceiver"],
  408. source: "on: aClass do: aBlock for: aReceiver\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (AnnouncementValuable new\x0a\x09\x09\x09valuable: aBlock;\x0a\x09\x09\x09receiver: aReceiver;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  409. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  410. //>>excludeEnd("ide");
  411. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  412. }),
  413. $globals.Announcer);
  414. $core.addMethod(
  415. $core.method({
  416. selector: "on:doOnce:",
  417. protocol: 'subscribing',
  418. fn: function (aClass,aBlock){
  419. var self=this;
  420. var subscription;
  421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  422. return $core.withContext(function($ctx1) {
  423. //>>excludeEnd("ctx");
  424. var $1;
  425. $1=$recv($globals.AnnouncementSubscription)._new();
  426. $recv($1)._announcementClass_(aClass);
  427. subscription=$recv($1)._yourself();
  428. $recv(subscription)._valuable_((function(ann){
  429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  430. return $core.withContext(function($ctx2) {
  431. //>>excludeEnd("ctx");
  432. $recv(self["@subscriptions"])._remove_(subscription);
  433. return $recv(aBlock)._value_(ann);
  434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  435. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  436. //>>excludeEnd("ctx");
  437. }));
  438. $recv(self["@subscriptions"])._add_(subscription);
  439. return self;
  440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  441. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  442. //>>excludeEnd("ctx");
  443. },
  444. //>>excludeStart("ide", pragmas.excludeIdeData);
  445. args: ["aClass", "aBlock"],
  446. 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",
  447. referencedClasses: ["AnnouncementSubscription"],
  448. //>>excludeEnd("ide");
  449. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  450. }),
  451. $globals.Announcer);
  452. $core.addMethod(
  453. $core.method({
  454. selector: "on:send:to:",
  455. protocol: 'subscribing',
  456. fn: function (aClass,aSelector,anObject){
  457. var self=this;
  458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  459. return $core.withContext(function($ctx1) {
  460. //>>excludeEnd("ctx");
  461. var $1,$3,$5,$6,$4,$2;
  462. $1=self["@subscriptions"];
  463. $3=$recv($globals.AnnouncementSubscription)._new();
  464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  465. $ctx1.sendIdx["new"]=1;
  466. //>>excludeEnd("ctx");
  467. $5=$recv($globals.MessageSend)._new();
  468. $recv($5)._receiver_(anObject);
  469. $recv($5)._selector_(aSelector);
  470. $6=$recv($5)._yourself();
  471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  472. $ctx1.sendIdx["yourself"]=1;
  473. //>>excludeEnd("ctx");
  474. $4=$6;
  475. $recv($3)._valuable_($4);
  476. $recv($3)._announcementClass_(aClass);
  477. $2=$recv($3)._yourself();
  478. $recv($1)._add_($2);
  479. return self;
  480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  481. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  482. //>>excludeEnd("ctx");
  483. },
  484. //>>excludeStart("ide", pragmas.excludeIdeData);
  485. args: ["aClass", "aSelector", "anObject"],
  486. 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)",
  487. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  488. //>>excludeEnd("ide");
  489. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  490. }),
  491. $globals.Announcer);
  492. $core.addMethod(
  493. $core.method({
  494. selector: "unsubscribe:",
  495. protocol: 'subscribing',
  496. fn: function (anObject){
  497. var self=this;
  498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  499. return $core.withContext(function($ctx1) {
  500. //>>excludeEnd("ctx");
  501. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  503. return $core.withContext(function($ctx2) {
  504. //>>excludeEnd("ctx");
  505. return $recv($recv(each)._receiver()).__eq(anObject);
  506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  507. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  508. //>>excludeEnd("ctx");
  509. }));
  510. return self;
  511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  512. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  513. //>>excludeEnd("ctx");
  514. },
  515. //>>excludeStart("ide", pragmas.excludeIdeData);
  516. args: ["anObject"],
  517. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  518. referencedClasses: [],
  519. //>>excludeEnd("ide");
  520. messageSends: ["reject:", "=", "receiver"]
  521. }),
  522. $globals.Announcer);
  523. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  524. //>>excludeStart("ide", pragmas.excludeIdeData);
  525. $globals.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`";
  526. //>>excludeEnd("ide");
  527. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  528. $core.addMethod(
  529. $core.method({
  530. selector: "current",
  531. protocol: 'accessing',
  532. fn: function (){
  533. var self=this;
  534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  535. return $core.withContext(function($ctx1) {
  536. //>>excludeEnd("ctx");
  537. var $1,$receiver;
  538. $1=self["@current"];
  539. if(($receiver = $1) == null || $receiver.isNil){
  540. self["@current"]=(
  541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  542. $ctx1.supercall = true,
  543. //>>excludeEnd("ctx");
  544. ($globals.SystemAnnouncer.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  546. $ctx1.supercall = false;
  547. //>>excludeEnd("ctx");;
  548. return self["@current"];
  549. } else {
  550. return $1;
  551. };
  552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  553. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  554. //>>excludeEnd("ctx");
  555. },
  556. //>>excludeStart("ide", pragmas.excludeIdeData);
  557. args: [],
  558. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  559. referencedClasses: [],
  560. //>>excludeEnd("ide");
  561. messageSends: ["ifNil:", "new"]
  562. }),
  563. $globals.SystemAnnouncer.klass);
  564. $core.addMethod(
  565. $core.method({
  566. selector: "new",
  567. protocol: 'instance creation',
  568. fn: function (){
  569. var self=this;
  570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  571. return $core.withContext(function($ctx1) {
  572. //>>excludeEnd("ctx");
  573. self._shouldNotImplement();
  574. return self;
  575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  576. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  577. //>>excludeEnd("ctx");
  578. },
  579. //>>excludeStart("ide", pragmas.excludeIdeData);
  580. args: [],
  581. source: "new\x0a\x09self shouldNotImplement",
  582. referencedClasses: [],
  583. //>>excludeEnd("ide");
  584. messageSends: ["shouldNotImplement"]
  585. }),
  586. $globals.SystemAnnouncer.klass);
  587. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  588. //>>excludeStart("ide", pragmas.excludeIdeData);
  589. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  590. //>>excludeEnd("ide");
  591. $core.addMethod(
  592. $core.method({
  593. selector: "classTag",
  594. protocol: 'accessing',
  595. fn: function (){
  596. var self=this;
  597. return "announcement";
  598. },
  599. //>>excludeStart("ide", pragmas.excludeIdeData);
  600. args: [],
  601. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'announcement'",
  602. referencedClasses: [],
  603. //>>excludeEnd("ide");
  604. messageSends: []
  605. }),
  606. $globals.SystemAnnouncement.klass);
  607. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  608. //>>excludeStart("ide", pragmas.excludeIdeData);
  609. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  610. //>>excludeEnd("ide");
  611. $core.addMethod(
  612. $core.method({
  613. selector: "theClass",
  614. protocol: 'accessing',
  615. fn: function (){
  616. var self=this;
  617. return self["@theClass"];
  618. },
  619. //>>excludeStart("ide", pragmas.excludeIdeData);
  620. args: [],
  621. source: "theClass\x0a\x09^ theClass",
  622. referencedClasses: [],
  623. //>>excludeEnd("ide");
  624. messageSends: []
  625. }),
  626. $globals.ClassAnnouncement);
  627. $core.addMethod(
  628. $core.method({
  629. selector: "theClass:",
  630. protocol: 'accessing',
  631. fn: function (aClass){
  632. var self=this;
  633. self["@theClass"]=aClass;
  634. return self;
  635. },
  636. //>>excludeStart("ide", pragmas.excludeIdeData);
  637. args: ["aClass"],
  638. source: "theClass: aClass\x0a\x09theClass := aClass",
  639. referencedClasses: [],
  640. //>>excludeEnd("ide");
  641. messageSends: []
  642. }),
  643. $globals.ClassAnnouncement);
  644. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  645. //>>excludeStart("ide", pragmas.excludeIdeData);
  646. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  647. //>>excludeEnd("ide");
  648. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  649. //>>excludeStart("ide", pragmas.excludeIdeData);
  650. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  651. //>>excludeEnd("ide");
  652. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  653. //>>excludeStart("ide", pragmas.excludeIdeData);
  654. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  655. //>>excludeEnd("ide");
  656. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  657. //>>excludeStart("ide", pragmas.excludeIdeData);
  658. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  659. //>>excludeEnd("ide");
  660. $core.addMethod(
  661. $core.method({
  662. selector: "oldClass",
  663. protocol: 'accessing',
  664. fn: function (){
  665. var self=this;
  666. return self["@oldClass"];
  667. },
  668. //>>excludeStart("ide", pragmas.excludeIdeData);
  669. args: [],
  670. source: "oldClass\x0a\x09^ oldClass",
  671. referencedClasses: [],
  672. //>>excludeEnd("ide");
  673. messageSends: []
  674. }),
  675. $globals.ClassMigrated);
  676. $core.addMethod(
  677. $core.method({
  678. selector: "oldClass:",
  679. protocol: 'accessing',
  680. fn: function (aClass){
  681. var self=this;
  682. self["@oldClass"]=aClass;
  683. return self;
  684. },
  685. //>>excludeStart("ide", pragmas.excludeIdeData);
  686. args: ["aClass"],
  687. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  688. referencedClasses: [],
  689. //>>excludeEnd("ide");
  690. messageSends: []
  691. }),
  692. $globals.ClassMigrated);
  693. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  694. //>>excludeStart("ide", pragmas.excludeIdeData);
  695. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  696. //>>excludeEnd("ide");
  697. $core.addMethod(
  698. $core.method({
  699. selector: "oldPackage",
  700. protocol: 'accessing',
  701. fn: function (){
  702. var self=this;
  703. return self["@oldPackage"];
  704. },
  705. //>>excludeStart("ide", pragmas.excludeIdeData);
  706. args: [],
  707. source: "oldPackage\x0a\x09^ oldPackage",
  708. referencedClasses: [],
  709. //>>excludeEnd("ide");
  710. messageSends: []
  711. }),
  712. $globals.ClassMoved);
  713. $core.addMethod(
  714. $core.method({
  715. selector: "oldPackage:",
  716. protocol: 'accessing',
  717. fn: function (aPackage){
  718. var self=this;
  719. self["@oldPackage"]=aPackage;
  720. return self;
  721. },
  722. //>>excludeStart("ide", pragmas.excludeIdeData);
  723. args: ["aPackage"],
  724. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  725. referencedClasses: [],
  726. //>>excludeEnd("ide");
  727. messageSends: []
  728. }),
  729. $globals.ClassMoved);
  730. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  731. //>>excludeStart("ide", pragmas.excludeIdeData);
  732. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  733. //>>excludeEnd("ide");
  734. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  735. //>>excludeStart("ide", pragmas.excludeIdeData);
  736. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  737. //>>excludeEnd("ide");
  738. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  739. //>>excludeStart("ide", pragmas.excludeIdeData);
  740. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  741. //>>excludeEnd("ide");
  742. $core.addMethod(
  743. $core.method({
  744. selector: "method",
  745. protocol: 'accessing',
  746. fn: function (){
  747. var self=this;
  748. return self["@method"];
  749. },
  750. //>>excludeStart("ide", pragmas.excludeIdeData);
  751. args: [],
  752. source: "method\x0a\x09^ method",
  753. referencedClasses: [],
  754. //>>excludeEnd("ide");
  755. messageSends: []
  756. }),
  757. $globals.MethodAnnouncement);
  758. $core.addMethod(
  759. $core.method({
  760. selector: "method:",
  761. protocol: 'accessing',
  762. fn: function (aCompiledMethod){
  763. var self=this;
  764. self["@method"]=aCompiledMethod;
  765. return self;
  766. },
  767. //>>excludeStart("ide", pragmas.excludeIdeData);
  768. args: ["aCompiledMethod"],
  769. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  770. referencedClasses: [],
  771. //>>excludeEnd("ide");
  772. messageSends: []
  773. }),
  774. $globals.MethodAnnouncement);
  775. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  776. //>>excludeStart("ide", pragmas.excludeIdeData);
  777. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  778. //>>excludeEnd("ide");
  779. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  780. //>>excludeStart("ide", pragmas.excludeIdeData);
  781. $globals.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.";
  782. //>>excludeEnd("ide");
  783. $core.addMethod(
  784. $core.method({
  785. selector: "oldMethod",
  786. protocol: 'accessing',
  787. fn: function (){
  788. var self=this;
  789. return self["@oldMethod"];
  790. },
  791. //>>excludeStart("ide", pragmas.excludeIdeData);
  792. args: [],
  793. source: "oldMethod\x0a\x09^ oldMethod",
  794. referencedClasses: [],
  795. //>>excludeEnd("ide");
  796. messageSends: []
  797. }),
  798. $globals.MethodModified);
  799. $core.addMethod(
  800. $core.method({
  801. selector: "oldMethod:",
  802. protocol: 'accessing',
  803. fn: function (aMethod){
  804. var self=this;
  805. self["@oldMethod"]=aMethod;
  806. return self;
  807. },
  808. //>>excludeStart("ide", pragmas.excludeIdeData);
  809. args: ["aMethod"],
  810. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  811. referencedClasses: [],
  812. //>>excludeEnd("ide");
  813. messageSends: []
  814. }),
  815. $globals.MethodModified);
  816. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  817. //>>excludeStart("ide", pragmas.excludeIdeData);
  818. $globals.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method.";
  819. //>>excludeEnd("ide");
  820. $core.addMethod(
  821. $core.method({
  822. selector: "oldProtocol",
  823. protocol: 'accessing',
  824. fn: function (){
  825. var self=this;
  826. return self["@oldProtocol"];
  827. },
  828. //>>excludeStart("ide", pragmas.excludeIdeData);
  829. args: [],
  830. source: "oldProtocol\x0a\x09^ oldProtocol",
  831. referencedClasses: [],
  832. //>>excludeEnd("ide");
  833. messageSends: []
  834. }),
  835. $globals.MethodMoved);
  836. $core.addMethod(
  837. $core.method({
  838. selector: "oldProtocol:",
  839. protocol: 'accessing',
  840. fn: function (aString){
  841. var self=this;
  842. self["@oldProtocol"]=aString;
  843. return self;
  844. },
  845. //>>excludeStart("ide", pragmas.excludeIdeData);
  846. args: ["aString"],
  847. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  848. referencedClasses: [],
  849. //>>excludeEnd("ide");
  850. messageSends: []
  851. }),
  852. $globals.MethodMoved);
  853. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  854. //>>excludeStart("ide", pragmas.excludeIdeData);
  855. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  856. //>>excludeEnd("ide");
  857. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  858. //>>excludeStart("ide", pragmas.excludeIdeData);
  859. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  860. //>>excludeEnd("ide");
  861. $core.addMethod(
  862. $core.method({
  863. selector: "package",
  864. protocol: 'accessing',
  865. fn: function (){
  866. var self=this;
  867. return self["@package"];
  868. },
  869. //>>excludeStart("ide", pragmas.excludeIdeData);
  870. args: [],
  871. source: "package\x0a\x09^ package",
  872. referencedClasses: [],
  873. //>>excludeEnd("ide");
  874. messageSends: []
  875. }),
  876. $globals.PackageAnnouncement);
  877. $core.addMethod(
  878. $core.method({
  879. selector: "package:",
  880. protocol: 'accessing',
  881. fn: function (aPackage){
  882. var self=this;
  883. self["@package"]=aPackage;
  884. return self;
  885. },
  886. //>>excludeStart("ide", pragmas.excludeIdeData);
  887. args: ["aPackage"],
  888. source: "package: aPackage\x0a\x09package := aPackage",
  889. referencedClasses: [],
  890. //>>excludeEnd("ide");
  891. messageSends: []
  892. }),
  893. $globals.PackageAnnouncement);
  894. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  895. //>>excludeStart("ide", pragmas.excludeIdeData);
  896. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  897. //>>excludeEnd("ide");
  898. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  899. //>>excludeStart("ide", pragmas.excludeIdeData);
  900. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  901. //>>excludeEnd("ide");
  902. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  903. //>>excludeStart("ide", pragmas.excludeIdeData);
  904. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  905. //>>excludeEnd("ide");
  906. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  907. //>>excludeStart("ide", pragmas.excludeIdeData);
  908. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  909. //>>excludeEnd("ide");
  910. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  911. //>>excludeStart("ide", pragmas.excludeIdeData);
  912. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  913. //>>excludeEnd("ide");
  914. $core.addMethod(
  915. $core.method({
  916. selector: "package",
  917. protocol: 'accessing',
  918. fn: function (){
  919. var self=this;
  920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  921. return $core.withContext(function($ctx1) {
  922. //>>excludeEnd("ctx");
  923. var $1,$receiver;
  924. $1=self._theClass();
  925. if(($receiver = $1) == null || $receiver.isNil){
  926. return $1;
  927. } else {
  928. var class_;
  929. class_=$receiver;
  930. return $recv(class_)._packageOfProtocol_(self._protocol());
  931. };
  932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  933. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  934. //>>excludeEnd("ctx");
  935. },
  936. //>>excludeStart("ide", pragmas.excludeIdeData);
  937. args: [],
  938. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  939. referencedClasses: [],
  940. //>>excludeEnd("ide");
  941. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  942. }),
  943. $globals.ProtocolAnnouncement);
  944. $core.addMethod(
  945. $core.method({
  946. selector: "protocol",
  947. protocol: 'accessing',
  948. fn: function (){
  949. var self=this;
  950. return self["@protocol"];
  951. },
  952. //>>excludeStart("ide", pragmas.excludeIdeData);
  953. args: [],
  954. source: "protocol\x0a\x09^ protocol",
  955. referencedClasses: [],
  956. //>>excludeEnd("ide");
  957. messageSends: []
  958. }),
  959. $globals.ProtocolAnnouncement);
  960. $core.addMethod(
  961. $core.method({
  962. selector: "protocol:",
  963. protocol: 'accessing',
  964. fn: function (aString){
  965. var self=this;
  966. self["@protocol"]=aString;
  967. return self;
  968. },
  969. //>>excludeStart("ide", pragmas.excludeIdeData);
  970. args: ["aString"],
  971. source: "protocol: aString\x0a\x09protocol := aString",
  972. referencedClasses: [],
  973. //>>excludeEnd("ide");
  974. messageSends: []
  975. }),
  976. $globals.ProtocolAnnouncement);
  977. $core.addMethod(
  978. $core.method({
  979. selector: "theClass",
  980. protocol: 'accessing',
  981. fn: function (){
  982. var self=this;
  983. return self["@theClass"];
  984. },
  985. //>>excludeStart("ide", pragmas.excludeIdeData);
  986. args: [],
  987. source: "theClass\x0a\x09^ theClass",
  988. referencedClasses: [],
  989. //>>excludeEnd("ide");
  990. messageSends: []
  991. }),
  992. $globals.ProtocolAnnouncement);
  993. $core.addMethod(
  994. $core.method({
  995. selector: "theClass:",
  996. protocol: 'accessing',
  997. fn: function (aClass){
  998. var self=this;
  999. self["@theClass"]=aClass;
  1000. return self;
  1001. },
  1002. //>>excludeStart("ide", pragmas.excludeIdeData);
  1003. args: ["aClass"],
  1004. source: "theClass: aClass\x0a\x09theClass := aClass",
  1005. referencedClasses: [],
  1006. //>>excludeEnd("ide");
  1007. messageSends: []
  1008. }),
  1009. $globals.ProtocolAnnouncement);
  1010. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  1011. //>>excludeStart("ide", pragmas.excludeIdeData);
  1012. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  1013. //>>excludeEnd("ide");
  1014. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  1015. //>>excludeStart("ide", pragmas.excludeIdeData);
  1016. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  1017. //>>excludeEnd("ide");
  1018. });