2
0

Kernel-Announcements.js 35 KB

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