Kernel-Announcements.js 35 KB

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