Kernel-Classes.js 152 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242
  1. define(["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  3. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  4. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  5. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  6. $core.addPackage("Kernel-Classes");
  7. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  8. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  9. $core.addClass("Behavior", $globals.Object, [], "Kernel-Classes");
  10. //>>excludeStart("ide", pragmas.excludeIdeData);
  11. $globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aIn addition to BehaviorBody, I define superclass/subclass relationships and instantiation.\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 and contain the description that instances are created from.\x0a\x0aI also provide iterating over the class hierarchy.";
  12. //>>excludeEnd("ide");
  13. $core.addMethod(
  14. $core.method({
  15. selector: "allInstanceVariableNames",
  16. protocol: "accessing",
  17. fn: function (){
  18. var self=this,$self=this;
  19. var result;
  20. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21. return $core.withContext(function($ctx1) {
  22. //>>excludeEnd("ctx");
  23. var $1,$receiver;
  24. result=$recv($self._instanceVariableNames())._copy();
  25. $1=$self._superclass();
  26. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27. $ctx1.sendIdx["superclass"]=1;
  28. //>>excludeEnd("ctx");
  29. if(($receiver = $1) == null || $receiver.a$nil){
  30. $1;
  31. } else {
  32. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  33. }
  34. return result;
  35. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  37. //>>excludeEnd("ctx");
  38. },
  39. //>>excludeStart("ide", pragmas.excludeIdeData);
  40. args: [],
  41. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  42. referencedClasses: [],
  43. //>>excludeEnd("ide");
  44. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  45. }),
  46. $globals.Behavior);
  47. $core.addMethod(
  48. $core.method({
  49. selector: "allSelectors",
  50. protocol: "accessing",
  51. fn: function (){
  52. var self=this,$self=this;
  53. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54. return $core.withContext(function($ctx1) {
  55. //>>excludeEnd("ctx");
  56. var $1,$2;
  57. $1=$self._allSuperclasses();
  58. $2=$self._selectors();
  59. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60. $ctx1.sendIdx["selectors"]=1;
  61. //>>excludeEnd("ctx");
  62. return $recv($1)._inject_into_($2,(function(acc,each){
  63. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64. return $core.withContext(function($ctx2) {
  65. //>>excludeEnd("ctx");
  66. $recv(acc)._addAll_($recv(each)._selectors());
  67. return $recv(acc)._yourself();
  68. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  70. //>>excludeEnd("ctx");
  71. }));
  72. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  74. //>>excludeEnd("ctx");
  75. },
  76. //>>excludeStart("ide", pragmas.excludeIdeData);
  77. args: [],
  78. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  79. referencedClasses: [],
  80. //>>excludeEnd("ide");
  81. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  82. }),
  83. $globals.Behavior);
  84. $core.addMethod(
  85. $core.method({
  86. selector: "allSubclasses",
  87. protocol: "accessing",
  88. fn: function (){
  89. var self=this,$self=this;
  90. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  91. return $core.withContext(function($ctx1) {
  92. //>>excludeEnd("ctx");
  93. return $recv($globals.Array)._streamContents_((function(str){
  94. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  95. return $core.withContext(function($ctx2) {
  96. //>>excludeEnd("ctx");
  97. return $self._allSubclassesDo_((function(each){
  98. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  99. return $core.withContext(function($ctx3) {
  100. //>>excludeEnd("ctx");
  101. return $recv(str)._nextPut_(each);
  102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  103. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  104. //>>excludeEnd("ctx");
  105. }));
  106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  107. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  108. //>>excludeEnd("ctx");
  109. }));
  110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  111. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  112. //>>excludeEnd("ctx");
  113. },
  114. //>>excludeStart("ide", pragmas.excludeIdeData);
  115. args: [],
  116. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09^ Array streamContents: [ :str | self allSubclassesDo: [ :each | str nextPut: each ] ]",
  117. referencedClasses: ["Array"],
  118. //>>excludeEnd("ide");
  119. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  120. }),
  121. $globals.Behavior);
  122. $core.addMethod(
  123. $core.method({
  124. selector: "allSubclassesDo:",
  125. protocol: "enumerating",
  126. fn: function (aBlock){
  127. var self=this,$self=this;
  128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  129. return $core.withContext(function($ctx1) {
  130. //>>excludeEnd("ctx");
  131. $core.traverseClassTree(self, function(subclass) {
  132. if (subclass !== self) aBlock._value_(subclass);
  133. });
  134. return self;
  135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  136. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  137. //>>excludeEnd("ctx");
  138. },
  139. //>>excludeStart("ide", pragmas.excludeIdeData);
  140. args: ["aBlock"],
  141. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<inlineJS: '$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})'>",
  142. referencedClasses: [],
  143. //>>excludeEnd("ide");
  144. messageSends: []
  145. }),
  146. $globals.Behavior);
  147. $core.addMethod(
  148. $core.method({
  149. selector: "allSuperclasses",
  150. protocol: "accessing",
  151. fn: function (){
  152. var self=this,$self=this;
  153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  154. return $core.withContext(function($ctx1) {
  155. //>>excludeEnd("ctx");
  156. var $1,$3,$2,$receiver;
  157. $1=$self._superclass();
  158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  159. $ctx1.sendIdx["superclass"]=1;
  160. //>>excludeEnd("ctx");
  161. if(($receiver = $1) == null || $receiver.a$nil){
  162. return [];
  163. } else {
  164. $1;
  165. }
  166. $3=$self._superclass();
  167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  168. $ctx1.sendIdx["superclass"]=2;
  169. //>>excludeEnd("ctx");
  170. $2=$recv($globals.OrderedCollection)._with_($3);
  171. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  172. return $recv($2)._yourself();
  173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  174. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  175. //>>excludeEnd("ctx");
  176. },
  177. //>>excludeStart("ide", pragmas.excludeIdeData);
  178. args: [],
  179. 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",
  180. referencedClasses: ["OrderedCollection"],
  181. //>>excludeEnd("ide");
  182. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  183. }),
  184. $globals.Behavior);
  185. $core.addMethod(
  186. $core.method({
  187. selector: "basicNew",
  188. protocol: "instance creation",
  189. fn: function (){
  190. var self=this,$self=this;
  191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  192. return $core.withContext(function($ctx1) {
  193. //>>excludeEnd("ctx");
  194. return new self.fn();
  195. return self;
  196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  197. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  198. //>>excludeEnd("ctx");
  199. },
  200. //>>excludeStart("ide", pragmas.excludeIdeData);
  201. args: [],
  202. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  203. referencedClasses: [],
  204. //>>excludeEnd("ide");
  205. messageSends: []
  206. }),
  207. $globals.Behavior);
  208. $core.addMethod(
  209. $core.method({
  210. selector: "canUnderstand:",
  211. protocol: "testing",
  212. fn: function (aSelector){
  213. var self=this,$self=this;
  214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  215. return $core.withContext(function($ctx1) {
  216. //>>excludeEnd("ctx");
  217. var $2,$1;
  218. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  220. return $core.withContext(function($ctx2) {
  221. //>>excludeEnd("ctx");
  222. $2=$self._superclass();
  223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  224. $ctx2.sendIdx["superclass"]=1;
  225. //>>excludeEnd("ctx");
  226. $1=$recv($2)._notNil();
  227. return $recv($1)._and_((function(){
  228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  229. return $core.withContext(function($ctx3) {
  230. //>>excludeEnd("ctx");
  231. return $recv($self._superclass())._canUnderstand_(aSelector);
  232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  233. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  234. //>>excludeEnd("ctx");
  235. }));
  236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  238. //>>excludeEnd("ctx");
  239. }));
  240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  241. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  242. //>>excludeEnd("ctx");
  243. },
  244. //>>excludeStart("ide", pragmas.excludeIdeData);
  245. args: ["aSelector"],
  246. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  247. referencedClasses: [],
  248. //>>excludeEnd("ide");
  249. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  250. }),
  251. $globals.Behavior);
  252. $core.addMethod(
  253. $core.method({
  254. selector: "includesBehavior:",
  255. protocol: "testing",
  256. fn: function (aClass){
  257. var self=this,$self=this;
  258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  259. return $core.withContext(function($ctx1) {
  260. //>>excludeEnd("ctx");
  261. return $recv($self.__eq_eq(aClass))._or_((function(){
  262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  263. return $core.withContext(function($ctx2) {
  264. //>>excludeEnd("ctx");
  265. return $self._inheritsFrom_(aClass);
  266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  268. //>>excludeEnd("ctx");
  269. }));
  270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  271. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  272. //>>excludeEnd("ctx");
  273. },
  274. //>>excludeStart("ide", pragmas.excludeIdeData);
  275. args: ["aClass"],
  276. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  277. referencedClasses: [],
  278. //>>excludeEnd("ide");
  279. messageSends: ["or:", "==", "inheritsFrom:"]
  280. }),
  281. $globals.Behavior);
  282. $core.addMethod(
  283. $core.method({
  284. selector: "inheritsFrom:",
  285. protocol: "testing",
  286. fn: function (aClass){
  287. var self=this,$self=this;
  288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  289. return $core.withContext(function($ctx1) {
  290. //>>excludeEnd("ctx");
  291. var $1,$3,$2,$receiver;
  292. $1=$self._superclass();
  293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  294. $ctx1.sendIdx["superclass"]=1;
  295. //>>excludeEnd("ctx");
  296. if(($receiver = $1) == null || $receiver.a$nil){
  297. return false;
  298. } else {
  299. $1;
  300. }
  301. $3=$self._superclass();
  302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  303. $ctx1.sendIdx["superclass"]=2;
  304. //>>excludeEnd("ctx");
  305. $2=$recv(aClass).__eq_eq($3);
  306. return $recv($2)._or_((function(){
  307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  308. return $core.withContext(function($ctx2) {
  309. //>>excludeEnd("ctx");
  310. return $recv($self._superclass())._inheritsFrom_(aClass);
  311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  313. //>>excludeEnd("ctx");
  314. }));
  315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  316. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  317. //>>excludeEnd("ctx");
  318. },
  319. //>>excludeStart("ide", pragmas.excludeIdeData);
  320. args: ["aClass"],
  321. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  322. referencedClasses: [],
  323. //>>excludeEnd("ide");
  324. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  325. }),
  326. $globals.Behavior);
  327. $core.addMethod(
  328. $core.method({
  329. selector: "instanceVariableNames",
  330. protocol: "accessing",
  331. fn: function (){
  332. var self=this,$self=this;
  333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  334. return $core.withContext(function($ctx1) {
  335. //>>excludeEnd("ctx");
  336. return self.iVarNames;
  337. return self;
  338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  339. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  340. //>>excludeEnd("ctx");
  341. },
  342. //>>excludeStart("ide", pragmas.excludeIdeData);
  343. args: [],
  344. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  345. referencedClasses: [],
  346. //>>excludeEnd("ide");
  347. messageSends: []
  348. }),
  349. $globals.Behavior);
  350. $core.addMethod(
  351. $core.method({
  352. selector: "isBehavior",
  353. protocol: "testing",
  354. fn: function (){
  355. var self=this,$self=this;
  356. return true;
  357. },
  358. //>>excludeStart("ide", pragmas.excludeIdeData);
  359. args: [],
  360. source: "isBehavior\x0a\x09^ true",
  361. referencedClasses: [],
  362. //>>excludeEnd("ide");
  363. messageSends: []
  364. }),
  365. $globals.Behavior);
  366. $core.addMethod(
  367. $core.method({
  368. selector: "javascriptConstructor",
  369. protocol: "accessing",
  370. fn: function (){
  371. var self=this,$self=this;
  372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  373. return $core.withContext(function($ctx1) {
  374. //>>excludeEnd("ctx");
  375. return self.fn;
  376. return self;
  377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  378. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  379. //>>excludeEnd("ctx");
  380. },
  381. //>>excludeStart("ide", pragmas.excludeIdeData);
  382. args: [],
  383. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  384. referencedClasses: [],
  385. //>>excludeEnd("ide");
  386. messageSends: []
  387. }),
  388. $globals.Behavior);
  389. $core.addMethod(
  390. $core.method({
  391. selector: "javascriptConstructor:",
  392. protocol: "accessing",
  393. fn: function (aJavaScriptFunction){
  394. var self=this,$self=this;
  395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  396. return $core.withContext(function($ctx1) {
  397. //>>excludeEnd("ctx");
  398. $core.setClassConstructor(self, aJavaScriptFunction);;
  399. return self;
  400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  401. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  402. //>>excludeEnd("ctx");
  403. },
  404. //>>excludeStart("ide", pragmas.excludeIdeData);
  405. args: ["aJavaScriptFunction"],
  406. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<inlineJS: '$core.setClassConstructor(self, aJavaScriptFunction);'>",
  407. referencedClasses: [],
  408. //>>excludeEnd("ide");
  409. messageSends: []
  410. }),
  411. $globals.Behavior);
  412. $core.addMethod(
  413. $core.method({
  414. selector: "lookupSelector:",
  415. protocol: "accessing",
  416. fn: function (selector){
  417. var self=this,$self=this;
  418. var lookupClass;
  419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  420. return $core.withContext(function($ctx1) {
  421. //>>excludeEnd("ctx");
  422. var $1;
  423. var $early={};
  424. try {
  425. lookupClass=self;
  426. $recv((function(){
  427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  428. return $core.withContext(function($ctx2) {
  429. //>>excludeEnd("ctx");
  430. return $recv(lookupClass).__eq(nil);
  431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  433. //>>excludeEnd("ctx");
  434. }))._whileFalse_((function(){
  435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  436. return $core.withContext(function($ctx2) {
  437. //>>excludeEnd("ctx");
  438. $1=$recv(lookupClass)._includesSelector_(selector);
  439. if($core.assert($1)){
  440. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  441. }
  442. lookupClass=$recv(lookupClass)._superclass();
  443. return lookupClass;
  444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  446. //>>excludeEnd("ctx");
  447. }));
  448. return nil;
  449. }
  450. catch(e) {if(e===$early)return e[0]; throw e}
  451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  452. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  453. //>>excludeEnd("ctx");
  454. },
  455. //>>excludeStart("ide", pragmas.excludeIdeData);
  456. args: ["selector"],
  457. 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",
  458. referencedClasses: [],
  459. //>>excludeEnd("ide");
  460. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  461. }),
  462. $globals.Behavior);
  463. $core.addMethod(
  464. $core.method({
  465. selector: "new",
  466. protocol: "instance creation",
  467. fn: function (){
  468. var self=this,$self=this;
  469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  470. return $core.withContext(function($ctx1) {
  471. //>>excludeEnd("ctx");
  472. return $recv($self._basicNew())._initialize();
  473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  474. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  475. //>>excludeEnd("ctx");
  476. },
  477. //>>excludeStart("ide", pragmas.excludeIdeData);
  478. args: [],
  479. source: "new\x0a\x09^ self basicNew initialize",
  480. referencedClasses: [],
  481. //>>excludeEnd("ide");
  482. messageSends: ["initialize", "basicNew"]
  483. }),
  484. $globals.Behavior);
  485. $core.addMethod(
  486. $core.method({
  487. selector: "prototype",
  488. protocol: "accessing",
  489. fn: function (){
  490. var self=this,$self=this;
  491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  492. return $core.withContext(function($ctx1) {
  493. //>>excludeEnd("ctx");
  494. return self.fn.prototype;
  495. return self;
  496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  497. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  498. //>>excludeEnd("ctx");
  499. },
  500. //>>excludeStart("ide", pragmas.excludeIdeData);
  501. args: [],
  502. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  503. referencedClasses: [],
  504. //>>excludeEnd("ide");
  505. messageSends: []
  506. }),
  507. $globals.Behavior);
  508. $core.addMethod(
  509. $core.method({
  510. selector: "subclasses",
  511. protocol: "accessing",
  512. fn: function (){
  513. var self=this,$self=this;
  514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  515. return $core.withContext(function($ctx1) {
  516. //>>excludeEnd("ctx");
  517. $self._subclassResponsibility();
  518. return self;
  519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  520. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  521. //>>excludeEnd("ctx");
  522. },
  523. //>>excludeStart("ide", pragmas.excludeIdeData);
  524. args: [],
  525. source: "subclasses\x0a\x09self subclassResponsibility",
  526. referencedClasses: [],
  527. //>>excludeEnd("ide");
  528. messageSends: ["subclassResponsibility"]
  529. }),
  530. $globals.Behavior);
  531. $core.addMethod(
  532. $core.method({
  533. selector: "superclass",
  534. protocol: "accessing",
  535. fn: function (){
  536. var self=this,$self=this;
  537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  538. return $core.withContext(function($ctx1) {
  539. //>>excludeEnd("ctx");
  540. return self.superclass;
  541. return self;
  542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  543. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  544. //>>excludeEnd("ctx");
  545. },
  546. //>>excludeStart("ide", pragmas.excludeIdeData);
  547. args: [],
  548. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  549. referencedClasses: [],
  550. //>>excludeEnd("ide");
  551. messageSends: []
  552. }),
  553. $globals.Behavior);
  554. $core.addMethod(
  555. $core.method({
  556. selector: "theMetaClass",
  557. protocol: "accessing",
  558. fn: function (){
  559. var self=this,$self=this;
  560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  561. return $core.withContext(function($ctx1) {
  562. //>>excludeEnd("ctx");
  563. $self._subclassResponsibility();
  564. return self;
  565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  566. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  567. //>>excludeEnd("ctx");
  568. },
  569. //>>excludeStart("ide", pragmas.excludeIdeData);
  570. args: [],
  571. source: "theMetaClass\x0a\x09self subclassResponsibility",
  572. referencedClasses: [],
  573. //>>excludeEnd("ide");
  574. messageSends: ["subclassResponsibility"]
  575. }),
  576. $globals.Behavior);
  577. $core.addMethod(
  578. $core.method({
  579. selector: "theNonMetaClass",
  580. protocol: "accessing",
  581. fn: function (){
  582. var self=this,$self=this;
  583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  584. return $core.withContext(function($ctx1) {
  585. //>>excludeEnd("ctx");
  586. $self._subclassResponsibility();
  587. return self;
  588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  589. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  590. //>>excludeEnd("ctx");
  591. },
  592. //>>excludeStart("ide", pragmas.excludeIdeData);
  593. args: [],
  594. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  595. referencedClasses: [],
  596. //>>excludeEnd("ide");
  597. messageSends: ["subclassResponsibility"]
  598. }),
  599. $globals.Behavior);
  600. $core.addMethod(
  601. $core.method({
  602. selector: "withAllSubclasses",
  603. protocol: "accessing",
  604. fn: function (){
  605. var self=this,$self=this;
  606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  607. return $core.withContext(function($ctx1) {
  608. //>>excludeEnd("ctx");
  609. var $1;
  610. $1=$recv($globals.Array)._with_(self);
  611. $recv($1)._addAll_($self._allSubclasses());
  612. return $recv($1)._yourself();
  613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  614. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  615. //>>excludeEnd("ctx");
  616. },
  617. //>>excludeStart("ide", pragmas.excludeIdeData);
  618. args: [],
  619. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  620. referencedClasses: ["Array"],
  621. //>>excludeEnd("ide");
  622. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  623. }),
  624. $globals.Behavior);
  625. $core.addClass("Class", $globals.Behavior, [], "Kernel-Classes");
  626. //>>excludeStart("ide", pragmas.excludeIdeData);
  627. $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.";
  628. //>>excludeEnd("ide");
  629. $core.addMethod(
  630. $core.method({
  631. selector: "classTag",
  632. protocol: "accessing",
  633. fn: function (){
  634. var self=this,$self=this;
  635. return "class";
  636. },
  637. //>>excludeStart("ide", pragmas.excludeIdeData);
  638. args: [],
  639. 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'",
  640. referencedClasses: [],
  641. //>>excludeEnd("ide");
  642. messageSends: []
  643. }),
  644. $globals.Class);
  645. $core.addMethod(
  646. $core.method({
  647. selector: "definition",
  648. protocol: "accessing",
  649. fn: function (){
  650. var self=this,$self=this;
  651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  652. return $core.withContext(function($ctx1) {
  653. //>>excludeEnd("ctx");
  654. var $1,$2;
  655. return $recv($globals.String)._streamContents_((function(stream){
  656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  657. return $core.withContext(function($ctx2) {
  658. //>>excludeEnd("ctx");
  659. $recv(stream)._print_($self._superclass());
  660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  661. $ctx2.sendIdx["print:"]=1;
  662. //>>excludeEnd("ctx");
  663. $recv(stream)._write_(" subclass: ");
  664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  665. $ctx2.sendIdx["write:"]=1;
  666. //>>excludeEnd("ctx");
  667. $recv(stream)._printSymbol_($self._name());
  668. $recv(stream)._lf();
  669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  670. $ctx2.sendIdx["lf"]=1;
  671. //>>excludeEnd("ctx");
  672. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  674. return $core.withContext(function($ctx3) {
  675. //>>excludeEnd("ctx");
  676. $1=$recv($globals.String)._tab();
  677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  678. $ctx3.sendIdx["tab"]=1;
  679. //>>excludeEnd("ctx");
  680. $2=$recv($globals.String)._lf();
  681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  682. $ctx3.sendIdx["lf"]=2;
  683. //>>excludeEnd("ctx");
  684. return [$1,"uses: ",tcd,$2];
  685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  686. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  687. //>>excludeEnd("ctx");
  688. })));
  689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  690. $ctx2.sendIdx["write:"]=2;
  691. //>>excludeEnd("ctx");
  692. $recv(stream)._tab();
  693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  694. $ctx2.sendIdx["tab"]=2;
  695. //>>excludeEnd("ctx");
  696. $recv(stream)._write_("instanceVariableNames: ");
  697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  698. $ctx2.sendIdx["write:"]=3;
  699. //>>excludeEnd("ctx");
  700. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  702. $ctx2.sendIdx["print:"]=2;
  703. //>>excludeEnd("ctx");
  704. $recv(stream)._lf();
  705. $recv(stream)._tab();
  706. $recv(stream)._write_("package: ");
  707. return $recv(stream)._print_($self._category());
  708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  709. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  710. //>>excludeEnd("ctx");
  711. }));
  712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  713. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  714. //>>excludeEnd("ctx");
  715. },
  716. //>>excludeStart("ide", pragmas.excludeIdeData);
  717. args: [],
  718. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self superclass; write: ' subclass: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'instanceVariableNames: '; print: (' ' join: self instanceVariableNames); lf;\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  719. referencedClasses: ["String"],
  720. //>>excludeEnd("ide");
  721. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  722. }),
  723. $globals.Class);
  724. $core.addMethod(
  725. $core.method({
  726. selector: "isClass",
  727. protocol: "testing",
  728. fn: function (){
  729. var self=this,$self=this;
  730. return true;
  731. },
  732. //>>excludeStart("ide", pragmas.excludeIdeData);
  733. args: [],
  734. source: "isClass\x0a\x09^ true",
  735. referencedClasses: [],
  736. //>>excludeEnd("ide");
  737. messageSends: []
  738. }),
  739. $globals.Class);
  740. $core.addMethod(
  741. $core.method({
  742. selector: "rename:",
  743. protocol: "accessing",
  744. fn: function (aString){
  745. var self=this,$self=this;
  746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  747. return $core.withContext(function($ctx1) {
  748. //>>excludeEnd("ctx");
  749. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  750. return self;
  751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  752. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  753. //>>excludeEnd("ctx");
  754. },
  755. //>>excludeStart("ide", pragmas.excludeIdeData);
  756. args: ["aString"],
  757. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  758. referencedClasses: ["ClassBuilder"],
  759. //>>excludeEnd("ide");
  760. messageSends: ["renameClass:to:", "new"]
  761. }),
  762. $globals.Class);
  763. $core.addMethod(
  764. $core.method({
  765. selector: "subclasses",
  766. protocol: "accessing",
  767. fn: function (){
  768. var self=this,$self=this;
  769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  770. return $core.withContext(function($ctx1) {
  771. //>>excludeEnd("ctx");
  772. return self.subclasses._copy();
  773. return self;
  774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  775. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  776. //>>excludeEnd("ctx");
  777. },
  778. //>>excludeStart("ide", pragmas.excludeIdeData);
  779. args: [],
  780. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  781. referencedClasses: [],
  782. //>>excludeEnd("ide");
  783. messageSends: []
  784. }),
  785. $globals.Class);
  786. $core.addMethod(
  787. $core.method({
  788. selector: "theMetaClass",
  789. protocol: "accessing",
  790. fn: function (){
  791. var self=this,$self=this;
  792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  793. return $core.withContext(function($ctx1) {
  794. //>>excludeEnd("ctx");
  795. return $self._class();
  796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  797. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  798. //>>excludeEnd("ctx");
  799. },
  800. //>>excludeStart("ide", pragmas.excludeIdeData);
  801. args: [],
  802. source: "theMetaClass\x0a\x09^ self class",
  803. referencedClasses: [],
  804. //>>excludeEnd("ide");
  805. messageSends: ["class"]
  806. }),
  807. $globals.Class);
  808. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  809. //>>excludeStart("ide", pragmas.excludeIdeData);
  810. $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.";
  811. //>>excludeEnd("ide");
  812. $core.addMethod(
  813. $core.method({
  814. selector: "asJavaScriptSource",
  815. protocol: "converting",
  816. fn: function (){
  817. var self=this,$self=this;
  818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  819. return $core.withContext(function($ctx1) {
  820. //>>excludeEnd("ctx");
  821. var $1;
  822. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  824. $ctx1.sendIdx[","]=1;
  825. //>>excludeEnd("ctx");
  826. return $1;
  827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  828. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  829. //>>excludeEnd("ctx");
  830. },
  831. //>>excludeStart("ide", pragmas.excludeIdeData);
  832. args: [],
  833. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  834. referencedClasses: [],
  835. //>>excludeEnd("ide");
  836. messageSends: [",", "name", "instanceClass"]
  837. }),
  838. $globals.Metaclass);
  839. $core.addMethod(
  840. $core.method({
  841. selector: "definition",
  842. protocol: "accessing",
  843. fn: function (){
  844. var self=this,$self=this;
  845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  846. return $core.withContext(function($ctx1) {
  847. //>>excludeEnd("ctx");
  848. var $1,$2;
  849. return $recv($globals.String)._streamContents_((function(stream){
  850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  851. return $core.withContext(function($ctx2) {
  852. //>>excludeEnd("ctx");
  853. $recv(stream)._print_(self);
  854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  855. $ctx2.sendIdx["print:"]=1;
  856. //>>excludeEnd("ctx");
  857. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  858. return " ";
  859. }),(function(tcd){
  860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  861. return $core.withContext(function($ctx3) {
  862. //>>excludeEnd("ctx");
  863. $1=$recv($globals.String)._lf();
  864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  865. $ctx3.sendIdx["lf"]=1;
  866. //>>excludeEnd("ctx");
  867. $2=$recv($globals.String)._tab();
  868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  869. $ctx3.sendIdx["tab"]=1;
  870. //>>excludeEnd("ctx");
  871. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  873. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  874. //>>excludeEnd("ctx");
  875. })));
  876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  877. $ctx2.sendIdx["write:"]=1;
  878. //>>excludeEnd("ctx");
  879. $recv(stream)._write_("instanceVariableNames: ");
  880. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  882. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  883. //>>excludeEnd("ctx");
  884. }));
  885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  886. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  887. //>>excludeEnd("ctx");
  888. },
  889. //>>excludeStart("ide", pragmas.excludeIdeData);
  890. args: [],
  891. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self;\x0a\x09\x09write: (self traitCompositionDefinition\x0a\x09\x09\x09ifEmpty: [' ']\x0a\x09\x09\x09ifNotEmpty: [ :tcd | { String lf. String tab. 'uses: '. tcd. String lf. String tab }]);\x0a\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09print: (' ' join: self instanceVariableNames) ]",
  892. referencedClasses: ["String"],
  893. //>>excludeEnd("ide");
  894. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  895. }),
  896. $globals.Metaclass);
  897. $core.addMethod(
  898. $core.method({
  899. selector: "instanceClass",
  900. protocol: "accessing",
  901. fn: function (){
  902. var self=this,$self=this;
  903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  904. return $core.withContext(function($ctx1) {
  905. //>>excludeEnd("ctx");
  906. return self.instanceClass;
  907. return self;
  908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  909. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  910. //>>excludeEnd("ctx");
  911. },
  912. //>>excludeStart("ide", pragmas.excludeIdeData);
  913. args: [],
  914. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  915. referencedClasses: [],
  916. //>>excludeEnd("ide");
  917. messageSends: []
  918. }),
  919. $globals.Metaclass);
  920. $core.addMethod(
  921. $core.method({
  922. selector: "instanceVariableNames:",
  923. protocol: "accessing",
  924. fn: function (aCollection){
  925. var self=this,$self=this;
  926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  927. return $core.withContext(function($ctx1) {
  928. //>>excludeEnd("ctx");
  929. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  930. return self;
  931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  932. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  933. //>>excludeEnd("ctx");
  934. },
  935. //>>excludeStart("ide", pragmas.excludeIdeData);
  936. args: ["aCollection"],
  937. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  938. referencedClasses: ["ClassBuilder"],
  939. //>>excludeEnd("ide");
  940. messageSends: ["class:instanceVariableNames:", "new"]
  941. }),
  942. $globals.Metaclass);
  943. $core.addMethod(
  944. $core.method({
  945. selector: "isMetaclass",
  946. protocol: "testing",
  947. fn: function (){
  948. var self=this,$self=this;
  949. return true;
  950. },
  951. //>>excludeStart("ide", pragmas.excludeIdeData);
  952. args: [],
  953. source: "isMetaclass\x0a\x09^ true",
  954. referencedClasses: [],
  955. //>>excludeEnd("ide");
  956. messageSends: []
  957. }),
  958. $globals.Metaclass);
  959. $core.addMethod(
  960. $core.method({
  961. selector: "name",
  962. protocol: "accessing",
  963. fn: function (){
  964. var self=this,$self=this;
  965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  966. return $core.withContext(function($ctx1) {
  967. //>>excludeEnd("ctx");
  968. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  970. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  971. //>>excludeEnd("ctx");
  972. },
  973. //>>excludeStart("ide", pragmas.excludeIdeData);
  974. args: [],
  975. source: "name\x0a\x09^ self instanceClass name, ' class'",
  976. referencedClasses: [],
  977. //>>excludeEnd("ide");
  978. messageSends: [",", "name", "instanceClass"]
  979. }),
  980. $globals.Metaclass);
  981. $core.addMethod(
  982. $core.method({
  983. selector: "package",
  984. protocol: "accessing",
  985. fn: function (){
  986. var self=this,$self=this;
  987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  988. return $core.withContext(function($ctx1) {
  989. //>>excludeEnd("ctx");
  990. return $recv($self._instanceClass())._package();
  991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  992. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  993. //>>excludeEnd("ctx");
  994. },
  995. //>>excludeStart("ide", pragmas.excludeIdeData);
  996. args: [],
  997. source: "package\x0a\x09^ self instanceClass package",
  998. referencedClasses: [],
  999. //>>excludeEnd("ide");
  1000. messageSends: ["package", "instanceClass"]
  1001. }),
  1002. $globals.Metaclass);
  1003. $core.addMethod(
  1004. $core.method({
  1005. selector: "subclasses",
  1006. protocol: "accessing",
  1007. fn: function (){
  1008. var self=this,$self=this;
  1009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1010. return $core.withContext(function($ctx1) {
  1011. //>>excludeEnd("ctx");
  1012. return $core.metaSubclasses(self);
  1013. return self;
  1014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1015. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  1016. //>>excludeEnd("ctx");
  1017. },
  1018. //>>excludeStart("ide", pragmas.excludeIdeData);
  1019. args: [],
  1020. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  1021. referencedClasses: [],
  1022. //>>excludeEnd("ide");
  1023. messageSends: []
  1024. }),
  1025. $globals.Metaclass);
  1026. $core.addMethod(
  1027. $core.method({
  1028. selector: "theMetaClass",
  1029. protocol: "accessing",
  1030. fn: function (){
  1031. var self=this,$self=this;
  1032. return self;
  1033. },
  1034. //>>excludeStart("ide", pragmas.excludeIdeData);
  1035. args: [],
  1036. source: "theMetaClass\x0a\x09^ self",
  1037. referencedClasses: [],
  1038. //>>excludeEnd("ide");
  1039. messageSends: []
  1040. }),
  1041. $globals.Metaclass);
  1042. $core.addMethod(
  1043. $core.method({
  1044. selector: "theNonMetaClass",
  1045. protocol: "accessing",
  1046. fn: function (){
  1047. var self=this,$self=this;
  1048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1049. return $core.withContext(function($ctx1) {
  1050. //>>excludeEnd("ctx");
  1051. return $self._instanceClass();
  1052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1053. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  1054. //>>excludeEnd("ctx");
  1055. },
  1056. //>>excludeStart("ide", pragmas.excludeIdeData);
  1057. args: [],
  1058. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  1059. referencedClasses: [],
  1060. //>>excludeEnd("ide");
  1061. messageSends: ["instanceClass"]
  1062. }),
  1063. $globals.Metaclass);
  1064. $core.addMethod(
  1065. $core.method({
  1066. selector: "uses:instanceVariableNames:",
  1067. protocol: "accessing",
  1068. fn: function (aTraitCompositionDescription,aCollection){
  1069. var self=this,$self=this;
  1070. var metaclass;
  1071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1072. return $core.withContext(function($ctx1) {
  1073. //>>excludeEnd("ctx");
  1074. metaclass=$self._instanceVariableNames_(aCollection);
  1075. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  1076. return metaclass;
  1077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1078. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  1079. //>>excludeEnd("ctx");
  1080. },
  1081. //>>excludeStart("ide", pragmas.excludeIdeData);
  1082. args: ["aTraitCompositionDescription", "aCollection"],
  1083. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  1084. referencedClasses: [],
  1085. //>>excludeEnd("ide");
  1086. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  1087. }),
  1088. $globals.Metaclass);
  1089. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  1090. //>>excludeStart("ide", pragmas.excludeIdeData);
  1091. $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:`.";
  1092. //>>excludeEnd("ide");
  1093. $core.addMethod(
  1094. $core.method({
  1095. selector: "addSubclassOf:named:instanceVariableNames:package:",
  1096. protocol: "class definition",
  1097. fn: function (aClass,className,aCollection,packageName){
  1098. var self=this,$self=this;
  1099. var theClass,thePackage;
  1100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1101. return $core.withContext(function($ctx1) {
  1102. //>>excludeEnd("ctx");
  1103. var $1,$2,$3,$receiver;
  1104. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  1105. thePackage=$recv($globals.Package)._named_(packageName);
  1106. $1=theClass;
  1107. if(($receiver = $1) == null || $receiver.a$nil){
  1108. $1;
  1109. } else {
  1110. $recv(theClass)._package_(thePackage);
  1111. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  1112. if(!$core.assert($2)){
  1113. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  1114. }
  1115. }
  1116. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  1117. $recv($3)._recompile();
  1118. return $recv($3)._yourself();
  1119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1120. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  1121. //>>excludeEnd("ctx");
  1122. },
  1123. //>>excludeStart("ide", pragmas.excludeIdeData);
  1124. args: ["aClass", "className", "aCollection", "packageName"],
  1125. 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\x0a\x09\x09\x09ifFalse: [ ^ 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) recompile; yourself",
  1126. referencedClasses: ["Smalltalk", "Package"],
  1127. //>>excludeEnd("ide");
  1128. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  1129. }),
  1130. $globals.ClassBuilder);
  1131. $core.addMethod(
  1132. $core.method({
  1133. selector: "addTraitNamed:package:",
  1134. protocol: "class definition",
  1135. fn: function (traitName,packageName){
  1136. var self=this,$self=this;
  1137. var theTrait,thePackage;
  1138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1139. return $core.withContext(function($ctx1) {
  1140. //>>excludeEnd("ctx");
  1141. var $1,$2,$receiver;
  1142. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  1143. thePackage=$recv($globals.Package)._named_(packageName);
  1144. $1=theTrait;
  1145. if(($receiver = $1) == null || $receiver.a$nil){
  1146. $1;
  1147. } else {
  1148. $2=theTrait;
  1149. $recv($2)._package_(thePackage);
  1150. $recv($2)._recompile();
  1151. return $recv($2)._yourself();
  1152. }
  1153. return $self._basicAddTraitNamed_package_(traitName,packageName);
  1154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1155. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  1156. //>>excludeEnd("ctx");
  1157. },
  1158. //>>excludeStart("ide", pragmas.excludeIdeData);
  1159. args: ["traitName", "packageName"],
  1160. source: "addTraitNamed: traitName package: packageName\x0a\x09| theTrait thePackage |\x0a\x09\x0a\x09theTrait := Smalltalk globals at: traitName.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theTrait ifNotNil: [ ^ theTrait package: thePackage; recompile; yourself ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddTraitNamed: traitName\x0a\x09\x09package: packageName",
  1161. referencedClasses: ["Smalltalk", "Package"],
  1162. //>>excludeEnd("ide");
  1163. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  1164. }),
  1165. $globals.ClassBuilder);
  1166. $core.addMethod(
  1167. $core.method({
  1168. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  1169. protocol: "private",
  1170. fn: function (aClass,aString,aCollection,packageName){
  1171. var self=this,$self=this;
  1172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1173. return $core.withContext(function($ctx1) {
  1174. //>>excludeEnd("ctx");
  1175. return $core.addClass(aString, aClass, aCollection, packageName);
  1176. ;
  1177. return self;
  1178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1179. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  1180. //>>excludeEnd("ctx");
  1181. },
  1182. //>>excludeStart("ide", pragmas.excludeIdeData);
  1183. args: ["aClass", "aString", "aCollection", "packageName"],
  1184. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  1185. referencedClasses: [],
  1186. //>>excludeEnd("ide");
  1187. messageSends: []
  1188. }),
  1189. $globals.ClassBuilder);
  1190. $core.addMethod(
  1191. $core.method({
  1192. selector: "basicAddTraitNamed:package:",
  1193. protocol: "private",
  1194. fn: function (aString,anotherString){
  1195. var self=this,$self=this;
  1196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1197. return $core.withContext(function($ctx1) {
  1198. //>>excludeEnd("ctx");
  1199. return $core.addTrait(aString, anotherString);
  1200. return self;
  1201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1202. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  1203. //>>excludeEnd("ctx");
  1204. },
  1205. //>>excludeStart("ide", pragmas.excludeIdeData);
  1206. args: ["aString", "anotherString"],
  1207. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  1208. referencedClasses: [],
  1209. //>>excludeEnd("ide");
  1210. messageSends: []
  1211. }),
  1212. $globals.ClassBuilder);
  1213. $core.addMethod(
  1214. $core.method({
  1215. selector: "basicClass:instanceVariableNames:",
  1216. protocol: "private",
  1217. fn: function (aClass,aString){
  1218. var self=this,$self=this;
  1219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1220. return $core.withContext(function($ctx1) {
  1221. //>>excludeEnd("ctx");
  1222. $self._basicClass_instanceVariables_(aClass,$self._instanceVariableNamesFor_(aString));
  1223. return self;
  1224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1225. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  1226. //>>excludeEnd("ctx");
  1227. },
  1228. //>>excludeStart("ide", pragmas.excludeIdeData);
  1229. args: ["aClass", "aString"],
  1230. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  1231. referencedClasses: [],
  1232. //>>excludeEnd("ide");
  1233. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  1234. }),
  1235. $globals.ClassBuilder);
  1236. $core.addMethod(
  1237. $core.method({
  1238. selector: "basicClass:instanceVariables:",
  1239. protocol: "private",
  1240. fn: function (aClass,aCollection){
  1241. var self=this,$self=this;
  1242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1243. return $core.withContext(function($ctx1) {
  1244. //>>excludeEnd("ctx");
  1245. var $1;
  1246. $1=$recv(aClass)._isMetaclass();
  1247. if(!$core.assert($1)){
  1248. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  1249. }
  1250. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  1251. return self;
  1252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1253. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  1254. //>>excludeEnd("ctx");
  1255. },
  1256. //>>excludeStart("ide", pragmas.excludeIdeData);
  1257. args: ["aClass", "aCollection"],
  1258. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  1259. referencedClasses: [],
  1260. //>>excludeEnd("ide");
  1261. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  1262. }),
  1263. $globals.ClassBuilder);
  1264. $core.addMethod(
  1265. $core.method({
  1266. selector: "basicRemoveClass:",
  1267. protocol: "private",
  1268. fn: function (aClass){
  1269. var self=this,$self=this;
  1270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1271. return $core.withContext(function($ctx1) {
  1272. //>>excludeEnd("ctx");
  1273. $core.removeClass(aClass);
  1274. return self;
  1275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1276. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  1277. //>>excludeEnd("ctx");
  1278. },
  1279. //>>excludeStart("ide", pragmas.excludeIdeData);
  1280. args: ["aClass"],
  1281. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  1282. referencedClasses: [],
  1283. //>>excludeEnd("ide");
  1284. messageSends: []
  1285. }),
  1286. $globals.ClassBuilder);
  1287. $core.addMethod(
  1288. $core.method({
  1289. selector: "basicRenameClass:to:",
  1290. protocol: "private",
  1291. fn: function (aClass,aString){
  1292. var self=this,$self=this;
  1293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1294. return $core.withContext(function($ctx1) {
  1295. //>>excludeEnd("ctx");
  1296. $globals[aString] = aClass;
  1297. delete $globals[aClass.className];
  1298. aClass.className = aString;
  1299. ;
  1300. return self;
  1301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1302. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  1303. //>>excludeEnd("ctx");
  1304. },
  1305. //>>excludeStart("ide", pragmas.excludeIdeData);
  1306. args: ["aClass", "aString"],
  1307. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09'>",
  1308. referencedClasses: [],
  1309. //>>excludeEnd("ide");
  1310. messageSends: []
  1311. }),
  1312. $globals.ClassBuilder);
  1313. $core.addMethod(
  1314. $core.method({
  1315. selector: "basicSwapClassNames:with:",
  1316. protocol: "private",
  1317. fn: function (aClass,anotherClass){
  1318. var self=this,$self=this;
  1319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1320. return $core.withContext(function($ctx1) {
  1321. //>>excludeEnd("ctx");
  1322. var tmp = aClass.className;
  1323. aClass.className = anotherClass.className;
  1324. anotherClass.className = tmp;
  1325. ;
  1326. return self;
  1327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1328. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  1329. //>>excludeEnd("ctx");
  1330. },
  1331. //>>excludeStart("ide", pragmas.excludeIdeData);
  1332. args: ["aClass", "anotherClass"],
  1333. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09'>",
  1334. referencedClasses: [],
  1335. //>>excludeEnd("ide");
  1336. messageSends: []
  1337. }),
  1338. $globals.ClassBuilder);
  1339. $core.addMethod(
  1340. $core.method({
  1341. selector: "class:instanceVariableNames:",
  1342. protocol: "class definition",
  1343. fn: function (aClass,ivarNames){
  1344. var self=this,$self=this;
  1345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1346. return $core.withContext(function($ctx1) {
  1347. //>>excludeEnd("ctx");
  1348. var $1,$3,$2;
  1349. $self._basicClass_instanceVariableNames_(aClass,ivarNames);
  1350. $1=$recv($globals.SystemAnnouncer)._current();
  1351. $3=$recv($globals.ClassDefinitionChanged)._new();
  1352. $recv($3)._theClass_(aClass);
  1353. $2=$recv($3)._yourself();
  1354. $recv($1)._announce_($2);
  1355. return self;
  1356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1357. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  1358. //>>excludeEnd("ctx");
  1359. },
  1360. //>>excludeStart("ide", pragmas.excludeIdeData);
  1361. args: ["aClass", "ivarNames"],
  1362. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  1363. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  1364. //>>excludeEnd("ide");
  1365. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  1366. }),
  1367. $globals.ClassBuilder);
  1368. $core.addMethod(
  1369. $core.method({
  1370. selector: "copyClass:named:",
  1371. protocol: "copying",
  1372. fn: function (aClass,className){
  1373. var self=this,$self=this;
  1374. var newClass;
  1375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1376. return $core.withContext(function($ctx1) {
  1377. //>>excludeEnd("ctx");
  1378. var $1,$3,$2;
  1379. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  1380. $self._copyClass_to_(aClass,newClass);
  1381. $1=$recv($globals.SystemAnnouncer)._current();
  1382. $3=$recv($globals.ClassAdded)._new();
  1383. $recv($3)._theClass_(newClass);
  1384. $2=$recv($3)._yourself();
  1385. $recv($1)._announce_($2);
  1386. return newClass;
  1387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1388. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  1389. //>>excludeEnd("ctx");
  1390. },
  1391. //>>excludeStart("ide", pragmas.excludeIdeData);
  1392. args: ["aClass", "className"],
  1393. 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",
  1394. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  1395. //>>excludeEnd("ide");
  1396. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  1397. }),
  1398. $globals.ClassBuilder);
  1399. $core.addMethod(
  1400. $core.method({
  1401. selector: "copyClass:to:",
  1402. protocol: "copying",
  1403. fn: function (aClass,anotherClass){
  1404. var self=this,$self=this;
  1405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1406. return $core.withContext(function($ctx1) {
  1407. //>>excludeEnd("ctx");
  1408. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  1409. $recv(anotherClass)._comment_($recv(aClass)._comment());
  1410. $1=$recv(aClass)._methodDictionary();
  1411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1412. $ctx1.sendIdx["methodDictionary"]=1;
  1413. //>>excludeEnd("ctx");
  1414. $recv($1)._valuesDo_((function(each){
  1415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1416. return $core.withContext(function($ctx2) {
  1417. //>>excludeEnd("ctx");
  1418. $3=$recv(each)._methodClass();
  1419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1420. $ctx2.sendIdx["methodClass"]=1;
  1421. //>>excludeEnd("ctx");
  1422. $2=$recv($3).__eq(aClass);
  1423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1424. $ctx2.sendIdx["="]=1;
  1425. //>>excludeEnd("ctx");
  1426. if($core.assert($2)){
  1427. $4=$recv($globals.Compiler)._new();
  1428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1429. $ctx2.sendIdx["new"]=1;
  1430. //>>excludeEnd("ctx");
  1431. $5=$recv(each)._source();
  1432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1433. $ctx2.sendIdx["source"]=1;
  1434. //>>excludeEnd("ctx");
  1435. $6=$recv(each)._protocol();
  1436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1437. $ctx2.sendIdx["protocol"]=1;
  1438. //>>excludeEnd("ctx");
  1439. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  1440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1441. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  1442. //>>excludeEnd("ctx");
  1443. }
  1444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1445. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1446. //>>excludeEnd("ctx");
  1447. }));
  1448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1449. $ctx1.sendIdx["valuesDo:"]=1;
  1450. //>>excludeEnd("ctx");
  1451. $7=$recv(aClass)._traitComposition();
  1452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1453. $ctx1.sendIdx["traitComposition"]=1;
  1454. //>>excludeEnd("ctx");
  1455. $recv(anotherClass)._setTraitComposition_($7);
  1456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1457. $ctx1.sendIdx["setTraitComposition:"]=1;
  1458. //>>excludeEnd("ctx");
  1459. $8=$recv(anotherClass)._class();
  1460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1461. $ctx1.sendIdx["class"]=1;
  1462. //>>excludeEnd("ctx");
  1463. $10=$recv(aClass)._class();
  1464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1465. $ctx1.sendIdx["class"]=2;
  1466. //>>excludeEnd("ctx");
  1467. $9=$recv($10)._instanceVariableNames();
  1468. $self._basicClass_instanceVariables_($8,$9);
  1469. $12=$recv(aClass)._class();
  1470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1471. $ctx1.sendIdx["class"]=3;
  1472. //>>excludeEnd("ctx");
  1473. $11=$recv($12)._methodDictionary();
  1474. $recv($11)._valuesDo_((function(each){
  1475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1476. return $core.withContext(function($ctx2) {
  1477. //>>excludeEnd("ctx");
  1478. $14=$recv(each)._methodClass();
  1479. $15=$recv(aClass)._class();
  1480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1481. $ctx2.sendIdx["class"]=4;
  1482. //>>excludeEnd("ctx");
  1483. $13=$recv($14).__eq($15);
  1484. if($core.assert($13)){
  1485. $16=$recv($globals.Compiler)._new();
  1486. $17=$recv(each)._source();
  1487. $18=$recv(anotherClass)._class();
  1488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1489. $ctx2.sendIdx["class"]=5;
  1490. //>>excludeEnd("ctx");
  1491. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  1492. }
  1493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1494. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1495. //>>excludeEnd("ctx");
  1496. }));
  1497. $19=$recv(anotherClass)._class();
  1498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1499. $ctx1.sendIdx["class"]=6;
  1500. //>>excludeEnd("ctx");
  1501. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  1502. return self;
  1503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1504. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  1505. //>>excludeEnd("ctx");
  1506. },
  1507. //>>excludeStart("ide", pragmas.excludeIdeData);
  1508. args: ["aClass", "anotherClass"],
  1509. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ] ].\x0a\x09anotherClass setTraitComposition: aClass traitComposition.\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass class ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ] ].\x0a\x09anotherClass class setTraitComposition: aClass class traitComposition",
  1510. referencedClasses: ["Compiler"],
  1511. //>>excludeEnd("ide");
  1512. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  1513. }),
  1514. $globals.ClassBuilder);
  1515. $core.addMethod(
  1516. $core.method({
  1517. selector: "installMethod:forClass:protocol:",
  1518. protocol: "method definition",
  1519. fn: function (aCompiledMethod,aBehavior,aString){
  1520. var self=this,$self=this;
  1521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1522. return $core.withContext(function($ctx1) {
  1523. //>>excludeEnd("ctx");
  1524. $recv(aCompiledMethod)._protocol_(aString);
  1525. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  1526. return aCompiledMethod;
  1527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1528. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  1529. //>>excludeEnd("ctx");
  1530. },
  1531. //>>excludeStart("ide", pragmas.excludeIdeData);
  1532. args: ["aCompiledMethod", "aBehavior", "aString"],
  1533. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  1534. referencedClasses: [],
  1535. //>>excludeEnd("ide");
  1536. messageSends: ["protocol:", "addCompiledMethod:"]
  1537. }),
  1538. $globals.ClassBuilder);
  1539. $core.addMethod(
  1540. $core.method({
  1541. selector: "instanceVariableNamesFor:",
  1542. protocol: "accessing",
  1543. fn: function (aString){
  1544. var self=this,$self=this;
  1545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1546. return $core.withContext(function($ctx1) {
  1547. //>>excludeEnd("ctx");
  1548. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  1549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1550. return $core.withContext(function($ctx2) {
  1551. //>>excludeEnd("ctx");
  1552. return $recv(each)._isEmpty();
  1553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1554. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1555. //>>excludeEnd("ctx");
  1556. }));
  1557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1558. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  1559. //>>excludeEnd("ctx");
  1560. },
  1561. //>>excludeStart("ide", pragmas.excludeIdeData);
  1562. args: ["aString"],
  1563. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  1564. referencedClasses: [],
  1565. //>>excludeEnd("ide");
  1566. messageSends: ["reject:", "tokenize:", "isEmpty"]
  1567. }),
  1568. $globals.ClassBuilder);
  1569. $core.addMethod(
  1570. $core.method({
  1571. selector: "migrateClass:superclass:",
  1572. protocol: "class migration",
  1573. fn: function (aClass,anotherClass){
  1574. var self=this,$self=this;
  1575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1576. return $core.withContext(function($ctx1) {
  1577. //>>excludeEnd("ctx");
  1578. var $1;
  1579. $1=$recv(aClass)._name();
  1580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1581. $ctx1.sendIdx["name"]=1;
  1582. //>>excludeEnd("ctx");
  1583. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  1584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1585. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  1586. //>>excludeEnd("ctx");
  1587. },
  1588. //>>excludeStart("ide", pragmas.excludeIdeData);
  1589. args: ["aClass", "anotherClass"],
  1590. 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",
  1591. referencedClasses: [],
  1592. //>>excludeEnd("ide");
  1593. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  1594. }),
  1595. $globals.ClassBuilder);
  1596. $core.addMethod(
  1597. $core.method({
  1598. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  1599. protocol: "class migration",
  1600. fn: function (className,aClass,aCollection,packageName){
  1601. var self=this,$self=this;
  1602. var oldClass,newClass,tmp;
  1603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1604. return $core.withContext(function($ctx1) {
  1605. //>>excludeEnd("ctx");
  1606. var $1,$2,$4,$3;
  1607. tmp="new*".__comma(className);
  1608. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  1609. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  1610. $self._basicSwapClassNames_with_(oldClass,newClass);
  1611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1612. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  1613. //>>excludeEnd("ctx");
  1614. $recv((function(){
  1615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1616. return $core.withContext(function($ctx2) {
  1617. //>>excludeEnd("ctx");
  1618. return $self._copyClass_to_(oldClass,newClass);
  1619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1621. //>>excludeEnd("ctx");
  1622. }))._on_do_($globals.Error,(function(exception){
  1623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1624. return $core.withContext(function($ctx2) {
  1625. //>>excludeEnd("ctx");
  1626. $self._basicSwapClassNames_with_(oldClass,newClass);
  1627. $1=$self._basicRemoveClass_(newClass);
  1628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1629. $ctx2.sendIdx["basicRemoveClass:"]=1;
  1630. //>>excludeEnd("ctx");
  1631. $1;
  1632. return $recv(exception)._resignal();
  1633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1634. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  1635. //>>excludeEnd("ctx");
  1636. }));
  1637. $self._rawRenameClass_to_(oldClass,tmp);
  1638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1639. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  1640. //>>excludeEnd("ctx");
  1641. $self._rawRenameClass_to_(newClass,className);
  1642. $recv($recv(oldClass)._subclasses())._do_((function(each){
  1643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1644. return $core.withContext(function($ctx2) {
  1645. //>>excludeEnd("ctx");
  1646. return $self._migrateClass_superclass_(each,newClass);
  1647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1648. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1649. //>>excludeEnd("ctx");
  1650. }));
  1651. $self._basicRemoveClass_(oldClass);
  1652. $2=$recv($globals.SystemAnnouncer)._current();
  1653. $4=$recv($globals.ClassMigrated)._new();
  1654. $recv($4)._theClass_(newClass);
  1655. $recv($4)._oldClass_(oldClass);
  1656. $3=$recv($4)._yourself();
  1657. $recv($2)._announce_($3);
  1658. return newClass;
  1659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1660. }, 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)});
  1661. //>>excludeEnd("ctx");
  1662. },
  1663. //>>excludeStart("ide", pragmas.excludeIdeData);
  1664. args: ["className", "aClass", "aCollection", "packageName"],
  1665. 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",
  1666. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  1667. //>>excludeEnd("ide");
  1668. 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"]
  1669. }),
  1670. $globals.ClassBuilder);
  1671. $core.addMethod(
  1672. $core.method({
  1673. selector: "rawRenameClass:to:",
  1674. protocol: "private",
  1675. fn: function (aClass,aString){
  1676. var self=this,$self=this;
  1677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1678. return $core.withContext(function($ctx1) {
  1679. //>>excludeEnd("ctx");
  1680. $globals[aString] = aClass;
  1681. ;
  1682. return self;
  1683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1684. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  1685. //>>excludeEnd("ctx");
  1686. },
  1687. //>>excludeStart("ide", pragmas.excludeIdeData);
  1688. args: ["aClass", "aString"],
  1689. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  1690. referencedClasses: [],
  1691. //>>excludeEnd("ide");
  1692. messageSends: []
  1693. }),
  1694. $globals.ClassBuilder);
  1695. $core.addMethod(
  1696. $core.method({
  1697. selector: "renameClass:to:",
  1698. protocol: "class migration",
  1699. fn: function (aClass,className){
  1700. var self=this,$self=this;
  1701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1702. return $core.withContext(function($ctx1) {
  1703. //>>excludeEnd("ctx");
  1704. var $1,$3,$2;
  1705. $self._basicRenameClass_to_(aClass,className);
  1706. $recv(aClass)._recompile();
  1707. $1=$recv($globals.SystemAnnouncer)._current();
  1708. $3=$recv($globals.ClassRenamed)._new();
  1709. $recv($3)._theClass_(aClass);
  1710. $2=$recv($3)._yourself();
  1711. $recv($1)._announce_($2);
  1712. return self;
  1713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1714. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  1715. //>>excludeEnd("ctx");
  1716. },
  1717. //>>excludeStart("ide", pragmas.excludeIdeData);
  1718. args: ["aClass", "className"],
  1719. 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)",
  1720. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  1721. //>>excludeEnd("ide");
  1722. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  1723. }),
  1724. $globals.ClassBuilder);
  1725. $core.addMethod(
  1726. $core.method({
  1727. selector: "setupClass:",
  1728. protocol: "public",
  1729. fn: function (aClass){
  1730. var self=this,$self=this;
  1731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1732. return $core.withContext(function($ctx1) {
  1733. //>>excludeEnd("ctx");
  1734. $self._deprecatedAPI_("Classes are now auto-inited.");
  1735. return self;
  1736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1737. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  1738. //>>excludeEnd("ctx");
  1739. },
  1740. //>>excludeStart("ide", pragmas.excludeIdeData);
  1741. args: ["aClass"],
  1742. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  1743. referencedClasses: [],
  1744. //>>excludeEnd("ide");
  1745. messageSends: ["deprecatedAPI:"]
  1746. }),
  1747. $globals.ClassBuilder);
  1748. $core.addMethod(
  1749. $core.method({
  1750. selector: "superclass:subclass:",
  1751. protocol: "class definition",
  1752. fn: function (aClass,className){
  1753. var self=this,$self=this;
  1754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1755. return $core.withContext(function($ctx1) {
  1756. //>>excludeEnd("ctx");
  1757. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  1758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1759. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  1760. //>>excludeEnd("ctx");
  1761. },
  1762. //>>excludeStart("ide", pragmas.excludeIdeData);
  1763. args: ["aClass", "className"],
  1764. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  1765. referencedClasses: [],
  1766. //>>excludeEnd("ide");
  1767. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  1768. }),
  1769. $globals.ClassBuilder);
  1770. $core.addMethod(
  1771. $core.method({
  1772. selector: "superclass:subclass:instanceVariableNames:package:",
  1773. protocol: "class definition",
  1774. fn: function (aClass,className,ivarNames,packageName){
  1775. var self=this,$self=this;
  1776. var newClass;
  1777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1778. return $core.withContext(function($ctx1) {
  1779. //>>excludeEnd("ctx");
  1780. var $1,$2,$3,$5,$4,$receiver;
  1781. $1=$self._instanceVariableNamesFor_(ivarNames);
  1782. if(($receiver = packageName) == null || $receiver.a$nil){
  1783. $2="unclassified";
  1784. } else {
  1785. $2=packageName;
  1786. }
  1787. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  1788. $3=$recv($globals.SystemAnnouncer)._current();
  1789. $5=$recv($globals.ClassAdded)._new();
  1790. $recv($5)._theClass_(newClass);
  1791. $4=$recv($5)._yourself();
  1792. $recv($3)._announce_($4);
  1793. return newClass;
  1794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1795. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  1796. //>>excludeEnd("ctx");
  1797. },
  1798. //>>excludeStart("ide", pragmas.excludeIdeData);
  1799. args: ["aClass", "className", "ivarNames", "packageName"],
  1800. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  1801. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  1802. //>>excludeEnd("ide");
  1803. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  1804. }),
  1805. $globals.ClassBuilder);
  1806. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  1807. //>>excludeStart("ide", pragmas.excludeIdeData);
  1808. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  1809. //>>excludeEnd("ide");
  1810. $core.addMethod(
  1811. $core.method({
  1812. selector: "getNodesFrom:",
  1813. protocol: "accessing",
  1814. fn: function (aCollection){
  1815. var self=this,$self=this;
  1816. var children,others;
  1817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1818. return $core.withContext(function($ctx1) {
  1819. //>>excludeEnd("ctx");
  1820. var $1;
  1821. children=[];
  1822. others=[];
  1823. $recv(aCollection)._do_((function(each){
  1824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1825. return $core.withContext(function($ctx2) {
  1826. //>>excludeEnd("ctx");
  1827. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  1828. if($core.assert($1)){
  1829. return $recv(children)._add_(each);
  1830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1831. $ctx2.sendIdx["add:"]=1;
  1832. //>>excludeEnd("ctx");
  1833. } else {
  1834. return $recv(others)._add_(each);
  1835. }
  1836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1837. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1838. //>>excludeEnd("ctx");
  1839. }));
  1840. $self["@nodes"]=$recv(children)._collect_((function(each){
  1841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1842. return $core.withContext(function($ctx2) {
  1843. //>>excludeEnd("ctx");
  1844. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  1845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1846. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  1847. //>>excludeEnd("ctx");
  1848. }));
  1849. return self;
  1850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1851. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  1852. //>>excludeEnd("ctx");
  1853. },
  1854. //>>excludeStart("ide", pragmas.excludeIdeData);
  1855. args: ["aCollection"],
  1856. 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 ]",
  1857. referencedClasses: ["ClassSorterNode"],
  1858. //>>excludeEnd("ide");
  1859. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  1860. }),
  1861. $globals.ClassSorterNode);
  1862. $core.addMethod(
  1863. $core.method({
  1864. selector: "level",
  1865. protocol: "accessing",
  1866. fn: function (){
  1867. var self=this,$self=this;
  1868. return $self["@level"];
  1869. },
  1870. //>>excludeStart("ide", pragmas.excludeIdeData);
  1871. args: [],
  1872. source: "level\x0a\x09^ level",
  1873. referencedClasses: [],
  1874. //>>excludeEnd("ide");
  1875. messageSends: []
  1876. }),
  1877. $globals.ClassSorterNode);
  1878. $core.addMethod(
  1879. $core.method({
  1880. selector: "level:",
  1881. protocol: "accessing",
  1882. fn: function (anInteger){
  1883. var self=this,$self=this;
  1884. $self["@level"]=anInteger;
  1885. return self;
  1886. },
  1887. //>>excludeStart("ide", pragmas.excludeIdeData);
  1888. args: ["anInteger"],
  1889. source: "level: anInteger\x0a\x09level := anInteger",
  1890. referencedClasses: [],
  1891. //>>excludeEnd("ide");
  1892. messageSends: []
  1893. }),
  1894. $globals.ClassSorterNode);
  1895. $core.addMethod(
  1896. $core.method({
  1897. selector: "nodes",
  1898. protocol: "accessing",
  1899. fn: function (){
  1900. var self=this,$self=this;
  1901. return $self["@nodes"];
  1902. },
  1903. //>>excludeStart("ide", pragmas.excludeIdeData);
  1904. args: [],
  1905. source: "nodes\x0a\x09^ nodes",
  1906. referencedClasses: [],
  1907. //>>excludeEnd("ide");
  1908. messageSends: []
  1909. }),
  1910. $globals.ClassSorterNode);
  1911. $core.addMethod(
  1912. $core.method({
  1913. selector: "theClass",
  1914. protocol: "accessing",
  1915. fn: function (){
  1916. var self=this,$self=this;
  1917. return $self["@theClass"];
  1918. },
  1919. //>>excludeStart("ide", pragmas.excludeIdeData);
  1920. args: [],
  1921. source: "theClass\x0a\x09^ theClass",
  1922. referencedClasses: [],
  1923. //>>excludeEnd("ide");
  1924. messageSends: []
  1925. }),
  1926. $globals.ClassSorterNode);
  1927. $core.addMethod(
  1928. $core.method({
  1929. selector: "theClass:",
  1930. protocol: "accessing",
  1931. fn: function (aClass){
  1932. var self=this,$self=this;
  1933. $self["@theClass"]=aClass;
  1934. return self;
  1935. },
  1936. //>>excludeStart("ide", pragmas.excludeIdeData);
  1937. args: ["aClass"],
  1938. source: "theClass: aClass\x0a\x09theClass := aClass",
  1939. referencedClasses: [],
  1940. //>>excludeEnd("ide");
  1941. messageSends: []
  1942. }),
  1943. $globals.ClassSorterNode);
  1944. $core.addMethod(
  1945. $core.method({
  1946. selector: "traverseClassesWith:",
  1947. protocol: "visiting",
  1948. fn: function (aCollection){
  1949. var self=this,$self=this;
  1950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1951. return $core.withContext(function($ctx1) {
  1952. //>>excludeEnd("ctx");
  1953. var $1,$3,$2;
  1954. $1=$self._theClass();
  1955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1956. $ctx1.sendIdx["theClass"]=1;
  1957. //>>excludeEnd("ctx");
  1958. $recv(aCollection)._add_($1);
  1959. $recv($recv($self._nodes())._sorted_((function(a,b){
  1960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1961. return $core.withContext(function($ctx2) {
  1962. //>>excludeEnd("ctx");
  1963. $3=$recv(a)._theClass();
  1964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1965. $ctx2.sendIdx["theClass"]=2;
  1966. //>>excludeEnd("ctx");
  1967. $2=$recv($3)._name();
  1968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1969. $ctx2.sendIdx["name"]=1;
  1970. //>>excludeEnd("ctx");
  1971. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  1972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1973. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  1974. //>>excludeEnd("ctx");
  1975. })))._do_((function(aNode){
  1976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1977. return $core.withContext(function($ctx2) {
  1978. //>>excludeEnd("ctx");
  1979. return $recv(aNode)._traverseClassesWith_(aCollection);
  1980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1981. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  1982. //>>excludeEnd("ctx");
  1983. }));
  1984. return self;
  1985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1986. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  1987. //>>excludeEnd("ctx");
  1988. },
  1989. //>>excludeStart("ide", pragmas.excludeIdeData);
  1990. args: ["aCollection"],
  1991. 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 ].",
  1992. referencedClasses: [],
  1993. //>>excludeEnd("ide");
  1994. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  1995. }),
  1996. $globals.ClassSorterNode);
  1997. $core.addMethod(
  1998. $core.method({
  1999. selector: "on:classes:level:",
  2000. protocol: "instance creation",
  2001. fn: function (aClass,aCollection,anInteger){
  2002. var self=this,$self=this;
  2003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2004. return $core.withContext(function($ctx1) {
  2005. //>>excludeEnd("ctx");
  2006. var $1;
  2007. $1=$self._new();
  2008. $recv($1)._theClass_(aClass);
  2009. $recv($1)._level_(anInteger);
  2010. $recv($1)._getNodesFrom_(aCollection);
  2011. return $recv($1)._yourself();
  2012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2013. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  2014. //>>excludeEnd("ctx");
  2015. },
  2016. //>>excludeStart("ide", pragmas.excludeIdeData);
  2017. args: ["aClass", "aCollection", "anInteger"],
  2018. 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",
  2019. referencedClasses: [],
  2020. //>>excludeEnd("ide");
  2021. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  2022. }),
  2023. $globals.ClassSorterNode.a$cls);
  2024. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  2025. $core.addMethod(
  2026. $core.method({
  2027. selector: "allInstanceVariableNames",
  2028. protocol: "accessing",
  2029. fn: function (){
  2030. var self=this,$self=this;
  2031. return [];
  2032. },
  2033. //>>excludeStart("ide", pragmas.excludeIdeData);
  2034. args: [],
  2035. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  2036. referencedClasses: [],
  2037. //>>excludeEnd("ide");
  2038. messageSends: []
  2039. }),
  2040. $globals.TBehaviorDefaults);
  2041. $core.addMethod(
  2042. $core.method({
  2043. selector: "allSubclassesDo:",
  2044. protocol: "enumerating",
  2045. fn: function (aBlock){
  2046. var self=this,$self=this;
  2047. return self;
  2048. },
  2049. //>>excludeStart("ide", pragmas.excludeIdeData);
  2050. args: ["aBlock"],
  2051. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  2052. referencedClasses: [],
  2053. //>>excludeEnd("ide");
  2054. messageSends: []
  2055. }),
  2056. $globals.TBehaviorDefaults);
  2057. $core.addMethod(
  2058. $core.method({
  2059. selector: "name",
  2060. protocol: "accessing",
  2061. fn: function (){
  2062. var self=this,$self=this;
  2063. return nil;
  2064. },
  2065. //>>excludeStart("ide", pragmas.excludeIdeData);
  2066. args: [],
  2067. source: "name\x0a\x09^ nil",
  2068. referencedClasses: [],
  2069. //>>excludeEnd("ide");
  2070. messageSends: []
  2071. }),
  2072. $globals.TBehaviorDefaults);
  2073. $core.addMethod(
  2074. $core.method({
  2075. selector: "printOn:",
  2076. protocol: "printing",
  2077. fn: function (aStream){
  2078. var self=this,$self=this;
  2079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2080. return $core.withContext(function($ctx1) {
  2081. //>>excludeEnd("ctx");
  2082. var $1,$receiver;
  2083. $1=$self._name();
  2084. if(($receiver = $1) == null || $receiver.a$nil){
  2085. (
  2086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2087. $ctx1.supercall = true,
  2088. //>>excludeEnd("ctx");
  2089. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  2090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2091. $ctx1.supercall = false;
  2092. //>>excludeEnd("ctx");;
  2093. } else {
  2094. var name;
  2095. name=$receiver;
  2096. $recv(aStream)._nextPutAll_(name);
  2097. }
  2098. return self;
  2099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2100. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  2101. //>>excludeEnd("ctx");
  2102. },
  2103. //>>excludeStart("ide", pragmas.excludeIdeData);
  2104. args: ["aStream"],
  2105. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  2106. referencedClasses: [],
  2107. //>>excludeEnd("ide");
  2108. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  2109. }),
  2110. $globals.TBehaviorDefaults);
  2111. $core.addMethod(
  2112. $core.method({
  2113. selector: "superclass",
  2114. protocol: "accessing",
  2115. fn: function (){
  2116. var self=this,$self=this;
  2117. return nil;
  2118. },
  2119. //>>excludeStart("ide", pragmas.excludeIdeData);
  2120. args: [],
  2121. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  2122. referencedClasses: [],
  2123. //>>excludeEnd("ide");
  2124. messageSends: []
  2125. }),
  2126. $globals.TBehaviorDefaults);
  2127. $core.addMethod(
  2128. $core.method({
  2129. selector: "traitUsers",
  2130. protocol: "accessing",
  2131. fn: function (){
  2132. var self=this,$self=this;
  2133. return [];
  2134. },
  2135. //>>excludeStart("ide", pragmas.excludeIdeData);
  2136. args: [],
  2137. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  2138. referencedClasses: [],
  2139. //>>excludeEnd("ide");
  2140. messageSends: []
  2141. }),
  2142. $globals.TBehaviorDefaults);
  2143. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  2144. //>>excludeStart("ide", pragmas.excludeIdeData);
  2145. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  2146. //>>excludeEnd("ide");
  2147. $core.addMethod(
  2148. $core.method({
  2149. selector: ">>",
  2150. protocol: "accessing",
  2151. fn: function (aString){
  2152. var self=this,$self=this;
  2153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2154. return $core.withContext(function($ctx1) {
  2155. //>>excludeEnd("ctx");
  2156. return $self._methodAt_(aString);
  2157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2158. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  2159. //>>excludeEnd("ctx");
  2160. },
  2161. //>>excludeStart("ide", pragmas.excludeIdeData);
  2162. args: ["aString"],
  2163. source: ">> aString\x0a\x09^ self methodAt: aString",
  2164. referencedClasses: [],
  2165. //>>excludeEnd("ide");
  2166. messageSends: ["methodAt:"]
  2167. }),
  2168. $globals.TBehaviorProvider);
  2169. $core.addMethod(
  2170. $core.method({
  2171. selector: "addCompiledMethod:",
  2172. protocol: "compiling",
  2173. fn: function (aMethod){
  2174. var self=this,$self=this;
  2175. var oldMethod,announcement;
  2176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2177. return $core.withContext(function($ctx1) {
  2178. //>>excludeEnd("ctx");
  2179. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$receiver;
  2180. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  2181. return nil;
  2182. }));
  2183. $2=$self._protocols();
  2184. $3=$recv(aMethod)._protocol();
  2185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2186. $ctx1.sendIdx["protocol"]=1;
  2187. //>>excludeEnd("ctx");
  2188. $1=$recv($2)._includes_($3);
  2189. if(!$core.assert($1)){
  2190. $4=$self._organization();
  2191. $5=$recv(aMethod)._protocol();
  2192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2193. $ctx1.sendIdx["protocol"]=2;
  2194. //>>excludeEnd("ctx");
  2195. $recv($4)._addElement_($5);
  2196. }
  2197. $self._basicAddCompiledMethod_(aMethod);
  2198. $6=oldMethod;
  2199. if(($receiver = $6) == null || $receiver.a$nil){
  2200. $6;
  2201. } else {
  2202. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  2203. }
  2204. $7=oldMethod;
  2205. if(($receiver = $7) == null || $receiver.a$nil){
  2206. $8=$recv($globals.MethodAdded)._new();
  2207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2208. $ctx1.sendIdx["new"]=1;
  2209. //>>excludeEnd("ctx");
  2210. $recv($8)._method_(aMethod);
  2211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2212. $ctx1.sendIdx["method:"]=1;
  2213. //>>excludeEnd("ctx");
  2214. $9=$recv($8)._yourself();
  2215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2216. $ctx1.sendIdx["yourself"]=1;
  2217. //>>excludeEnd("ctx");
  2218. announcement=$9;
  2219. } else {
  2220. $10=$recv($globals.MethodModified)._new();
  2221. $recv($10)._oldMethod_(oldMethod);
  2222. $recv($10)._method_(aMethod);
  2223. announcement=$recv($10)._yourself();
  2224. }
  2225. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  2226. return self;
  2227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2228. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  2229. //>>excludeEnd("ctx");
  2230. },
  2231. //>>excludeStart("ide", pragmas.excludeIdeData);
  2232. args: ["aMethod"],
  2233. 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",
  2234. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  2235. //>>excludeEnd("ide");
  2236. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  2237. }),
  2238. $globals.TBehaviorProvider);
  2239. $core.addMethod(
  2240. $core.method({
  2241. selector: "basicAddCompiledMethod:",
  2242. protocol: "private",
  2243. fn: function (aMethod){
  2244. var self=this,$self=this;
  2245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2246. return $core.withContext(function($ctx1) {
  2247. //>>excludeEnd("ctx");
  2248. $core.addMethod(aMethod, self);
  2249. return self;
  2250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2251. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  2252. //>>excludeEnd("ctx");
  2253. },
  2254. //>>excludeStart("ide", pragmas.excludeIdeData);
  2255. args: ["aMethod"],
  2256. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  2257. referencedClasses: [],
  2258. //>>excludeEnd("ide");
  2259. messageSends: []
  2260. }),
  2261. $globals.TBehaviorProvider);
  2262. $core.addMethod(
  2263. $core.method({
  2264. selector: "basicRemoveCompiledMethod:",
  2265. protocol: "private",
  2266. fn: function (aMethod){
  2267. var self=this,$self=this;
  2268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2269. return $core.withContext(function($ctx1) {
  2270. //>>excludeEnd("ctx");
  2271. $core.removeMethod(aMethod,self);
  2272. return self;
  2273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2274. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  2275. //>>excludeEnd("ctx");
  2276. },
  2277. //>>excludeStart("ide", pragmas.excludeIdeData);
  2278. args: ["aMethod"],
  2279. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  2280. referencedClasses: [],
  2281. //>>excludeEnd("ide");
  2282. messageSends: []
  2283. }),
  2284. $globals.TBehaviorProvider);
  2285. $core.addMethod(
  2286. $core.method({
  2287. selector: "compile:protocol:",
  2288. protocol: "compiling",
  2289. fn: function (aString,anotherString){
  2290. var self=this,$self=this;
  2291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2292. return $core.withContext(function($ctx1) {
  2293. //>>excludeEnd("ctx");
  2294. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  2295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2296. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  2297. //>>excludeEnd("ctx");
  2298. },
  2299. //>>excludeStart("ide", pragmas.excludeIdeData);
  2300. args: ["aString", "anotherString"],
  2301. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  2302. referencedClasses: ["Compiler"],
  2303. //>>excludeEnd("ide");
  2304. messageSends: ["install:forClass:protocol:", "new"]
  2305. }),
  2306. $globals.TBehaviorProvider);
  2307. $core.addMethod(
  2308. $core.method({
  2309. selector: "includesSelector:",
  2310. protocol: "testing",
  2311. fn: function (aString){
  2312. var self=this,$self=this;
  2313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2314. return $core.withContext(function($ctx1) {
  2315. //>>excludeEnd("ctx");
  2316. return $recv($self._methodDictionary())._includesKey_(aString);
  2317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2318. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  2319. //>>excludeEnd("ctx");
  2320. },
  2321. //>>excludeStart("ide", pragmas.excludeIdeData);
  2322. args: ["aString"],
  2323. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  2324. referencedClasses: [],
  2325. //>>excludeEnd("ide");
  2326. messageSends: ["includesKey:", "methodDictionary"]
  2327. }),
  2328. $globals.TBehaviorProvider);
  2329. $core.addMethod(
  2330. $core.method({
  2331. selector: "methodAt:",
  2332. protocol: "accessing",
  2333. fn: function (aString){
  2334. var self=this,$self=this;
  2335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2336. return $core.withContext(function($ctx1) {
  2337. //>>excludeEnd("ctx");
  2338. return $recv($self._methodDictionary())._at_(aString);
  2339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2340. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  2341. //>>excludeEnd("ctx");
  2342. },
  2343. //>>excludeStart("ide", pragmas.excludeIdeData);
  2344. args: ["aString"],
  2345. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  2346. referencedClasses: [],
  2347. //>>excludeEnd("ide");
  2348. messageSends: ["at:", "methodDictionary"]
  2349. }),
  2350. $globals.TBehaviorProvider);
  2351. $core.addMethod(
  2352. $core.method({
  2353. selector: "methodDictionary",
  2354. protocol: "accessing",
  2355. fn: function (){
  2356. var self=this,$self=this;
  2357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2358. return $core.withContext(function($ctx1) {
  2359. //>>excludeEnd("ctx");
  2360. var dict = $globals.HashedCollection._new();
  2361. var methods = self.methods;
  2362. Object.keys(methods).forEach(function(i) {
  2363. if(methods[i].selector) {
  2364. dict._at_put_(methods[i].selector, methods[i]);
  2365. }
  2366. });
  2367. return dict;
  2368. return self;
  2369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2370. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  2371. //>>excludeEnd("ctx");
  2372. },
  2373. //>>excludeStart("ide", pragmas.excludeIdeData);
  2374. args: [],
  2375. source: "methodDictionary\x0a\x09<inlineJS: 'var dict = $globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict'>",
  2376. referencedClasses: [],
  2377. //>>excludeEnd("ide");
  2378. messageSends: []
  2379. }),
  2380. $globals.TBehaviorProvider);
  2381. $core.addMethod(
  2382. $core.method({
  2383. selector: "methodTemplate",
  2384. protocol: "accessing",
  2385. fn: function (){
  2386. var self=this,$self=this;
  2387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2388. return $core.withContext(function($ctx1) {
  2389. //>>excludeEnd("ctx");
  2390. return $recv($globals.String)._streamContents_((function(stream){
  2391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2392. return $core.withContext(function($ctx2) {
  2393. //>>excludeEnd("ctx");
  2394. $recv(stream)._write_("messageSelectorAndArgumentNames");
  2395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2396. $ctx2.sendIdx["write:"]=1;
  2397. //>>excludeEnd("ctx");
  2398. $recv(stream)._lf();
  2399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2400. $ctx2.sendIdx["lf"]=1;
  2401. //>>excludeEnd("ctx");
  2402. $recv(stream)._tab();
  2403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2404. $ctx2.sendIdx["tab"]=1;
  2405. //>>excludeEnd("ctx");
  2406. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  2407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2408. $ctx2.sendIdx["write:"]=2;
  2409. //>>excludeEnd("ctx");
  2410. $recv(stream)._lf();
  2411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2412. $ctx2.sendIdx["lf"]=2;
  2413. //>>excludeEnd("ctx");
  2414. $recv(stream)._lf();
  2415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2416. $ctx2.sendIdx["lf"]=3;
  2417. //>>excludeEnd("ctx");
  2418. $recv(stream)._tab();
  2419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2420. $ctx2.sendIdx["tab"]=2;
  2421. //>>excludeEnd("ctx");
  2422. $recv(stream)._write_("| temporary variable names |");
  2423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2424. $ctx2.sendIdx["write:"]=3;
  2425. //>>excludeEnd("ctx");
  2426. $recv(stream)._lf();
  2427. $recv(stream)._tab();
  2428. return $recv(stream)._write_("statements");
  2429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2430. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  2431. //>>excludeEnd("ctx");
  2432. }));
  2433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2434. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  2435. //>>excludeEnd("ctx");
  2436. },
  2437. //>>excludeStart("ide", pragmas.excludeIdeData);
  2438. args: [],
  2439. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: 'messageSelectorAndArgumentNames'; lf;\x0a\x09\x09tab; write: '\x22comment stating purpose of message\x22'; lf;\x0a\x09\x09lf;\x0a\x09\x09tab; write: '| temporary variable names |'; lf;\x0a\x09\x09tab; write: 'statements' ]",
  2440. referencedClasses: ["String"],
  2441. //>>excludeEnd("ide");
  2442. messageSends: ["streamContents:", "write:", "lf", "tab"]
  2443. }),
  2444. $globals.TBehaviorProvider);
  2445. $core.addMethod(
  2446. $core.method({
  2447. selector: "methods",
  2448. protocol: "accessing",
  2449. fn: function (){
  2450. var self=this,$self=this;
  2451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2452. return $core.withContext(function($ctx1) {
  2453. //>>excludeEnd("ctx");
  2454. return $recv($self._methodDictionary())._values();
  2455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2456. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  2457. //>>excludeEnd("ctx");
  2458. },
  2459. //>>excludeStart("ide", pragmas.excludeIdeData);
  2460. args: [],
  2461. source: "methods\x0a\x09^ self methodDictionary values",
  2462. referencedClasses: [],
  2463. //>>excludeEnd("ide");
  2464. messageSends: ["values", "methodDictionary"]
  2465. }),
  2466. $globals.TBehaviorProvider);
  2467. $core.addMethod(
  2468. $core.method({
  2469. selector: "methodsInProtocol:",
  2470. protocol: "accessing",
  2471. fn: function (aString){
  2472. var self=this,$self=this;
  2473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2474. return $core.withContext(function($ctx1) {
  2475. //>>excludeEnd("ctx");
  2476. return $recv($self._methods())._select_((function(each){
  2477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2478. return $core.withContext(function($ctx2) {
  2479. //>>excludeEnd("ctx");
  2480. return $recv($recv(each)._protocol()).__eq(aString);
  2481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2483. //>>excludeEnd("ctx");
  2484. }));
  2485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2486. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  2487. //>>excludeEnd("ctx");
  2488. },
  2489. //>>excludeStart("ide", pragmas.excludeIdeData);
  2490. args: ["aString"],
  2491. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  2492. referencedClasses: [],
  2493. //>>excludeEnd("ide");
  2494. messageSends: ["select:", "methods", "=", "protocol"]
  2495. }),
  2496. $globals.TBehaviorProvider);
  2497. $core.addMethod(
  2498. $core.method({
  2499. selector: "organization",
  2500. protocol: "accessing",
  2501. fn: function (){
  2502. var self=this,$self=this;
  2503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2504. return $core.withContext(function($ctx1) {
  2505. //>>excludeEnd("ctx");
  2506. return $self._basicAt_("organization");
  2507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2508. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  2509. //>>excludeEnd("ctx");
  2510. },
  2511. //>>excludeStart("ide", pragmas.excludeIdeData);
  2512. args: [],
  2513. source: "organization\x0a\x09^ self basicAt: 'organization'",
  2514. referencedClasses: [],
  2515. //>>excludeEnd("ide");
  2516. messageSends: ["basicAt:"]
  2517. }),
  2518. $globals.TBehaviorProvider);
  2519. $core.addMethod(
  2520. $core.method({
  2521. selector: "ownMethods",
  2522. protocol: "accessing",
  2523. fn: function (){
  2524. var self=this,$self=this;
  2525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2526. return $core.withContext(function($ctx1) {
  2527. //>>excludeEnd("ctx");
  2528. var $1;
  2529. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  2530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2531. return $core.withContext(function($ctx2) {
  2532. //>>excludeEnd("ctx");
  2533. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  2534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2535. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  2536. //>>excludeEnd("ctx");
  2537. })))._sorted_((function(a,b){
  2538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2539. return $core.withContext(function($ctx2) {
  2540. //>>excludeEnd("ctx");
  2541. $1=$recv(a)._selector();
  2542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2543. $ctx2.sendIdx["selector"]=1;
  2544. //>>excludeEnd("ctx");
  2545. return $recv($1).__lt_eq($recv(b)._selector());
  2546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2547. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  2548. //>>excludeEnd("ctx");
  2549. }));
  2550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2551. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  2552. //>>excludeEnd("ctx");
  2553. },
  2554. //>>excludeStart("ide", pragmas.excludeIdeData);
  2555. args: [],
  2556. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x0a\x09nor obtained via trait composition\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self ownMethodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  2557. referencedClasses: ["OrderedCollection"],
  2558. //>>excludeEnd("ide");
  2559. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  2560. }),
  2561. $globals.TBehaviorProvider);
  2562. $core.addMethod(
  2563. $core.method({
  2564. selector: "ownMethodsInProtocol:",
  2565. protocol: "accessing",
  2566. fn: function (aString){
  2567. var self=this,$self=this;
  2568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2569. return $core.withContext(function($ctx1) {
  2570. //>>excludeEnd("ctx");
  2571. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  2572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2573. return $core.withContext(function($ctx2) {
  2574. //>>excludeEnd("ctx");
  2575. return $recv($recv(each)._methodClass()).__eq(self);
  2576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2578. //>>excludeEnd("ctx");
  2579. }));
  2580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2581. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  2582. //>>excludeEnd("ctx");
  2583. },
  2584. //>>excludeStart("ide", pragmas.excludeIdeData);
  2585. args: ["aString"],
  2586. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  2587. referencedClasses: [],
  2588. //>>excludeEnd("ide");
  2589. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  2590. }),
  2591. $globals.TBehaviorProvider);
  2592. $core.addMethod(
  2593. $core.method({
  2594. selector: "ownProtocols",
  2595. protocol: "accessing",
  2596. fn: function (){
  2597. var self=this,$self=this;
  2598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2599. return $core.withContext(function($ctx1) {
  2600. //>>excludeEnd("ctx");
  2601. return $recv($self._protocols())._reject_((function(each){
  2602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2603. return $core.withContext(function($ctx2) {
  2604. //>>excludeEnd("ctx");
  2605. return $recv(each)._match_("^\x5c*");
  2606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2607. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2608. //>>excludeEnd("ctx");
  2609. }));
  2610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2611. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  2612. //>>excludeEnd("ctx");
  2613. },
  2614. //>>excludeStart("ide", pragmas.excludeIdeData);
  2615. args: [],
  2616. 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*' ]",
  2617. referencedClasses: [],
  2618. //>>excludeEnd("ide");
  2619. messageSends: ["reject:", "protocols", "match:"]
  2620. }),
  2621. $globals.TBehaviorProvider);
  2622. $core.addMethod(
  2623. $core.method({
  2624. selector: "packageOfProtocol:",
  2625. protocol: "accessing",
  2626. fn: function (aString){
  2627. var self=this,$self=this;
  2628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2629. return $core.withContext(function($ctx1) {
  2630. //>>excludeEnd("ctx");
  2631. var $1;
  2632. $1=$recv(aString)._beginsWith_("*");
  2633. if(!$core.assert($1)){
  2634. return $self._package();
  2635. }
  2636. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  2637. return nil;
  2638. }));
  2639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2640. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  2641. //>>excludeEnd("ctx");
  2642. },
  2643. //>>excludeStart("ide", pragmas.excludeIdeData);
  2644. args: ["aString"],
  2645. 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 ]",
  2646. referencedClasses: ["Package"],
  2647. //>>excludeEnd("ide");
  2648. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  2649. }),
  2650. $globals.TBehaviorProvider);
  2651. $core.addMethod(
  2652. $core.method({
  2653. selector: "protocols",
  2654. protocol: "accessing",
  2655. fn: function (){
  2656. var self=this,$self=this;
  2657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2658. return $core.withContext(function($ctx1) {
  2659. //>>excludeEnd("ctx");
  2660. return $recv($recv($self._organization())._elements())._sorted();
  2661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2662. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  2663. //>>excludeEnd("ctx");
  2664. },
  2665. //>>excludeStart("ide", pragmas.excludeIdeData);
  2666. args: [],
  2667. source: "protocols\x0a\x09^ self organization elements sorted",
  2668. referencedClasses: [],
  2669. //>>excludeEnd("ide");
  2670. messageSends: ["sorted", "elements", "organization"]
  2671. }),
  2672. $globals.TBehaviorProvider);
  2673. $core.addMethod(
  2674. $core.method({
  2675. selector: "protocolsDo:",
  2676. protocol: "enumerating",
  2677. fn: function (aBlock){
  2678. var self=this,$self=this;
  2679. var methodsByProtocol;
  2680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2681. return $core.withContext(function($ctx1) {
  2682. //>>excludeEnd("ctx");
  2683. methodsByProtocol=$recv($globals.HashedCollection)._new();
  2684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2685. $ctx1.sendIdx["new"]=1;
  2686. //>>excludeEnd("ctx");
  2687. $recv($self._methodDictionary())._valuesDo_((function(m){
  2688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2689. return $core.withContext(function($ctx2) {
  2690. //>>excludeEnd("ctx");
  2691. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  2692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2693. return $core.withContext(function($ctx3) {
  2694. //>>excludeEnd("ctx");
  2695. return $recv($globals.Array)._new();
  2696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2697. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  2698. //>>excludeEnd("ctx");
  2699. })))._add_(m);
  2700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2701. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  2702. //>>excludeEnd("ctx");
  2703. }));
  2704. $recv($self._protocols())._do_((function(protocol){
  2705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2706. return $core.withContext(function($ctx2) {
  2707. //>>excludeEnd("ctx");
  2708. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  2709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2710. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  2711. //>>excludeEnd("ctx");
  2712. }));
  2713. return self;
  2714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2715. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  2716. //>>excludeEnd("ctx");
  2717. },
  2718. //>>excludeStart("ide", pragmas.excludeIdeData);
  2719. args: ["aBlock"],
  2720. 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) ]",
  2721. referencedClasses: ["HashedCollection", "Array"],
  2722. //>>excludeEnd("ide");
  2723. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  2724. }),
  2725. $globals.TBehaviorProvider);
  2726. $core.addMethod(
  2727. $core.method({
  2728. selector: "recompile",
  2729. protocol: "compiling",
  2730. fn: function (){
  2731. var self=this,$self=this;
  2732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2733. return $core.withContext(function($ctx1) {
  2734. //>>excludeEnd("ctx");
  2735. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  2736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2737. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  2738. //>>excludeEnd("ctx");
  2739. },
  2740. //>>excludeStart("ide", pragmas.excludeIdeData);
  2741. args: [],
  2742. source: "recompile\x0a\x09^ Compiler new recompile: self",
  2743. referencedClasses: ["Compiler"],
  2744. //>>excludeEnd("ide");
  2745. messageSends: ["recompile:", "new"]
  2746. }),
  2747. $globals.TBehaviorProvider);
  2748. $core.addMethod(
  2749. $core.method({
  2750. selector: "removeCompiledMethod:",
  2751. protocol: "compiling",
  2752. fn: function (aMethod){
  2753. var self=this,$self=this;
  2754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2755. return $core.withContext(function($ctx1) {
  2756. //>>excludeEnd("ctx");
  2757. var $1,$3,$2;
  2758. $self._basicRemoveCompiledMethod_(aMethod);
  2759. $self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  2760. $1=$recv($globals.SystemAnnouncer)._current();
  2761. $3=$recv($globals.MethodRemoved)._new();
  2762. $recv($3)._method_(aMethod);
  2763. $2=$recv($3)._yourself();
  2764. $recv($1)._announce_($2);
  2765. return self;
  2766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2767. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  2768. //>>excludeEnd("ctx");
  2769. },
  2770. //>>excludeStart("ide", pragmas.excludeIdeData);
  2771. args: ["aMethod"],
  2772. 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)",
  2773. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  2774. //>>excludeEnd("ide");
  2775. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  2776. }),
  2777. $globals.TBehaviorProvider);
  2778. $core.addMethod(
  2779. $core.method({
  2780. selector: "removeProtocolIfEmpty:",
  2781. protocol: "accessing",
  2782. fn: function (aString){
  2783. var self=this,$self=this;
  2784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2785. return $core.withContext(function($ctx1) {
  2786. //>>excludeEnd("ctx");
  2787. $recv($self._methods())._detect_ifNone_((function(each){
  2788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2789. return $core.withContext(function($ctx2) {
  2790. //>>excludeEnd("ctx");
  2791. return $recv($recv(each)._protocol()).__eq(aString);
  2792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2793. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2794. //>>excludeEnd("ctx");
  2795. }),(function(){
  2796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2797. return $core.withContext(function($ctx2) {
  2798. //>>excludeEnd("ctx");
  2799. return $recv($self._organization())._removeElement_(aString);
  2800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2802. //>>excludeEnd("ctx");
  2803. }));
  2804. return self;
  2805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2806. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  2807. //>>excludeEnd("ctx");
  2808. },
  2809. //>>excludeStart("ide", pragmas.excludeIdeData);
  2810. args: ["aString"],
  2811. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  2812. referencedClasses: [],
  2813. //>>excludeEnd("ide");
  2814. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  2815. }),
  2816. $globals.TBehaviorProvider);
  2817. $core.addMethod(
  2818. $core.method({
  2819. selector: "selectors",
  2820. protocol: "accessing",
  2821. fn: function (){
  2822. var self=this,$self=this;
  2823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2824. return $core.withContext(function($ctx1) {
  2825. //>>excludeEnd("ctx");
  2826. return $recv($self._methodDictionary())._keys();
  2827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2828. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  2829. //>>excludeEnd("ctx");
  2830. },
  2831. //>>excludeStart("ide", pragmas.excludeIdeData);
  2832. args: [],
  2833. source: "selectors\x0a\x09^ self methodDictionary keys",
  2834. referencedClasses: [],
  2835. //>>excludeEnd("ide");
  2836. messageSends: ["keys", "methodDictionary"]
  2837. }),
  2838. $globals.TBehaviorProvider);
  2839. $core.addMethod(
  2840. $core.method({
  2841. selector: "setTraitComposition:",
  2842. protocol: "compiling",
  2843. fn: function (aTraitComposition){
  2844. var self=this,$self=this;
  2845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2846. return $core.withContext(function($ctx1) {
  2847. //>>excludeEnd("ctx");
  2848. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  2849. return self;
  2850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2851. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  2852. //>>excludeEnd("ctx");
  2853. },
  2854. //>>excludeStart("ide", pragmas.excludeIdeData);
  2855. args: ["aTraitComposition"],
  2856. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  2857. referencedClasses: [],
  2858. //>>excludeEnd("ide");
  2859. messageSends: []
  2860. }),
  2861. $globals.TBehaviorProvider);
  2862. $core.addMethod(
  2863. $core.method({
  2864. selector: "traitComposition",
  2865. protocol: "accessing",
  2866. fn: function (){
  2867. var self=this,$self=this;
  2868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2869. return $core.withContext(function($ctx1) {
  2870. //>>excludeEnd("ctx");
  2871. return $recv($self._basicAt_("traitComposition"))._collect_((function(each){
  2872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2873. return $core.withContext(function($ctx2) {
  2874. //>>excludeEnd("ctx");
  2875. return $recv($globals.TraitTransformation)._fromJSON_(each);
  2876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2877. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2878. //>>excludeEnd("ctx");
  2879. }));
  2880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2881. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  2882. //>>excludeEnd("ctx");
  2883. },
  2884. //>>excludeStart("ide", pragmas.excludeIdeData);
  2885. args: [],
  2886. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition') collect: [ :each | TraitTransformation fromJSON: each ]",
  2887. referencedClasses: ["TraitTransformation"],
  2888. //>>excludeEnd("ide");
  2889. messageSends: ["collect:", "basicAt:", "fromJSON:"]
  2890. }),
  2891. $globals.TBehaviorProvider);
  2892. $core.addMethod(
  2893. $core.method({
  2894. selector: "traitCompositionDefinition",
  2895. protocol: "accessing",
  2896. fn: function (){
  2897. var self=this,$self=this;
  2898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2899. return $core.withContext(function($ctx1) {
  2900. //>>excludeEnd("ctx");
  2901. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  2902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2903. return $core.withContext(function($ctx2) {
  2904. //>>excludeEnd("ctx");
  2905. return $recv($globals.String)._streamContents_((function(str){
  2906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2907. return $core.withContext(function($ctx3) {
  2908. //>>excludeEnd("ctx");
  2909. $recv(str)._write_("{");
  2910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2911. $ctx3.sendIdx["write:"]=1;
  2912. //>>excludeEnd("ctx");
  2913. $recv(traitComposition)._do_separatedBy_((function(each){
  2914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2915. return $core.withContext(function($ctx4) {
  2916. //>>excludeEnd("ctx");
  2917. return $recv(str)._write_($recv(each)._definition());
  2918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2919. $ctx4.sendIdx["write:"]=2;
  2920. //>>excludeEnd("ctx");
  2921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2922. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  2923. //>>excludeEnd("ctx");
  2924. }),(function(){
  2925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2926. return $core.withContext(function($ctx4) {
  2927. //>>excludeEnd("ctx");
  2928. return $recv(str)._write_(". ");
  2929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2930. $ctx4.sendIdx["write:"]=3;
  2931. //>>excludeEnd("ctx");
  2932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2933. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  2934. //>>excludeEnd("ctx");
  2935. }));
  2936. return $recv(str)._write_("}");
  2937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2938. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  2939. //>>excludeEnd("ctx");
  2940. }));
  2941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2942. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  2943. //>>excludeEnd("ctx");
  2944. }));
  2945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2946. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  2947. //>>excludeEnd("ctx");
  2948. },
  2949. //>>excludeStart("ide", pragmas.excludeIdeData);
  2950. args: [],
  2951. source: "traitCompositionDefinition\x0a\x09^ self traitComposition ifNotEmpty: [ :traitComposition |\x0a\x09\x09String streamContents: [ :str |\x0a\x09\x09\x09str write: '{'.\x0a\x09\x09\x09traitComposition\x0a\x09\x09\x09\x09do: [ :each | str write: each definition ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ] ]",
  2952. referencedClasses: ["String"],
  2953. //>>excludeEnd("ide");
  2954. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  2955. }),
  2956. $globals.TBehaviorProvider);
  2957. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  2958. //>>excludeStart("ide", pragmas.excludeIdeData);
  2959. $globals.TMasterBehavior.comment="I am the behavior on the instance-side of the browser.\x0a\x0aI define things like package, category, name, comment etc.\x0aas opposed to derived behaviors (metaclass, class trait, ...)\x0athat relate to me.";
  2960. //>>excludeEnd("ide");
  2961. $core.addMethod(
  2962. $core.method({
  2963. selector: "asJavaScriptSource",
  2964. protocol: "converting",
  2965. fn: function (){
  2966. var self=this,$self=this;
  2967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2968. return $core.withContext(function($ctx1) {
  2969. //>>excludeEnd("ctx");
  2970. return "$globals.".__comma($self._name());
  2971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2972. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  2973. //>>excludeEnd("ctx");
  2974. },
  2975. //>>excludeStart("ide", pragmas.excludeIdeData);
  2976. args: [],
  2977. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  2978. referencedClasses: [],
  2979. //>>excludeEnd("ide");
  2980. messageSends: [",", "name"]
  2981. }),
  2982. $globals.TMasterBehavior);
  2983. $core.addMethod(
  2984. $core.method({
  2985. selector: "browse",
  2986. protocol: "browsing",
  2987. fn: function (){
  2988. var self=this,$self=this;
  2989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2990. return $core.withContext(function($ctx1) {
  2991. //>>excludeEnd("ctx");
  2992. $recv($globals.Finder)._findClass_(self);
  2993. return self;
  2994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2995. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  2996. //>>excludeEnd("ctx");
  2997. },
  2998. //>>excludeStart("ide", pragmas.excludeIdeData);
  2999. args: [],
  3000. source: "browse\x0a\x09Finder findClass: self",
  3001. referencedClasses: ["Finder"],
  3002. //>>excludeEnd("ide");
  3003. messageSends: ["findClass:"]
  3004. }),
  3005. $globals.TMasterBehavior);
  3006. $core.addMethod(
  3007. $core.method({
  3008. selector: "category",
  3009. protocol: "accessing",
  3010. fn: function (){
  3011. var self=this,$self=this;
  3012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3013. return $core.withContext(function($ctx1) {
  3014. //>>excludeEnd("ctx");
  3015. var $1,$receiver;
  3016. $1=$self._package();
  3017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3018. $ctx1.sendIdx["package"]=1;
  3019. //>>excludeEnd("ctx");
  3020. if(($receiver = $1) == null || $receiver.a$nil){
  3021. return "Unclassified";
  3022. } else {
  3023. return $recv($self._package())._name();
  3024. }
  3025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3026. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  3027. //>>excludeEnd("ctx");
  3028. },
  3029. //>>excludeStart("ide", pragmas.excludeIdeData);
  3030. args: [],
  3031. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  3032. referencedClasses: [],
  3033. //>>excludeEnd("ide");
  3034. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  3035. }),
  3036. $globals.TMasterBehavior);
  3037. $core.addMethod(
  3038. $core.method({
  3039. selector: "classTag",
  3040. protocol: "accessing",
  3041. fn: function (){
  3042. var self=this,$self=this;
  3043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3044. return $core.withContext(function($ctx1) {
  3045. //>>excludeEnd("ctx");
  3046. return $self._subclassResponsibility();
  3047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3048. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  3049. //>>excludeEnd("ctx");
  3050. },
  3051. //>>excludeStart("ide", pragmas.excludeIdeData);
  3052. args: [],
  3053. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  3054. referencedClasses: [],
  3055. //>>excludeEnd("ide");
  3056. messageSends: ["subclassResponsibility"]
  3057. }),
  3058. $globals.TMasterBehavior);
  3059. $core.addMethod(
  3060. $core.method({
  3061. selector: "comment",
  3062. protocol: "accessing",
  3063. fn: function (){
  3064. var self=this,$self=this;
  3065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3066. return $core.withContext(function($ctx1) {
  3067. //>>excludeEnd("ctx");
  3068. var $1,$receiver;
  3069. $1=$self._basicAt_("comment");
  3070. if(($receiver = $1) == null || $receiver.a$nil){
  3071. return "";
  3072. } else {
  3073. return $1;
  3074. }
  3075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3076. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  3077. //>>excludeEnd("ctx");
  3078. },
  3079. //>>excludeStart("ide", pragmas.excludeIdeData);
  3080. args: [],
  3081. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  3082. referencedClasses: [],
  3083. //>>excludeEnd("ide");
  3084. messageSends: ["ifNil:", "basicAt:"]
  3085. }),
  3086. $globals.TMasterBehavior);
  3087. $core.addMethod(
  3088. $core.method({
  3089. selector: "comment:",
  3090. protocol: "accessing",
  3091. fn: function (aString){
  3092. var self=this,$self=this;
  3093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3094. return $core.withContext(function($ctx1) {
  3095. //>>excludeEnd("ctx");
  3096. var $1,$3,$2;
  3097. $self._basicAt_put_("comment",aString);
  3098. $1=$recv($globals.SystemAnnouncer)._current();
  3099. $3=$recv($globals.ClassCommentChanged)._new();
  3100. $recv($3)._theClass_(self);
  3101. $2=$recv($3)._yourself();
  3102. $recv($1)._announce_($2);
  3103. return self;
  3104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3105. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  3106. //>>excludeEnd("ctx");
  3107. },
  3108. //>>excludeStart("ide", pragmas.excludeIdeData);
  3109. args: ["aString"],
  3110. 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)",
  3111. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  3112. //>>excludeEnd("ide");
  3113. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  3114. }),
  3115. $globals.TMasterBehavior);
  3116. $core.addMethod(
  3117. $core.method({
  3118. selector: "name",
  3119. protocol: "accessing",
  3120. fn: function (){
  3121. var self=this,$self=this;
  3122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3123. return $core.withContext(function($ctx1) {
  3124. //>>excludeEnd("ctx");
  3125. return self.className;
  3126. return self;
  3127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3128. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  3129. //>>excludeEnd("ctx");
  3130. },
  3131. //>>excludeStart("ide", pragmas.excludeIdeData);
  3132. args: [],
  3133. source: "name\x0a\x09<inlineJS: 'return self.className'>",
  3134. referencedClasses: [],
  3135. //>>excludeEnd("ide");
  3136. messageSends: []
  3137. }),
  3138. $globals.TMasterBehavior);
  3139. $core.addMethod(
  3140. $core.method({
  3141. selector: "package",
  3142. protocol: "accessing",
  3143. fn: function (){
  3144. var self=this,$self=this;
  3145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3146. return $core.withContext(function($ctx1) {
  3147. //>>excludeEnd("ctx");
  3148. return $self._basicAt_("pkg");
  3149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3150. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.TMasterBehavior)});
  3151. //>>excludeEnd("ctx");
  3152. },
  3153. //>>excludeStart("ide", pragmas.excludeIdeData);
  3154. args: [],
  3155. source: "package\x0a\x09^ self basicAt: 'pkg'",
  3156. referencedClasses: [],
  3157. //>>excludeEnd("ide");
  3158. messageSends: ["basicAt:"]
  3159. }),
  3160. $globals.TMasterBehavior);
  3161. $core.addMethod(
  3162. $core.method({
  3163. selector: "package:",
  3164. protocol: "accessing",
  3165. fn: function (aPackage){
  3166. var self=this,$self=this;
  3167. var oldPackage;
  3168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3169. return $core.withContext(function($ctx1) {
  3170. //>>excludeEnd("ctx");
  3171. var $2,$1,$3,$4,$6,$5;
  3172. $2=$self._package();
  3173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3174. $ctx1.sendIdx["package"]=1;
  3175. //>>excludeEnd("ctx");
  3176. $1=$recv($2).__eq(aPackage);
  3177. if($core.assert($1)){
  3178. return self;
  3179. }
  3180. oldPackage=$self._package();
  3181. $self._basicAt_put_("pkg",aPackage);
  3182. $3=$recv(oldPackage)._organization();
  3183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3184. $ctx1.sendIdx["organization"]=1;
  3185. //>>excludeEnd("ctx");
  3186. $recv($3)._removeElement_(self);
  3187. $recv($recv(aPackage)._organization())._addElement_(self);
  3188. $4=$recv($globals.SystemAnnouncer)._current();
  3189. $6=$recv($globals.ClassMoved)._new();
  3190. $recv($6)._theClass_(self);
  3191. $recv($6)._oldPackage_(oldPackage);
  3192. $5=$recv($6)._yourself();
  3193. $recv($4)._announce_($5);
  3194. return self;
  3195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3196. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  3197. //>>excludeEnd("ctx");
  3198. },
  3199. //>>excludeStart("ide", pragmas.excludeIdeData);
  3200. args: ["aPackage"],
  3201. 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)",
  3202. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  3203. //>>excludeEnd("ide");
  3204. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  3205. }),
  3206. $globals.TMasterBehavior);
  3207. $core.addMethod(
  3208. $core.method({
  3209. selector: "theNonMetaClass",
  3210. protocol: "accessing",
  3211. fn: function (){
  3212. var self=this,$self=this;
  3213. return self;
  3214. },
  3215. //>>excludeStart("ide", pragmas.excludeIdeData);
  3216. args: [],
  3217. source: "theNonMetaClass\x0a\x09^ self",
  3218. referencedClasses: [],
  3219. //>>excludeEnd("ide");
  3220. messageSends: []
  3221. }),
  3222. $globals.TMasterBehavior);
  3223. $core.addClass("Trait", $globals.Object, [], "Kernel-Classes");
  3224. $core.addMethod(
  3225. $core.method({
  3226. selector: "-",
  3227. protocol: "composition",
  3228. fn: function (anArray){
  3229. var self=this,$self=this;
  3230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3231. return $core.withContext(function($ctx1) {
  3232. //>>excludeEnd("ctx");
  3233. return $recv($self._asTraitTransformation()).__minus(anArray);
  3234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3235. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  3236. //>>excludeEnd("ctx");
  3237. },
  3238. //>>excludeStart("ide", pragmas.excludeIdeData);
  3239. args: ["anArray"],
  3240. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  3241. referencedClasses: [],
  3242. //>>excludeEnd("ide");
  3243. messageSends: ["-", "asTraitTransformation"]
  3244. }),
  3245. $globals.Trait);
  3246. $core.addMethod(
  3247. $core.method({
  3248. selector: "@",
  3249. protocol: "composition",
  3250. fn: function (anArrayOfAssociations){
  3251. var self=this,$self=this;
  3252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3253. return $core.withContext(function($ctx1) {
  3254. //>>excludeEnd("ctx");
  3255. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  3256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3257. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  3258. //>>excludeEnd("ctx");
  3259. },
  3260. //>>excludeStart("ide", pragmas.excludeIdeData);
  3261. args: ["anArrayOfAssociations"],
  3262. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  3263. referencedClasses: [],
  3264. //>>excludeEnd("ide");
  3265. messageSends: ["@", "asTraitTransformation"]
  3266. }),
  3267. $globals.Trait);
  3268. $core.addMethod(
  3269. $core.method({
  3270. selector: "asTraitComposition",
  3271. protocol: "converting",
  3272. fn: function (){
  3273. var self=this,$self=this;
  3274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3275. return $core.withContext(function($ctx1) {
  3276. //>>excludeEnd("ctx");
  3277. return $recv($self._asTraitTransformation())._asTraitComposition();
  3278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3279. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  3280. //>>excludeEnd("ctx");
  3281. },
  3282. //>>excludeStart("ide", pragmas.excludeIdeData);
  3283. args: [],
  3284. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  3285. referencedClasses: [],
  3286. //>>excludeEnd("ide");
  3287. messageSends: ["asTraitComposition", "asTraitTransformation"]
  3288. }),
  3289. $globals.Trait);
  3290. $core.addMethod(
  3291. $core.method({
  3292. selector: "asTraitTransformation",
  3293. protocol: "converting",
  3294. fn: function (){
  3295. var self=this,$self=this;
  3296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3297. return $core.withContext(function($ctx1) {
  3298. //>>excludeEnd("ctx");
  3299. return $recv($globals.TraitTransformation)._on_(self);
  3300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3301. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  3302. //>>excludeEnd("ctx");
  3303. },
  3304. //>>excludeStart("ide", pragmas.excludeIdeData);
  3305. args: [],
  3306. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  3307. referencedClasses: ["TraitTransformation"],
  3308. //>>excludeEnd("ide");
  3309. messageSends: ["on:"]
  3310. }),
  3311. $globals.Trait);
  3312. $core.addMethod(
  3313. $core.method({
  3314. selector: "classTag",
  3315. protocol: "accessing",
  3316. fn: function (){
  3317. var self=this,$self=this;
  3318. return "trait";
  3319. },
  3320. //>>excludeStart("ide", pragmas.excludeIdeData);
  3321. args: [],
  3322. source: "classTag\x0a\x09^ 'trait'",
  3323. referencedClasses: [],
  3324. //>>excludeEnd("ide");
  3325. messageSends: []
  3326. }),
  3327. $globals.Trait);
  3328. $core.addMethod(
  3329. $core.method({
  3330. selector: "definition",
  3331. protocol: "accessing",
  3332. fn: function (){
  3333. var self=this,$self=this;
  3334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3335. return $core.withContext(function($ctx1) {
  3336. //>>excludeEnd("ctx");
  3337. var $1;
  3338. return $recv($globals.String)._streamContents_((function(stream){
  3339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3340. return $core.withContext(function($ctx2) {
  3341. //>>excludeEnd("ctx");
  3342. $recv(stream)._write_("Trait named: ");
  3343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3344. $ctx2.sendIdx["write:"]=1;
  3345. //>>excludeEnd("ctx");
  3346. $recv(stream)._printSymbol_($self._name());
  3347. $recv(stream)._lf();
  3348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3349. $ctx2.sendIdx["lf"]=1;
  3350. //>>excludeEnd("ctx");
  3351. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  3352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3353. return $core.withContext(function($ctx3) {
  3354. //>>excludeEnd("ctx");
  3355. $1=$recv($globals.String)._tab();
  3356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3357. $ctx3.sendIdx["tab"]=1;
  3358. //>>excludeEnd("ctx");
  3359. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  3360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3361. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  3362. //>>excludeEnd("ctx");
  3363. })));
  3364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3365. $ctx2.sendIdx["write:"]=2;
  3366. //>>excludeEnd("ctx");
  3367. $recv(stream)._tab();
  3368. $recv(stream)._write_("package: ");
  3369. return $recv(stream)._print_($self._category());
  3370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3371. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  3372. //>>excludeEnd("ctx");
  3373. }));
  3374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3375. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  3376. //>>excludeEnd("ctx");
  3377. },
  3378. //>>excludeStart("ide", pragmas.excludeIdeData);
  3379. args: [],
  3380. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Trait named: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  3381. referencedClasses: ["String"],
  3382. //>>excludeEnd("ide");
  3383. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  3384. }),
  3385. $globals.Trait);
  3386. $core.addMethod(
  3387. $core.method({
  3388. selector: "theMetaClass",
  3389. protocol: "accessing",
  3390. fn: function (){
  3391. var self=this,$self=this;
  3392. return nil;
  3393. },
  3394. //>>excludeStart("ide", pragmas.excludeIdeData);
  3395. args: [],
  3396. source: "theMetaClass\x0a\x09^ nil",
  3397. referencedClasses: [],
  3398. //>>excludeEnd("ide");
  3399. messageSends: []
  3400. }),
  3401. $globals.Trait);
  3402. $core.addMethod(
  3403. $core.method({
  3404. selector: "traitUsers",
  3405. protocol: "accessing",
  3406. fn: function (){
  3407. var self=this,$self=this;
  3408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3409. return $core.withContext(function($ctx1) {
  3410. //>>excludeEnd("ctx");
  3411. return $recv($self._basicAt_("traitUsers"))._copy();
  3412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3413. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  3414. //>>excludeEnd("ctx");
  3415. },
  3416. //>>excludeStart("ide", pragmas.excludeIdeData);
  3417. args: [],
  3418. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  3419. referencedClasses: [],
  3420. //>>excludeEnd("ide");
  3421. messageSends: ["copy", "basicAt:"]
  3422. }),
  3423. $globals.Trait);
  3424. $core.addMethod(
  3425. $core.method({
  3426. selector: "named:package:",
  3427. protocol: "instance creation",
  3428. fn: function (aString,anotherString){
  3429. var self=this,$self=this;
  3430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3431. return $core.withContext(function($ctx1) {
  3432. //>>excludeEnd("ctx");
  3433. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  3434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3435. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  3436. //>>excludeEnd("ctx");
  3437. },
  3438. //>>excludeStart("ide", pragmas.excludeIdeData);
  3439. args: ["aString", "anotherString"],
  3440. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  3441. referencedClasses: ["ClassBuilder"],
  3442. //>>excludeEnd("ide");
  3443. messageSends: ["addTraitNamed:package:", "new"]
  3444. }),
  3445. $globals.Trait.a$cls);
  3446. $core.addMethod(
  3447. $core.method({
  3448. selector: "named:uses:package:",
  3449. protocol: "instance creation",
  3450. fn: function (aString,aTraitCompositionDescription,anotherString){
  3451. var self=this,$self=this;
  3452. var trait;
  3453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3454. return $core.withContext(function($ctx1) {
  3455. //>>excludeEnd("ctx");
  3456. trait=$self._named_package_(aString,anotherString);
  3457. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  3458. return trait;
  3459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3460. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  3461. //>>excludeEnd("ctx");
  3462. },
  3463. //>>excludeStart("ide", pragmas.excludeIdeData);
  3464. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  3465. source: "named: aString uses: aTraitCompositionDescription package: anotherString\x0a\x09| trait |\x0a\x09trait := self named: aString package: anotherString.\x0a\x09trait setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ trait",
  3466. referencedClasses: [],
  3467. //>>excludeEnd("ide");
  3468. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  3469. }),
  3470. $globals.Trait.a$cls);
  3471. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  3472. //>>excludeStart("ide", pragmas.excludeIdeData);
  3473. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  3474. //>>excludeEnd("ide");
  3475. $core.addMethod(
  3476. $core.method({
  3477. selector: "-",
  3478. protocol: "composition",
  3479. fn: function (anArray){
  3480. var self=this,$self=this;
  3481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3482. return $core.withContext(function($ctx1) {
  3483. //>>excludeEnd("ctx");
  3484. var $1;
  3485. $1=$self._copy();
  3486. $recv($1)._addExclusions_(anArray);
  3487. return $recv($1)._yourself();
  3488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3489. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  3490. //>>excludeEnd("ctx");
  3491. },
  3492. //>>excludeStart("ide", pragmas.excludeIdeData);
  3493. args: ["anArray"],
  3494. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  3495. referencedClasses: [],
  3496. //>>excludeEnd("ide");
  3497. messageSends: ["addExclusions:", "copy", "yourself"]
  3498. }),
  3499. $globals.TraitTransformation);
  3500. $core.addMethod(
  3501. $core.method({
  3502. selector: "@",
  3503. protocol: "composition",
  3504. fn: function (anArrayOfAssociations){
  3505. var self=this,$self=this;
  3506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3507. return $core.withContext(function($ctx1) {
  3508. //>>excludeEnd("ctx");
  3509. var $1;
  3510. $1=$self._copy();
  3511. $recv($1)._addAliases_(anArrayOfAssociations);
  3512. return $recv($1)._yourself();
  3513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3514. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  3515. //>>excludeEnd("ctx");
  3516. },
  3517. //>>excludeStart("ide", pragmas.excludeIdeData);
  3518. args: ["anArrayOfAssociations"],
  3519. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  3520. referencedClasses: [],
  3521. //>>excludeEnd("ide");
  3522. messageSends: ["addAliases:", "copy", "yourself"]
  3523. }),
  3524. $globals.TraitTransformation);
  3525. $core.addMethod(
  3526. $core.method({
  3527. selector: "addAliases:",
  3528. protocol: "accessing",
  3529. fn: function (anArrayOfAssociations){
  3530. var self=this,$self=this;
  3531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3532. return $core.withContext(function($ctx1) {
  3533. //>>excludeEnd("ctx");
  3534. $recv(anArrayOfAssociations)._do_((function(each){
  3535. var key;
  3536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3537. return $core.withContext(function($ctx2) {
  3538. //>>excludeEnd("ctx");
  3539. key=$recv(each)._key();
  3540. key;
  3541. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  3542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3543. return $core.withContext(function($ctx3) {
  3544. //>>excludeEnd("ctx");
  3545. return $self._error_("Cannot use same alias name twice.");
  3546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3547. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  3548. //>>excludeEnd("ctx");
  3549. }),(function(){
  3550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3551. return $core.withContext(function($ctx3) {
  3552. //>>excludeEnd("ctx");
  3553. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  3554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3555. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  3556. //>>excludeEnd("ctx");
  3557. }));
  3558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3559. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  3560. //>>excludeEnd("ctx");
  3561. }));
  3562. return anArrayOfAssociations;
  3563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3564. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  3565. //>>excludeEnd("ctx");
  3566. },
  3567. //>>excludeStart("ide", pragmas.excludeIdeData);
  3568. args: ["anArrayOfAssociations"],
  3569. source: "addAliases: anArrayOfAssociations\x0a\x09anArrayOfAssociations do: [ :each |\x0a\x09\x09| key |\x0a\x09\x09key := each key.\x0a\x09\x09aliases at: key\x0a\x09\x09\x09ifPresent: [ self error: 'Cannot use same alias name twice.' ]\x0a\x09\x09\x09ifAbsent: [ aliases at: key put: each value ] ].\x0a\x09^ anArrayOfAssociations",
  3570. referencedClasses: [],
  3571. //>>excludeEnd("ide");
  3572. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  3573. }),
  3574. $globals.TraitTransformation);
  3575. $core.addMethod(
  3576. $core.method({
  3577. selector: "addExclusions:",
  3578. protocol: "accessing",
  3579. fn: function (anArray){
  3580. var self=this,$self=this;
  3581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3582. return $core.withContext(function($ctx1) {
  3583. //>>excludeEnd("ctx");
  3584. $recv($self["@exclusions"])._addAll_(anArray);
  3585. return anArray;
  3586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3587. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  3588. //>>excludeEnd("ctx");
  3589. },
  3590. //>>excludeStart("ide", pragmas.excludeIdeData);
  3591. args: ["anArray"],
  3592. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  3593. referencedClasses: [],
  3594. //>>excludeEnd("ide");
  3595. messageSends: ["addAll:"]
  3596. }),
  3597. $globals.TraitTransformation);
  3598. $core.addMethod(
  3599. $core.method({
  3600. selector: "aliases",
  3601. protocol: "accessing",
  3602. fn: function (){
  3603. var self=this,$self=this;
  3604. return $self["@aliases"];
  3605. },
  3606. //>>excludeStart("ide", pragmas.excludeIdeData);
  3607. args: [],
  3608. source: "aliases\x0a\x09^ aliases",
  3609. referencedClasses: [],
  3610. //>>excludeEnd("ide");
  3611. messageSends: []
  3612. }),
  3613. $globals.TraitTransformation);
  3614. $core.addMethod(
  3615. $core.method({
  3616. selector: "asJavaScriptObject",
  3617. protocol: "converting",
  3618. fn: function (){
  3619. var self=this,$self=this;
  3620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3621. return $core.withContext(function($ctx1) {
  3622. //>>excludeEnd("ctx");
  3623. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  3624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3625. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  3626. //>>excludeEnd("ctx");
  3627. },
  3628. //>>excludeStart("ide", pragmas.excludeIdeData);
  3629. args: [],
  3630. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  3631. referencedClasses: [],
  3632. //>>excludeEnd("ide");
  3633. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  3634. }),
  3635. $globals.TraitTransformation);
  3636. $core.addMethod(
  3637. $core.method({
  3638. selector: "asJavaScriptSource",
  3639. protocol: "converting",
  3640. fn: function (){
  3641. var self=this,$self=this;
  3642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3643. return $core.withContext(function($ctx1) {
  3644. //>>excludeEnd("ctx");
  3645. var $2,$3,$1;
  3646. return $recv($globals.String)._streamContents_((function(str){
  3647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3648. return $core.withContext(function($ctx2) {
  3649. //>>excludeEnd("ctx");
  3650. $2=$recv($self._trait())._asJavaScriptSource();
  3651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3652. $ctx2.sendIdx["asJavaScriptSource"]=1;
  3653. //>>excludeEnd("ctx");
  3654. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  3655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3656. return $core.withContext(function($ctx3) {
  3657. //>>excludeEnd("ctx");
  3658. return [", aliases: ",$recv(al)._asJSONString()];
  3659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3660. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  3661. //>>excludeEnd("ctx");
  3662. }));
  3663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3664. $ctx2.sendIdx["ifNotEmpty:"]=1;
  3665. //>>excludeEnd("ctx");
  3666. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  3667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3668. return $core.withContext(function($ctx3) {
  3669. //>>excludeEnd("ctx");
  3670. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  3671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3672. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  3673. //>>excludeEnd("ctx");
  3674. })),"}"];
  3675. return $recv(str)._write_($1);
  3676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3677. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3678. //>>excludeEnd("ctx");
  3679. }));
  3680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3681. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  3682. //>>excludeEnd("ctx");
  3683. },
  3684. //>>excludeStart("ide", pragmas.excludeIdeData);
  3685. args: [],
  3686. source: "asJavaScriptSource\x0a\x09^ String streamContents: [ :str | str write: {\x0a\x09\x09'{trait: '. self trait asJavaScriptSource.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09{', aliases: '. al asJSONString} ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09{', exclusions: '. ex asArray sorted asJavaScriptSource} ].\x0a\x09\x09'}' } ]",
  3687. referencedClasses: ["String"],
  3688. //>>excludeEnd("ide");
  3689. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  3690. }),
  3691. $globals.TraitTransformation);
  3692. $core.addMethod(
  3693. $core.method({
  3694. selector: "asTraitComposition",
  3695. protocol: "converting",
  3696. fn: function (){
  3697. var self=this,$self=this;
  3698. return [self];
  3699. },
  3700. //>>excludeStart("ide", pragmas.excludeIdeData);
  3701. args: [],
  3702. source: "asTraitComposition\x0a\x09^ { self }",
  3703. referencedClasses: [],
  3704. //>>excludeEnd("ide");
  3705. messageSends: []
  3706. }),
  3707. $globals.TraitTransformation);
  3708. $core.addMethod(
  3709. $core.method({
  3710. selector: "asTraitTransformation",
  3711. protocol: "converting",
  3712. fn: function (){
  3713. var self=this,$self=this;
  3714. return self;
  3715. },
  3716. //>>excludeStart("ide", pragmas.excludeIdeData);
  3717. args: [],
  3718. source: "asTraitTransformation\x0a\x09^ self",
  3719. referencedClasses: [],
  3720. //>>excludeEnd("ide");
  3721. messageSends: []
  3722. }),
  3723. $globals.TraitTransformation);
  3724. $core.addMethod(
  3725. $core.method({
  3726. selector: "definition",
  3727. protocol: "accessing",
  3728. fn: function (){
  3729. var self=this,$self=this;
  3730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3731. return $core.withContext(function($ctx1) {
  3732. //>>excludeEnd("ctx");
  3733. return $recv($globals.String)._streamContents_((function(str){
  3734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3735. return $core.withContext(function($ctx2) {
  3736. //>>excludeEnd("ctx");
  3737. $recv(str)._print_($self._trait());
  3738. $recv($self._aliases())._ifNotEmpty_((function(al){
  3739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3740. return $core.withContext(function($ctx3) {
  3741. //>>excludeEnd("ctx");
  3742. $recv(str)._write_(" @ {");
  3743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3744. $ctx3.sendIdx["write:"]=1;
  3745. //>>excludeEnd("ctx");
  3746. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  3747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3748. return $core.withContext(function($ctx4) {
  3749. //>>excludeEnd("ctx");
  3750. $recv(str)._printSymbol_($recv(each)._key());
  3751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3752. $ctx4.sendIdx["printSymbol:"]=1;
  3753. //>>excludeEnd("ctx");
  3754. $recv(str)._write_(" -> ");
  3755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3756. $ctx4.sendIdx["write:"]=2;
  3757. //>>excludeEnd("ctx");
  3758. return $recv(str)._printSymbol_($recv(each)._value());
  3759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3760. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  3761. //>>excludeEnd("ctx");
  3762. }),(function(){
  3763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3764. return $core.withContext(function($ctx4) {
  3765. //>>excludeEnd("ctx");
  3766. return $recv(str)._write_(". ");
  3767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3768. $ctx4.sendIdx["write:"]=3;
  3769. //>>excludeEnd("ctx");
  3770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3771. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  3772. //>>excludeEnd("ctx");
  3773. }));
  3774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3775. $ctx3.sendIdx["do:separatedBy:"]=1;
  3776. //>>excludeEnd("ctx");
  3777. return $recv(str)._write_("}");
  3778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3779. $ctx3.sendIdx["write:"]=4;
  3780. //>>excludeEnd("ctx");
  3781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3782. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  3783. //>>excludeEnd("ctx");
  3784. }));
  3785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3786. $ctx2.sendIdx["ifNotEmpty:"]=1;
  3787. //>>excludeEnd("ctx");
  3788. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  3789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3790. return $core.withContext(function($ctx3) {
  3791. //>>excludeEnd("ctx");
  3792. $recv(str)._write_(" - #(");
  3793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3794. $ctx3.sendIdx["write:"]=5;
  3795. //>>excludeEnd("ctx");
  3796. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  3797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3798. return $core.withContext(function($ctx4) {
  3799. //>>excludeEnd("ctx");
  3800. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  3801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3802. $ctx4.sendIdx["write:"]=6;
  3803. //>>excludeEnd("ctx");
  3804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3805. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  3806. //>>excludeEnd("ctx");
  3807. }),(function(){
  3808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3809. return $core.withContext(function($ctx4) {
  3810. //>>excludeEnd("ctx");
  3811. return $recv(str)._space();
  3812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3813. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  3814. //>>excludeEnd("ctx");
  3815. }));
  3816. return $recv(str)._write_(")");
  3817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3818. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  3819. //>>excludeEnd("ctx");
  3820. }));
  3821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3822. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3823. //>>excludeEnd("ctx");
  3824. }));
  3825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3826. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  3827. //>>excludeEnd("ctx");
  3828. },
  3829. //>>excludeStart("ide", pragmas.excludeIdeData);
  3830. args: [],
  3831. source: "definition\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09str print: self trait.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09str write: ' @ {'.\x0a\x09\x09\x09al associations\x0a\x09\x09\x09\x09do: [ :each | str printSymbol: each key; write: ' -> '; printSymbol: each value ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09str write: ' - #('.\x0a\x09\x09\x09ex asArray sorted \x0a\x09\x09\x09\x09do: [ :each | str write: each symbolPrintString allButFirst ]\x0a\x09\x09\x09\x09separatedBy: [ str space ].\x0a\x09\x09\x09str write: ')' ] ]",
  3832. referencedClasses: ["String"],
  3833. //>>excludeEnd("ide");
  3834. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  3835. }),
  3836. $globals.TraitTransformation);
  3837. $core.addMethod(
  3838. $core.method({
  3839. selector: "exclusions",
  3840. protocol: "accessing",
  3841. fn: function (){
  3842. var self=this,$self=this;
  3843. return $self["@exclusions"];
  3844. },
  3845. //>>excludeStart("ide", pragmas.excludeIdeData);
  3846. args: [],
  3847. source: "exclusions\x0a\x09^ exclusions",
  3848. referencedClasses: [],
  3849. //>>excludeEnd("ide");
  3850. messageSends: []
  3851. }),
  3852. $globals.TraitTransformation);
  3853. $core.addMethod(
  3854. $core.method({
  3855. selector: "initialize",
  3856. protocol: "initialization",
  3857. fn: function (){
  3858. var self=this,$self=this;
  3859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3860. return $core.withContext(function($ctx1) {
  3861. //>>excludeEnd("ctx");
  3862. (
  3863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3864. $ctx1.supercall = true,
  3865. //>>excludeEnd("ctx");
  3866. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  3867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3868. $ctx1.supercall = false;
  3869. //>>excludeEnd("ctx");;
  3870. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  3871. $self["@exclusions"]=$recv($globals.Set)._new();
  3872. $self["@trait"]=nil;
  3873. return self;
  3874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3875. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  3876. //>>excludeEnd("ctx");
  3877. },
  3878. //>>excludeStart("ide", pragmas.excludeIdeData);
  3879. args: [],
  3880. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  3881. referencedClasses: ["Set"],
  3882. //>>excludeEnd("ide");
  3883. messageSends: ["initialize", "new"]
  3884. }),
  3885. $globals.TraitTransformation);
  3886. $core.addMethod(
  3887. $core.method({
  3888. selector: "postCopy",
  3889. protocol: "copying",
  3890. fn: function (){
  3891. var self=this,$self=this;
  3892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3893. return $core.withContext(function($ctx1) {
  3894. //>>excludeEnd("ctx");
  3895. $self["@aliases"]=$recv($self["@aliases"])._copy();
  3896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3897. $ctx1.sendIdx["copy"]=1;
  3898. //>>excludeEnd("ctx");
  3899. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  3900. return self;
  3901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3902. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  3903. //>>excludeEnd("ctx");
  3904. },
  3905. //>>excludeStart("ide", pragmas.excludeIdeData);
  3906. args: [],
  3907. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  3908. referencedClasses: [],
  3909. //>>excludeEnd("ide");
  3910. messageSends: ["copy"]
  3911. }),
  3912. $globals.TraitTransformation);
  3913. $core.addMethod(
  3914. $core.method({
  3915. selector: "trait",
  3916. protocol: "accessing",
  3917. fn: function (){
  3918. var self=this,$self=this;
  3919. return $self["@trait"];
  3920. },
  3921. //>>excludeStart("ide", pragmas.excludeIdeData);
  3922. args: [],
  3923. source: "trait\x0a\x09^ trait",
  3924. referencedClasses: [],
  3925. //>>excludeEnd("ide");
  3926. messageSends: []
  3927. }),
  3928. $globals.TraitTransformation);
  3929. $core.addMethod(
  3930. $core.method({
  3931. selector: "trait:",
  3932. protocol: "accessing",
  3933. fn: function (anObject){
  3934. var self=this,$self=this;
  3935. $self["@trait"]=anObject;
  3936. return self;
  3937. },
  3938. //>>excludeStart("ide", pragmas.excludeIdeData);
  3939. args: ["anObject"],
  3940. source: "trait: anObject\x0a\x09trait := anObject",
  3941. referencedClasses: [],
  3942. //>>excludeEnd("ide");
  3943. messageSends: []
  3944. }),
  3945. $globals.TraitTransformation);
  3946. $core.addMethod(
  3947. $core.method({
  3948. selector: "fromJSON:",
  3949. protocol: "instance creation",
  3950. fn: function (aJSObject){
  3951. var self=this,$self=this;
  3952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3953. return $core.withContext(function($ctx1) {
  3954. //>>excludeEnd("ctx");
  3955. var $1,$4,$3,$2;
  3956. $1=(
  3957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3958. $ctx1.supercall = true,
  3959. //>>excludeEnd("ctx");
  3960. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  3961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3962. $ctx1.supercall = false;
  3963. //>>excludeEnd("ctx");;
  3964. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  3965. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  3966. return $globals.HashedCollection._newFromPairs_([]);
  3967. }));
  3968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3969. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3970. //>>excludeEnd("ctx");
  3971. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  3972. $2=$recv($3)._associations();
  3973. $recv($1)._addAliases_($2);
  3974. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  3975. return [];
  3976. })));
  3977. return $recv($1)._yourself();
  3978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3979. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  3980. //>>excludeEnd("ctx");
  3981. },
  3982. //>>excludeStart("ide", pragmas.excludeIdeData);
  3983. args: ["aJSObject"],
  3984. source: "fromJSON: aJSObject\x0a\x09^ super new\x0a\x09\x09trait: (aJSObject at: #trait);\x0a\x09\x09addAliases: (Smalltalk readJSObject: (aJSObject at: #aliases ifAbsent: [#{}])) associations;\x0a\x09\x09addExclusions: (aJSObject at: #exclusions ifAbsent: [#()]);\x0a\x09\x09yourself",
  3985. referencedClasses: ["Smalltalk"],
  3986. //>>excludeEnd("ide");
  3987. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  3988. }),
  3989. $globals.TraitTransformation.a$cls);
  3990. $core.addMethod(
  3991. $core.method({
  3992. selector: "on:",
  3993. protocol: "instance creation",
  3994. fn: function (aTrait){
  3995. var self=this,$self=this;
  3996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3997. return $core.withContext(function($ctx1) {
  3998. //>>excludeEnd("ctx");
  3999. var $1;
  4000. $1=(
  4001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4002. $ctx1.supercall = true,
  4003. //>>excludeEnd("ctx");
  4004. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  4005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4006. $ctx1.supercall = false;
  4007. //>>excludeEnd("ctx");;
  4008. $recv($1)._trait_(aTrait);
  4009. return $recv($1)._yourself();
  4010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4011. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  4012. //>>excludeEnd("ctx");
  4013. },
  4014. //>>excludeStart("ide", pragmas.excludeIdeData);
  4015. args: ["aTrait"],
  4016. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  4017. referencedClasses: [],
  4018. //>>excludeEnd("ide");
  4019. messageSends: ["trait:", "new", "yourself"]
  4020. }),
  4021. $globals.TraitTransformation.a$cls);
  4022. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  4023. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  4024. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  4025. $core.addMethod(
  4026. $core.method({
  4027. selector: "asTraitComposition",
  4028. protocol: "*Kernel-Classes",
  4029. fn: function (){
  4030. var self=this,$self=this;
  4031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4032. return $core.withContext(function($ctx1) {
  4033. //>>excludeEnd("ctx");
  4034. return $self._collect_((function(each){
  4035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4036. return $core.withContext(function($ctx2) {
  4037. //>>excludeEnd("ctx");
  4038. return $recv(each)._asTraitTransformation();
  4039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4040. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4041. //>>excludeEnd("ctx");
  4042. }));
  4043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4044. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  4045. //>>excludeEnd("ctx");
  4046. },
  4047. //>>excludeStart("ide", pragmas.excludeIdeData);
  4048. args: [],
  4049. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  4050. referencedClasses: [],
  4051. //>>excludeEnd("ide");
  4052. messageSends: ["collect:", "asTraitTransformation"]
  4053. }),
  4054. $globals.Array);
  4055. });