2
0

Kernel-Classes.js 112 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115
  1. define(["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  3. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  4. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  5. $core.addPackage('Kernel-Classes');
  6. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  7. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  8. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  9. //>>excludeStart("ide", pragmas.excludeIdeData);
  10. $globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
  11. //>>excludeEnd("ide");
  12. $core.addMethod(
  13. $core.method({
  14. selector: ">>",
  15. protocol: 'accessing',
  16. fn: function (aString){
  17. var self=this;
  18. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19. return $core.withContext(function($ctx1) {
  20. //>>excludeEnd("ctx");
  21. return self._methodAt_(aString);
  22. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  24. //>>excludeEnd("ctx");
  25. },
  26. //>>excludeStart("ide", pragmas.excludeIdeData);
  27. args: ["aString"],
  28. source: ">> aString\x0a\x09^ self methodAt: aString",
  29. referencedClasses: [],
  30. //>>excludeEnd("ide");
  31. messageSends: ["methodAt:"]
  32. }),
  33. $globals.Behavior);
  34. $core.addMethod(
  35. $core.method({
  36. selector: "addCompiledMethod:",
  37. protocol: 'compiling',
  38. fn: function (aMethod){
  39. var self=this;
  40. var oldMethod,announcement;
  41. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42. return $core.withContext(function($ctx1) {
  43. //>>excludeEnd("ctx");
  44. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$receiver;
  45. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  46. return nil;
  47. }));
  48. $2=self._protocols();
  49. $3=$recv(aMethod)._protocol();
  50. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  51. $ctx1.sendIdx["protocol"]=1;
  52. //>>excludeEnd("ctx");
  53. $1=$recv($2)._includes_($3);
  54. if(!$core.assert($1)){
  55. $4=self._organization();
  56. $5=$recv(aMethod)._protocol();
  57. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58. $ctx1.sendIdx["protocol"]=2;
  59. //>>excludeEnd("ctx");
  60. $recv($4)._addElement_($5);
  61. };
  62. self._basicAddCompiledMethod_(aMethod);
  63. $6=oldMethod;
  64. if(($receiver = $6) == null || $receiver.isNil){
  65. $6;
  66. } else {
  67. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  68. };
  69. $7=oldMethod;
  70. if(($receiver = $7) == null || $receiver.isNil){
  71. $8=$recv($globals.MethodAdded)._new();
  72. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73. $ctx1.sendIdx["new"]=1;
  74. //>>excludeEnd("ctx");
  75. $recv($8)._method_(aMethod);
  76. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77. $ctx1.sendIdx["method:"]=1;
  78. //>>excludeEnd("ctx");
  79. $9=$recv($8)._yourself();
  80. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  81. $ctx1.sendIdx["yourself"]=1;
  82. //>>excludeEnd("ctx");
  83. announcement=$9;
  84. } else {
  85. $10=$recv($globals.MethodModified)._new();
  86. $recv($10)._oldMethod_(oldMethod);
  87. $recv($10)._method_(aMethod);
  88. announcement=$recv($10)._yourself();
  89. };
  90. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  91. return self;
  92. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  93. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  94. //>>excludeEnd("ctx");
  95. },
  96. //>>excludeStart("ide", pragmas.excludeIdeData);
  97. args: ["aMethod"],
  98. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ].\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  99. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  100. //>>excludeEnd("ide");
  101. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  102. }),
  103. $globals.Behavior);
  104. $core.addMethod(
  105. $core.method({
  106. selector: "allInstanceVariableNames",
  107. protocol: 'accessing',
  108. fn: function (){
  109. var self=this;
  110. var result;
  111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  112. return $core.withContext(function($ctx1) {
  113. //>>excludeEnd("ctx");
  114. var $1,$receiver;
  115. result=$recv(self._instanceVariableNames())._copy();
  116. $1=self._superclass();
  117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  118. $ctx1.sendIdx["superclass"]=1;
  119. //>>excludeEnd("ctx");
  120. if(($receiver = $1) == null || $receiver.isNil){
  121. $1;
  122. } else {
  123. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  124. };
  125. return result;
  126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  127. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  128. //>>excludeEnd("ctx");
  129. },
  130. //>>excludeStart("ide", pragmas.excludeIdeData);
  131. args: [],
  132. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  133. referencedClasses: [],
  134. //>>excludeEnd("ide");
  135. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  136. }),
  137. $globals.Behavior);
  138. $core.addMethod(
  139. $core.method({
  140. selector: "allSelectors",
  141. protocol: 'accessing',
  142. fn: function (){
  143. var self=this;
  144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  145. return $core.withContext(function($ctx1) {
  146. //>>excludeEnd("ctx");
  147. var $1,$2;
  148. $1=self._allSuperclasses();
  149. $2=self._selectors();
  150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  151. $ctx1.sendIdx["selectors"]=1;
  152. //>>excludeEnd("ctx");
  153. return $recv($1)._inject_into_($2,(function(acc,each){
  154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  155. return $core.withContext(function($ctx2) {
  156. //>>excludeEnd("ctx");
  157. $recv(acc)._addAll_($recv(each)._selectors());
  158. return $recv(acc)._yourself();
  159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  160. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  161. //>>excludeEnd("ctx");
  162. }));
  163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  164. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  165. //>>excludeEnd("ctx");
  166. },
  167. //>>excludeStart("ide", pragmas.excludeIdeData);
  168. args: [],
  169. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  170. referencedClasses: [],
  171. //>>excludeEnd("ide");
  172. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  173. }),
  174. $globals.Behavior);
  175. $core.addMethod(
  176. $core.method({
  177. selector: "allSubclasses",
  178. protocol: 'accessing',
  179. fn: function (){
  180. var self=this;
  181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  182. return $core.withContext(function($ctx1) {
  183. //>>excludeEnd("ctx");
  184. return $recv($globals.Array)._streamContents_((function(str){
  185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  186. return $core.withContext(function($ctx2) {
  187. //>>excludeEnd("ctx");
  188. return self._allSubclassesDo_((function(each){
  189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  190. return $core.withContext(function($ctx3) {
  191. //>>excludeEnd("ctx");
  192. return $recv(str)._nextPut_(each);
  193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  194. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  195. //>>excludeEnd("ctx");
  196. }));
  197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  198. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  199. //>>excludeEnd("ctx");
  200. }));
  201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  202. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  203. //>>excludeEnd("ctx");
  204. },
  205. //>>excludeStart("ide", pragmas.excludeIdeData);
  206. args: [],
  207. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09^ Array streamContents: [ :str | self allSubclassesDo: [ :each | str nextPut: each ] ]",
  208. referencedClasses: ["Array"],
  209. //>>excludeEnd("ide");
  210. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  211. }),
  212. $globals.Behavior);
  213. $core.addMethod(
  214. $core.method({
  215. selector: "allSubclassesDo:",
  216. protocol: 'enumerating',
  217. fn: function (aBlock){
  218. var self=this;
  219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  220. return $core.withContext(function($ctx1) {
  221. //>>excludeEnd("ctx");
  222. $core.traverseClassTree(self, function(subclass) {
  223. if (subclass !== self) aBlock._value_(subclass);
  224. });
  225. return self;
  226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  227. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  228. //>>excludeEnd("ctx");
  229. },
  230. //>>excludeStart("ide", pragmas.excludeIdeData);
  231. args: ["aBlock"],
  232. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<inlineJS: '$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})'>",
  233. referencedClasses: [],
  234. //>>excludeEnd("ide");
  235. messageSends: []
  236. }),
  237. $globals.Behavior);
  238. $core.addMethod(
  239. $core.method({
  240. selector: "allSuperclasses",
  241. protocol: 'accessing',
  242. fn: function (){
  243. var self=this;
  244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  245. return $core.withContext(function($ctx1) {
  246. //>>excludeEnd("ctx");
  247. var $1,$3,$2,$receiver;
  248. $1=self._superclass();
  249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  250. $ctx1.sendIdx["superclass"]=1;
  251. //>>excludeEnd("ctx");
  252. if(($receiver = $1) == null || $receiver.isNil){
  253. return [];
  254. } else {
  255. $1;
  256. };
  257. $3=self._superclass();
  258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  259. $ctx1.sendIdx["superclass"]=2;
  260. //>>excludeEnd("ctx");
  261. $2=$recv($globals.OrderedCollection)._with_($3);
  262. $recv($2)._addAll_($recv(self._superclass())._allSuperclasses());
  263. return $recv($2)._yourself();
  264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  265. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  266. //>>excludeEnd("ctx");
  267. },
  268. //>>excludeStart("ide", pragmas.excludeIdeData);
  269. args: [],
  270. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
  271. referencedClasses: ["OrderedCollection"],
  272. //>>excludeEnd("ide");
  273. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  274. }),
  275. $globals.Behavior);
  276. $core.addMethod(
  277. $core.method({
  278. selector: "basicAddCompiledMethod:",
  279. protocol: 'private',
  280. fn: function (aMethod){
  281. var self=this;
  282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  283. return $core.withContext(function($ctx1) {
  284. //>>excludeEnd("ctx");
  285. $core.addMethod(aMethod, self);
  286. return self;
  287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  288. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  289. //>>excludeEnd("ctx");
  290. },
  291. //>>excludeStart("ide", pragmas.excludeIdeData);
  292. args: ["aMethod"],
  293. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  294. referencedClasses: [],
  295. //>>excludeEnd("ide");
  296. messageSends: []
  297. }),
  298. $globals.Behavior);
  299. $core.addMethod(
  300. $core.method({
  301. selector: "basicNew",
  302. protocol: 'instance creation',
  303. fn: function (){
  304. var self=this;
  305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  306. return $core.withContext(function($ctx1) {
  307. //>>excludeEnd("ctx");
  308. return new self.fn();
  309. return self;
  310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  311. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  312. //>>excludeEnd("ctx");
  313. },
  314. //>>excludeStart("ide", pragmas.excludeIdeData);
  315. args: [],
  316. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  317. referencedClasses: [],
  318. //>>excludeEnd("ide");
  319. messageSends: []
  320. }),
  321. $globals.Behavior);
  322. $core.addMethod(
  323. $core.method({
  324. selector: "basicRemoveCompiledMethod:",
  325. protocol: 'private',
  326. fn: function (aMethod){
  327. var self=this;
  328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  329. return $core.withContext(function($ctx1) {
  330. //>>excludeEnd("ctx");
  331. $core.removeMethod(aMethod,self);
  332. return self;
  333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  334. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  335. //>>excludeEnd("ctx");
  336. },
  337. //>>excludeStart("ide", pragmas.excludeIdeData);
  338. args: ["aMethod"],
  339. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  340. referencedClasses: [],
  341. //>>excludeEnd("ide");
  342. messageSends: []
  343. }),
  344. $globals.Behavior);
  345. $core.addMethod(
  346. $core.method({
  347. selector: "canUnderstand:",
  348. protocol: 'testing',
  349. fn: function (aSelector){
  350. var self=this;
  351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  352. return $core.withContext(function($ctx1) {
  353. //>>excludeEnd("ctx");
  354. var $2,$1;
  355. return $recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  357. return $core.withContext(function($ctx2) {
  358. //>>excludeEnd("ctx");
  359. $2=self._superclass();
  360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  361. $ctx2.sendIdx["superclass"]=1;
  362. //>>excludeEnd("ctx");
  363. $1=$recv($2)._notNil();
  364. return $recv($1)._and_((function(){
  365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  366. return $core.withContext(function($ctx3) {
  367. //>>excludeEnd("ctx");
  368. return $recv(self._superclass())._canUnderstand_(aSelector);
  369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  370. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  371. //>>excludeEnd("ctx");
  372. }));
  373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  375. //>>excludeEnd("ctx");
  376. }));
  377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  378. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  379. //>>excludeEnd("ctx");
  380. },
  381. //>>excludeStart("ide", pragmas.excludeIdeData);
  382. args: ["aSelector"],
  383. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  384. referencedClasses: [],
  385. //>>excludeEnd("ide");
  386. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  387. }),
  388. $globals.Behavior);
  389. $core.addMethod(
  390. $core.method({
  391. selector: "comment",
  392. protocol: 'accessing',
  393. fn: function (){
  394. var self=this;
  395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  396. return $core.withContext(function($ctx1) {
  397. //>>excludeEnd("ctx");
  398. var $1,$receiver;
  399. $1=self._basicAt_("comment");
  400. if(($receiver = $1) == null || $receiver.isNil){
  401. return "";
  402. } else {
  403. return $1;
  404. };
  405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  406. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  407. //>>excludeEnd("ctx");
  408. },
  409. //>>excludeStart("ide", pragmas.excludeIdeData);
  410. args: [],
  411. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  412. referencedClasses: [],
  413. //>>excludeEnd("ide");
  414. messageSends: ["ifNil:", "basicAt:"]
  415. }),
  416. $globals.Behavior);
  417. $core.addMethod(
  418. $core.method({
  419. selector: "comment:",
  420. protocol: 'accessing',
  421. fn: function (aString){
  422. var self=this;
  423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  424. return $core.withContext(function($ctx1) {
  425. //>>excludeEnd("ctx");
  426. var $1,$3,$2;
  427. self._basicAt_put_("comment",aString);
  428. $1=$recv($globals.SystemAnnouncer)._current();
  429. $3=$recv($globals.ClassCommentChanged)._new();
  430. $recv($3)._theClass_(self);
  431. $2=$recv($3)._yourself();
  432. $recv($1)._announce_($2);
  433. return self;
  434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  435. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  436. //>>excludeEnd("ctx");
  437. },
  438. //>>excludeStart("ide", pragmas.excludeIdeData);
  439. args: ["aString"],
  440. source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)",
  441. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  442. //>>excludeEnd("ide");
  443. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  444. }),
  445. $globals.Behavior);
  446. $core.addMethod(
  447. $core.method({
  448. selector: "compile:protocol:",
  449. protocol: 'compiling',
  450. fn: function (aString,anotherString){
  451. var self=this;
  452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  453. return $core.withContext(function($ctx1) {
  454. //>>excludeEnd("ctx");
  455. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  457. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  458. //>>excludeEnd("ctx");
  459. },
  460. //>>excludeStart("ide", pragmas.excludeIdeData);
  461. args: ["aString", "anotherString"],
  462. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  463. referencedClasses: ["Compiler"],
  464. //>>excludeEnd("ide");
  465. messageSends: ["install:forClass:protocol:", "new"]
  466. }),
  467. $globals.Behavior);
  468. $core.addMethod(
  469. $core.method({
  470. selector: "definition",
  471. protocol: 'accessing',
  472. fn: function (){
  473. var self=this;
  474. return "";
  475. },
  476. //>>excludeStart("ide", pragmas.excludeIdeData);
  477. args: [],
  478. source: "definition\x0a\x09^ ''",
  479. referencedClasses: [],
  480. //>>excludeEnd("ide");
  481. messageSends: []
  482. }),
  483. $globals.Behavior);
  484. $core.addMethod(
  485. $core.method({
  486. selector: "includesBehavior:",
  487. protocol: 'testing',
  488. fn: function (aClass){
  489. var self=this;
  490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  491. return $core.withContext(function($ctx1) {
  492. //>>excludeEnd("ctx");
  493. return $recv(self.__eq_eq(aClass))._or_((function(){
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. return $core.withContext(function($ctx2) {
  496. //>>excludeEnd("ctx");
  497. return self._inheritsFrom_(aClass);
  498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  500. //>>excludeEnd("ctx");
  501. }));
  502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  503. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  504. //>>excludeEnd("ctx");
  505. },
  506. //>>excludeStart("ide", pragmas.excludeIdeData);
  507. args: ["aClass"],
  508. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  509. referencedClasses: [],
  510. //>>excludeEnd("ide");
  511. messageSends: ["or:", "==", "inheritsFrom:"]
  512. }),
  513. $globals.Behavior);
  514. $core.addMethod(
  515. $core.method({
  516. selector: "includesSelector:",
  517. protocol: 'testing',
  518. fn: function (aString){
  519. var self=this;
  520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  521. return $core.withContext(function($ctx1) {
  522. //>>excludeEnd("ctx");
  523. return $recv(self._methodDictionary())._includesKey_(aString);
  524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  525. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  526. //>>excludeEnd("ctx");
  527. },
  528. //>>excludeStart("ide", pragmas.excludeIdeData);
  529. args: ["aString"],
  530. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  531. referencedClasses: [],
  532. //>>excludeEnd("ide");
  533. messageSends: ["includesKey:", "methodDictionary"]
  534. }),
  535. $globals.Behavior);
  536. $core.addMethod(
  537. $core.method({
  538. selector: "inheritsFrom:",
  539. protocol: 'testing',
  540. fn: function (aClass){
  541. var self=this;
  542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  543. return $core.withContext(function($ctx1) {
  544. //>>excludeEnd("ctx");
  545. var $1,$3,$2,$receiver;
  546. $1=self._superclass();
  547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  548. $ctx1.sendIdx["superclass"]=1;
  549. //>>excludeEnd("ctx");
  550. if(($receiver = $1) == null || $receiver.isNil){
  551. return false;
  552. } else {
  553. $1;
  554. };
  555. $3=self._superclass();
  556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  557. $ctx1.sendIdx["superclass"]=2;
  558. //>>excludeEnd("ctx");
  559. $2=$recv(aClass).__eq_eq($3);
  560. return $recv($2)._or_((function(){
  561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  562. return $core.withContext(function($ctx2) {
  563. //>>excludeEnd("ctx");
  564. return $recv(self._superclass())._inheritsFrom_(aClass);
  565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  567. //>>excludeEnd("ctx");
  568. }));
  569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  570. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  571. //>>excludeEnd("ctx");
  572. },
  573. //>>excludeStart("ide", pragmas.excludeIdeData);
  574. args: ["aClass"],
  575. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  576. referencedClasses: [],
  577. //>>excludeEnd("ide");
  578. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  579. }),
  580. $globals.Behavior);
  581. $core.addMethod(
  582. $core.method({
  583. selector: "instanceVariableNames",
  584. protocol: 'accessing',
  585. fn: function (){
  586. var self=this;
  587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  588. return $core.withContext(function($ctx1) {
  589. //>>excludeEnd("ctx");
  590. return self.iVarNames;
  591. return self;
  592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  593. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  594. //>>excludeEnd("ctx");
  595. },
  596. //>>excludeStart("ide", pragmas.excludeIdeData);
  597. args: [],
  598. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  599. referencedClasses: [],
  600. //>>excludeEnd("ide");
  601. messageSends: []
  602. }),
  603. $globals.Behavior);
  604. $core.addMethod(
  605. $core.method({
  606. selector: "isBehavior",
  607. protocol: 'testing',
  608. fn: function (){
  609. var self=this;
  610. return true;
  611. },
  612. //>>excludeStart("ide", pragmas.excludeIdeData);
  613. args: [],
  614. source: "isBehavior\x0a\x09^ true",
  615. referencedClasses: [],
  616. //>>excludeEnd("ide");
  617. messageSends: []
  618. }),
  619. $globals.Behavior);
  620. $core.addMethod(
  621. $core.method({
  622. selector: "javascriptConstructor",
  623. protocol: 'accessing',
  624. fn: function (){
  625. var self=this;
  626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  627. return $core.withContext(function($ctx1) {
  628. //>>excludeEnd("ctx");
  629. return self.fn;
  630. return self;
  631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  632. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  633. //>>excludeEnd("ctx");
  634. },
  635. //>>excludeStart("ide", pragmas.excludeIdeData);
  636. args: [],
  637. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  638. referencedClasses: [],
  639. //>>excludeEnd("ide");
  640. messageSends: []
  641. }),
  642. $globals.Behavior);
  643. $core.addMethod(
  644. $core.method({
  645. selector: "javascriptConstructor:",
  646. protocol: 'accessing',
  647. fn: function (aJavaScriptFunction){
  648. var self=this;
  649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  650. return $core.withContext(function($ctx1) {
  651. //>>excludeEnd("ctx");
  652. $core.setClassConstructor(self, aJavaScriptFunction);;
  653. return self;
  654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  655. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  656. //>>excludeEnd("ctx");
  657. },
  658. //>>excludeStart("ide", pragmas.excludeIdeData);
  659. args: ["aJavaScriptFunction"],
  660. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<inlineJS: '$core.setClassConstructor(self, aJavaScriptFunction);'>",
  661. referencedClasses: [],
  662. //>>excludeEnd("ide");
  663. messageSends: []
  664. }),
  665. $globals.Behavior);
  666. $core.addMethod(
  667. $core.method({
  668. selector: "lookupSelector:",
  669. protocol: 'accessing',
  670. fn: function (selector){
  671. var self=this;
  672. var lookupClass;
  673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  674. return $core.withContext(function($ctx1) {
  675. //>>excludeEnd("ctx");
  676. var $1;
  677. var $early={};
  678. try {
  679. lookupClass=self;
  680. $recv((function(){
  681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  682. return $core.withContext(function($ctx2) {
  683. //>>excludeEnd("ctx");
  684. return $recv(lookupClass).__eq(nil);
  685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  687. //>>excludeEnd("ctx");
  688. }))._whileFalse_((function(){
  689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  690. return $core.withContext(function($ctx2) {
  691. //>>excludeEnd("ctx");
  692. $1=$recv(lookupClass)._includesSelector_(selector);
  693. if($core.assert($1)){
  694. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  695. };
  696. lookupClass=$recv(lookupClass)._superclass();
  697. return lookupClass;
  698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  700. //>>excludeEnd("ctx");
  701. }));
  702. return nil;
  703. }
  704. catch(e) {if(e===$early)return e[0]; throw e}
  705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  706. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  707. //>>excludeEnd("ctx");
  708. },
  709. //>>excludeStart("ide", pragmas.excludeIdeData);
  710. args: ["selector"],
  711. source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
  712. referencedClasses: [],
  713. //>>excludeEnd("ide");
  714. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  715. }),
  716. $globals.Behavior);
  717. $core.addMethod(
  718. $core.method({
  719. selector: "methodAt:",
  720. protocol: 'accessing',
  721. fn: function (aString){
  722. var self=this;
  723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  724. return $core.withContext(function($ctx1) {
  725. //>>excludeEnd("ctx");
  726. return $recv(self._methodDictionary())._at_(aString);
  727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  728. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  729. //>>excludeEnd("ctx");
  730. },
  731. //>>excludeStart("ide", pragmas.excludeIdeData);
  732. args: ["aString"],
  733. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  734. referencedClasses: [],
  735. //>>excludeEnd("ide");
  736. messageSends: ["at:", "methodDictionary"]
  737. }),
  738. $globals.Behavior);
  739. $core.addMethod(
  740. $core.method({
  741. selector: "methodDictionary",
  742. protocol: 'accessing',
  743. fn: function (){
  744. var self=this;
  745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  746. return $core.withContext(function($ctx1) {
  747. //>>excludeEnd("ctx");
  748. var dict = $globals.HashedCollection._new();
  749. var methods = self.methods;
  750. Object.keys(methods).forEach(function(i) {
  751. if(methods[i].selector) {
  752. dict._at_put_(methods[i].selector, methods[i]);
  753. }
  754. });
  755. return dict;
  756. return self;
  757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  758. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  759. //>>excludeEnd("ctx");
  760. },
  761. //>>excludeStart("ide", pragmas.excludeIdeData);
  762. args: [],
  763. source: "methodDictionary\x0a\x09<inlineJS: 'var dict = $globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict'>",
  764. referencedClasses: [],
  765. //>>excludeEnd("ide");
  766. messageSends: []
  767. }),
  768. $globals.Behavior);
  769. $core.addMethod(
  770. $core.method({
  771. selector: "methodTemplate",
  772. protocol: 'accessing',
  773. fn: function (){
  774. var self=this;
  775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  776. return $core.withContext(function($ctx1) {
  777. //>>excludeEnd("ctx");
  778. var $2,$3,$1,$6,$7,$5,$8,$4;
  779. return $recv($globals.String)._streamContents_((function(stream){
  780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  781. return $core.withContext(function($ctx2) {
  782. //>>excludeEnd("ctx");
  783. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  785. $ctx2.sendIdx["nextPutAll:"]=1;
  786. //>>excludeEnd("ctx");
  787. $2=$recv($globals.String)._lf();
  788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  789. $ctx2.sendIdx["lf"]=1;
  790. //>>excludeEnd("ctx");
  791. $3=$recv($globals.String)._tab();
  792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  793. $ctx2.sendIdx["tab"]=1;
  794. //>>excludeEnd("ctx");
  795. $1=$recv($2).__comma($3);
  796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  797. $ctx2.sendIdx[","]=1;
  798. //>>excludeEnd("ctx");
  799. $recv(stream)._nextPutAll_($1);
  800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  801. $ctx2.sendIdx["nextPutAll:"]=2;
  802. //>>excludeEnd("ctx");
  803. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  805. $ctx2.sendIdx["nextPutAll:"]=3;
  806. //>>excludeEnd("ctx");
  807. $6=$recv($globals.String)._lf();
  808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  809. $ctx2.sendIdx["lf"]=2;
  810. //>>excludeEnd("ctx");
  811. $7=$recv($globals.String)._lf();
  812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  813. $ctx2.sendIdx["lf"]=3;
  814. //>>excludeEnd("ctx");
  815. $5=$recv($6).__comma($7);
  816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  817. $ctx2.sendIdx[","]=3;
  818. //>>excludeEnd("ctx");
  819. $8=$recv($globals.String)._tab();
  820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  821. $ctx2.sendIdx["tab"]=2;
  822. //>>excludeEnd("ctx");
  823. $4=$recv($5).__comma($8);
  824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  825. $ctx2.sendIdx[","]=2;
  826. //>>excludeEnd("ctx");
  827. $recv(stream)._nextPutAll_($4);
  828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  829. $ctx2.sendIdx["nextPutAll:"]=4;
  830. //>>excludeEnd("ctx");
  831. $recv(stream)._nextPutAll_("| temporary variable names |");
  832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  833. $ctx2.sendIdx["nextPutAll:"]=5;
  834. //>>excludeEnd("ctx");
  835. $recv(stream)._nextPutAll_($recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab()));
  836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  837. $ctx2.sendIdx["nextPutAll:"]=6;
  838. //>>excludeEnd("ctx");
  839. return $recv(stream)._nextPutAll_("statements");
  840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  841. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  842. //>>excludeEnd("ctx");
  843. }));
  844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  845. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  846. //>>excludeEnd("ctx");
  847. },
  848. //>>excludeStart("ide", pragmas.excludeIdeData);
  849. args: [],
  850. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: 'messageSelectorAndArgumentNames';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: '\x22comment stating purpose of message\x22';\x0a\x09\x09\x09nextPutAll: String lf, String lf, String tab;\x0a\x09\x09\x09nextPutAll: '| temporary variable names |';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'statements' ]",
  851. referencedClasses: ["String"],
  852. //>>excludeEnd("ide");
  853. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  854. }),
  855. $globals.Behavior);
  856. $core.addMethod(
  857. $core.method({
  858. selector: "methods",
  859. protocol: 'accessing',
  860. fn: function (){
  861. var self=this;
  862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  863. return $core.withContext(function($ctx1) {
  864. //>>excludeEnd("ctx");
  865. return $recv(self._methodDictionary())._values();
  866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  867. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  868. //>>excludeEnd("ctx");
  869. },
  870. //>>excludeStart("ide", pragmas.excludeIdeData);
  871. args: [],
  872. source: "methods\x0a\x09^ self methodDictionary values",
  873. referencedClasses: [],
  874. //>>excludeEnd("ide");
  875. messageSends: ["values", "methodDictionary"]
  876. }),
  877. $globals.Behavior);
  878. $core.addMethod(
  879. $core.method({
  880. selector: "methodsInProtocol:",
  881. protocol: 'accessing',
  882. fn: function (aString){
  883. var self=this;
  884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  885. return $core.withContext(function($ctx1) {
  886. //>>excludeEnd("ctx");
  887. return $recv(self._methods())._select_((function(each){
  888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  889. return $core.withContext(function($ctx2) {
  890. //>>excludeEnd("ctx");
  891. return $recv($recv(each)._protocol()).__eq(aString);
  892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  893. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  894. //>>excludeEnd("ctx");
  895. }));
  896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  897. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  898. //>>excludeEnd("ctx");
  899. },
  900. //>>excludeStart("ide", pragmas.excludeIdeData);
  901. args: ["aString"],
  902. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  903. referencedClasses: [],
  904. //>>excludeEnd("ide");
  905. messageSends: ["select:", "methods", "=", "protocol"]
  906. }),
  907. $globals.Behavior);
  908. $core.addMethod(
  909. $core.method({
  910. selector: "name",
  911. protocol: 'accessing',
  912. fn: function (){
  913. var self=this;
  914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  915. return $core.withContext(function($ctx1) {
  916. //>>excludeEnd("ctx");
  917. return self.className || nil;
  918. return self;
  919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  920. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  921. //>>excludeEnd("ctx");
  922. },
  923. //>>excludeStart("ide", pragmas.excludeIdeData);
  924. args: [],
  925. source: "name\x0a\x09<inlineJS: 'return self.className || nil'>",
  926. referencedClasses: [],
  927. //>>excludeEnd("ide");
  928. messageSends: []
  929. }),
  930. $globals.Behavior);
  931. $core.addMethod(
  932. $core.method({
  933. selector: "new",
  934. protocol: 'instance creation',
  935. fn: function (){
  936. var self=this;
  937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  938. return $core.withContext(function($ctx1) {
  939. //>>excludeEnd("ctx");
  940. return $recv(self._basicNew())._initialize();
  941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  942. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  943. //>>excludeEnd("ctx");
  944. },
  945. //>>excludeStart("ide", pragmas.excludeIdeData);
  946. args: [],
  947. source: "new\x0a\x09^ self basicNew initialize",
  948. referencedClasses: [],
  949. //>>excludeEnd("ide");
  950. messageSends: ["initialize", "basicNew"]
  951. }),
  952. $globals.Behavior);
  953. $core.addMethod(
  954. $core.method({
  955. selector: "organization",
  956. protocol: 'accessing',
  957. fn: function (){
  958. var self=this;
  959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  960. return $core.withContext(function($ctx1) {
  961. //>>excludeEnd("ctx");
  962. return self._basicAt_("organization");
  963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  964. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  965. //>>excludeEnd("ctx");
  966. },
  967. //>>excludeStart("ide", pragmas.excludeIdeData);
  968. args: [],
  969. source: "organization\x0a\x09^ self basicAt: 'organization'",
  970. referencedClasses: [],
  971. //>>excludeEnd("ide");
  972. messageSends: ["basicAt:"]
  973. }),
  974. $globals.Behavior);
  975. $core.addMethod(
  976. $core.method({
  977. selector: "ownMethods",
  978. protocol: 'accessing',
  979. fn: function (){
  980. var self=this;
  981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  982. return $core.withContext(function($ctx1) {
  983. //>>excludeEnd("ctx");
  984. var $1;
  985. return $recv($recv(self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  987. return $core.withContext(function($ctx2) {
  988. //>>excludeEnd("ctx");
  989. return $recv(acc).__comma(self._methodsInProtocol_(each));
  990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  991. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  992. //>>excludeEnd("ctx");
  993. })))._sorted_((function(a,b){
  994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  995. return $core.withContext(function($ctx2) {
  996. //>>excludeEnd("ctx");
  997. $1=$recv(a)._selector();
  998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  999. $ctx2.sendIdx["selector"]=1;
  1000. //>>excludeEnd("ctx");
  1001. return $recv($1).__lt_eq($recv(b)._selector());
  1002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1003. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  1004. //>>excludeEnd("ctx");
  1005. }));
  1006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1007. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  1008. //>>excludeEnd("ctx");
  1009. },
  1010. //>>excludeStart("ide", pragmas.excludeIdeData);
  1011. args: [],
  1012. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self methodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  1013. referencedClasses: ["OrderedCollection"],
  1014. //>>excludeEnd("ide");
  1015. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  1016. }),
  1017. $globals.Behavior);
  1018. $core.addMethod(
  1019. $core.method({
  1020. selector: "ownProtocols",
  1021. protocol: 'accessing',
  1022. fn: function (){
  1023. var self=this;
  1024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1025. return $core.withContext(function($ctx1) {
  1026. //>>excludeEnd("ctx");
  1027. return $recv(self._protocols())._reject_((function(each){
  1028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1029. return $core.withContext(function($ctx2) {
  1030. //>>excludeEnd("ctx");
  1031. return $recv(each)._match_("^\x5c*");
  1032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1033. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1034. //>>excludeEnd("ctx");
  1035. }));
  1036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1037. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  1038. //>>excludeEnd("ctx");
  1039. },
  1040. //>>excludeStart("ide", pragmas.excludeIdeData);
  1041. args: [],
  1042. source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
  1043. referencedClasses: [],
  1044. //>>excludeEnd("ide");
  1045. messageSends: ["reject:", "protocols", "match:"]
  1046. }),
  1047. $globals.Behavior);
  1048. $core.addMethod(
  1049. $core.method({
  1050. selector: "packageOfProtocol:",
  1051. protocol: 'accessing',
  1052. fn: function (aString){
  1053. var self=this;
  1054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1055. return $core.withContext(function($ctx1) {
  1056. //>>excludeEnd("ctx");
  1057. var $1;
  1058. $1=$recv(aString)._beginsWith_("*");
  1059. if(!$core.assert($1)){
  1060. return self._package();
  1061. };
  1062. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  1063. return nil;
  1064. }));
  1065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1066. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  1067. //>>excludeEnd("ctx");
  1068. },
  1069. //>>excludeStart("ide", pragmas.excludeIdeData);
  1070. args: ["aString"],
  1071. source: "packageOfProtocol: aString\x0a\x09\x22Answer the package the method of receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the receiver's package\x22\x0a\x09\x0a\x09(aString beginsWith: '*') ifFalse: [\x0a\x09\x09^ self package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: aString allButFirst\x0a\x09\x09ifAbsent: [ nil ]",
  1072. referencedClasses: ["Package"],
  1073. //>>excludeEnd("ide");
  1074. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  1075. }),
  1076. $globals.Behavior);
  1077. $core.addMethod(
  1078. $core.method({
  1079. selector: "protocols",
  1080. protocol: 'accessing',
  1081. fn: function (){
  1082. var self=this;
  1083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1084. return $core.withContext(function($ctx1) {
  1085. //>>excludeEnd("ctx");
  1086. return $recv($recv(self._organization())._elements())._sorted();
  1087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1088. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  1089. //>>excludeEnd("ctx");
  1090. },
  1091. //>>excludeStart("ide", pragmas.excludeIdeData);
  1092. args: [],
  1093. source: "protocols\x0a\x09^ self organization elements sorted",
  1094. referencedClasses: [],
  1095. //>>excludeEnd("ide");
  1096. messageSends: ["sorted", "elements", "organization"]
  1097. }),
  1098. $globals.Behavior);
  1099. $core.addMethod(
  1100. $core.method({
  1101. selector: "protocolsDo:",
  1102. protocol: 'enumerating',
  1103. fn: function (aBlock){
  1104. var self=this;
  1105. var methodsByProtocol;
  1106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1107. return $core.withContext(function($ctx1) {
  1108. //>>excludeEnd("ctx");
  1109. methodsByProtocol=$recv($globals.HashedCollection)._new();
  1110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1111. $ctx1.sendIdx["new"]=1;
  1112. //>>excludeEnd("ctx");
  1113. $recv(self._methodDictionary())._valuesDo_((function(m){
  1114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1115. return $core.withContext(function($ctx2) {
  1116. //>>excludeEnd("ctx");
  1117. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  1118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1119. return $core.withContext(function($ctx3) {
  1120. //>>excludeEnd("ctx");
  1121. return $recv($globals.Array)._new();
  1122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1123. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1124. //>>excludeEnd("ctx");
  1125. })))._add_(m);
  1126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1127. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  1128. //>>excludeEnd("ctx");
  1129. }));
  1130. $recv(self._protocols())._do_((function(protocol){
  1131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1132. return $core.withContext(function($ctx2) {
  1133. //>>excludeEnd("ctx");
  1134. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  1135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1136. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  1137. //>>excludeEnd("ctx");
  1138. }));
  1139. return self;
  1140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1141. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  1142. //>>excludeEnd("ctx");
  1143. },
  1144. //>>excludeStart("ide", pragmas.excludeIdeData);
  1145. args: ["aBlock"],
  1146. source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method protocol with\x0a\x09its collection of methods in the sort order of protocol name.\x22\x0a\x0a\x09| methodsByProtocol |\x0a\x09methodsByProtocol := HashedCollection new.\x0a\x09self methodDictionary valuesDo: [ :m |\x0a\x09\x09(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])\x0a\x09\x09\x09add: m ].\x0a\x09self protocols do: [ :protocol |\x0a\x09\x09aBlock value: protocol value: (methodsByProtocol at: protocol) ]",
  1147. referencedClasses: ["HashedCollection", "Array"],
  1148. //>>excludeEnd("ide");
  1149. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  1150. }),
  1151. $globals.Behavior);
  1152. $core.addMethod(
  1153. $core.method({
  1154. selector: "prototype",
  1155. protocol: 'accessing',
  1156. fn: function (){
  1157. var self=this;
  1158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1159. return $core.withContext(function($ctx1) {
  1160. //>>excludeEnd("ctx");
  1161. return self.fn.prototype;
  1162. return self;
  1163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1164. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  1165. //>>excludeEnd("ctx");
  1166. },
  1167. //>>excludeStart("ide", pragmas.excludeIdeData);
  1168. args: [],
  1169. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  1170. referencedClasses: [],
  1171. //>>excludeEnd("ide");
  1172. messageSends: []
  1173. }),
  1174. $globals.Behavior);
  1175. $core.addMethod(
  1176. $core.method({
  1177. selector: "recompile",
  1178. protocol: 'compiling',
  1179. fn: function (){
  1180. var self=this;
  1181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1182. return $core.withContext(function($ctx1) {
  1183. //>>excludeEnd("ctx");
  1184. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  1185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1186. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  1187. //>>excludeEnd("ctx");
  1188. },
  1189. //>>excludeStart("ide", pragmas.excludeIdeData);
  1190. args: [],
  1191. source: "recompile\x0a\x09^ Compiler new recompile: self",
  1192. referencedClasses: ["Compiler"],
  1193. //>>excludeEnd("ide");
  1194. messageSends: ["recompile:", "new"]
  1195. }),
  1196. $globals.Behavior);
  1197. $core.addMethod(
  1198. $core.method({
  1199. selector: "removeCompiledMethod:",
  1200. protocol: 'compiling',
  1201. fn: function (aMethod){
  1202. var self=this;
  1203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1204. return $core.withContext(function($ctx1) {
  1205. //>>excludeEnd("ctx");
  1206. var $1,$3,$2;
  1207. self._basicRemoveCompiledMethod_(aMethod);
  1208. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  1209. $1=$recv($globals.SystemAnnouncer)._current();
  1210. $3=$recv($globals.MethodRemoved)._new();
  1211. $recv($3)._method_(aMethod);
  1212. $2=$recv($3)._yourself();
  1213. $recv($1)._announce_($2);
  1214. return self;
  1215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1216. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  1217. //>>excludeEnd("ctx");
  1218. },
  1219. //>>excludeStart("ide", pragmas.excludeIdeData);
  1220. args: ["aMethod"],
  1221. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self removeProtocolIfEmpty: aMethod protocol.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  1222. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  1223. //>>excludeEnd("ide");
  1224. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  1225. }),
  1226. $globals.Behavior);
  1227. $core.addMethod(
  1228. $core.method({
  1229. selector: "removeProtocolIfEmpty:",
  1230. protocol: 'accessing',
  1231. fn: function (aString){
  1232. var self=this;
  1233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1234. return $core.withContext(function($ctx1) {
  1235. //>>excludeEnd("ctx");
  1236. $recv(self._methods())._detect_ifNone_((function(each){
  1237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1238. return $core.withContext(function($ctx2) {
  1239. //>>excludeEnd("ctx");
  1240. return $recv($recv(each)._protocol()).__eq(aString);
  1241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1242. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1243. //>>excludeEnd("ctx");
  1244. }),(function(){
  1245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1246. return $core.withContext(function($ctx2) {
  1247. //>>excludeEnd("ctx");
  1248. return $recv(self._organization())._removeElement_(aString);
  1249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  1251. //>>excludeEnd("ctx");
  1252. }));
  1253. return self;
  1254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1255. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  1256. //>>excludeEnd("ctx");
  1257. },
  1258. //>>excludeStart("ide", pragmas.excludeIdeData);
  1259. args: ["aString"],
  1260. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  1261. referencedClasses: [],
  1262. //>>excludeEnd("ide");
  1263. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  1264. }),
  1265. $globals.Behavior);
  1266. $core.addMethod(
  1267. $core.method({
  1268. selector: "selectors",
  1269. protocol: 'accessing',
  1270. fn: function (){
  1271. var self=this;
  1272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1273. return $core.withContext(function($ctx1) {
  1274. //>>excludeEnd("ctx");
  1275. return $recv(self._methodDictionary())._keys();
  1276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1277. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  1278. //>>excludeEnd("ctx");
  1279. },
  1280. //>>excludeStart("ide", pragmas.excludeIdeData);
  1281. args: [],
  1282. source: "selectors\x0a\x09^ self methodDictionary keys",
  1283. referencedClasses: [],
  1284. //>>excludeEnd("ide");
  1285. messageSends: ["keys", "methodDictionary"]
  1286. }),
  1287. $globals.Behavior);
  1288. $core.addMethod(
  1289. $core.method({
  1290. selector: "subclasses",
  1291. protocol: 'accessing',
  1292. fn: function (){
  1293. var self=this;
  1294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1295. return $core.withContext(function($ctx1) {
  1296. //>>excludeEnd("ctx");
  1297. self._subclassResponsibility();
  1298. return self;
  1299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1300. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  1301. //>>excludeEnd("ctx");
  1302. },
  1303. //>>excludeStart("ide", pragmas.excludeIdeData);
  1304. args: [],
  1305. source: "subclasses\x0a\x09self subclassResponsibility",
  1306. referencedClasses: [],
  1307. //>>excludeEnd("ide");
  1308. messageSends: ["subclassResponsibility"]
  1309. }),
  1310. $globals.Behavior);
  1311. $core.addMethod(
  1312. $core.method({
  1313. selector: "superclass",
  1314. protocol: 'accessing',
  1315. fn: function (){
  1316. var self=this;
  1317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1318. return $core.withContext(function($ctx1) {
  1319. //>>excludeEnd("ctx");
  1320. return self.superclass;
  1321. return self;
  1322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1323. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  1324. //>>excludeEnd("ctx");
  1325. },
  1326. //>>excludeStart("ide", pragmas.excludeIdeData);
  1327. args: [],
  1328. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  1329. referencedClasses: [],
  1330. //>>excludeEnd("ide");
  1331. messageSends: []
  1332. }),
  1333. $globals.Behavior);
  1334. $core.addMethod(
  1335. $core.method({
  1336. selector: "theMetaClass",
  1337. protocol: 'accessing',
  1338. fn: function (){
  1339. var self=this;
  1340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1341. return $core.withContext(function($ctx1) {
  1342. //>>excludeEnd("ctx");
  1343. self._subclassResponsibility();
  1344. return self;
  1345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1346. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  1347. //>>excludeEnd("ctx");
  1348. },
  1349. //>>excludeStart("ide", pragmas.excludeIdeData);
  1350. args: [],
  1351. source: "theMetaClass\x0a\x09self subclassResponsibility",
  1352. referencedClasses: [],
  1353. //>>excludeEnd("ide");
  1354. messageSends: ["subclassResponsibility"]
  1355. }),
  1356. $globals.Behavior);
  1357. $core.addMethod(
  1358. $core.method({
  1359. selector: "theNonMetaClass",
  1360. protocol: 'accessing',
  1361. fn: function (){
  1362. var self=this;
  1363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1364. return $core.withContext(function($ctx1) {
  1365. //>>excludeEnd("ctx");
  1366. self._subclassResponsibility();
  1367. return self;
  1368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1369. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  1370. //>>excludeEnd("ctx");
  1371. },
  1372. //>>excludeStart("ide", pragmas.excludeIdeData);
  1373. args: [],
  1374. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  1375. referencedClasses: [],
  1376. //>>excludeEnd("ide");
  1377. messageSends: ["subclassResponsibility"]
  1378. }),
  1379. $globals.Behavior);
  1380. $core.addMethod(
  1381. $core.method({
  1382. selector: "withAllSubclasses",
  1383. protocol: 'accessing',
  1384. fn: function (){
  1385. var self=this;
  1386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1387. return $core.withContext(function($ctx1) {
  1388. //>>excludeEnd("ctx");
  1389. var $1;
  1390. $1=$recv($globals.Array)._with_(self);
  1391. $recv($1)._addAll_(self._allSubclasses());
  1392. return $recv($1)._yourself();
  1393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1394. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  1395. //>>excludeEnd("ctx");
  1396. },
  1397. //>>excludeStart("ide", pragmas.excludeIdeData);
  1398. args: [],
  1399. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  1400. referencedClasses: ["Array"],
  1401. //>>excludeEnd("ide");
  1402. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  1403. }),
  1404. $globals.Behavior);
  1405. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  1406. //>>excludeStart("ide", pragmas.excludeIdeData);
  1407. $globals.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  1408. //>>excludeEnd("ide");
  1409. $core.addMethod(
  1410. $core.method({
  1411. selector: "asJavascript",
  1412. protocol: 'converting',
  1413. fn: function (){
  1414. var self=this;
  1415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1416. return $core.withContext(function($ctx1) {
  1417. //>>excludeEnd("ctx");
  1418. return "$globals.".__comma(self._name());
  1419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1420. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  1421. //>>excludeEnd("ctx");
  1422. },
  1423. //>>excludeStart("ide", pragmas.excludeIdeData);
  1424. args: [],
  1425. source: "asJavascript\x0a\x09^ '$globals.', self name",
  1426. referencedClasses: [],
  1427. //>>excludeEnd("ide");
  1428. messageSends: [",", "name"]
  1429. }),
  1430. $globals.Class);
  1431. $core.addMethod(
  1432. $core.method({
  1433. selector: "browse",
  1434. protocol: 'browsing',
  1435. fn: function (){
  1436. var self=this;
  1437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1438. return $core.withContext(function($ctx1) {
  1439. //>>excludeEnd("ctx");
  1440. $recv($globals.Finder)._findClass_(self);
  1441. return self;
  1442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1443. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  1444. //>>excludeEnd("ctx");
  1445. },
  1446. //>>excludeStart("ide", pragmas.excludeIdeData);
  1447. args: [],
  1448. source: "browse\x0a\x09Finder findClass: self",
  1449. referencedClasses: ["Finder"],
  1450. //>>excludeEnd("ide");
  1451. messageSends: ["findClass:"]
  1452. }),
  1453. $globals.Class);
  1454. $core.addMethod(
  1455. $core.method({
  1456. selector: "category",
  1457. protocol: 'accessing',
  1458. fn: function (){
  1459. var self=this;
  1460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1461. return $core.withContext(function($ctx1) {
  1462. //>>excludeEnd("ctx");
  1463. var $1,$receiver;
  1464. $1=self._package();
  1465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1466. $ctx1.sendIdx["package"]=1;
  1467. //>>excludeEnd("ctx");
  1468. if(($receiver = $1) == null || $receiver.isNil){
  1469. return "Unclassified";
  1470. } else {
  1471. return $recv(self._package())._name();
  1472. };
  1473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1474. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  1475. //>>excludeEnd("ctx");
  1476. },
  1477. //>>excludeStart("ide", pragmas.excludeIdeData);
  1478. args: [],
  1479. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  1480. referencedClasses: [],
  1481. //>>excludeEnd("ide");
  1482. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  1483. }),
  1484. $globals.Class);
  1485. $core.addMethod(
  1486. $core.method({
  1487. selector: "classTag",
  1488. protocol: 'accessing',
  1489. fn: function (){
  1490. var self=this;
  1491. return "class";
  1492. },
  1493. //>>excludeStart("ide", pragmas.excludeIdeData);
  1494. args: [],
  1495. 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^ 'class'",
  1496. referencedClasses: [],
  1497. //>>excludeEnd("ide");
  1498. messageSends: []
  1499. }),
  1500. $globals.Class);
  1501. $core.addMethod(
  1502. $core.method({
  1503. selector: "definition",
  1504. protocol: 'accessing',
  1505. fn: function (){
  1506. var self=this;
  1507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1508. return $core.withContext(function($ctx1) {
  1509. //>>excludeEnd("ctx");
  1510. var $2,$3,$1,$4,$5;
  1511. return $recv($globals.String)._streamContents_((function(stream){
  1512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1513. return $core.withContext(function($ctx2) {
  1514. //>>excludeEnd("ctx");
  1515. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  1516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1517. $ctx2.sendIdx["nextPutAll:"]=1;
  1518. //>>excludeEnd("ctx");
  1519. $recv(stream)._nextPutAll_(" subclass: #");
  1520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1521. $ctx2.sendIdx["nextPutAll:"]=2;
  1522. //>>excludeEnd("ctx");
  1523. $recv(stream)._nextPutAll_(self._name());
  1524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1525. $ctx2.sendIdx["nextPutAll:"]=3;
  1526. //>>excludeEnd("ctx");
  1527. $2=$recv($globals.String)._lf();
  1528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1529. $ctx2.sendIdx["lf"]=1;
  1530. //>>excludeEnd("ctx");
  1531. $3=$recv($globals.String)._tab();
  1532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1533. $ctx2.sendIdx["tab"]=1;
  1534. //>>excludeEnd("ctx");
  1535. $1=$recv($2).__comma($3);
  1536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1537. $ctx2.sendIdx[","]=1;
  1538. //>>excludeEnd("ctx");
  1539. $recv(stream)._nextPutAll_($1);
  1540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1541. $ctx2.sendIdx["nextPutAll:"]=4;
  1542. //>>excludeEnd("ctx");
  1543. $4=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  1544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1545. $ctx2.sendIdx["nextPutAll:"]=5;
  1546. //>>excludeEnd("ctx");
  1547. $4;
  1548. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  1549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1550. return $core.withContext(function($ctx3) {
  1551. //>>excludeEnd("ctx");
  1552. return $recv(stream)._nextPutAll_(each);
  1553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1554. $ctx3.sendIdx["nextPutAll:"]=6;
  1555. //>>excludeEnd("ctx");
  1556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1557. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  1558. //>>excludeEnd("ctx");
  1559. }),(function(){
  1560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1561. return $core.withContext(function($ctx3) {
  1562. //>>excludeEnd("ctx");
  1563. return $recv(stream)._nextPutAll_(" ");
  1564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1565. $ctx3.sendIdx["nextPutAll:"]=7;
  1566. //>>excludeEnd("ctx");
  1567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1568. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  1569. //>>excludeEnd("ctx");
  1570. }));
  1571. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  1572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1573. $ctx2.sendIdx[","]=2;
  1574. //>>excludeEnd("ctx");
  1575. $recv(stream)._nextPutAll_($5);
  1576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1577. $ctx2.sendIdx["nextPutAll:"]=8;
  1578. //>>excludeEnd("ctx");
  1579. $recv(stream)._nextPutAll_("package: '");
  1580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1581. $ctx2.sendIdx["nextPutAll:"]=9;
  1582. //>>excludeEnd("ctx");
  1583. $recv(stream)._nextPutAll_(self._category());
  1584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1585. $ctx2.sendIdx["nextPutAll:"]=10;
  1586. //>>excludeEnd("ctx");
  1587. return $recv(stream)._nextPutAll_("'");
  1588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1589. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1590. //>>excludeEnd("ctx");
  1591. }));
  1592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1593. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  1594. //>>excludeEnd("ctx");
  1595. },
  1596. //>>excludeStart("ide", pragmas.excludeIdeData);
  1597. args: [],
  1598. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]",
  1599. referencedClasses: ["String"],
  1600. //>>excludeEnd("ide");
  1601. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  1602. }),
  1603. $globals.Class);
  1604. $core.addMethod(
  1605. $core.method({
  1606. selector: "isClass",
  1607. protocol: 'testing',
  1608. fn: function (){
  1609. var self=this;
  1610. return true;
  1611. },
  1612. //>>excludeStart("ide", pragmas.excludeIdeData);
  1613. args: [],
  1614. source: "isClass\x0a\x09^ true",
  1615. referencedClasses: [],
  1616. //>>excludeEnd("ide");
  1617. messageSends: []
  1618. }),
  1619. $globals.Class);
  1620. $core.addMethod(
  1621. $core.method({
  1622. selector: "package",
  1623. protocol: 'accessing',
  1624. fn: function (){
  1625. var self=this;
  1626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1627. return $core.withContext(function($ctx1) {
  1628. //>>excludeEnd("ctx");
  1629. return self._basicAt_("pkg");
  1630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1631. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  1632. //>>excludeEnd("ctx");
  1633. },
  1634. //>>excludeStart("ide", pragmas.excludeIdeData);
  1635. args: [],
  1636. source: "package\x0a\x09^ self basicAt: 'pkg'",
  1637. referencedClasses: [],
  1638. //>>excludeEnd("ide");
  1639. messageSends: ["basicAt:"]
  1640. }),
  1641. $globals.Class);
  1642. $core.addMethod(
  1643. $core.method({
  1644. selector: "package:",
  1645. protocol: 'accessing',
  1646. fn: function (aPackage){
  1647. var self=this;
  1648. var oldPackage;
  1649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1650. return $core.withContext(function($ctx1) {
  1651. //>>excludeEnd("ctx");
  1652. var $2,$1,$3,$4,$6,$5;
  1653. $2=self._package();
  1654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1655. $ctx1.sendIdx["package"]=1;
  1656. //>>excludeEnd("ctx");
  1657. $1=$recv($2).__eq(aPackage);
  1658. if($core.assert($1)){
  1659. return self;
  1660. };
  1661. oldPackage=self._package();
  1662. self._basicAt_put_("pkg",aPackage);
  1663. $3=$recv(oldPackage)._organization();
  1664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1665. $ctx1.sendIdx["organization"]=1;
  1666. //>>excludeEnd("ctx");
  1667. $recv($3)._removeElement_(self);
  1668. $recv($recv(aPackage)._organization())._addElement_(self);
  1669. $4=$recv($globals.SystemAnnouncer)._current();
  1670. $6=$recv($globals.ClassMoved)._new();
  1671. $recv($6)._theClass_(self);
  1672. $recv($6)._oldPackage_(oldPackage);
  1673. $5=$recv($6)._yourself();
  1674. $recv($4)._announce_($5);
  1675. return self;
  1676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1677. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  1678. //>>excludeEnd("ctx");
  1679. },
  1680. //>>excludeStart("ide", pragmas.excludeIdeData);
  1681. args: ["aPackage"],
  1682. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  1683. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  1684. //>>excludeEnd("ide");
  1685. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  1686. }),
  1687. $globals.Class);
  1688. $core.addMethod(
  1689. $core.method({
  1690. selector: "printOn:",
  1691. protocol: 'printing',
  1692. fn: function (aStream){
  1693. var self=this;
  1694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1695. return $core.withContext(function($ctx1) {
  1696. //>>excludeEnd("ctx");
  1697. $recv(aStream)._nextPutAll_(self._name());
  1698. return self;
  1699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1700. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  1701. //>>excludeEnd("ctx");
  1702. },
  1703. //>>excludeStart("ide", pragmas.excludeIdeData);
  1704. args: ["aStream"],
  1705. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  1706. referencedClasses: [],
  1707. //>>excludeEnd("ide");
  1708. messageSends: ["nextPutAll:", "name"]
  1709. }),
  1710. $globals.Class);
  1711. $core.addMethod(
  1712. $core.method({
  1713. selector: "rename:",
  1714. protocol: 'accessing',
  1715. fn: function (aString){
  1716. var self=this;
  1717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1718. return $core.withContext(function($ctx1) {
  1719. //>>excludeEnd("ctx");
  1720. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  1721. return self;
  1722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1723. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  1724. //>>excludeEnd("ctx");
  1725. },
  1726. //>>excludeStart("ide", pragmas.excludeIdeData);
  1727. args: ["aString"],
  1728. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  1729. referencedClasses: ["ClassBuilder"],
  1730. //>>excludeEnd("ide");
  1731. messageSends: ["renameClass:to:", "new"]
  1732. }),
  1733. $globals.Class);
  1734. $core.addMethod(
  1735. $core.method({
  1736. selector: "subclass:instanceVariableNames:",
  1737. protocol: 'class creation',
  1738. fn: function (aString,anotherString){
  1739. var self=this;
  1740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1741. return $core.withContext(function($ctx1) {
  1742. //>>excludeEnd("ctx");
  1743. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  1744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1745. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  1746. //>>excludeEnd("ctx");
  1747. },
  1748. //>>excludeStart("ide", pragmas.excludeIdeData);
  1749. args: ["aString", "anotherString"],
  1750. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  1751. referencedClasses: [],
  1752. //>>excludeEnd("ide");
  1753. messageSends: ["subclass:instanceVariableNames:package:"]
  1754. }),
  1755. $globals.Class);
  1756. $core.addMethod(
  1757. $core.method({
  1758. selector: "subclass:instanceVariableNames:category:",
  1759. protocol: 'class creation',
  1760. fn: function (aString,aString2,aString3){
  1761. var self=this;
  1762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1763. return $core.withContext(function($ctx1) {
  1764. //>>excludeEnd("ctx");
  1765. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  1766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1767. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  1768. //>>excludeEnd("ctx");
  1769. },
  1770. //>>excludeStart("ide", pragmas.excludeIdeData);
  1771. args: ["aString", "aString2", "aString3"],
  1772. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  1773. referencedClasses: [],
  1774. //>>excludeEnd("ide");
  1775. messageSends: ["subclass:instanceVariableNames:package:"]
  1776. }),
  1777. $globals.Class);
  1778. $core.addMethod(
  1779. $core.method({
  1780. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  1781. protocol: 'class creation',
  1782. fn: function (aString,aString2,classVars,pools,aString3){
  1783. var self=this;
  1784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1785. return $core.withContext(function($ctx1) {
  1786. //>>excludeEnd("ctx");
  1787. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  1788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1789. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  1790. //>>excludeEnd("ctx");
  1791. },
  1792. //>>excludeStart("ide", pragmas.excludeIdeData);
  1793. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  1794. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  1795. referencedClasses: [],
  1796. //>>excludeEnd("ide");
  1797. messageSends: ["subclass:instanceVariableNames:package:"]
  1798. }),
  1799. $globals.Class);
  1800. $core.addMethod(
  1801. $core.method({
  1802. selector: "subclass:instanceVariableNames:package:",
  1803. protocol: 'class creation',
  1804. fn: function (aString,aString2,aString3){
  1805. var self=this;
  1806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1807. return $core.withContext(function($ctx1) {
  1808. //>>excludeEnd("ctx");
  1809. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  1810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1811. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  1812. //>>excludeEnd("ctx");
  1813. },
  1814. //>>excludeStart("ide", pragmas.excludeIdeData);
  1815. args: ["aString", "aString2", "aString3"],
  1816. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  1817. referencedClasses: ["ClassBuilder"],
  1818. //>>excludeEnd("ide");
  1819. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  1820. }),
  1821. $globals.Class);
  1822. $core.addMethod(
  1823. $core.method({
  1824. selector: "subclasses",
  1825. protocol: 'accessing',
  1826. fn: function (){
  1827. var self=this;
  1828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1829. return $core.withContext(function($ctx1) {
  1830. //>>excludeEnd("ctx");
  1831. return self.subclasses._copy();
  1832. return self;
  1833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1834. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  1835. //>>excludeEnd("ctx");
  1836. },
  1837. //>>excludeStart("ide", pragmas.excludeIdeData);
  1838. args: [],
  1839. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  1840. referencedClasses: [],
  1841. //>>excludeEnd("ide");
  1842. messageSends: []
  1843. }),
  1844. $globals.Class);
  1845. $core.addMethod(
  1846. $core.method({
  1847. selector: "theMetaClass",
  1848. protocol: 'accessing',
  1849. fn: function (){
  1850. var self=this;
  1851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1852. return $core.withContext(function($ctx1) {
  1853. //>>excludeEnd("ctx");
  1854. return self._class();
  1855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1856. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  1857. //>>excludeEnd("ctx");
  1858. },
  1859. //>>excludeStart("ide", pragmas.excludeIdeData);
  1860. args: [],
  1861. source: "theMetaClass\x0a\x09^ self class",
  1862. referencedClasses: [],
  1863. //>>excludeEnd("ide");
  1864. messageSends: ["class"]
  1865. }),
  1866. $globals.Class);
  1867. $core.addMethod(
  1868. $core.method({
  1869. selector: "theNonMetaClass",
  1870. protocol: 'accessing',
  1871. fn: function (){
  1872. var self=this;
  1873. return self;
  1874. },
  1875. //>>excludeStart("ide", pragmas.excludeIdeData);
  1876. args: [],
  1877. source: "theNonMetaClass\x0a\x09^ self",
  1878. referencedClasses: [],
  1879. //>>excludeEnd("ide");
  1880. messageSends: []
  1881. }),
  1882. $globals.Class);
  1883. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  1884. //>>excludeStart("ide", pragmas.excludeIdeData);
  1885. $globals.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.";
  1886. //>>excludeEnd("ide");
  1887. $core.addMethod(
  1888. $core.method({
  1889. selector: "asJavascript",
  1890. protocol: 'converting',
  1891. fn: function (){
  1892. var self=this;
  1893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1894. return $core.withContext(function($ctx1) {
  1895. //>>excludeEnd("ctx");
  1896. var $1;
  1897. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  1898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1899. $ctx1.sendIdx[","]=1;
  1900. //>>excludeEnd("ctx");
  1901. return $1;
  1902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1903. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  1904. //>>excludeEnd("ctx");
  1905. },
  1906. //>>excludeStart("ide", pragmas.excludeIdeData);
  1907. args: [],
  1908. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  1909. referencedClasses: [],
  1910. //>>excludeEnd("ide");
  1911. messageSends: [",", "name", "instanceClass"]
  1912. }),
  1913. $globals.Metaclass);
  1914. $core.addMethod(
  1915. $core.method({
  1916. selector: "definition",
  1917. protocol: 'accessing',
  1918. fn: function (){
  1919. var self=this;
  1920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1921. return $core.withContext(function($ctx1) {
  1922. //>>excludeEnd("ctx");
  1923. var $1;
  1924. return $recv($globals.String)._streamContents_((function(stream){
  1925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1926. return $core.withContext(function($ctx2) {
  1927. //>>excludeEnd("ctx");
  1928. $recv(stream)._nextPutAll_(self._asString());
  1929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1930. $ctx2.sendIdx["nextPutAll:"]=1;
  1931. //>>excludeEnd("ctx");
  1932. $1=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  1933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1934. $ctx2.sendIdx["nextPutAll:"]=2;
  1935. //>>excludeEnd("ctx");
  1936. $1;
  1937. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  1938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1939. return $core.withContext(function($ctx3) {
  1940. //>>excludeEnd("ctx");
  1941. return $recv(stream)._nextPutAll_(each);
  1942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1943. $ctx3.sendIdx["nextPutAll:"]=3;
  1944. //>>excludeEnd("ctx");
  1945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1946. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  1947. //>>excludeEnd("ctx");
  1948. }),(function(){
  1949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1950. return $core.withContext(function($ctx3) {
  1951. //>>excludeEnd("ctx");
  1952. return $recv(stream)._nextPutAll_(" ");
  1953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1954. $ctx3.sendIdx["nextPutAll:"]=4;
  1955. //>>excludeEnd("ctx");
  1956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1957. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  1958. //>>excludeEnd("ctx");
  1959. }));
  1960. return $recv(stream)._nextPutAll_("'");
  1961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1962. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1963. //>>excludeEnd("ctx");
  1964. }));
  1965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1966. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  1967. //>>excludeEnd("ctx");
  1968. },
  1969. //>>excludeStart("ide", pragmas.excludeIdeData);
  1970. args: [],
  1971. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  1972. referencedClasses: ["String"],
  1973. //>>excludeEnd("ide");
  1974. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  1975. }),
  1976. $globals.Metaclass);
  1977. $core.addMethod(
  1978. $core.method({
  1979. selector: "instanceClass",
  1980. protocol: 'accessing',
  1981. fn: function (){
  1982. var self=this;
  1983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1984. return $core.withContext(function($ctx1) {
  1985. //>>excludeEnd("ctx");
  1986. return self.instanceClass;
  1987. return self;
  1988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1989. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  1990. //>>excludeEnd("ctx");
  1991. },
  1992. //>>excludeStart("ide", pragmas.excludeIdeData);
  1993. args: [],
  1994. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  1995. referencedClasses: [],
  1996. //>>excludeEnd("ide");
  1997. messageSends: []
  1998. }),
  1999. $globals.Metaclass);
  2000. $core.addMethod(
  2001. $core.method({
  2002. selector: "instanceVariableNames:",
  2003. protocol: 'accessing',
  2004. fn: function (aCollection){
  2005. var self=this;
  2006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2007. return $core.withContext(function($ctx1) {
  2008. //>>excludeEnd("ctx");
  2009. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  2010. return self;
  2011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2012. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  2013. //>>excludeEnd("ctx");
  2014. },
  2015. //>>excludeStart("ide", pragmas.excludeIdeData);
  2016. args: ["aCollection"],
  2017. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  2018. referencedClasses: ["ClassBuilder"],
  2019. //>>excludeEnd("ide");
  2020. messageSends: ["class:instanceVariableNames:", "new"]
  2021. }),
  2022. $globals.Metaclass);
  2023. $core.addMethod(
  2024. $core.method({
  2025. selector: "isMetaclass",
  2026. protocol: 'testing',
  2027. fn: function (){
  2028. var self=this;
  2029. return true;
  2030. },
  2031. //>>excludeStart("ide", pragmas.excludeIdeData);
  2032. args: [],
  2033. source: "isMetaclass\x0a\x09^ true",
  2034. referencedClasses: [],
  2035. //>>excludeEnd("ide");
  2036. messageSends: []
  2037. }),
  2038. $globals.Metaclass);
  2039. $core.addMethod(
  2040. $core.method({
  2041. selector: "package",
  2042. protocol: 'accessing',
  2043. fn: function (){
  2044. var self=this;
  2045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2046. return $core.withContext(function($ctx1) {
  2047. //>>excludeEnd("ctx");
  2048. return $recv(self._instanceClass())._package();
  2049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2050. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  2051. //>>excludeEnd("ctx");
  2052. },
  2053. //>>excludeStart("ide", pragmas.excludeIdeData);
  2054. args: [],
  2055. source: "package\x0a\x09^ self instanceClass package",
  2056. referencedClasses: [],
  2057. //>>excludeEnd("ide");
  2058. messageSends: ["package", "instanceClass"]
  2059. }),
  2060. $globals.Metaclass);
  2061. $core.addMethod(
  2062. $core.method({
  2063. selector: "printOn:",
  2064. protocol: 'printing',
  2065. fn: function (aStream){
  2066. var self=this;
  2067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2068. return $core.withContext(function($ctx1) {
  2069. //>>excludeEnd("ctx");
  2070. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  2071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2072. $ctx1.sendIdx["nextPutAll:"]=1;
  2073. //>>excludeEnd("ctx");
  2074. $recv(aStream)._nextPutAll_(" class");
  2075. return self;
  2076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2077. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  2078. //>>excludeEnd("ctx");
  2079. },
  2080. //>>excludeStart("ide", pragmas.excludeIdeData);
  2081. args: ["aStream"],
  2082. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  2083. referencedClasses: [],
  2084. //>>excludeEnd("ide");
  2085. messageSends: ["nextPutAll:", "name", "instanceClass"]
  2086. }),
  2087. $globals.Metaclass);
  2088. $core.addMethod(
  2089. $core.method({
  2090. selector: "subclasses",
  2091. protocol: 'accessing',
  2092. fn: function (){
  2093. var self=this;
  2094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2095. return $core.withContext(function($ctx1) {
  2096. //>>excludeEnd("ctx");
  2097. return $core.metaSubclasses(self);
  2098. return self;
  2099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2100. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  2101. //>>excludeEnd("ctx");
  2102. },
  2103. //>>excludeStart("ide", pragmas.excludeIdeData);
  2104. args: [],
  2105. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  2106. referencedClasses: [],
  2107. //>>excludeEnd("ide");
  2108. messageSends: []
  2109. }),
  2110. $globals.Metaclass);
  2111. $core.addMethod(
  2112. $core.method({
  2113. selector: "theMetaClass",
  2114. protocol: 'accessing',
  2115. fn: function (){
  2116. var self=this;
  2117. return self;
  2118. },
  2119. //>>excludeStart("ide", pragmas.excludeIdeData);
  2120. args: [],
  2121. source: "theMetaClass\x0a\x09^ self",
  2122. referencedClasses: [],
  2123. //>>excludeEnd("ide");
  2124. messageSends: []
  2125. }),
  2126. $globals.Metaclass);
  2127. $core.addMethod(
  2128. $core.method({
  2129. selector: "theNonMetaClass",
  2130. protocol: 'accessing',
  2131. fn: function (){
  2132. var self=this;
  2133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2134. return $core.withContext(function($ctx1) {
  2135. //>>excludeEnd("ctx");
  2136. return self._instanceClass();
  2137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2138. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  2139. //>>excludeEnd("ctx");
  2140. },
  2141. //>>excludeStart("ide", pragmas.excludeIdeData);
  2142. args: [],
  2143. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  2144. referencedClasses: [],
  2145. //>>excludeEnd("ide");
  2146. messageSends: ["instanceClass"]
  2147. }),
  2148. $globals.Metaclass);
  2149. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  2150. //>>excludeStart("ide", pragmas.excludeIdeData);
  2151. $globals.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.";
  2152. //>>excludeEnd("ide");
  2153. $core.addMethod(
  2154. $core.method({
  2155. selector: "addSubclassOf:named:instanceVariableNames:package:",
  2156. protocol: 'class definition',
  2157. fn: function (aClass,className,aCollection,packageName){
  2158. var self=this;
  2159. var theClass,thePackage;
  2160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2161. return $core.withContext(function($ctx1) {
  2162. //>>excludeEnd("ctx");
  2163. var $1,$2,$receiver;
  2164. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  2165. thePackage=$recv($globals.Package)._named_(packageName);
  2166. $1=theClass;
  2167. if(($receiver = $1) == null || $receiver.isNil){
  2168. $1;
  2169. } else {
  2170. $recv(theClass)._package_(thePackage);
  2171. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  2172. if(!$core.assert($2)){
  2173. return self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  2174. };
  2175. };
  2176. return self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  2177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2178. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  2179. //>>excludeEnd("ctx");
  2180. },
  2181. //>>excludeStart("ide", pragmas.excludeIdeData);
  2182. args: ["aClass", "className", "aCollection", "packageName"],
  2183. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
  2184. referencedClasses: ["Smalltalk", "Package"],
  2185. //>>excludeEnd("ide");
  2186. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  2187. }),
  2188. $globals.ClassBuilder);
  2189. $core.addMethod(
  2190. $core.method({
  2191. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  2192. protocol: 'private',
  2193. fn: function (aClass,aString,aCollection,packageName){
  2194. var self=this;
  2195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2196. return $core.withContext(function($ctx1) {
  2197. //>>excludeEnd("ctx");
  2198. return $core.addClass(aString, aClass, aCollection, packageName);
  2199. ;
  2200. return self;
  2201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2202. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  2203. //>>excludeEnd("ctx");
  2204. },
  2205. //>>excludeStart("ide", pragmas.excludeIdeData);
  2206. args: ["aClass", "aString", "aCollection", "packageName"],
  2207. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  2208. referencedClasses: [],
  2209. //>>excludeEnd("ide");
  2210. messageSends: []
  2211. }),
  2212. $globals.ClassBuilder);
  2213. $core.addMethod(
  2214. $core.method({
  2215. selector: "basicClass:instanceVariableNames:",
  2216. protocol: 'private',
  2217. fn: function (aClass,aString){
  2218. var self=this;
  2219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2220. return $core.withContext(function($ctx1) {
  2221. //>>excludeEnd("ctx");
  2222. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  2223. return self;
  2224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2225. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  2226. //>>excludeEnd("ctx");
  2227. },
  2228. //>>excludeStart("ide", pragmas.excludeIdeData);
  2229. args: ["aClass", "aString"],
  2230. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  2231. referencedClasses: [],
  2232. //>>excludeEnd("ide");
  2233. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  2234. }),
  2235. $globals.ClassBuilder);
  2236. $core.addMethod(
  2237. $core.method({
  2238. selector: "basicClass:instanceVariables:",
  2239. protocol: 'private',
  2240. fn: function (aClass,aCollection){
  2241. var self=this;
  2242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2243. return $core.withContext(function($ctx1) {
  2244. //>>excludeEnd("ctx");
  2245. var $1;
  2246. $1=$recv(aClass)._isMetaclass();
  2247. if(!$core.assert($1)){
  2248. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  2249. };
  2250. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  2251. return self;
  2252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2253. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  2254. //>>excludeEnd("ctx");
  2255. },
  2256. //>>excludeStart("ide", pragmas.excludeIdeData);
  2257. args: ["aClass", "aCollection"],
  2258. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  2259. referencedClasses: [],
  2260. //>>excludeEnd("ide");
  2261. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  2262. }),
  2263. $globals.ClassBuilder);
  2264. $core.addMethod(
  2265. $core.method({
  2266. selector: "basicRemoveClass:",
  2267. protocol: 'private',
  2268. fn: function (aClass){
  2269. var self=this;
  2270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2271. return $core.withContext(function($ctx1) {
  2272. //>>excludeEnd("ctx");
  2273. $core.removeClass(aClass);
  2274. return self;
  2275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2276. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  2277. //>>excludeEnd("ctx");
  2278. },
  2279. //>>excludeStart("ide", pragmas.excludeIdeData);
  2280. args: ["aClass"],
  2281. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  2282. referencedClasses: [],
  2283. //>>excludeEnd("ide");
  2284. messageSends: []
  2285. }),
  2286. $globals.ClassBuilder);
  2287. $core.addMethod(
  2288. $core.method({
  2289. selector: "basicRenameClass:to:",
  2290. protocol: 'private',
  2291. fn: function (aClass,aString){
  2292. var self=this;
  2293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2294. return $core.withContext(function($ctx1) {
  2295. //>>excludeEnd("ctx");
  2296. $globals[aString] = aClass;
  2297. delete $globals[aClass.className];
  2298. aClass.className = aString;
  2299. ;
  2300. return self;
  2301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2302. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  2303. //>>excludeEnd("ctx");
  2304. },
  2305. //>>excludeStart("ide", pragmas.excludeIdeData);
  2306. args: ["aClass", "aString"],
  2307. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09'>",
  2308. referencedClasses: [],
  2309. //>>excludeEnd("ide");
  2310. messageSends: []
  2311. }),
  2312. $globals.ClassBuilder);
  2313. $core.addMethod(
  2314. $core.method({
  2315. selector: "basicSwapClassNames:with:",
  2316. protocol: 'private',
  2317. fn: function (aClass,anotherClass){
  2318. var self=this;
  2319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2320. return $core.withContext(function($ctx1) {
  2321. //>>excludeEnd("ctx");
  2322. var tmp = aClass.className;
  2323. aClass.className = anotherClass.className;
  2324. anotherClass.className = tmp;
  2325. ;
  2326. return self;
  2327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2328. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  2329. //>>excludeEnd("ctx");
  2330. },
  2331. //>>excludeStart("ide", pragmas.excludeIdeData);
  2332. args: ["aClass", "anotherClass"],
  2333. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09'>",
  2334. referencedClasses: [],
  2335. //>>excludeEnd("ide");
  2336. messageSends: []
  2337. }),
  2338. $globals.ClassBuilder);
  2339. $core.addMethod(
  2340. $core.method({
  2341. selector: "class:instanceVariableNames:",
  2342. protocol: 'class definition',
  2343. fn: function (aClass,ivarNames){
  2344. var self=this;
  2345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2346. return $core.withContext(function($ctx1) {
  2347. //>>excludeEnd("ctx");
  2348. var $1,$3,$2;
  2349. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  2350. $1=$recv($globals.SystemAnnouncer)._current();
  2351. $3=$recv($globals.ClassDefinitionChanged)._new();
  2352. $recv($3)._theClass_(aClass);
  2353. $2=$recv($3)._yourself();
  2354. $recv($1)._announce_($2);
  2355. return self;
  2356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2357. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  2358. //>>excludeEnd("ctx");
  2359. },
  2360. //>>excludeStart("ide", pragmas.excludeIdeData);
  2361. args: ["aClass", "ivarNames"],
  2362. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  2363. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  2364. //>>excludeEnd("ide");
  2365. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  2366. }),
  2367. $globals.ClassBuilder);
  2368. $core.addMethod(
  2369. $core.method({
  2370. selector: "copyClass:named:",
  2371. protocol: 'copying',
  2372. fn: function (aClass,className){
  2373. var self=this;
  2374. var newClass;
  2375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2376. return $core.withContext(function($ctx1) {
  2377. //>>excludeEnd("ctx");
  2378. var $1,$3,$2;
  2379. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  2380. self._copyClass_to_(aClass,newClass);
  2381. $1=$recv($globals.SystemAnnouncer)._current();
  2382. $3=$recv($globals.ClassAdded)._new();
  2383. $recv($3)._theClass_(newClass);
  2384. $2=$recv($3)._yourself();
  2385. $recv($1)._announce_($2);
  2386. return newClass;
  2387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2388. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  2389. //>>excludeEnd("ctx");
  2390. },
  2391. //>>excludeStart("ide", pragmas.excludeIdeData);
  2392. args: ["aClass", "className"],
  2393. source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  2394. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  2395. //>>excludeEnd("ide");
  2396. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  2397. }),
  2398. $globals.ClassBuilder);
  2399. $core.addMethod(
  2400. $core.method({
  2401. selector: "copyClass:to:",
  2402. protocol: 'copying',
  2403. fn: function (aClass,anotherClass){
  2404. var self=this;
  2405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2406. return $core.withContext(function($ctx1) {
  2407. //>>excludeEnd("ctx");
  2408. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  2409. $recv(anotherClass)._comment_($recv(aClass)._comment());
  2410. $1=$recv(aClass)._methodDictionary();
  2411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2412. $ctx1.sendIdx["methodDictionary"]=1;
  2413. //>>excludeEnd("ctx");
  2414. $recv($1)._valuesDo_((function(each){
  2415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2416. return $core.withContext(function($ctx2) {
  2417. //>>excludeEnd("ctx");
  2418. $2=$recv($globals.Compiler)._new();
  2419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2420. $ctx2.sendIdx["new"]=1;
  2421. //>>excludeEnd("ctx");
  2422. $3=$recv(each)._source();
  2423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2424. $ctx2.sendIdx["source"]=1;
  2425. //>>excludeEnd("ctx");
  2426. $4=$recv(each)._protocol();
  2427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2428. $ctx2.sendIdx["protocol"]=1;
  2429. //>>excludeEnd("ctx");
  2430. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  2431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2432. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  2433. //>>excludeEnd("ctx");
  2434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2435. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2436. //>>excludeEnd("ctx");
  2437. }));
  2438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2439. $ctx1.sendIdx["valuesDo:"]=1;
  2440. //>>excludeEnd("ctx");
  2441. $5=$recv(anotherClass)._class();
  2442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2443. $ctx1.sendIdx["class"]=1;
  2444. //>>excludeEnd("ctx");
  2445. $7=$recv(aClass)._class();
  2446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2447. $ctx1.sendIdx["class"]=2;
  2448. //>>excludeEnd("ctx");
  2449. $6=$recv($7)._instanceVariableNames();
  2450. self._basicClass_instanceVariables_($5,$6);
  2451. $9=$recv(aClass)._class();
  2452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2453. $ctx1.sendIdx["class"]=3;
  2454. //>>excludeEnd("ctx");
  2455. $8=$recv($9)._methodDictionary();
  2456. $recv($8)._valuesDo_((function(each){
  2457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2458. return $core.withContext(function($ctx2) {
  2459. //>>excludeEnd("ctx");
  2460. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  2461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2462. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2463. //>>excludeEnd("ctx");
  2464. }));
  2465. return self;
  2466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2467. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  2468. //>>excludeEnd("ctx");
  2469. },
  2470. //>>excludeStart("ide", pragmas.excludeIdeData);
  2471. args: ["aClass", "anotherClass"],
  2472. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ]",
  2473. referencedClasses: ["Compiler"],
  2474. //>>excludeEnd("ide");
  2475. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  2476. }),
  2477. $globals.ClassBuilder);
  2478. $core.addMethod(
  2479. $core.method({
  2480. selector: "installMethod:forClass:protocol:",
  2481. protocol: 'method definition',
  2482. fn: function (aCompiledMethod,aBehavior,aString){
  2483. var self=this;
  2484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2485. return $core.withContext(function($ctx1) {
  2486. //>>excludeEnd("ctx");
  2487. $recv(aCompiledMethod)._protocol_(aString);
  2488. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  2489. return aCompiledMethod;
  2490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2491. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  2492. //>>excludeEnd("ctx");
  2493. },
  2494. //>>excludeStart("ide", pragmas.excludeIdeData);
  2495. args: ["aCompiledMethod", "aBehavior", "aString"],
  2496. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  2497. referencedClasses: [],
  2498. //>>excludeEnd("ide");
  2499. messageSends: ["protocol:", "addCompiledMethod:"]
  2500. }),
  2501. $globals.ClassBuilder);
  2502. $core.addMethod(
  2503. $core.method({
  2504. selector: "instanceVariableNamesFor:",
  2505. protocol: 'accessing',
  2506. fn: function (aString){
  2507. var self=this;
  2508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2509. return $core.withContext(function($ctx1) {
  2510. //>>excludeEnd("ctx");
  2511. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  2512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2513. return $core.withContext(function($ctx2) {
  2514. //>>excludeEnd("ctx");
  2515. return $recv(each)._isEmpty();
  2516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2518. //>>excludeEnd("ctx");
  2519. }));
  2520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2521. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  2522. //>>excludeEnd("ctx");
  2523. },
  2524. //>>excludeStart("ide", pragmas.excludeIdeData);
  2525. args: ["aString"],
  2526. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  2527. referencedClasses: [],
  2528. //>>excludeEnd("ide");
  2529. messageSends: ["reject:", "tokenize:", "isEmpty"]
  2530. }),
  2531. $globals.ClassBuilder);
  2532. $core.addMethod(
  2533. $core.method({
  2534. selector: "migrateClass:superclass:",
  2535. protocol: 'class migration',
  2536. fn: function (aClass,anotherClass){
  2537. var self=this;
  2538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2539. return $core.withContext(function($ctx1) {
  2540. //>>excludeEnd("ctx");
  2541. var $1;
  2542. $1=$recv(aClass)._name();
  2543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2544. $ctx1.sendIdx["name"]=1;
  2545. //>>excludeEnd("ctx");
  2546. return self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  2547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2548. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  2549. //>>excludeEnd("ctx");
  2550. },
  2551. //>>excludeStart("ide", pragmas.excludeIdeData);
  2552. args: ["aClass", "anotherClass"],
  2553. source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
  2554. referencedClasses: [],
  2555. //>>excludeEnd("ide");
  2556. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  2557. }),
  2558. $globals.ClassBuilder);
  2559. $core.addMethod(
  2560. $core.method({
  2561. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  2562. protocol: 'class migration',
  2563. fn: function (className,aClass,aCollection,packageName){
  2564. var self=this;
  2565. var oldClass,newClass,tmp;
  2566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2567. return $core.withContext(function($ctx1) {
  2568. //>>excludeEnd("ctx");
  2569. var $1,$2,$4,$3;
  2570. tmp="new*".__comma(className);
  2571. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  2572. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  2573. self._basicSwapClassNames_with_(oldClass,newClass);
  2574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2575. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  2576. //>>excludeEnd("ctx");
  2577. $recv((function(){
  2578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2579. return $core.withContext(function($ctx2) {
  2580. //>>excludeEnd("ctx");
  2581. return self._copyClass_to_(oldClass,newClass);
  2582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2584. //>>excludeEnd("ctx");
  2585. }))._on_do_($globals.Error,(function(exception){
  2586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2587. return $core.withContext(function($ctx2) {
  2588. //>>excludeEnd("ctx");
  2589. self._basicSwapClassNames_with_(oldClass,newClass);
  2590. $1=self._basicRemoveClass_(newClass);
  2591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2592. $ctx2.sendIdx["basicRemoveClass:"]=1;
  2593. //>>excludeEnd("ctx");
  2594. $1;
  2595. return $recv(exception)._resignal();
  2596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2597. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  2598. //>>excludeEnd("ctx");
  2599. }));
  2600. self._rawRenameClass_to_(oldClass,tmp);
  2601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2602. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  2603. //>>excludeEnd("ctx");
  2604. self._rawRenameClass_to_(newClass,className);
  2605. $recv($recv(oldClass)._subclasses())._do_((function(each){
  2606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2607. return $core.withContext(function($ctx2) {
  2608. //>>excludeEnd("ctx");
  2609. return self._migrateClass_superclass_(each,newClass);
  2610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  2612. //>>excludeEnd("ctx");
  2613. }));
  2614. self._basicRemoveClass_(oldClass);
  2615. $2=$recv($globals.SystemAnnouncer)._current();
  2616. $4=$recv($globals.ClassMigrated)._new();
  2617. $recv($4)._theClass_(newClass);
  2618. $recv($4)._oldClass_(oldClass);
  2619. $3=$recv($4)._yourself();
  2620. $recv($2)._announce_($3);
  2621. return newClass;
  2622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2623. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},$globals.ClassBuilder)});
  2624. //>>excludeEnd("ctx");
  2625. },
  2626. //>>excludeStart("ide", pragmas.excludeIdeData);
  2627. args: ["className", "aClass", "aCollection", "packageName"],
  2628. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception resignal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  2629. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  2630. //>>excludeEnd("ide");
  2631. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  2632. }),
  2633. $globals.ClassBuilder);
  2634. $core.addMethod(
  2635. $core.method({
  2636. selector: "rawRenameClass:to:",
  2637. protocol: 'private',
  2638. fn: function (aClass,aString){
  2639. var self=this;
  2640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2641. return $core.withContext(function($ctx1) {
  2642. //>>excludeEnd("ctx");
  2643. $globals[aString] = aClass;
  2644. ;
  2645. return self;
  2646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2647. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  2648. //>>excludeEnd("ctx");
  2649. },
  2650. //>>excludeStart("ide", pragmas.excludeIdeData);
  2651. args: ["aClass", "aString"],
  2652. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  2653. referencedClasses: [],
  2654. //>>excludeEnd("ide");
  2655. messageSends: []
  2656. }),
  2657. $globals.ClassBuilder);
  2658. $core.addMethod(
  2659. $core.method({
  2660. selector: "renameClass:to:",
  2661. protocol: 'class migration',
  2662. fn: function (aClass,className){
  2663. var self=this;
  2664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2665. return $core.withContext(function($ctx1) {
  2666. //>>excludeEnd("ctx");
  2667. var $1,$3,$2;
  2668. self._basicRenameClass_to_(aClass,className);
  2669. $recv(aClass)._recompile();
  2670. $1=$recv($globals.SystemAnnouncer)._current();
  2671. $3=$recv($globals.ClassRenamed)._new();
  2672. $recv($3)._theClass_(aClass);
  2673. $2=$recv($3)._yourself();
  2674. $recv($1)._announce_($2);
  2675. return self;
  2676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2677. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  2678. //>>excludeEnd("ctx");
  2679. },
  2680. //>>excludeStart("ide", pragmas.excludeIdeData);
  2681. args: ["aClass", "className"],
  2682. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  2683. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  2684. //>>excludeEnd("ide");
  2685. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  2686. }),
  2687. $globals.ClassBuilder);
  2688. $core.addMethod(
  2689. $core.method({
  2690. selector: "setupClass:",
  2691. protocol: 'public',
  2692. fn: function (aClass){
  2693. var self=this;
  2694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2695. return $core.withContext(function($ctx1) {
  2696. //>>excludeEnd("ctx");
  2697. self._deprecatedAPI_("Classes are now auto-inited.");
  2698. return self;
  2699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2700. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  2701. //>>excludeEnd("ctx");
  2702. },
  2703. //>>excludeStart("ide", pragmas.excludeIdeData);
  2704. args: ["aClass"],
  2705. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  2706. referencedClasses: [],
  2707. //>>excludeEnd("ide");
  2708. messageSends: ["deprecatedAPI:"]
  2709. }),
  2710. $globals.ClassBuilder);
  2711. $core.addMethod(
  2712. $core.method({
  2713. selector: "superclass:subclass:",
  2714. protocol: 'class definition',
  2715. fn: function (aClass,className){
  2716. var self=this;
  2717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2718. return $core.withContext(function($ctx1) {
  2719. //>>excludeEnd("ctx");
  2720. return self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  2721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2722. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  2723. //>>excludeEnd("ctx");
  2724. },
  2725. //>>excludeStart("ide", pragmas.excludeIdeData);
  2726. args: ["aClass", "className"],
  2727. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  2728. referencedClasses: [],
  2729. //>>excludeEnd("ide");
  2730. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  2731. }),
  2732. $globals.ClassBuilder);
  2733. $core.addMethod(
  2734. $core.method({
  2735. selector: "superclass:subclass:instanceVariableNames:package:",
  2736. protocol: 'class definition',
  2737. fn: function (aClass,className,ivarNames,packageName){
  2738. var self=this;
  2739. var newClass;
  2740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2741. return $core.withContext(function($ctx1) {
  2742. //>>excludeEnd("ctx");
  2743. var $1,$2,$3,$5,$4,$receiver;
  2744. $1=self._instanceVariableNamesFor_(ivarNames);
  2745. if(($receiver = packageName) == null || $receiver.isNil){
  2746. $2="unclassified";
  2747. } else {
  2748. $2=packageName;
  2749. };
  2750. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  2751. $3=$recv($globals.SystemAnnouncer)._current();
  2752. $5=$recv($globals.ClassAdded)._new();
  2753. $recv($5)._theClass_(newClass);
  2754. $4=$recv($5)._yourself();
  2755. $recv($3)._announce_($4);
  2756. return newClass;
  2757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2758. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  2759. //>>excludeEnd("ctx");
  2760. },
  2761. //>>excludeStart("ide", pragmas.excludeIdeData);
  2762. args: ["aClass", "className", "ivarNames", "packageName"],
  2763. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  2764. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  2765. //>>excludeEnd("ide");
  2766. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  2767. }),
  2768. $globals.ClassBuilder);
  2769. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  2770. //>>excludeStart("ide", pragmas.excludeIdeData);
  2771. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  2772. //>>excludeEnd("ide");
  2773. $core.addMethod(
  2774. $core.method({
  2775. selector: "getNodesFrom:",
  2776. protocol: 'accessing',
  2777. fn: function (aCollection){
  2778. var self=this;
  2779. var children,others;
  2780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2781. return $core.withContext(function($ctx1) {
  2782. //>>excludeEnd("ctx");
  2783. var $1;
  2784. children=[];
  2785. others=[];
  2786. $recv(aCollection)._do_((function(each){
  2787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2788. return $core.withContext(function($ctx2) {
  2789. //>>excludeEnd("ctx");
  2790. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  2791. if($core.assert($1)){
  2792. return $recv(children)._add_(each);
  2793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2794. $ctx2.sendIdx["add:"]=1;
  2795. //>>excludeEnd("ctx");
  2796. } else {
  2797. return $recv(others)._add_(each);
  2798. };
  2799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2800. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2801. //>>excludeEnd("ctx");
  2802. }));
  2803. self["@nodes"]=$recv(children)._collect_((function(each){
  2804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2805. return $core.withContext(function($ctx2) {
  2806. //>>excludeEnd("ctx");
  2807. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  2808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  2810. //>>excludeEnd("ctx");
  2811. }));
  2812. return self;
  2813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2814. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  2815. //>>excludeEnd("ctx");
  2816. },
  2817. //>>excludeStart("ide", pragmas.excludeIdeData);
  2818. args: ["aCollection"],
  2819. source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [ :each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [ children add: each ]\x0a\x09\x09\x09ifFalse: [ others add: each ]].\x0a\x09nodes:= children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1 ]",
  2820. referencedClasses: ["ClassSorterNode"],
  2821. //>>excludeEnd("ide");
  2822. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  2823. }),
  2824. $globals.ClassSorterNode);
  2825. $core.addMethod(
  2826. $core.method({
  2827. selector: "level",
  2828. protocol: 'accessing',
  2829. fn: function (){
  2830. var self=this;
  2831. return self["@level"];
  2832. },
  2833. //>>excludeStart("ide", pragmas.excludeIdeData);
  2834. args: [],
  2835. source: "level\x0a\x09^ level",
  2836. referencedClasses: [],
  2837. //>>excludeEnd("ide");
  2838. messageSends: []
  2839. }),
  2840. $globals.ClassSorterNode);
  2841. $core.addMethod(
  2842. $core.method({
  2843. selector: "level:",
  2844. protocol: 'accessing',
  2845. fn: function (anInteger){
  2846. var self=this;
  2847. self["@level"]=anInteger;
  2848. return self;
  2849. },
  2850. //>>excludeStart("ide", pragmas.excludeIdeData);
  2851. args: ["anInteger"],
  2852. source: "level: anInteger\x0a\x09level := anInteger",
  2853. referencedClasses: [],
  2854. //>>excludeEnd("ide");
  2855. messageSends: []
  2856. }),
  2857. $globals.ClassSorterNode);
  2858. $core.addMethod(
  2859. $core.method({
  2860. selector: "nodes",
  2861. protocol: 'accessing',
  2862. fn: function (){
  2863. var self=this;
  2864. return self["@nodes"];
  2865. },
  2866. //>>excludeStart("ide", pragmas.excludeIdeData);
  2867. args: [],
  2868. source: "nodes\x0a\x09^ nodes",
  2869. referencedClasses: [],
  2870. //>>excludeEnd("ide");
  2871. messageSends: []
  2872. }),
  2873. $globals.ClassSorterNode);
  2874. $core.addMethod(
  2875. $core.method({
  2876. selector: "theClass",
  2877. protocol: 'accessing',
  2878. fn: function (){
  2879. var self=this;
  2880. return self["@theClass"];
  2881. },
  2882. //>>excludeStart("ide", pragmas.excludeIdeData);
  2883. args: [],
  2884. source: "theClass\x0a\x09^ theClass",
  2885. referencedClasses: [],
  2886. //>>excludeEnd("ide");
  2887. messageSends: []
  2888. }),
  2889. $globals.ClassSorterNode);
  2890. $core.addMethod(
  2891. $core.method({
  2892. selector: "theClass:",
  2893. protocol: 'accessing',
  2894. fn: function (aClass){
  2895. var self=this;
  2896. self["@theClass"]=aClass;
  2897. return self;
  2898. },
  2899. //>>excludeStart("ide", pragmas.excludeIdeData);
  2900. args: ["aClass"],
  2901. source: "theClass: aClass\x0a\x09theClass := aClass",
  2902. referencedClasses: [],
  2903. //>>excludeEnd("ide");
  2904. messageSends: []
  2905. }),
  2906. $globals.ClassSorterNode);
  2907. $core.addMethod(
  2908. $core.method({
  2909. selector: "traverseClassesWith:",
  2910. protocol: 'visiting',
  2911. fn: function (aCollection){
  2912. var self=this;
  2913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2914. return $core.withContext(function($ctx1) {
  2915. //>>excludeEnd("ctx");
  2916. var $1,$3,$2;
  2917. $1=self._theClass();
  2918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2919. $ctx1.sendIdx["theClass"]=1;
  2920. //>>excludeEnd("ctx");
  2921. $recv(aCollection)._add_($1);
  2922. $recv($recv(self._nodes())._sorted_((function(a,b){
  2923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2924. return $core.withContext(function($ctx2) {
  2925. //>>excludeEnd("ctx");
  2926. $3=$recv(a)._theClass();
  2927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2928. $ctx2.sendIdx["theClass"]=2;
  2929. //>>excludeEnd("ctx");
  2930. $2=$recv($3)._name();
  2931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2932. $ctx2.sendIdx["name"]=1;
  2933. //>>excludeEnd("ctx");
  2934. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  2935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2936. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  2937. //>>excludeEnd("ctx");
  2938. })))._do_((function(aNode){
  2939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2940. return $core.withContext(function($ctx2) {
  2941. //>>excludeEnd("ctx");
  2942. return $recv(aNode)._traverseClassesWith_(aCollection);
  2943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2944. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  2945. //>>excludeEnd("ctx");
  2946. }));
  2947. return self;
  2948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2949. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  2950. //>>excludeEnd("ctx");
  2951. },
  2952. //>>excludeStart("ide", pragmas.excludeIdeData);
  2953. args: ["aCollection"],
  2954. source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [ :a :b | a theClass name <= b theClass name ]) do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].",
  2955. referencedClasses: [],
  2956. //>>excludeEnd("ide");
  2957. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  2958. }),
  2959. $globals.ClassSorterNode);
  2960. $core.addMethod(
  2961. $core.method({
  2962. selector: "on:classes:level:",
  2963. protocol: 'instance creation',
  2964. fn: function (aClass,aCollection,anInteger){
  2965. var self=this;
  2966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2967. return $core.withContext(function($ctx1) {
  2968. //>>excludeEnd("ctx");
  2969. var $1;
  2970. $1=self._new();
  2971. $recv($1)._theClass_(aClass);
  2972. $recv($1)._level_(anInteger);
  2973. $recv($1)._getNodesFrom_(aCollection);
  2974. return $recv($1)._yourself();
  2975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2976. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  2977. //>>excludeEnd("ctx");
  2978. },
  2979. //>>excludeStart("ide", pragmas.excludeIdeData);
  2980. args: ["aClass", "aCollection", "anInteger"],
  2981. source: "on: aClass classes: aCollection level: anInteger\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself",
  2982. referencedClasses: [],
  2983. //>>excludeEnd("ide");
  2984. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  2985. }),
  2986. $globals.ClassSorterNode.klass);
  2987. });