Kernel-Classes.js 118 KB

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