Kernel-Announcements.js 36 KB

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