1
0

Kernel-Classes.js 159 KB

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