Kernel-Infrastructure.js 156 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365
  1. define(["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects", "amber_core/Kernel-Promises"], 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-Infrastructure");
  5. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  6. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  8. $core.addMethod(
  9. $core.method({
  10. selector: "initializeClasses:",
  11. protocol: "initialization",
  12. fn: function (classes){
  13. var self=this,$self=this;
  14. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15. return $core.withContext(function($ctx1) {
  16. //>>excludeEnd("ctx");
  17. var $1;
  18. $recv(classes)._do_((function(each){
  19. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20. return $core.withContext(function($ctx2) {
  21. //>>excludeEnd("ctx");
  22. $1=$recv(each).__eq($globals.SmalltalkImage);
  23. if(!$core.assert($1)){
  24. return $recv(each)._initialize();
  25. }
  26. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28. //>>excludeEnd("ctx");
  29. }));
  30. return self;
  31. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32. }, function($ctx1) {$ctx1.fill(self,"initializeClasses:",{classes:classes},$globals.AmberBootstrapInitialization.a$cls)});
  33. //>>excludeEnd("ctx");
  34. },
  35. //>>excludeStart("ide", pragmas.excludeIdeData);
  36. args: ["classes"],
  37. source: "initializeClasses: classes\x0a\x09classes do: [ :each |\x0a\x09\x09each = SmalltalkImage ifFalse: [ each initialize ] ]",
  38. referencedClasses: ["SmalltalkImage"],
  39. //>>excludeEnd("ide");
  40. messageSends: ["do:", "ifFalse:", "=", "initialize"]
  41. }),
  42. $globals.AmberBootstrapInitialization.a$cls);
  43. $core.addMethod(
  44. $core.method({
  45. selector: "organizeClasses:",
  46. protocol: "organization",
  47. fn: function (classes){
  48. var self=this,$self=this;
  49. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  50. return $core.withContext(function($ctx1) {
  51. //>>excludeEnd("ctx");
  52. $recv(classes)._do_((function(each){
  53. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54. return $core.withContext(function($ctx2) {
  55. //>>excludeEnd("ctx");
  56. return $recv(each)._enterOrganization();
  57. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59. //>>excludeEnd("ctx");
  60. }));
  61. return self;
  62. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63. }, function($ctx1) {$ctx1.fill(self,"organizeClasses:",{classes:classes},$globals.AmberBootstrapInitialization.a$cls)});
  64. //>>excludeEnd("ctx");
  65. },
  66. //>>excludeStart("ide", pragmas.excludeIdeData);
  67. args: ["classes"],
  68. source: "organizeClasses: classes\x0a\x09classes do: [ :each | each enterOrganization ]",
  69. referencedClasses: [],
  70. //>>excludeEnd("ide");
  71. messageSends: ["do:", "enterOrganization"]
  72. }),
  73. $globals.AmberBootstrapInitialization.a$cls);
  74. $core.addMethod(
  75. $core.method({
  76. selector: "organizeMethodsOf:",
  77. protocol: "organization",
  78. fn: function (classes){
  79. var self=this,$self=this;
  80. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  81. return $core.withContext(function($ctx1) {
  82. //>>excludeEnd("ctx");
  83. $recv(classes)._do_((function(eachClass){
  84. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  85. return $core.withContext(function($ctx2) {
  86. //>>excludeEnd("ctx");
  87. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  88. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  89. return $core.withContext(function($ctx3) {
  90. //>>excludeEnd("ctx");
  91. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  92. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  93. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  94. //>>excludeEnd("ctx");
  95. }));
  96. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  97. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  98. //>>excludeEnd("ctx");
  99. }));
  100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  101. $ctx1.sendIdx["do:"]=1;
  102. //>>excludeEnd("ctx");
  103. return self;
  104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  105. }, function($ctx1) {$ctx1.fill(self,"organizeMethodsOf:",{classes:classes},$globals.AmberBootstrapInitialization.a$cls)});
  106. //>>excludeEnd("ctx");
  107. },
  108. //>>excludeStart("ide", pragmas.excludeIdeData);
  109. args: ["classes"],
  110. source: "organizeMethodsOf: classes\x0a\x09classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  111. referencedClasses: [],
  112. //>>excludeEnd("ide");
  113. messageSends: ["do:", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  114. }),
  115. $globals.AmberBootstrapInitialization.a$cls);
  116. $core.addMethod(
  117. $core.method({
  118. selector: "processArrivals",
  119. protocol: "public api",
  120. fn: function(){
  121. var self=this,$self=this;
  122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  123. return $core.withContext(function($ctx1) {
  124. //>>excludeEnd("ctx");
  125. $recv($globals.Smalltalk)._withArrivalsDo_((function(newPackages){
  126. var names,classes;
  127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  128. return $core.withContext(function($ctx2) {
  129. //>>excludeEnd("ctx");
  130. names=$recv($recv(newPackages)._collect_((function(each){
  131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  132. return $core.withContext(function($ctx3) {
  133. //>>excludeEnd("ctx");
  134. return $recv(each)._name();
  135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  136. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  137. //>>excludeEnd("ctx");
  138. })))._asSet();
  139. names;
  140. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  142. return $core.withContext(function($ctx3) {
  143. //>>excludeEnd("ctx");
  144. return $recv($recv($recv(each)._package())._isNil())._and_((function(){
  145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  146. return $core.withContext(function($ctx4) {
  147. //>>excludeEnd("ctx");
  148. return $recv(names)._includes_($recv(each)._basicAt_("category"));
  149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  150. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  151. //>>excludeEnd("ctx");
  152. }));
  153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  154. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  155. //>>excludeEnd("ctx");
  156. }));
  157. classes;
  158. $self._organizeClasses_(classes);
  159. $self._organizeMethodsOf_(classes);
  160. return $self._initializeClasses_(classes);
  161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  162. }, function($ctx2) {$ctx2.fillBlock({newPackages:newPackages,names:names,classes:classes},$ctx1,1)});
  163. //>>excludeEnd("ctx");
  164. }));
  165. return self;
  166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  167. }, function($ctx1) {$ctx1.fill(self,"processArrivals",{},$globals.AmberBootstrapInitialization.a$cls)});
  168. //>>excludeEnd("ctx");
  169. },
  170. //>>excludeStart("ide", pragmas.excludeIdeData);
  171. args: [],
  172. source: "processArrivals\x0a\x09Smalltalk withArrivalsDo: [ :newPackages |\x0a\x09\x09| names classes |\x0a\x09\x09names := (newPackages collect: [ :each | each name ]) asSet.\x0a\x09\x09classes := Smalltalk classes select: [ :each |\x0a\x09\x09\x09each package isNil and: [ names includes: (each basicAt: 'category') ] ].\x0a\x0a\x09\x09self\x0a\x09\x09\x09organizeClasses: classes;\x0a\x09\x09\x09organizeMethodsOf: classes;\x0a\x09\x09\x09initializeClasses: classes ]",
  173. referencedClasses: ["Smalltalk"],
  174. //>>excludeEnd("ide");
  175. messageSends: ["withArrivalsDo:", "asSet", "collect:", "name", "select:", "classes", "and:", "isNil", "package", "includes:", "basicAt:", "organizeClasses:", "organizeMethodsOf:", "initializeClasses:"]
  176. }),
  177. $globals.AmberBootstrapInitialization.a$cls);
  178. $core.addMethod(
  179. $core.method({
  180. selector: "run",
  181. protocol: "public api",
  182. fn: function(){
  183. var self=this,$self=this;
  184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  185. return $core.withContext(function($ctx1) {
  186. //>>excludeEnd("ctx");
  187. $recv($globals.SmalltalkImage)._initialize();
  188. $self._processArrivals();
  189. return self;
  190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  191. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  192. //>>excludeEnd("ctx");
  193. },
  194. //>>excludeStart("ide", pragmas.excludeIdeData);
  195. args: [],
  196. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self processArrivals",
  197. referencedClasses: ["SmalltalkImage"],
  198. //>>excludeEnd("ide");
  199. messageSends: ["initialize", "processArrivals"]
  200. }),
  201. $globals.AmberBootstrapInitialization.a$cls);
  202. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  203. //>>excludeStart("ide", pragmas.excludeIdeData);
  204. $globals.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.";
  205. //>>excludeEnd("ide");
  206. $core.addMethod(
  207. $core.method({
  208. selector: "=",
  209. protocol: "comparing",
  210. fn: function (anObject){
  211. var self=this,$self=this;
  212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  213. return $core.withContext(function($ctx1) {
  214. //>>excludeEnd("ctx");
  215. var $2,$1;
  216. $2=$recv(anObject)._class();
  217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  218. $ctx1.sendIdx["class"]=1;
  219. //>>excludeEnd("ctx");
  220. $1=$recv($2).__eq_eq($self._class());
  221. if(!$core.assert($1)){
  222. return false;
  223. }
  224. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  226. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  227. //>>excludeEnd("ctx");
  228. },
  229. //>>excludeStart("ide", pragmas.excludeIdeData);
  230. args: ["anObject"],
  231. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  232. referencedClasses: ["JSObjectProxy"],
  233. //>>excludeEnd("ide");
  234. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  235. }),
  236. $globals.JSObjectProxy);
  237. $core.addMethod(
  238. $core.method({
  239. selector: "asJavaScriptObject",
  240. protocol: "converting",
  241. fn: function (){
  242. var self=this,$self=this;
  243. return $self["@jsObject"];
  244. },
  245. //>>excludeStart("ide", pragmas.excludeIdeData);
  246. args: [],
  247. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  248. referencedClasses: [],
  249. //>>excludeEnd("ide");
  250. messageSends: []
  251. }),
  252. $globals.JSObjectProxy);
  253. $core.addMethod(
  254. $core.method({
  255. selector: "at:",
  256. protocol: "accessing",
  257. fn: function (aString){
  258. var self=this,$self=this;
  259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  260. return $core.withContext(function($ctx1) {
  261. //>>excludeEnd("ctx");
  262. return $self['@jsObject'][aString];
  263. return self;
  264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  265. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  266. //>>excludeEnd("ctx");
  267. },
  268. //>>excludeStart("ide", pragmas.excludeIdeData);
  269. args: ["aString"],
  270. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  271. referencedClasses: [],
  272. //>>excludeEnd("ide");
  273. messageSends: []
  274. }),
  275. $globals.JSObjectProxy);
  276. $core.addMethod(
  277. $core.method({
  278. selector: "at:ifAbsent:",
  279. protocol: "accessing",
  280. fn: function (aString,aBlock){
  281. var self=this,$self=this;
  282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  283. return $core.withContext(function($ctx1) {
  284. //>>excludeEnd("ctx");
  285. var obj = $self['@jsObject'];
  286. return aString in obj ? obj[aString] : aBlock._value();
  287. ;
  288. return self;
  289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  290. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  291. //>>excludeEnd("ctx");
  292. },
  293. //>>excludeStart("ide", pragmas.excludeIdeData);
  294. args: ["aString", "aBlock"],
  295. source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09'>",
  296. referencedClasses: [],
  297. //>>excludeEnd("ide");
  298. messageSends: []
  299. }),
  300. $globals.JSObjectProxy);
  301. $core.addMethod(
  302. $core.method({
  303. selector: "at:ifPresent:",
  304. protocol: "accessing",
  305. fn: function (aString,aBlock){
  306. var self=this,$self=this;
  307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  308. return $core.withContext(function($ctx1) {
  309. //>>excludeEnd("ctx");
  310. var obj = $self['@jsObject'];
  311. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  312. ;
  313. return self;
  314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  315. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  316. //>>excludeEnd("ctx");
  317. },
  318. //>>excludeStart("ide", pragmas.excludeIdeData);
  319. args: ["aString", "aBlock"],
  320. source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09'>",
  321. referencedClasses: [],
  322. //>>excludeEnd("ide");
  323. messageSends: []
  324. }),
  325. $globals.JSObjectProxy);
  326. $core.addMethod(
  327. $core.method({
  328. selector: "at:ifPresent:ifAbsent:",
  329. protocol: "accessing",
  330. fn: function (aString,aBlock,anotherBlock){
  331. var self=this,$self=this;
  332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  333. return $core.withContext(function($ctx1) {
  334. //>>excludeEnd("ctx");
  335. var obj = $self['@jsObject'];
  336. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  337. ;
  338. return self;
  339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  340. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  341. //>>excludeEnd("ctx");
  342. },
  343. //>>excludeStart("ide", pragmas.excludeIdeData);
  344. args: ["aString", "aBlock", "anotherBlock"],
  345. source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09'>",
  346. referencedClasses: [],
  347. //>>excludeEnd("ide");
  348. messageSends: []
  349. }),
  350. $globals.JSObjectProxy);
  351. $core.addMethod(
  352. $core.method({
  353. selector: "at:put:",
  354. protocol: "accessing",
  355. fn: function (aString,anObject){
  356. var self=this,$self=this;
  357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  358. return $core.withContext(function($ctx1) {
  359. //>>excludeEnd("ctx");
  360. return $self['@jsObject'][aString] = anObject;
  361. return self;
  362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  363. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  364. //>>excludeEnd("ctx");
  365. },
  366. //>>excludeStart("ide", pragmas.excludeIdeData);
  367. args: ["aString", "anObject"],
  368. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  369. referencedClasses: [],
  370. //>>excludeEnd("ide");
  371. messageSends: []
  372. }),
  373. $globals.JSObjectProxy);
  374. $core.addMethod(
  375. $core.method({
  376. selector: "catch:",
  377. protocol: "promises",
  378. fn: function (aBlock){
  379. var self=this,$self=this;
  380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  381. return $core.withContext(function($ctx1) {
  382. //>>excludeEnd("ctx");
  383. var $1,$2;
  384. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  385. if($core.assert($1)){
  386. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  387. } else {
  388. $2=(
  389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  390. $ctx1.supercall = true,
  391. //>>excludeEnd("ctx");
  392. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  394. $ctx1.supercall = false;
  395. //>>excludeEnd("ctx");;
  396. return $2;
  397. }
  398. return self;
  399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  400. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  401. //>>excludeEnd("ctx");
  402. },
  403. //>>excludeStart("ide", pragmas.excludeIdeData);
  404. args: ["aBlock"],
  405. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  406. referencedClasses: ["NativeFunction", "TThenable"],
  407. //>>excludeEnd("ide");
  408. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  409. }),
  410. $globals.JSObjectProxy);
  411. $core.addMethod(
  412. $core.method({
  413. selector: "doesNotUnderstand:",
  414. protocol: "proxy",
  415. fn: function (aMessage){
  416. var self=this,$self=this;
  417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  418. return $core.withContext(function($ctx1) {
  419. //>>excludeEnd("ctx");
  420. var $1,$receiver;
  421. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  422. if(($receiver = $1) == null || $receiver.a$nil){
  423. return (
  424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  425. $ctx1.supercall = true,
  426. //>>excludeEnd("ctx");
  427. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  429. $ctx1.supercall = false;
  430. //>>excludeEnd("ctx");;
  431. } else {
  432. var jsSelector;
  433. jsSelector=$receiver;
  434. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  435. }
  436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  437. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  438. //>>excludeEnd("ctx");
  439. },
  440. //>>excludeStart("ide", pragmas.excludeIdeData);
  441. args: ["aMessage"],
  442. source: "doesNotUnderstand: aMessage\x0a\x09^ (JSObjectProxy lookupProperty: aMessage selector asJavaScriptPropertyName ofProxy: self)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09JSObjectProxy \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments\x0a\x09\x09\x09\x09ofProxy: self ]",
  443. referencedClasses: ["JSObjectProxy"],
  444. //>>excludeEnd("ide");
  445. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  446. }),
  447. $globals.JSObjectProxy);
  448. $core.addMethod(
  449. $core.method({
  450. selector: "in:",
  451. protocol: "accessing",
  452. fn: function (aValuable){
  453. var self=this,$self=this;
  454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  455. return $core.withContext(function($ctx1) {
  456. //>>excludeEnd("ctx");
  457. return $recv(aValuable)._value_($self["@jsObject"]);
  458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  459. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  460. //>>excludeEnd("ctx");
  461. },
  462. //>>excludeStart("ide", pragmas.excludeIdeData);
  463. args: ["aValuable"],
  464. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  465. referencedClasses: [],
  466. //>>excludeEnd("ide");
  467. messageSends: ["value:"]
  468. }),
  469. $globals.JSObjectProxy);
  470. $core.addMethod(
  471. $core.method({
  472. selector: "jsObject",
  473. protocol: "accessing",
  474. fn: function (){
  475. var self=this,$self=this;
  476. return $self["@jsObject"];
  477. },
  478. //>>excludeStart("ide", pragmas.excludeIdeData);
  479. args: [],
  480. source: "jsObject\x0a\x09^ jsObject",
  481. referencedClasses: [],
  482. //>>excludeEnd("ide");
  483. messageSends: []
  484. }),
  485. $globals.JSObjectProxy);
  486. $core.addMethod(
  487. $core.method({
  488. selector: "keysAndValuesDo:",
  489. protocol: "enumerating",
  490. fn: function (aBlock){
  491. var self=this,$self=this;
  492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  493. return $core.withContext(function($ctx1) {
  494. //>>excludeEnd("ctx");
  495. var o = $self['@jsObject'];
  496. for(var i in o) {
  497. aBlock._value_value_(i, o[i]);
  498. }
  499. ;
  500. return self;
  501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  502. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  503. //>>excludeEnd("ctx");
  504. },
  505. //>>excludeStart("ide", pragmas.excludeIdeData);
  506. args: ["aBlock"],
  507. source: "keysAndValuesDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var o = $self[''@jsObject''];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09'>",
  508. referencedClasses: [],
  509. //>>excludeEnd("ide");
  510. messageSends: []
  511. }),
  512. $globals.JSObjectProxy);
  513. $core.addMethod(
  514. $core.method({
  515. selector: "on:do:",
  516. protocol: "promises",
  517. fn: function (aClass,aBlock){
  518. var self=this,$self=this;
  519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  520. return $core.withContext(function($ctx1) {
  521. //>>excludeEnd("ctx");
  522. var $1,$2;
  523. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  524. if($core.assert($1)){
  525. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  526. } else {
  527. $2=(
  528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  529. $ctx1.supercall = true,
  530. //>>excludeEnd("ctx");
  531. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  533. $ctx1.supercall = false;
  534. //>>excludeEnd("ctx");;
  535. return $2;
  536. }
  537. return self;
  538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  539. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  540. //>>excludeEnd("ctx");
  541. },
  542. //>>excludeStart("ide", pragmas.excludeIdeData);
  543. args: ["aClass", "aBlock"],
  544. source: "on: aClass do: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #on:do:) sendTo: jsObject arguments: {aClass. aBlock} ]\x0a\x09ifFalse: [ ^ super on: aClass do: aBlock ]",
  545. referencedClasses: ["NativeFunction", "TThenable"],
  546. //>>excludeEnd("ide");
  547. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  548. }),
  549. $globals.JSObjectProxy);
  550. $core.addMethod(
  551. $core.method({
  552. selector: "printOn:",
  553. protocol: "printing",
  554. fn: function (aStream){
  555. var self=this,$self=this;
  556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  557. return $core.withContext(function($ctx1) {
  558. //>>excludeEnd("ctx");
  559. $recv(aStream)._nextPutAll_($self._printString());
  560. return self;
  561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  562. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  563. //>>excludeEnd("ctx");
  564. },
  565. //>>excludeStart("ide", pragmas.excludeIdeData);
  566. args: ["aStream"],
  567. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  568. referencedClasses: [],
  569. //>>excludeEnd("ide");
  570. messageSends: ["nextPutAll:", "printString"]
  571. }),
  572. $globals.JSObjectProxy);
  573. $core.addMethod(
  574. $core.method({
  575. selector: "printString",
  576. protocol: "printing",
  577. fn: function (){
  578. var self=this,$self=this;
  579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  580. return $core.withContext(function($ctx1) {
  581. //>>excludeEnd("ctx");
  582. var js = $self['@jsObject'];
  583. return js.toString
  584. ? js.toString()
  585. : Object.prototype.toString.call(js)
  586. ;
  587. return self;
  588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  589. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  590. //>>excludeEnd("ctx");
  591. },
  592. //>>excludeStart("ide", pragmas.excludeIdeData);
  593. args: [],
  594. source: "printString\x0a\x09<inlineJS: '\x0a\x09\x09var js = $self[''@jsObject''];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09'>",
  595. referencedClasses: [],
  596. //>>excludeEnd("ide");
  597. messageSends: []
  598. }),
  599. $globals.JSObjectProxy);
  600. $core.addMethod(
  601. $core.method({
  602. selector: "putOn:",
  603. protocol: "streaming",
  604. fn: function (aStream){
  605. var self=this,$self=this;
  606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  607. return $core.withContext(function($ctx1) {
  608. //>>excludeEnd("ctx");
  609. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  610. return self;
  611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  612. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  613. //>>excludeEnd("ctx");
  614. },
  615. //>>excludeStart("ide", pragmas.excludeIdeData);
  616. args: ["aStream"],
  617. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  618. referencedClasses: [],
  619. //>>excludeEnd("ide");
  620. messageSends: ["nextPutJSObject:"]
  621. }),
  622. $globals.JSObjectProxy);
  623. $core.addMethod(
  624. $core.method({
  625. selector: "removeKey:",
  626. protocol: "accessing",
  627. fn: function(aString){
  628. var self=this,$self=this;
  629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  630. return $core.withContext(function($ctx1) {
  631. //>>excludeEnd("ctx");
  632. delete $self['@jsObject'][aString]; return aString;
  633. return self;
  634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  635. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString},$globals.JSObjectProxy)});
  636. //>>excludeEnd("ctx");
  637. },
  638. //>>excludeStart("ide", pragmas.excludeIdeData);
  639. args: ["aString"],
  640. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self[''@jsObject''][aString]; return aString'>",
  641. referencedClasses: [],
  642. //>>excludeEnd("ide");
  643. messageSends: []
  644. }),
  645. $globals.JSObjectProxy);
  646. $core.addMethod(
  647. $core.method({
  648. selector: "then:",
  649. protocol: "promises",
  650. fn: function (aBlockOrArray){
  651. var self=this,$self=this;
  652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  653. return $core.withContext(function($ctx1) {
  654. //>>excludeEnd("ctx");
  655. var $1,$2;
  656. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  657. if($core.assert($1)){
  658. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  659. } else {
  660. $2=(
  661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  662. $ctx1.supercall = true,
  663. //>>excludeEnd("ctx");
  664. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  666. $ctx1.supercall = false;
  667. //>>excludeEnd("ctx");;
  668. return $2;
  669. }
  670. return self;
  671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  672. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  673. //>>excludeEnd("ctx");
  674. },
  675. //>>excludeStart("ide", pragmas.excludeIdeData);
  676. args: ["aBlockOrArray"],
  677. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  678. referencedClasses: ["NativeFunction", "TThenable"],
  679. //>>excludeEnd("ide");
  680. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  681. }),
  682. $globals.JSObjectProxy);
  683. $core.addMethod(
  684. $core.method({
  685. selector: "addObjectVariablesTo:ofProxy:",
  686. protocol: "proxy",
  687. fn: function (aDictionary,aProxy){
  688. var self=this,$self=this;
  689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  690. return $core.withContext(function($ctx1) {
  691. //>>excludeEnd("ctx");
  692. var jsObject = aProxy['@jsObject'];
  693. for(var i in jsObject) {
  694. aDictionary._at_put_(i, jsObject[i]);
  695. }
  696. ;
  697. return self;
  698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  699. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  700. //>>excludeEnd("ctx");
  701. },
  702. //>>excludeStart("ide", pragmas.excludeIdeData);
  703. args: ["aDictionary", "aProxy"],
  704. source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09var jsObject = aProxy[''@jsObject''];\x0a\x09\x09for(var i in jsObject) {\x0a\x09\x09\x09aDictionary._at_put_(i, jsObject[i]);\x0a\x09\x09}\x0a\x09'>",
  705. referencedClasses: [],
  706. //>>excludeEnd("ide");
  707. messageSends: []
  708. }),
  709. $globals.JSObjectProxy.a$cls);
  710. $core.addMethod(
  711. $core.method({
  712. selector: "compareJSObjectOfProxy:withProxy:",
  713. protocol: "proxy",
  714. fn: function (aProxy,anotherProxy){
  715. var self=this,$self=this;
  716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  717. return $core.withContext(function($ctx1) {
  718. //>>excludeEnd("ctx");
  719. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  720. return aProxy["@jsObject"] === anotherJSObject;
  721. return self;
  722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  723. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  724. //>>excludeEnd("ctx");
  725. },
  726. //>>excludeStart("ide", pragmas.excludeIdeData);
  727. args: ["aProxy", "anotherProxy"],
  728. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a'>",
  729. referencedClasses: [],
  730. //>>excludeEnd("ide");
  731. messageSends: []
  732. }),
  733. $globals.JSObjectProxy.a$cls);
  734. $core.addMethod(
  735. $core.method({
  736. selector: "forwardMessage:withArguments:ofProxy:",
  737. protocol: "proxy",
  738. fn: function (aString,anArray,aProxy){
  739. var self=this,$self=this;
  740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  741. return $core.withContext(function($ctx1) {
  742. //>>excludeEnd("ctx");
  743. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  744. ;
  745. return self;
  746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  747. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  748. //>>excludeEnd("ctx");
  749. },
  750. //>>excludeStart("ide", pragmas.excludeIdeData);
  751. args: ["aString", "anArray", "aProxy"],
  752. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  753. referencedClasses: [],
  754. //>>excludeEnd("ide");
  755. messageSends: []
  756. }),
  757. $globals.JSObjectProxy.a$cls);
  758. $core.addMethod(
  759. $core.method({
  760. selector: "jsObject:ofProxy:",
  761. protocol: "proxy",
  762. fn: function (aJSObject,aProxy){
  763. var self=this,$self=this;
  764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  765. return $core.withContext(function($ctx1) {
  766. //>>excludeEnd("ctx");
  767. aProxy['@jsObject'] = aJSObject;
  768. return self;
  769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  770. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  771. //>>excludeEnd("ctx");
  772. },
  773. //>>excludeStart("ide", pragmas.excludeIdeData);
  774. args: ["aJSObject", "aProxy"],
  775. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  776. referencedClasses: [],
  777. //>>excludeEnd("ide");
  778. messageSends: []
  779. }),
  780. $globals.JSObjectProxy.a$cls);
  781. $core.addMethod(
  782. $core.method({
  783. selector: "lookupProperty:ofProxy:",
  784. protocol: "proxy",
  785. fn: function (aString,aProxy){
  786. var self=this,$self=this;
  787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  788. return $core.withContext(function($ctx1) {
  789. //>>excludeEnd("ctx");
  790. return aString in aProxy._jsObject() ? aString : nil;
  791. return self;
  792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  793. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  794. //>>excludeEnd("ctx");
  795. },
  796. //>>excludeStart("ide", pragmas.excludeIdeData);
  797. args: ["aString", "aProxy"],
  798. source: "lookupProperty: aString ofProxy: aProxy\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09<inlineJS: 'return aString in aProxy._jsObject() ? aString : nil'>",
  799. referencedClasses: [],
  800. //>>excludeEnd("ide");
  801. messageSends: []
  802. }),
  803. $globals.JSObjectProxy.a$cls);
  804. $core.addMethod(
  805. $core.method({
  806. selector: "null",
  807. protocol: "accessing",
  808. fn: function (){
  809. var self=this,$self=this;
  810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  811. return $core.withContext(function($ctx1) {
  812. //>>excludeEnd("ctx");
  813. return null;
  814. return self;
  815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  816. }, function($ctx1) {$ctx1.fill(self,"null",{},$globals.JSObjectProxy.a$cls)});
  817. //>>excludeEnd("ctx");
  818. },
  819. //>>excludeStart("ide", pragmas.excludeIdeData);
  820. args: [],
  821. source: "null\x0a\x09<inlineJS: 'return null'>",
  822. referencedClasses: [],
  823. //>>excludeEnd("ide");
  824. messageSends: []
  825. }),
  826. $globals.JSObjectProxy.a$cls);
  827. $core.addMethod(
  828. $core.method({
  829. selector: "on:",
  830. protocol: "instance creation",
  831. fn: function (aJSObject){
  832. var self=this,$self=this;
  833. var instance;
  834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  835. return $core.withContext(function($ctx1) {
  836. //>>excludeEnd("ctx");
  837. instance=$self._new();
  838. $self._jsObject_ofProxy_(aJSObject,instance);
  839. return instance;
  840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  841. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  842. //>>excludeEnd("ctx");
  843. },
  844. //>>excludeStart("ide", pragmas.excludeIdeData);
  845. args: ["aJSObject"],
  846. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  847. referencedClasses: [],
  848. //>>excludeEnd("ide");
  849. messageSends: ["new", "jsObject:ofProxy:"]
  850. }),
  851. $globals.JSObjectProxy.a$cls);
  852. $core.addMethod(
  853. $core.method({
  854. selector: "undefined",
  855. protocol: "accessing",
  856. fn: function (){
  857. var self=this,$self=this;
  858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  859. return $core.withContext(function($ctx1) {
  860. //>>excludeEnd("ctx");
  861. return undefined;
  862. return self;
  863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  864. }, function($ctx1) {$ctx1.fill(self,"undefined",{},$globals.JSObjectProxy.a$cls)});
  865. //>>excludeEnd("ctx");
  866. },
  867. //>>excludeStart("ide", pragmas.excludeIdeData);
  868. args: [],
  869. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  870. referencedClasses: [],
  871. //>>excludeEnd("ide");
  872. messageSends: []
  873. }),
  874. $globals.JSObjectProxy.a$cls);
  875. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  876. //>>excludeStart("ide", pragmas.excludeIdeData);
  877. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  878. //>>excludeEnd("ide");
  879. $core.addMethod(
  880. $core.method({
  881. selector: "addElement:",
  882. protocol: "accessing",
  883. fn: function (anObject){
  884. var self=this,$self=this;
  885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  886. return $core.withContext(function($ctx1) {
  887. //>>excludeEnd("ctx");
  888. $recv($self._elements())._add_(anObject);
  889. return self;
  890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  891. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  892. //>>excludeEnd("ctx");
  893. },
  894. //>>excludeStart("ide", pragmas.excludeIdeData);
  895. args: ["anObject"],
  896. source: "addElement: anObject\x0a\x09self elements add: anObject",
  897. referencedClasses: [],
  898. //>>excludeEnd("ide");
  899. messageSends: ["add:", "elements"]
  900. }),
  901. $globals.Organizer);
  902. $core.addMethod(
  903. $core.method({
  904. selector: "elements",
  905. protocol: "accessing",
  906. fn: function (){
  907. var self=this,$self=this;
  908. return $self["@elements"];
  909. },
  910. //>>excludeStart("ide", pragmas.excludeIdeData);
  911. args: [],
  912. source: "elements\x0a\x09^ elements",
  913. referencedClasses: [],
  914. //>>excludeEnd("ide");
  915. messageSends: []
  916. }),
  917. $globals.Organizer);
  918. $core.addMethod(
  919. $core.method({
  920. selector: "initialize",
  921. protocol: "initialization",
  922. fn: function (){
  923. var self=this,$self=this;
  924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  925. return $core.withContext(function($ctx1) {
  926. //>>excludeEnd("ctx");
  927. (
  928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  929. $ctx1.supercall = true,
  930. //>>excludeEnd("ctx");
  931. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  933. $ctx1.supercall = false;
  934. //>>excludeEnd("ctx");;
  935. $self["@elements"]=$recv($globals.Set)._new();
  936. return self;
  937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  938. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  939. //>>excludeEnd("ctx");
  940. },
  941. //>>excludeStart("ide", pragmas.excludeIdeData);
  942. args: [],
  943. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  944. referencedClasses: ["Set"],
  945. //>>excludeEnd("ide");
  946. messageSends: ["initialize", "new"]
  947. }),
  948. $globals.Organizer);
  949. $core.addMethod(
  950. $core.method({
  951. selector: "removeElement:",
  952. protocol: "accessing",
  953. fn: function (anObject){
  954. var self=this,$self=this;
  955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  956. return $core.withContext(function($ctx1) {
  957. //>>excludeEnd("ctx");
  958. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  959. }));
  960. return self;
  961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  962. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  963. //>>excludeEnd("ctx");
  964. },
  965. //>>excludeStart("ide", pragmas.excludeIdeData);
  966. args: ["anObject"],
  967. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  968. referencedClasses: [],
  969. //>>excludeEnd("ide");
  970. messageSends: ["remove:ifAbsent:", "elements"]
  971. }),
  972. $globals.Organizer);
  973. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  974. //>>excludeStart("ide", pragmas.excludeIdeData);
  975. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  976. //>>excludeEnd("ide");
  977. $core.addMethod(
  978. $core.method({
  979. selector: "addElement:",
  980. protocol: "accessing",
  981. fn: function (aString){
  982. var self=this,$self=this;
  983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  984. return $core.withContext(function($ctx1) {
  985. //>>excludeEnd("ctx");
  986. var $1,$3,$2;
  987. (
  988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  989. $ctx1.supercall = true,
  990. //>>excludeEnd("ctx");
  991. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  993. $ctx1.supercall = false;
  994. //>>excludeEnd("ctx");;
  995. $1=$recv($globals.SystemAnnouncer)._current();
  996. $3=$recv($globals.ProtocolAdded)._new();
  997. $recv($3)._protocol_(aString);
  998. $recv($3)._theClass_($self._theClass());
  999. $2=$recv($3)._yourself();
  1000. $recv($1)._announce_($2);
  1001. return self;
  1002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1003. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  1004. //>>excludeEnd("ctx");
  1005. },
  1006. //>>excludeStart("ide", pragmas.excludeIdeData);
  1007. args: ["aString"],
  1008. source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  1009. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  1010. //>>excludeEnd("ide");
  1011. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  1012. }),
  1013. $globals.ClassOrganizer);
  1014. $core.addMethod(
  1015. $core.method({
  1016. selector: "removeElement:",
  1017. protocol: "accessing",
  1018. fn: function (aString){
  1019. var self=this,$self=this;
  1020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1021. return $core.withContext(function($ctx1) {
  1022. //>>excludeEnd("ctx");
  1023. var $1,$3,$2;
  1024. (
  1025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1026. $ctx1.supercall = true,
  1027. //>>excludeEnd("ctx");
  1028. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  1029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1030. $ctx1.supercall = false;
  1031. //>>excludeEnd("ctx");;
  1032. $1=$recv($globals.SystemAnnouncer)._current();
  1033. $3=$recv($globals.ProtocolRemoved)._new();
  1034. $recv($3)._protocol_(aString);
  1035. $recv($3)._theClass_($self._theClass());
  1036. $2=$recv($3)._yourself();
  1037. $recv($1)._announce_($2);
  1038. return self;
  1039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1040. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  1041. //>>excludeEnd("ctx");
  1042. },
  1043. //>>excludeStart("ide", pragmas.excludeIdeData);
  1044. args: ["aString"],
  1045. source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  1046. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  1047. //>>excludeEnd("ide");
  1048. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  1049. }),
  1050. $globals.ClassOrganizer);
  1051. $core.addMethod(
  1052. $core.method({
  1053. selector: "theClass",
  1054. protocol: "accessing",
  1055. fn: function (){
  1056. var self=this,$self=this;
  1057. return $self["@traitOrBehavior"];
  1058. },
  1059. //>>excludeStart("ide", pragmas.excludeIdeData);
  1060. args: [],
  1061. source: "theClass\x0a\x09^ traitOrBehavior",
  1062. referencedClasses: [],
  1063. //>>excludeEnd("ide");
  1064. messageSends: []
  1065. }),
  1066. $globals.ClassOrganizer);
  1067. $core.addMethod(
  1068. $core.method({
  1069. selector: "theClass:",
  1070. protocol: "accessing",
  1071. fn: function (aClass){
  1072. var self=this,$self=this;
  1073. $self["@traitOrBehavior"]=aClass;
  1074. return self;
  1075. },
  1076. //>>excludeStart("ide", pragmas.excludeIdeData);
  1077. args: ["aClass"],
  1078. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  1079. referencedClasses: [],
  1080. //>>excludeEnd("ide");
  1081. messageSends: []
  1082. }),
  1083. $globals.ClassOrganizer);
  1084. $core.addMethod(
  1085. $core.method({
  1086. selector: "on:",
  1087. protocol: "instance creation",
  1088. fn: function (aClass){
  1089. var self=this,$self=this;
  1090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1091. return $core.withContext(function($ctx1) {
  1092. //>>excludeEnd("ctx");
  1093. var $1;
  1094. $1=$self._new();
  1095. $recv($1)._theClass_(aClass);
  1096. return $recv($1)._yourself();
  1097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1098. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  1099. //>>excludeEnd("ctx");
  1100. },
  1101. //>>excludeStart("ide", pragmas.excludeIdeData);
  1102. args: ["aClass"],
  1103. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  1104. referencedClasses: [],
  1105. //>>excludeEnd("ide");
  1106. messageSends: ["theClass:", "new", "yourself"]
  1107. }),
  1108. $globals.ClassOrganizer.a$cls);
  1109. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  1110. //>>excludeStart("ide", pragmas.excludeIdeData);
  1111. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  1112. //>>excludeEnd("ide");
  1113. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization"], "Kernel-Infrastructure");
  1114. //>>excludeStart("ide", pragmas.excludeIdeData);
  1115. $globals.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
  1116. //>>excludeEnd("ide");
  1117. $core.addMethod(
  1118. $core.method({
  1119. selector: "basicTransport",
  1120. protocol: "private",
  1121. fn: function (){
  1122. var self=this,$self=this;
  1123. return $self["@basicTransport"];
  1124. },
  1125. //>>excludeStart("ide", pragmas.excludeIdeData);
  1126. args: [],
  1127. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  1128. referencedClasses: [],
  1129. //>>excludeEnd("ide");
  1130. messageSends: []
  1131. }),
  1132. $globals.Package);
  1133. $core.addMethod(
  1134. $core.method({
  1135. selector: "beClean",
  1136. protocol: "accessing",
  1137. fn: function (){
  1138. var self=this,$self=this;
  1139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1140. return $core.withContext(function($ctx1) {
  1141. //>>excludeEnd("ctx");
  1142. var $1,$3,$2;
  1143. $self["@dirty"]=false;
  1144. $1=$recv($globals.SystemAnnouncer)._current();
  1145. $3=$recv($globals.PackageClean)._new();
  1146. $recv($3)._package_(self);
  1147. $2=$recv($3)._yourself();
  1148. $recv($1)._announce_($2);
  1149. return self;
  1150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1151. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  1152. //>>excludeEnd("ctx");
  1153. },
  1154. //>>excludeStart("ide", pragmas.excludeIdeData);
  1155. args: [],
  1156. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  1157. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  1158. //>>excludeEnd("ide");
  1159. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  1160. }),
  1161. $globals.Package);
  1162. $core.addMethod(
  1163. $core.method({
  1164. selector: "beDirty",
  1165. protocol: "accessing",
  1166. fn: function (){
  1167. var self=this,$self=this;
  1168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1169. return $core.withContext(function($ctx1) {
  1170. //>>excludeEnd("ctx");
  1171. var $1,$3,$2;
  1172. $self["@dirty"]=true;
  1173. $1=$recv($globals.SystemAnnouncer)._current();
  1174. $3=$recv($globals.PackageDirty)._new();
  1175. $recv($3)._package_(self);
  1176. $2=$recv($3)._yourself();
  1177. $recv($1)._announce_($2);
  1178. return self;
  1179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1180. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  1181. //>>excludeEnd("ctx");
  1182. },
  1183. //>>excludeStart("ide", pragmas.excludeIdeData);
  1184. args: [],
  1185. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  1186. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  1187. //>>excludeEnd("ide");
  1188. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  1189. }),
  1190. $globals.Package);
  1191. $core.addMethod(
  1192. $core.method({
  1193. selector: "classTemplate",
  1194. protocol: "accessing",
  1195. fn: function (){
  1196. var self=this,$self=this;
  1197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1198. return $core.withContext(function($ctx1) {
  1199. //>>excludeEnd("ctx");
  1200. return $recv($globals.String)._streamContents_((function(stream){
  1201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1202. return $core.withContext(function($ctx2) {
  1203. //>>excludeEnd("ctx");
  1204. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  1205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1206. $ctx2.sendIdx["write:"]=1;
  1207. //>>excludeEnd("ctx");
  1208. $recv(stream)._lf();
  1209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1210. $ctx2.sendIdx["lf"]=1;
  1211. //>>excludeEnd("ctx");
  1212. $recv(stream)._tab();
  1213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1214. $ctx2.sendIdx["tab"]=1;
  1215. //>>excludeEnd("ctx");
  1216. $recv(stream)._write_("instanceVariableNames: ''");
  1217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1218. $ctx2.sendIdx["write:"]=2;
  1219. //>>excludeEnd("ctx");
  1220. $recv(stream)._lf();
  1221. $recv(stream)._tab();
  1222. $recv(stream)._write_("package: ");
  1223. return $recv(stream)._print_($self._name());
  1224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1225. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1226. //>>excludeEnd("ctx");
  1227. }));
  1228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1229. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  1230. //>>excludeEnd("ctx");
  1231. },
  1232. //>>excludeStart("ide", pragmas.excludeIdeData);
  1233. args: [],
  1234. source: "classTemplate\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Object subclass: #NameOfSubclass'; lf;\x0a\x09\x09tab; write: 'instanceVariableNames: '''''; lf;\x0a\x09\x09tab; write: 'package: '; print: self name ]",
  1235. referencedClasses: ["String"],
  1236. //>>excludeEnd("ide");
  1237. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  1238. }),
  1239. $globals.Package);
  1240. $core.addMethod(
  1241. $core.method({
  1242. selector: "classes",
  1243. protocol: "classes",
  1244. fn: function (){
  1245. var self=this,$self=this;
  1246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1247. return $core.withContext(function($ctx1) {
  1248. //>>excludeEnd("ctx");
  1249. return $recv($recv($self._organization())._elements())._copy();
  1250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1251. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  1252. //>>excludeEnd("ctx");
  1253. },
  1254. //>>excludeStart("ide", pragmas.excludeIdeData);
  1255. args: [],
  1256. source: "classes\x0a\x09^ self organization elements copy",
  1257. referencedClasses: [],
  1258. //>>excludeEnd("ide");
  1259. messageSends: ["copy", "elements", "organization"]
  1260. }),
  1261. $globals.Package);
  1262. $core.addMethod(
  1263. $core.method({
  1264. selector: "definition",
  1265. protocol: "accessing",
  1266. fn: function (){
  1267. var self=this,$self=this;
  1268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1269. return $core.withContext(function($ctx1) {
  1270. //>>excludeEnd("ctx");
  1271. var $1;
  1272. return $recv($globals.String)._streamContents_((function(stream){
  1273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1274. return $core.withContext(function($ctx2) {
  1275. //>>excludeEnd("ctx");
  1276. $1=$recv($self._class())._name();
  1277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1278. $ctx2.sendIdx["name"]=1;
  1279. //>>excludeEnd("ctx");
  1280. $recv(stream)._write_($1);
  1281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1282. $ctx2.sendIdx["write:"]=1;
  1283. //>>excludeEnd("ctx");
  1284. $recv(stream)._lf();
  1285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1286. $ctx2.sendIdx["lf"]=1;
  1287. //>>excludeEnd("ctx");
  1288. $recv(stream)._tab();
  1289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1290. $ctx2.sendIdx["tab"]=1;
  1291. //>>excludeEnd("ctx");
  1292. $recv(stream)._write_("named: ");
  1293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1294. $ctx2.sendIdx["write:"]=2;
  1295. //>>excludeEnd("ctx");
  1296. $recv(stream)._print_($self._name());
  1297. $recv(stream)._lf();
  1298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1299. $ctx2.sendIdx["lf"]=2;
  1300. //>>excludeEnd("ctx");
  1301. $recv(stream)._tab();
  1302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1303. $ctx2.sendIdx["tab"]=2;
  1304. //>>excludeEnd("ctx");
  1305. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  1306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1307. $ctx2.sendIdx["write:"]=3;
  1308. //>>excludeEnd("ctx");
  1309. $recv(stream)._lf();
  1310. $recv(stream)._tab();
  1311. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  1312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1313. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1314. //>>excludeEnd("ctx");
  1315. }));
  1316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1317. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  1318. //>>excludeEnd("ctx");
  1319. },
  1320. //>>excludeStart("ide", pragmas.excludeIdeData);
  1321. args: [],
  1322. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: self class name; lf;\x0a\x09\x09tab; write: 'named: '; print: self name; lf;\x0a\x09\x09tab; write: { 'imports: '. self importsDefinition }; lf;\x0a\x09\x09tab; write: { 'transport: ('. self transport definition. ')' } ]",
  1323. referencedClasses: ["String"],
  1324. //>>excludeEnd("ide");
  1325. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  1326. }),
  1327. $globals.Package);
  1328. $core.addMethod(
  1329. $core.method({
  1330. selector: "eval:",
  1331. protocol: "evaluating",
  1332. fn: function (aString){
  1333. var self=this,$self=this;
  1334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1335. return $core.withContext(function($ctx1) {
  1336. //>>excludeEnd("ctx");
  1337. var $1,$receiver;
  1338. $1=$self["@evalBlock"];
  1339. if(($receiver = $1) == null || $receiver.a$nil){
  1340. return $recv($globals.Compiler)._eval_(aString);
  1341. } else {
  1342. return $recv($self["@evalBlock"])._value_(aString);
  1343. }
  1344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1345. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  1346. //>>excludeEnd("ctx");
  1347. },
  1348. //>>excludeStart("ide", pragmas.excludeIdeData);
  1349. args: ["aString"],
  1350. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  1351. referencedClasses: ["Compiler"],
  1352. //>>excludeEnd("ide");
  1353. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  1354. }),
  1355. $globals.Package);
  1356. $core.addMethod(
  1357. $core.method({
  1358. selector: "evalBlock",
  1359. protocol: "accessing",
  1360. fn: function (){
  1361. var self=this,$self=this;
  1362. return $self["@evalBlock"];
  1363. },
  1364. //>>excludeStart("ide", pragmas.excludeIdeData);
  1365. args: [],
  1366. source: "evalBlock\x0a\x09^ evalBlock",
  1367. referencedClasses: [],
  1368. //>>excludeEnd("ide");
  1369. messageSends: []
  1370. }),
  1371. $globals.Package);
  1372. $core.addMethod(
  1373. $core.method({
  1374. selector: "evalBlock:",
  1375. protocol: "accessing",
  1376. fn: function (aBlock){
  1377. var self=this,$self=this;
  1378. $self["@evalBlock"]=aBlock;
  1379. return self;
  1380. },
  1381. //>>excludeStart("ide", pragmas.excludeIdeData);
  1382. args: ["aBlock"],
  1383. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  1384. referencedClasses: [],
  1385. //>>excludeEnd("ide");
  1386. messageSends: []
  1387. }),
  1388. $globals.Package);
  1389. $core.addMethod(
  1390. $core.method({
  1391. selector: "imports",
  1392. protocol: "accessing",
  1393. fn: function (){
  1394. var self=this,$self=this;
  1395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1396. return $core.withContext(function($ctx1) {
  1397. //>>excludeEnd("ctx");
  1398. var $1,$receiver;
  1399. $1=$self["@imports"];
  1400. if(($receiver = $1) == null || $receiver.a$nil){
  1401. $self._imports_([]);
  1402. return $self["@imports"];
  1403. } else {
  1404. return $1;
  1405. }
  1406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1407. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  1408. //>>excludeEnd("ctx");
  1409. },
  1410. //>>excludeStart("ide", pragmas.excludeIdeData);
  1411. args: [],
  1412. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  1413. referencedClasses: [],
  1414. //>>excludeEnd("ide");
  1415. messageSends: ["ifNil:", "imports:"]
  1416. }),
  1417. $globals.Package);
  1418. $core.addMethod(
  1419. $core.method({
  1420. selector: "imports:",
  1421. protocol: "accessing",
  1422. fn: function (anArray){
  1423. var self=this,$self=this;
  1424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1425. return $core.withContext(function($ctx1) {
  1426. //>>excludeEnd("ctx");
  1427. $self._validateImports_(anArray);
  1428. $self["@imports"]=$recv(anArray)._asSet();
  1429. return self;
  1430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1431. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  1432. //>>excludeEnd("ctx");
  1433. },
  1434. //>>excludeStart("ide", pragmas.excludeIdeData);
  1435. args: ["anArray"],
  1436. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  1437. referencedClasses: [],
  1438. //>>excludeEnd("ide");
  1439. messageSends: ["validateImports:", "asSet"]
  1440. }),
  1441. $globals.Package);
  1442. $core.addMethod(
  1443. $core.method({
  1444. selector: "importsAsJson",
  1445. protocol: "converting",
  1446. fn: function (){
  1447. var self=this,$self=this;
  1448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1449. return $core.withContext(function($ctx1) {
  1450. //>>excludeEnd("ctx");
  1451. var $1;
  1452. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  1453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1454. return $core.withContext(function($ctx2) {
  1455. //>>excludeEnd("ctx");
  1456. $1=$recv(each)._isString();
  1457. if($core.assert($1)){
  1458. return each;
  1459. } else {
  1460. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  1461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1462. $ctx2.sendIdx[","]=1;
  1463. //>>excludeEnd("ctx");
  1464. }
  1465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1467. //>>excludeEnd("ctx");
  1468. }));
  1469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1470. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  1471. //>>excludeEnd("ctx");
  1472. },
  1473. //>>excludeStart("ide", pragmas.excludeIdeData);
  1474. args: [],
  1475. source: "importsAsJson\x0a\x0a\x09^ self sortedImportsAsArray collect: [ :each |\x0a\x09\x09each isString\x0a\x09\x09\x09ifTrue: [ each ]\x0a\x09\x09\x09ifFalse: [ each key, '=', each value ]]",
  1476. referencedClasses: [],
  1477. //>>excludeEnd("ide");
  1478. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  1479. }),
  1480. $globals.Package);
  1481. $core.addMethod(
  1482. $core.method({
  1483. selector: "importsDefinition",
  1484. protocol: "accessing",
  1485. fn: function (){
  1486. var self=this,$self=this;
  1487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1488. return $core.withContext(function($ctx1) {
  1489. //>>excludeEnd("ctx");
  1490. return $recv($globals.String)._streamContents_((function(stream){
  1491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1492. return $core.withContext(function($ctx2) {
  1493. //>>excludeEnd("ctx");
  1494. $recv(stream)._write_("{");
  1495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1496. $ctx2.sendIdx["write:"]=1;
  1497. //>>excludeEnd("ctx");
  1498. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  1499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1500. return $core.withContext(function($ctx3) {
  1501. //>>excludeEnd("ctx");
  1502. return $recv(stream)._print_(each);
  1503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1504. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  1505. //>>excludeEnd("ctx");
  1506. }),(function(){
  1507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1508. return $core.withContext(function($ctx3) {
  1509. //>>excludeEnd("ctx");
  1510. return $recv(stream)._write_(". ");
  1511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1512. $ctx3.sendIdx["write:"]=2;
  1513. //>>excludeEnd("ctx");
  1514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1515. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  1516. //>>excludeEnd("ctx");
  1517. }));
  1518. return $recv(stream)._write_("}");
  1519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1520. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1521. //>>excludeEnd("ctx");
  1522. }));
  1523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1524. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  1525. //>>excludeEnd("ctx");
  1526. },
  1527. //>>excludeStart("ide", pragmas.excludeIdeData);
  1528. args: [],
  1529. source: "importsDefinition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream write: '{'.\x0a\x09\x09self sortedImportsAsArray\x0a\x09\x09\x09do: [ :each | stream print: each ]\x0a\x09\x09\x09separatedBy: [ stream write: '. ' ].\x0a\x09\x09stream write: '}' ]",
  1530. referencedClasses: ["String"],
  1531. //>>excludeEnd("ide");
  1532. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  1533. }),
  1534. $globals.Package);
  1535. $core.addMethod(
  1536. $core.method({
  1537. selector: "importsFromJson:",
  1538. protocol: "converting",
  1539. fn: function (anArray){
  1540. var self=this,$self=this;
  1541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1542. return $core.withContext(function($ctx1) {
  1543. //>>excludeEnd("ctx");
  1544. var $1;
  1545. return $recv(anArray)._collect_((function(each){
  1546. var split;
  1547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1548. return $core.withContext(function($ctx2) {
  1549. //>>excludeEnd("ctx");
  1550. split=$recv(each)._tokenize_("=");
  1551. split;
  1552. $1=$recv($recv(split)._size()).__eq((1));
  1553. if($core.assert($1)){
  1554. return $recv(split)._first();
  1555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1556. $ctx2.sendIdx["first"]=1;
  1557. //>>excludeEnd("ctx");
  1558. } else {
  1559. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  1560. }
  1561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1562. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  1563. //>>excludeEnd("ctx");
  1564. }));
  1565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1566. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  1567. //>>excludeEnd("ctx");
  1568. },
  1569. //>>excludeStart("ide", pragmas.excludeIdeData);
  1570. args: ["anArray"],
  1571. source: "importsFromJson: anArray\x0a\x09\x22Parses array of string, eg. #('asdf' 'qwer=tyuo')\x0a\x09into array of Strings and Associations,\x0a\x09eg. {'asdf'. 'qwer'->'tyuo'}\x22\x0a\x0a\x09^ anArray collect: [ :each |\x0a\x09\x09| split |\x0a\x09\x09split := each tokenize: '='.\x0a\x09\x09split size = 1\x0a\x09\x09\x09ifTrue: [ split first ]\x0a\x09\x09\x09ifFalse: [ split first -> split second ]]",
  1572. referencedClasses: [],
  1573. //>>excludeEnd("ide");
  1574. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  1575. }),
  1576. $globals.Package);
  1577. $core.addMethod(
  1578. $core.method({
  1579. selector: "initialize",
  1580. protocol: "initialization",
  1581. fn: function (){
  1582. var self=this,$self=this;
  1583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1584. return $core.withContext(function($ctx1) {
  1585. //>>excludeEnd("ctx");
  1586. (
  1587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1588. $ctx1.supercall = true,
  1589. //>>excludeEnd("ctx");
  1590. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  1591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1592. $ctx1.supercall = false;
  1593. //>>excludeEnd("ctx");;
  1594. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  1595. $self["@evalBlock"]=nil;
  1596. $self["@dirty"]=nil;
  1597. $self["@imports"]=nil;
  1598. $self["@transport"]=nil;
  1599. return self;
  1600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1601. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  1602. //>>excludeEnd("ctx");
  1603. },
  1604. //>>excludeStart("ide", pragmas.excludeIdeData);
  1605. args: [],
  1606. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09transport := nil",
  1607. referencedClasses: ["PackageOrganizer"],
  1608. //>>excludeEnd("ide");
  1609. messageSends: ["initialize", "new"]
  1610. }),
  1611. $globals.Package);
  1612. $core.addMethod(
  1613. $core.method({
  1614. selector: "isDirty",
  1615. protocol: "testing",
  1616. fn: function (){
  1617. var self=this,$self=this;
  1618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1619. return $core.withContext(function($ctx1) {
  1620. //>>excludeEnd("ctx");
  1621. var $1,$receiver;
  1622. $1=$self["@dirty"];
  1623. if(($receiver = $1) == null || $receiver.a$nil){
  1624. return false;
  1625. } else {
  1626. return $1;
  1627. }
  1628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1629. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  1630. //>>excludeEnd("ctx");
  1631. },
  1632. //>>excludeStart("ide", pragmas.excludeIdeData);
  1633. args: [],
  1634. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  1635. referencedClasses: [],
  1636. //>>excludeEnd("ide");
  1637. messageSends: ["ifNil:"]
  1638. }),
  1639. $globals.Package);
  1640. $core.addMethod(
  1641. $core.method({
  1642. selector: "isPackage",
  1643. protocol: "testing",
  1644. fn: function (){
  1645. var self=this,$self=this;
  1646. return true;
  1647. },
  1648. //>>excludeStart("ide", pragmas.excludeIdeData);
  1649. args: [],
  1650. source: "isPackage\x0a\x09^ true",
  1651. referencedClasses: [],
  1652. //>>excludeEnd("ide");
  1653. messageSends: []
  1654. }),
  1655. $globals.Package);
  1656. $core.addMethod(
  1657. $core.method({
  1658. selector: "javaScriptDescriptor:",
  1659. protocol: "accessing",
  1660. fn: function (anObject){
  1661. var self=this,$self=this;
  1662. var basicEval,basicImports;
  1663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1664. return $core.withContext(function($ctx1) {
  1665. //>>excludeEnd("ctx");
  1666. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  1667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1668. return $core.withContext(function($ctx2) {
  1669. //>>excludeEnd("ctx");
  1670. return nil._asJavaScriptObject();
  1671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1673. //>>excludeEnd("ctx");
  1674. }));
  1675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1676. $ctx1.sendIdx["at:ifAbsent:"]=1;
  1677. //>>excludeEnd("ctx");
  1678. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  1679. return [];
  1680. }));
  1681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1682. $ctx1.sendIdx["at:ifAbsent:"]=2;
  1683. //>>excludeEnd("ctx");
  1684. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  1685. }));
  1686. $self._evalBlock_(basicEval);
  1687. $self._imports_($self._importsFromJson_(basicImports));
  1688. return self;
  1689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1690. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  1691. //>>excludeEnd("ctx");
  1692. },
  1693. //>>excludeStart("ide", pragmas.excludeIdeData);
  1694. args: ["anObject"],
  1695. source: "javaScriptDescriptor: anObject\x0a\x09| basicEval basicImports |\x0a\x0a\x09basicEval := (anObject at: 'innerEval' ifAbsent: [ nil asJavaScriptObject ]).\x0a\x09basicImports := (anObject at: 'imports' ifAbsent: [ #() ]).\x0a\x09basicTransport := (anObject at: 'transport' ifAbsent: []).\x0a\x09\x09\x09\x0a\x09self\x0a\x09\x09evalBlock: basicEval;\x0a\x09\x09imports: (self importsFromJson: basicImports)",
  1696. referencedClasses: [],
  1697. //>>excludeEnd("ide");
  1698. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "evalBlock:", "imports:", "importsFromJson:"]
  1699. }),
  1700. $globals.Package);
  1701. $core.addMethod(
  1702. $core.method({
  1703. selector: "loadDependencies",
  1704. protocol: "dependencies",
  1705. fn: function (){
  1706. var self=this,$self=this;
  1707. var classes,packages;
  1708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1709. return $core.withContext(function($ctx1) {
  1710. //>>excludeEnd("ctx");
  1711. var $1;
  1712. classes=$self._loadDependencyClasses();
  1713. $1=$recv($recv(classes)._collect_((function(each){
  1714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1715. return $core.withContext(function($ctx2) {
  1716. //>>excludeEnd("ctx");
  1717. return $recv(each)._package();
  1718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1719. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1720. //>>excludeEnd("ctx");
  1721. })))._asSet();
  1722. $recv($1)._remove_ifAbsent_(self,(function(){
  1723. }));
  1724. return $recv($1)._yourself();
  1725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1726. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  1727. //>>excludeEnd("ctx");
  1728. },
  1729. //>>excludeStart("ide", pragmas.excludeIdeData);
  1730. args: [],
  1731. source: "loadDependencies\x0a\x09\x22Returns list of packages that need to be loaded\x0a\x09before loading this package.\x22\x0a\x09\x0a\x09| classes packages |\x0a\x09classes := self loadDependencyClasses.\x0a\x09^ (classes collect: [ :each | each package ]) asSet\x0a\x09\x09remove: self ifAbsent: [];\x0a\x09\x09yourself",
  1732. referencedClasses: [],
  1733. //>>excludeEnd("ide");
  1734. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  1735. }),
  1736. $globals.Package);
  1737. $core.addMethod(
  1738. $core.method({
  1739. selector: "loadDependencyClasses",
  1740. protocol: "dependencies",
  1741. fn: function (){
  1742. var self=this,$self=this;
  1743. var starCategoryName;
  1744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1745. return $core.withContext(function($ctx1) {
  1746. //>>excludeEnd("ctx");
  1747. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  1748. starCategoryName="*".__comma($self._name());
  1749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1750. $ctx1.sendIdx[","]=1;
  1751. //>>excludeEnd("ctx");
  1752. $3=$self._classes();
  1753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1754. $ctx1.sendIdx["classes"]=1;
  1755. //>>excludeEnd("ctx");
  1756. $2=$recv($3)._collect_((function(each){
  1757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1758. return $core.withContext(function($ctx2) {
  1759. //>>excludeEnd("ctx");
  1760. return $recv(each)._superclass();
  1761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1762. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1763. //>>excludeEnd("ctx");
  1764. }));
  1765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1766. $ctx1.sendIdx["collect:"]=1;
  1767. //>>excludeEnd("ctx");
  1768. $1=$recv($2)._asSet();
  1769. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  1770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1771. return $core.withContext(function($ctx2) {
  1772. //>>excludeEnd("ctx");
  1773. $5=$recv(each)._protocols();
  1774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1775. $ctx2.sendIdx["protocols"]=1;
  1776. //>>excludeEnd("ctx");
  1777. $7=$recv(each)._theMetaClass();
  1778. if(($receiver = $7) == null || $receiver.a$nil){
  1779. $6=[];
  1780. } else {
  1781. var meta;
  1782. meta=$receiver;
  1783. $6=$recv(meta)._protocols();
  1784. }
  1785. $4=$recv($5).__comma($6);
  1786. return $recv($4)._includes_(starCategoryName);
  1787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1788. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  1789. //>>excludeEnd("ctx");
  1790. })));
  1791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1792. $ctx1.sendIdx["addAll:"]=1;
  1793. //>>excludeEnd("ctx");
  1794. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  1795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1796. return $core.withContext(function($ctx2) {
  1797. //>>excludeEnd("ctx");
  1798. return $recv($self._traitCompositions())._valuesDo_((function(each){
  1799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1800. return $core.withContext(function($ctx3) {
  1801. //>>excludeEnd("ctx");
  1802. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  1803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1804. return $core.withContext(function($ctx4) {
  1805. //>>excludeEnd("ctx");
  1806. return $recv(eachTT)._trait();
  1807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1808. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  1809. //>>excludeEnd("ctx");
  1810. })));
  1811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1812. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  1813. //>>excludeEnd("ctx");
  1814. }));
  1815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1816. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  1817. //>>excludeEnd("ctx");
  1818. })));
  1819. $recv($1)._remove_ifAbsent_(nil,(function(){
  1820. }));
  1821. return $recv($1)._yourself();
  1822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1823. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  1824. //>>excludeEnd("ctx");
  1825. },
  1826. //>>excludeStart("ide", pragmas.excludeIdeData);
  1827. args: [],
  1828. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x0a\x09as well as all traits used\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09addAll: (Smalltalk classes select: [ :each |\x0a\x09\x09\x09each protocols, (each theMetaClass ifNil: [ #() ] ifNotNil: [ :meta | meta protocols])\x0a\x09\x09\x09\x09includes: starCategoryName ]);\x0a\x09\x09addAll: (Array streamContents: [ :as | self traitCompositions valuesDo: [ :each | as write: (each collect: [ :eachTT | eachTT trait ])]]);\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09yourself",
  1829. referencedClasses: ["Smalltalk", "Array"],
  1830. //>>excludeEnd("ide");
  1831. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  1832. }),
  1833. $globals.Package);
  1834. $core.addMethod(
  1835. $core.method({
  1836. selector: "name",
  1837. protocol: "accessing",
  1838. fn: function (){
  1839. var self=this,$self=this;
  1840. return $self["@name"];
  1841. },
  1842. //>>excludeStart("ide", pragmas.excludeIdeData);
  1843. args: [],
  1844. source: "name\x0a\x09^ name",
  1845. referencedClasses: [],
  1846. //>>excludeEnd("ide");
  1847. messageSends: []
  1848. }),
  1849. $globals.Package);
  1850. $core.addMethod(
  1851. $core.method({
  1852. selector: "name:",
  1853. protocol: "accessing",
  1854. fn: function (aString){
  1855. var self=this,$self=this;
  1856. $self["@name"]=aString;
  1857. return self;
  1858. },
  1859. //>>excludeStart("ide", pragmas.excludeIdeData);
  1860. args: ["aString"],
  1861. source: "name: aString\x0a\x09name := aString",
  1862. referencedClasses: [],
  1863. //>>excludeEnd("ide");
  1864. messageSends: []
  1865. }),
  1866. $globals.Package);
  1867. $core.addMethod(
  1868. $core.method({
  1869. selector: "organization",
  1870. protocol: "accessing",
  1871. fn: function (){
  1872. var self=this,$self=this;
  1873. return $self["@organization"];
  1874. },
  1875. //>>excludeStart("ide", pragmas.excludeIdeData);
  1876. args: [],
  1877. source: "organization\x0a\x09^ organization",
  1878. referencedClasses: [],
  1879. //>>excludeEnd("ide");
  1880. messageSends: []
  1881. }),
  1882. $globals.Package);
  1883. $core.addMethod(
  1884. $core.method({
  1885. selector: "printOn:",
  1886. protocol: "printing",
  1887. fn: function (aStream){
  1888. var self=this,$self=this;
  1889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1890. return $core.withContext(function($ctx1) {
  1891. //>>excludeEnd("ctx");
  1892. (
  1893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1894. $ctx1.supercall = true,
  1895. //>>excludeEnd("ctx");
  1896. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  1897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1898. $ctx1.supercall = false;
  1899. //>>excludeEnd("ctx");;
  1900. $recv(aStream)._nextPutAll_(" (");
  1901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1902. $ctx1.sendIdx["nextPutAll:"]=1;
  1903. //>>excludeEnd("ctx");
  1904. $recv(aStream)._nextPutAll_($self._name());
  1905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1906. $ctx1.sendIdx["nextPutAll:"]=2;
  1907. //>>excludeEnd("ctx");
  1908. $recv(aStream)._nextPutAll_(")");
  1909. return self;
  1910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1911. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  1912. //>>excludeEnd("ctx");
  1913. },
  1914. //>>excludeStart("ide", pragmas.excludeIdeData);
  1915. args: ["aStream"],
  1916. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  1917. referencedClasses: [],
  1918. //>>excludeEnd("ide");
  1919. messageSends: ["printOn:", "nextPutAll:", "name"]
  1920. }),
  1921. $globals.Package);
  1922. $core.addMethod(
  1923. $core.method({
  1924. selector: "setupClasses",
  1925. protocol: "classes",
  1926. fn: function (){
  1927. var self=this,$self=this;
  1928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1929. return $core.withContext(function($ctx1) {
  1930. //>>excludeEnd("ctx");
  1931. $recv($self._classes())._do_((function(each){
  1932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1933. return $core.withContext(function($ctx2) {
  1934. //>>excludeEnd("ctx");
  1935. return $recv(each)._initialize();
  1936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1937. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1938. //>>excludeEnd("ctx");
  1939. }));
  1940. return self;
  1941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1942. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  1943. //>>excludeEnd("ctx");
  1944. },
  1945. //>>excludeStart("ide", pragmas.excludeIdeData);
  1946. args: [],
  1947. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  1948. referencedClasses: [],
  1949. //>>excludeEnd("ide");
  1950. messageSends: ["do:", "classes", "initialize"]
  1951. }),
  1952. $globals.Package);
  1953. $core.addMethod(
  1954. $core.method({
  1955. selector: "sortedClasses",
  1956. protocol: "classes",
  1957. fn: function (){
  1958. var self=this,$self=this;
  1959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1960. return $core.withContext(function($ctx1) {
  1961. //>>excludeEnd("ctx");
  1962. return $recv($self._class())._sortedClasses_($self._classes());
  1963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1964. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  1965. //>>excludeEnd("ctx");
  1966. },
  1967. //>>excludeStart("ide", pragmas.excludeIdeData);
  1968. args: [],
  1969. source: "sortedClasses\x0a\x09\x22Answer all classes in the receiver, sorted by superclass/subclasses and by class name for common subclasses (Issue #143).\x22\x0a\x0a\x09^ self class sortedClasses: self classes",
  1970. referencedClasses: [],
  1971. //>>excludeEnd("ide");
  1972. messageSends: ["sortedClasses:", "class", "classes"]
  1973. }),
  1974. $globals.Package);
  1975. $core.addMethod(
  1976. $core.method({
  1977. selector: "sortedImportsAsArray",
  1978. protocol: "private",
  1979. fn: function (){
  1980. var self=this,$self=this;
  1981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1982. return $core.withContext(function($ctx1) {
  1983. //>>excludeEnd("ctx");
  1984. var $3,$2,$4,$1,$6,$5,$7;
  1985. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  1986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1987. return $core.withContext(function($ctx2) {
  1988. //>>excludeEnd("ctx");
  1989. $3=$recv(a)._isString();
  1990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1991. $ctx2.sendIdx["isString"]=1;
  1992. //>>excludeEnd("ctx");
  1993. $2=$recv($3)._not();
  1994. $4=$recv(b)._isString();
  1995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1996. $ctx2.sendIdx["isString"]=2;
  1997. //>>excludeEnd("ctx");
  1998. $1=$recv($2).__and($4);
  1999. return $recv($1)._or_((function(){
  2000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2001. return $core.withContext(function($ctx3) {
  2002. //>>excludeEnd("ctx");
  2003. $6=$recv(a)._isString();
  2004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2005. $ctx3.sendIdx["isString"]=3;
  2006. //>>excludeEnd("ctx");
  2007. $5=$recv($6).__eq($recv(b)._isString());
  2008. return $recv($5)._and_((function(){
  2009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2010. return $core.withContext(function($ctx4) {
  2011. //>>excludeEnd("ctx");
  2012. $7=$recv(a)._value();
  2013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2014. $ctx4.sendIdx["value"]=1;
  2015. //>>excludeEnd("ctx");
  2016. return $recv($7).__lt_eq($recv(b)._value());
  2017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2018. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  2019. //>>excludeEnd("ctx");
  2020. }));
  2021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2022. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  2023. //>>excludeEnd("ctx");
  2024. }));
  2025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2026. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  2027. //>>excludeEnd("ctx");
  2028. }));
  2029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2030. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  2031. //>>excludeEnd("ctx");
  2032. },
  2033. //>>excludeStart("ide", pragmas.excludeIdeData);
  2034. args: [],
  2035. source: "sortedImportsAsArray\x0a\x09\x22Answer imports sorted first by type (associations first),\x0a\x09then by value\x22\x0a\x0a\x09^ self imports asArray\x0a\x09\x09sorted: [ :a :b |\x0a\x09\x09\x09a isString not & b isString or: [\x0a\x09\x09\x09\x09a isString = b isString and: [\x0a\x09\x09\x09\x09\x09a value <= b value ]]]",
  2036. referencedClasses: [],
  2037. //>>excludeEnd("ide");
  2038. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  2039. }),
  2040. $globals.Package);
  2041. $core.addMethod(
  2042. $core.method({
  2043. selector: "traitCompositions",
  2044. protocol: "dependencies",
  2045. fn: function (){
  2046. var self=this,$self=this;
  2047. var traitCompositions;
  2048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2049. return $core.withContext(function($ctx1) {
  2050. //>>excludeEnd("ctx");
  2051. var $1,$2,$3,$receiver;
  2052. traitCompositions=$recv($globals.Dictionary)._new();
  2053. $recv($self._classes())._do_((function(each){
  2054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2055. return $core.withContext(function($ctx2) {
  2056. //>>excludeEnd("ctx");
  2057. $1=traitCompositions;
  2058. $2=$recv(each)._traitComposition();
  2059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2060. $ctx2.sendIdx["traitComposition"]=1;
  2061. //>>excludeEnd("ctx");
  2062. $recv($1)._at_put_(each,$2);
  2063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2064. $ctx2.sendIdx["at:put:"]=1;
  2065. //>>excludeEnd("ctx");
  2066. $3=$recv(each)._theMetaClass();
  2067. if(($receiver = $3) == null || $receiver.a$nil){
  2068. return $3;
  2069. } else {
  2070. var meta;
  2071. meta=$receiver;
  2072. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  2073. }
  2074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2075. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2076. //>>excludeEnd("ctx");
  2077. }));
  2078. return $recv(traitCompositions)._reject_((function(each){
  2079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2080. return $core.withContext(function($ctx2) {
  2081. //>>excludeEnd("ctx");
  2082. return $recv(each)._isEmpty();
  2083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2084. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  2085. //>>excludeEnd("ctx");
  2086. }));
  2087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2088. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  2089. //>>excludeEnd("ctx");
  2090. },
  2091. //>>excludeStart("ide", pragmas.excludeIdeData);
  2092. args: [],
  2093. source: "traitCompositions\x0a\x09| traitCompositions |\x0a\x09traitCompositions := Dictionary new.\x0a\x09self classes do: [ :each |\x0a\x09\x09traitCompositions at: each put: each traitComposition.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | traitCompositions at: meta put: meta traitComposition ] ].\x0a\x09^ traitCompositions reject: [ :each | each isEmpty ]",
  2094. referencedClasses: ["Dictionary"],
  2095. //>>excludeEnd("ide");
  2096. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  2097. }),
  2098. $globals.Package);
  2099. $core.addMethod(
  2100. $core.method({
  2101. selector: "transport",
  2102. protocol: "accessing",
  2103. fn: function (){
  2104. var self=this,$self=this;
  2105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2106. return $core.withContext(function($ctx1) {
  2107. //>>excludeEnd("ctx");
  2108. var $1,$receiver;
  2109. $1=$self["@transport"];
  2110. if(($receiver = $1) == null || $receiver.a$nil){
  2111. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  2112. return $self["@transport"];
  2113. } else {
  2114. return $1;
  2115. }
  2116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2117. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  2118. //>>excludeEnd("ctx");
  2119. },
  2120. //>>excludeStart("ide", pragmas.excludeIdeData);
  2121. args: [],
  2122. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  2123. referencedClasses: ["PackageTransport"],
  2124. //>>excludeEnd("ide");
  2125. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  2126. }),
  2127. $globals.Package);
  2128. $core.addMethod(
  2129. $core.method({
  2130. selector: "transport:",
  2131. protocol: "accessing",
  2132. fn: function (aPackageTransport){
  2133. var self=this,$self=this;
  2134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2135. return $core.withContext(function($ctx1) {
  2136. //>>excludeEnd("ctx");
  2137. $self["@transport"]=aPackageTransport;
  2138. $recv(aPackageTransport)._package_(self);
  2139. return self;
  2140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2141. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  2142. //>>excludeEnd("ctx");
  2143. },
  2144. //>>excludeStart("ide", pragmas.excludeIdeData);
  2145. args: ["aPackageTransport"],
  2146. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  2147. referencedClasses: [],
  2148. //>>excludeEnd("ide");
  2149. messageSends: ["package:"]
  2150. }),
  2151. $globals.Package);
  2152. $core.addMethod(
  2153. $core.method({
  2154. selector: "validateImports:",
  2155. protocol: "validation",
  2156. fn: function (aCollection){
  2157. var self=this,$self=this;
  2158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2159. return $core.withContext(function($ctx1) {
  2160. //>>excludeEnd("ctx");
  2161. var $1,$2,$5,$4,$3,$6;
  2162. $recv(aCollection)._do_((function(import_){
  2163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2164. return $core.withContext(function($ctx2) {
  2165. //>>excludeEnd("ctx");
  2166. $1=$recv(import_)._isString();
  2167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2168. $ctx2.sendIdx["isString"]=1;
  2169. //>>excludeEnd("ctx");
  2170. if(!$core.assert($1)){
  2171. $2=$recv(import_)._respondsTo_("key");
  2172. if(!$core.assert($2)){
  2173. $self._error_("Imports must be Strings or Associations");
  2174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2175. $ctx2.sendIdx["error:"]=1;
  2176. //>>excludeEnd("ctx");
  2177. }
  2178. $5=$recv(import_)._key();
  2179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2180. $ctx2.sendIdx["key"]=1;
  2181. //>>excludeEnd("ctx");
  2182. $4=$recv($5)._isString();
  2183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2184. $ctx2.sendIdx["isString"]=2;
  2185. //>>excludeEnd("ctx");
  2186. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  2187. if(!$core.assert($3)){
  2188. $self._error_("Key and value must be Strings");
  2189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2190. $ctx2.sendIdx["error:"]=2;
  2191. //>>excludeEnd("ctx");
  2192. }
  2193. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  2194. if(!$core.assert($6)){
  2195. return $self._error_("Keys must be identifiers");
  2196. }
  2197. }
  2198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2199. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  2200. //>>excludeEnd("ctx");
  2201. }));
  2202. return self;
  2203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2204. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  2205. //>>excludeEnd("ctx");
  2206. },
  2207. //>>excludeStart("ide", pragmas.excludeIdeData);
  2208. args: ["aCollection"],
  2209. source: "validateImports: aCollection\x0a\x0a\x09aCollection do: [ :import |\x0a\x09\x09import isString ifFalse: [\x0a\x09\x09\x09(import respondsTo: #key) ifFalse: [\x0a\x09\x09\x09\x09self error: 'Imports must be Strings or Associations' ].\x0a\x09\x09\x09import key isString & import value isString ifFalse: [\x0a\x09\x09\x09\x09self error: 'Key and value must be Strings' ].\x0a\x09\x09\x09(import key match: '^[a-zA-Z][a-zA-Z0-9]*$') ifFalse: [\x0a\x09\x09\x09\x09self error: 'Keys must be identifiers' ]]]",
  2210. referencedClasses: [],
  2211. //>>excludeEnd("ide");
  2212. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  2213. }),
  2214. $globals.Package);
  2215. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  2216. $core.addMethod(
  2217. $core.method({
  2218. selector: "named:",
  2219. protocol: "accessing",
  2220. fn: function (aPackageName){
  2221. var self=this,$self=this;
  2222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2223. return $core.withContext(function($ctx1) {
  2224. //>>excludeEnd("ctx");
  2225. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  2226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2227. return $core.withContext(function($ctx2) {
  2228. //>>excludeEnd("ctx");
  2229. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  2230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2232. //>>excludeEnd("ctx");
  2233. }));
  2234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2235. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  2236. //>>excludeEnd("ctx");
  2237. },
  2238. //>>excludeStart("ide", pragmas.excludeIdeData);
  2239. args: ["aPackageName"],
  2240. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  2241. referencedClasses: ["Smalltalk"],
  2242. //>>excludeEnd("ide");
  2243. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  2244. }),
  2245. $globals.Package.a$cls);
  2246. $core.addMethod(
  2247. $core.method({
  2248. selector: "named:ifAbsent:",
  2249. protocol: "accessing",
  2250. fn: function (aPackageName,aBlock){
  2251. var self=this,$self=this;
  2252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2253. return $core.withContext(function($ctx1) {
  2254. //>>excludeEnd("ctx");
  2255. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  2256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2257. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  2258. //>>excludeEnd("ctx");
  2259. },
  2260. //>>excludeStart("ide", pragmas.excludeIdeData);
  2261. args: ["aPackageName", "aBlock"],
  2262. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  2263. referencedClasses: ["Smalltalk"],
  2264. //>>excludeEnd("ide");
  2265. messageSends: ["packageAt:ifAbsent:"]
  2266. }),
  2267. $globals.Package.a$cls);
  2268. $core.addMethod(
  2269. $core.method({
  2270. selector: "named:imports:transport:",
  2271. protocol: "accessing",
  2272. fn: function (aPackageName,anArray,aTransport){
  2273. var self=this,$self=this;
  2274. var pkg;
  2275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2276. return $core.withContext(function($ctx1) {
  2277. //>>excludeEnd("ctx");
  2278. pkg=$self._named_(aPackageName);
  2279. $recv(pkg)._imports_(anArray);
  2280. $recv(pkg)._transport_(aTransport);
  2281. return pkg;
  2282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2283. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  2284. //>>excludeEnd("ctx");
  2285. },
  2286. //>>excludeStart("ide", pragmas.excludeIdeData);
  2287. args: ["aPackageName", "anArray", "aTransport"],
  2288. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg imports: anArray.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  2289. referencedClasses: [],
  2290. //>>excludeEnd("ide");
  2291. messageSends: ["named:", "imports:", "transport:"]
  2292. }),
  2293. $globals.Package.a$cls);
  2294. $core.addMethod(
  2295. $core.method({
  2296. selector: "named:javaScriptDescriptor:",
  2297. protocol: "instance creation",
  2298. fn: function (aString,anObject){
  2299. var self=this,$self=this;
  2300. var pkg;
  2301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2302. return $core.withContext(function($ctx1) {
  2303. //>>excludeEnd("ctx");
  2304. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  2305. $recv(pkg)._javaScriptDescriptor_(anObject);
  2306. return pkg;
  2307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2308. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  2309. //>>excludeEnd("ctx");
  2310. },
  2311. //>>excludeStart("ide", pragmas.excludeIdeData);
  2312. args: ["aString", "anObject"],
  2313. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  2314. referencedClasses: ["Smalltalk"],
  2315. //>>excludeEnd("ide");
  2316. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  2317. }),
  2318. $globals.Package.a$cls);
  2319. $core.addMethod(
  2320. $core.method({
  2321. selector: "named:transport:",
  2322. protocol: "accessing",
  2323. fn: function (aPackageName,aTransport){
  2324. var self=this,$self=this;
  2325. var pkg;
  2326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2327. return $core.withContext(function($ctx1) {
  2328. //>>excludeEnd("ctx");
  2329. pkg=$self._named_(aPackageName);
  2330. $recv(pkg)._transport_(aTransport);
  2331. return pkg;
  2332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2333. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  2334. //>>excludeEnd("ctx");
  2335. },
  2336. //>>excludeStart("ide", pragmas.excludeIdeData);
  2337. args: ["aPackageName", "aTransport"],
  2338. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  2339. referencedClasses: [],
  2340. //>>excludeEnd("ide");
  2341. messageSends: ["named:", "transport:"]
  2342. }),
  2343. $globals.Package.a$cls);
  2344. $core.addMethod(
  2345. $core.method({
  2346. selector: "new:",
  2347. protocol: "instance creation",
  2348. fn: function (aString){
  2349. var self=this,$self=this;
  2350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2351. return $core.withContext(function($ctx1) {
  2352. //>>excludeEnd("ctx");
  2353. var $1;
  2354. $1=$recv($globals.Package)._new();
  2355. $recv($1)._name_(aString);
  2356. return $recv($1)._yourself();
  2357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2358. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  2359. //>>excludeEnd("ctx");
  2360. },
  2361. //>>excludeStart("ide", pragmas.excludeIdeData);
  2362. args: ["aString"],
  2363. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  2364. referencedClasses: ["Package"],
  2365. //>>excludeEnd("ide");
  2366. messageSends: ["name:", "new", "yourself"]
  2367. }),
  2368. $globals.Package.a$cls);
  2369. $core.addMethod(
  2370. $core.method({
  2371. selector: "sortedClasses:",
  2372. protocol: "sorting",
  2373. fn: function (classes){
  2374. var self=this,$self=this;
  2375. var children,others,nodes,expandedClasses;
  2376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2377. return $core.withContext(function($ctx1) {
  2378. //>>excludeEnd("ctx");
  2379. var $1,$3,$2;
  2380. children=[];
  2381. others=[];
  2382. $recv(classes)._do_((function(each){
  2383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2384. return $core.withContext(function($ctx2) {
  2385. //>>excludeEnd("ctx");
  2386. $1=$recv(classes)._includes_($recv(each)._superclass());
  2387. if($core.assert($1)){
  2388. return $recv(others)._add_(each);
  2389. } else {
  2390. return $recv(children)._add_(each);
  2391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2392. $ctx2.sendIdx["add:"]=1;
  2393. //>>excludeEnd("ctx");
  2394. }
  2395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2396. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2397. //>>excludeEnd("ctx");
  2398. }));
  2399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2400. $ctx1.sendIdx["do:"]=1;
  2401. //>>excludeEnd("ctx");
  2402. nodes=$recv(children)._collect_((function(each){
  2403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2404. return $core.withContext(function($ctx2) {
  2405. //>>excludeEnd("ctx");
  2406. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  2407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2408. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  2409. //>>excludeEnd("ctx");
  2410. }));
  2411. nodes=$recv(nodes)._sorted_((function(a,b){
  2412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2413. return $core.withContext(function($ctx2) {
  2414. //>>excludeEnd("ctx");
  2415. $3=$recv(a)._theClass();
  2416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2417. $ctx2.sendIdx["theClass"]=1;
  2418. //>>excludeEnd("ctx");
  2419. $2=$recv($3)._name();
  2420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2421. $ctx2.sendIdx["name"]=1;
  2422. //>>excludeEnd("ctx");
  2423. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  2424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2425. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  2426. //>>excludeEnd("ctx");
  2427. }));
  2428. expandedClasses=$recv($globals.Array)._new();
  2429. $recv(nodes)._do_((function(aNode){
  2430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2431. return $core.withContext(function($ctx2) {
  2432. //>>excludeEnd("ctx");
  2433. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  2434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2435. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  2436. //>>excludeEnd("ctx");
  2437. }));
  2438. return expandedClasses;
  2439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2440. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  2441. //>>excludeEnd("ctx");
  2442. },
  2443. //>>excludeStart("ide", pragmas.excludeIdeData);
  2444. args: ["classes"],
  2445. source: "sortedClasses: classes\x0a\x09\x22Answer classes, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)\x22\x0a\x0a\x09| children others nodes expandedClasses |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09classes do: [ :each |\x0a\x09\x09(classes includes: each superclass)\x0a\x09\x09\x09ifFalse: [ children add: each ]\x0a\x09\x09\x09ifTrue: [ others add: each ]].\x0a\x09nodes := children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: 0 ].\x0a\x09nodes := nodes sorted: [ :a :b | a theClass name <= b theClass name ].\x0a\x09expandedClasses := Array new.\x0a\x09nodes do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: expandedClasses ].\x0a\x09^ expandedClasses",
  2446. referencedClasses: ["ClassSorterNode", "Array"],
  2447. //>>excludeEnd("ide");
  2448. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  2449. }),
  2450. $globals.Package.a$cls);
  2451. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  2452. //>>excludeStart("ide", pragmas.excludeIdeData);
  2453. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  2454. //>>excludeEnd("ide");
  2455. $core.addMethod(
  2456. $core.method({
  2457. selector: "announcer",
  2458. protocol: "accessing",
  2459. fn: function (){
  2460. var self=this,$self=this;
  2461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2462. return $core.withContext(function($ctx1) {
  2463. //>>excludeEnd("ctx");
  2464. return $recv($globals.SystemAnnouncer)._current();
  2465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2466. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  2467. //>>excludeEnd("ctx");
  2468. },
  2469. //>>excludeStart("ide", pragmas.excludeIdeData);
  2470. args: [],
  2471. source: "announcer\x0a\x09^ SystemAnnouncer current",
  2472. referencedClasses: ["SystemAnnouncer"],
  2473. //>>excludeEnd("ide");
  2474. messageSends: ["current"]
  2475. }),
  2476. $globals.PackageStateObserver);
  2477. $core.addMethod(
  2478. $core.method({
  2479. selector: "observeSystem",
  2480. protocol: "actions",
  2481. fn: function (){
  2482. var self=this,$self=this;
  2483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2484. return $core.withContext(function($ctx1) {
  2485. //>>excludeEnd("ctx");
  2486. var $1;
  2487. $1=$self._announcer();
  2488. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  2489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2490. $ctx1.sendIdx["on:send:to:"]=1;
  2491. //>>excludeEnd("ctx");
  2492. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  2493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2494. $ctx1.sendIdx["on:send:to:"]=2;
  2495. //>>excludeEnd("ctx");
  2496. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  2497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2498. $ctx1.sendIdx["on:send:to:"]=3;
  2499. //>>excludeEnd("ctx");
  2500. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  2501. return self;
  2502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2503. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  2504. //>>excludeEnd("ctx");
  2505. },
  2506. //>>excludeStart("ide", pragmas.excludeIdeData);
  2507. args: [],
  2508. source: "observeSystem\x0a\x09self announcer\x0a\x09\x09on: PackageAdded\x0a\x09\x09send: #onPackageAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassAnnouncement\x0a\x09\x09send: #onClassModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: MethodAnnouncement\x0a\x09\x09send: #onMethodModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ProtocolAnnouncement\x0a\x09\x09send: #onProtocolModification:\x0a\x09\x09to: self",
  2509. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  2510. //>>excludeEnd("ide");
  2511. messageSends: ["on:send:to:", "announcer"]
  2512. }),
  2513. $globals.PackageStateObserver);
  2514. $core.addMethod(
  2515. $core.method({
  2516. selector: "onClassModification:",
  2517. protocol: "reactions",
  2518. fn: function (anAnnouncement){
  2519. var self=this,$self=this;
  2520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2521. return $core.withContext(function($ctx1) {
  2522. //>>excludeEnd("ctx");
  2523. var $1,$receiver;
  2524. $1=$recv(anAnnouncement)._theClass();
  2525. if(($receiver = $1) == null || $receiver.a$nil){
  2526. $1;
  2527. } else {
  2528. var theClass;
  2529. theClass=$receiver;
  2530. $recv($recv(theClass)._package())._beDirty();
  2531. }
  2532. return self;
  2533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2534. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2535. //>>excludeEnd("ctx");
  2536. },
  2537. //>>excludeStart("ide", pragmas.excludeIdeData);
  2538. args: ["anAnnouncement"],
  2539. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  2540. referencedClasses: [],
  2541. //>>excludeEnd("ide");
  2542. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  2543. }),
  2544. $globals.PackageStateObserver);
  2545. $core.addMethod(
  2546. $core.method({
  2547. selector: "onMethodModification:",
  2548. protocol: "reactions",
  2549. fn: function (anAnnouncement){
  2550. var self=this,$self=this;
  2551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2552. return $core.withContext(function($ctx1) {
  2553. //>>excludeEnd("ctx");
  2554. var $1,$receiver;
  2555. $1=$recv($recv(anAnnouncement)._method())._package();
  2556. if(($receiver = $1) == null || $receiver.a$nil){
  2557. $1;
  2558. } else {
  2559. var package_;
  2560. package_=$receiver;
  2561. $recv(package_)._beDirty();
  2562. }
  2563. return self;
  2564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2565. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2566. //>>excludeEnd("ctx");
  2567. },
  2568. //>>excludeStart("ide", pragmas.excludeIdeData);
  2569. args: ["anAnnouncement"],
  2570. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  2571. referencedClasses: [],
  2572. //>>excludeEnd("ide");
  2573. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  2574. }),
  2575. $globals.PackageStateObserver);
  2576. $core.addMethod(
  2577. $core.method({
  2578. selector: "onPackageAdded:",
  2579. protocol: "reactions",
  2580. fn: function (anAnnouncement){
  2581. var self=this,$self=this;
  2582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2583. return $core.withContext(function($ctx1) {
  2584. //>>excludeEnd("ctx");
  2585. $recv($recv(anAnnouncement)._package())._beDirty();
  2586. return self;
  2587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2588. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2589. //>>excludeEnd("ctx");
  2590. },
  2591. //>>excludeStart("ide", pragmas.excludeIdeData);
  2592. args: ["anAnnouncement"],
  2593. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  2594. referencedClasses: [],
  2595. //>>excludeEnd("ide");
  2596. messageSends: ["beDirty", "package"]
  2597. }),
  2598. $globals.PackageStateObserver);
  2599. $core.addMethod(
  2600. $core.method({
  2601. selector: "onProtocolModification:",
  2602. protocol: "reactions",
  2603. fn: function (anAnnouncement){
  2604. var self=this,$self=this;
  2605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2606. return $core.withContext(function($ctx1) {
  2607. //>>excludeEnd("ctx");
  2608. var $1,$receiver;
  2609. $1=$recv(anAnnouncement)._package();
  2610. if(($receiver = $1) == null || $receiver.a$nil){
  2611. $1;
  2612. } else {
  2613. var package_;
  2614. package_=$receiver;
  2615. $recv(package_)._beDirty();
  2616. }
  2617. return self;
  2618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2619. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2620. //>>excludeEnd("ctx");
  2621. },
  2622. //>>excludeStart("ide", pragmas.excludeIdeData);
  2623. args: ["anAnnouncement"],
  2624. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  2625. referencedClasses: [],
  2626. //>>excludeEnd("ide");
  2627. messageSends: ["ifNotNil:", "package", "beDirty"]
  2628. }),
  2629. $globals.PackageStateObserver);
  2630. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  2631. $core.addMethod(
  2632. $core.method({
  2633. selector: "current",
  2634. protocol: "accessing",
  2635. fn: function (){
  2636. var self=this,$self=this;
  2637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2638. return $core.withContext(function($ctx1) {
  2639. //>>excludeEnd("ctx");
  2640. var $1,$receiver;
  2641. $1=$self["@current"];
  2642. if(($receiver = $1) == null || $receiver.a$nil){
  2643. $self["@current"]=$self._new();
  2644. return $self["@current"];
  2645. } else {
  2646. return $1;
  2647. }
  2648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2649. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  2650. //>>excludeEnd("ctx");
  2651. },
  2652. //>>excludeStart("ide", pragmas.excludeIdeData);
  2653. args: [],
  2654. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  2655. referencedClasses: [],
  2656. //>>excludeEnd("ide");
  2657. messageSends: ["ifNil:", "new"]
  2658. }),
  2659. $globals.PackageStateObserver.a$cls);
  2660. $core.addMethod(
  2661. $core.method({
  2662. selector: "initialize",
  2663. protocol: "initialization",
  2664. fn: function (){
  2665. var self=this,$self=this;
  2666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2667. return $core.withContext(function($ctx1) {
  2668. //>>excludeEnd("ctx");
  2669. $recv($self._current())._observeSystem();
  2670. return self;
  2671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2672. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  2673. //>>excludeEnd("ctx");
  2674. },
  2675. //>>excludeStart("ide", pragmas.excludeIdeData);
  2676. args: [],
  2677. source: "initialize\x0a\x09self current observeSystem",
  2678. referencedClasses: [],
  2679. //>>excludeEnd("ide");
  2680. messageSends: ["observeSystem", "current"]
  2681. }),
  2682. $globals.PackageStateObserver.a$cls);
  2683. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  2684. //>>excludeStart("ide", pragmas.excludeIdeData);
  2685. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  2686. //>>excludeEnd("ide");
  2687. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  2688. //>>excludeStart("ide", pragmas.excludeIdeData);
  2689. $globals.Setting.comment="I represent a setting **stored** at `Smalltalk settings`. \x0aIn the current implementation, `Smalltalk settings` is an object persisted in the localStorage.\x0a\x0a## API\x0a\x0aA `Setting` value can be read using `value` and set using `value:`.\x0a\x0aSettings are accessed with `'key' asSetting` or `'key' asSettingIfAbsent: aDefaultValue`.\x0a\x0aTo read the value of a setting you can also use the convenience:\x0a\x0a`theValueSet := 'any.characteristic' settingValue` \x0a\x0aor with a default using:\x0a\x0a `theEnsuredValueSet := 'any.characteristic' settingValueIfAbsent: true`";
  2690. //>>excludeEnd("ide");
  2691. $core.addMethod(
  2692. $core.method({
  2693. selector: "defaultValue",
  2694. protocol: "accessing",
  2695. fn: function (){
  2696. var self=this,$self=this;
  2697. return $self["@defaultValue"];
  2698. },
  2699. //>>excludeStart("ide", pragmas.excludeIdeData);
  2700. args: [],
  2701. source: "defaultValue\x0a\x09^ defaultValue",
  2702. referencedClasses: [],
  2703. //>>excludeEnd("ide");
  2704. messageSends: []
  2705. }),
  2706. $globals.Setting);
  2707. $core.addMethod(
  2708. $core.method({
  2709. selector: "defaultValue:",
  2710. protocol: "accessing",
  2711. fn: function (aStringifiableObject){
  2712. var self=this,$self=this;
  2713. $self["@defaultValue"]=aStringifiableObject;
  2714. return self;
  2715. },
  2716. //>>excludeStart("ide", pragmas.excludeIdeData);
  2717. args: ["aStringifiableObject"],
  2718. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  2719. referencedClasses: [],
  2720. //>>excludeEnd("ide");
  2721. messageSends: []
  2722. }),
  2723. $globals.Setting);
  2724. $core.addMethod(
  2725. $core.method({
  2726. selector: "key",
  2727. protocol: "accessing",
  2728. fn: function (){
  2729. var self=this,$self=this;
  2730. return $self["@key"];
  2731. },
  2732. //>>excludeStart("ide", pragmas.excludeIdeData);
  2733. args: [],
  2734. source: "key\x0a\x09^ key",
  2735. referencedClasses: [],
  2736. //>>excludeEnd("ide");
  2737. messageSends: []
  2738. }),
  2739. $globals.Setting);
  2740. $core.addMethod(
  2741. $core.method({
  2742. selector: "key:",
  2743. protocol: "accessing",
  2744. fn: function (aString){
  2745. var self=this,$self=this;
  2746. $self["@key"]=aString;
  2747. return self;
  2748. },
  2749. //>>excludeStart("ide", pragmas.excludeIdeData);
  2750. args: ["aString"],
  2751. source: "key: aString\x0a\x09key := aString",
  2752. referencedClasses: [],
  2753. //>>excludeEnd("ide");
  2754. messageSends: []
  2755. }),
  2756. $globals.Setting);
  2757. $core.addMethod(
  2758. $core.method({
  2759. selector: "value",
  2760. protocol: "accessing",
  2761. fn: function (){
  2762. var self=this,$self=this;
  2763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2764. return $core.withContext(function($ctx1) {
  2765. //>>excludeEnd("ctx");
  2766. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  2767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2768. return $core.withContext(function($ctx2) {
  2769. //>>excludeEnd("ctx");
  2770. return $self._defaultValue();
  2771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2773. //>>excludeEnd("ctx");
  2774. }));
  2775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2776. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  2777. //>>excludeEnd("ctx");
  2778. },
  2779. //>>excludeStart("ide", pragmas.excludeIdeData);
  2780. args: [],
  2781. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  2782. referencedClasses: ["Smalltalk"],
  2783. //>>excludeEnd("ide");
  2784. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  2785. }),
  2786. $globals.Setting);
  2787. $core.addMethod(
  2788. $core.method({
  2789. selector: "value:",
  2790. protocol: "accessing",
  2791. fn: function (aStringifiableObject){
  2792. var self=this,$self=this;
  2793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2794. return $core.withContext(function($ctx1) {
  2795. //>>excludeEnd("ctx");
  2796. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  2797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2798. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  2799. //>>excludeEnd("ctx");
  2800. },
  2801. //>>excludeStart("ide", pragmas.excludeIdeData);
  2802. args: ["aStringifiableObject"],
  2803. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  2804. referencedClasses: ["Smalltalk"],
  2805. //>>excludeEnd("ide");
  2806. messageSends: ["at:put:", "settings", "key"]
  2807. }),
  2808. $globals.Setting);
  2809. $core.addMethod(
  2810. $core.method({
  2811. selector: "at:ifAbsent:",
  2812. protocol: "instance creation",
  2813. fn: function (aString,aDefaultValue){
  2814. var self=this,$self=this;
  2815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2816. return $core.withContext(function($ctx1) {
  2817. //>>excludeEnd("ctx");
  2818. var $1;
  2819. $1=(
  2820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2821. $ctx1.supercall = true,
  2822. //>>excludeEnd("ctx");
  2823. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  2824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2825. $ctx1.supercall = false;
  2826. //>>excludeEnd("ctx");;
  2827. $recv($1)._key_(aString);
  2828. $recv($1)._defaultValue_(aDefaultValue);
  2829. return $recv($1)._yourself();
  2830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2831. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  2832. //>>excludeEnd("ctx");
  2833. },
  2834. //>>excludeStart("ide", pragmas.excludeIdeData);
  2835. args: ["aString", "aDefaultValue"],
  2836. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  2837. referencedClasses: [],
  2838. //>>excludeEnd("ide");
  2839. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  2840. }),
  2841. $globals.Setting.a$cls);
  2842. $core.addMethod(
  2843. $core.method({
  2844. selector: "new",
  2845. protocol: "instance creation",
  2846. fn: function (){
  2847. var self=this,$self=this;
  2848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2849. return $core.withContext(function($ctx1) {
  2850. //>>excludeEnd("ctx");
  2851. $self._shouldNotImplement();
  2852. return self;
  2853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2854. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  2855. //>>excludeEnd("ctx");
  2856. },
  2857. //>>excludeStart("ide", pragmas.excludeIdeData);
  2858. args: [],
  2859. source: "new\x0a\x09self shouldNotImplement",
  2860. referencedClasses: [],
  2861. //>>excludeEnd("ide");
  2862. messageSends: ["shouldNotImplement"]
  2863. }),
  2864. $globals.Setting.a$cls);
  2865. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  2866. //>>excludeStart("ide", pragmas.excludeIdeData);
  2867. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#globals #at:` answers a specific global (usually, a class) or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `support/parser.js` parser file in order to work.";
  2868. //>>excludeEnd("ide");
  2869. $core.addMethod(
  2870. $core.method({
  2871. selector: "addGlobalJsVariable:",
  2872. protocol: "globals",
  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._globalJsVariables())._add_(aString);
  2879. return self;
  2880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2881. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  2882. //>>excludeEnd("ctx");
  2883. },
  2884. //>>excludeStart("ide", pragmas.excludeIdeData);
  2885. args: ["aString"],
  2886. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  2887. referencedClasses: [],
  2888. //>>excludeEnd("ide");
  2889. messageSends: ["add:", "globalJsVariables"]
  2890. }),
  2891. $globals.SmalltalkImage);
  2892. $core.addMethod(
  2893. $core.method({
  2894. selector: "adoptPackageDictionary",
  2895. protocol: "private",
  2896. fn: function (){
  2897. var self=this,$self=this;
  2898. var adopted;
  2899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2900. return $core.withContext(function($ctx1) {
  2901. //>>excludeEnd("ctx");
  2902. adopted=[];
  2903. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  2904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2905. return $core.withContext(function($ctx2) {
  2906. //>>excludeEnd("ctx");
  2907. return $recv(adopted)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  2908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2909. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2910. //>>excludeEnd("ctx");
  2911. }));
  2912. return adopted;
  2913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2914. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDictionary",{adopted:adopted},$globals.SmalltalkImage)});
  2915. //>>excludeEnd("ctx");
  2916. },
  2917. //>>excludeStart("ide", pragmas.excludeIdeData);
  2918. args: [],
  2919. source: "adoptPackageDictionary\x0a\x09| adopted |\x0a\x09adopted := #().\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value |\x0a\x09\x09adopted add: (Package named: key javaScriptDescriptor: value) ].\x0a\x09^ adopted",
  2920. referencedClasses: ["Package"],
  2921. //>>excludeEnd("ide");
  2922. messageSends: ["keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:"]
  2923. }),
  2924. $globals.SmalltalkImage);
  2925. $core.addMethod(
  2926. $core.method({
  2927. selector: "amdRequire",
  2928. protocol: "accessing amd",
  2929. fn: function (){
  2930. var self=this,$self=this;
  2931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2932. return $core.withContext(function($ctx1) {
  2933. //>>excludeEnd("ctx");
  2934. return $recv($self._core())._at_("amdRequire");
  2935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2936. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  2937. //>>excludeEnd("ctx");
  2938. },
  2939. //>>excludeStart("ide", pragmas.excludeIdeData);
  2940. args: [],
  2941. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  2942. referencedClasses: [],
  2943. //>>excludeEnd("ide");
  2944. messageSends: ["at:", "core"]
  2945. }),
  2946. $globals.SmalltalkImage);
  2947. $core.addMethod(
  2948. $core.method({
  2949. selector: "asSmalltalkException:",
  2950. protocol: "error handling",
  2951. fn: function (anObject){
  2952. var self=this,$self=this;
  2953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2954. return $core.withContext(function($ctx1) {
  2955. //>>excludeEnd("ctx");
  2956. var $1;
  2957. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  2958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2959. return $core.withContext(function($ctx2) {
  2960. //>>excludeEnd("ctx");
  2961. return $recv(anObject)._isKindOf_($globals.Error);
  2962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2964. //>>excludeEnd("ctx");
  2965. }));
  2966. if($core.assert($1)){
  2967. return anObject;
  2968. } else {
  2969. return $recv($globals.JavaScriptException)._on_(anObject);
  2970. }
  2971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2972. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  2973. //>>excludeEnd("ctx");
  2974. },
  2975. //>>excludeStart("ide", pragmas.excludeIdeData);
  2976. args: ["anObject"],
  2977. source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a\x09We then need to convert it back to a Smalltalk object\x22\x0a\x09\x0a\x09^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]",
  2978. referencedClasses: ["Error", "JavaScriptException"],
  2979. //>>excludeEnd("ide");
  2980. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  2981. }),
  2982. $globals.SmalltalkImage);
  2983. $core.addMethod(
  2984. $core.method({
  2985. selector: "basicCreatePackage:",
  2986. protocol: "private",
  2987. fn: function (packageName){
  2988. var self=this,$self=this;
  2989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2990. return $core.withContext(function($ctx1) {
  2991. //>>excludeEnd("ctx");
  2992. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  2993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2994. return $core.withContext(function($ctx2) {
  2995. //>>excludeEnd("ctx");
  2996. return $recv($globals.Package)._new_(packageName);
  2997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2999. //>>excludeEnd("ctx");
  3000. }));
  3001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3002. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  3003. //>>excludeEnd("ctx");
  3004. },
  3005. //>>excludeStart("ide", pragmas.excludeIdeData);
  3006. args: ["packageName"],
  3007. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09^ self packageDictionary at: packageName ifAbsentPut: [ Package new: packageName ]",
  3008. referencedClasses: ["Package"],
  3009. //>>excludeEnd("ide");
  3010. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  3011. }),
  3012. $globals.SmalltalkImage);
  3013. $core.addMethod(
  3014. $core.method({
  3015. selector: "basicParse:",
  3016. protocol: "private",
  3017. fn: function (aString){
  3018. var self=this,$self=this;
  3019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3020. return $core.withContext(function($ctx1) {
  3021. //>>excludeEnd("ctx");
  3022. return $recv($globals.SmalltalkParser)._parse_(aString);
  3023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3024. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  3025. //>>excludeEnd("ctx");
  3026. },
  3027. //>>excludeStart("ide", pragmas.excludeIdeData);
  3028. args: ["aString"],
  3029. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  3030. referencedClasses: ["SmalltalkParser"],
  3031. //>>excludeEnd("ide");
  3032. messageSends: ["parse:"]
  3033. }),
  3034. $globals.SmalltalkImage);
  3035. $core.addMethod(
  3036. $core.method({
  3037. selector: "cancelOptOut:",
  3038. protocol: "accessing",
  3039. fn: function (anObject){
  3040. var self=this,$self=this;
  3041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3042. return $core.withContext(function($ctx1) {
  3043. //>>excludeEnd("ctx");
  3044. delete anObject.klass; delete anObject.a$cls;;
  3045. return self;
  3046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3047. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  3048. //>>excludeEnd("ctx");
  3049. },
  3050. //>>excludeStart("ide", pragmas.excludeIdeData);
  3051. args: ["anObject"],
  3052. source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<inlineJS: 'delete anObject.klass; delete anObject.a$cls;'>",
  3053. referencedClasses: [],
  3054. //>>excludeEnd("ide");
  3055. messageSends: []
  3056. }),
  3057. $globals.SmalltalkImage);
  3058. $core.addMethod(
  3059. $core.method({
  3060. selector: "classes",
  3061. protocol: "classes",
  3062. fn: function (){
  3063. var self=this,$self=this;
  3064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3065. return $core.withContext(function($ctx1) {
  3066. //>>excludeEnd("ctx");
  3067. return $recv($recv($self._core())._traitsOrClasses())._copy();
  3068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3069. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  3070. //>>excludeEnd("ctx");
  3071. },
  3072. //>>excludeStart("ide", pragmas.excludeIdeData);
  3073. args: [],
  3074. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  3075. referencedClasses: [],
  3076. //>>excludeEnd("ide");
  3077. messageSends: ["copy", "traitsOrClasses", "core"]
  3078. }),
  3079. $globals.SmalltalkImage);
  3080. $core.addMethod(
  3081. $core.method({
  3082. selector: "core",
  3083. protocol: "accessing",
  3084. fn: function (){
  3085. var self=this,$self=this;
  3086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3087. return $core.withContext(function($ctx1) {
  3088. //>>excludeEnd("ctx");
  3089. return $core;
  3090. return self;
  3091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3092. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  3093. //>>excludeEnd("ctx");
  3094. },
  3095. //>>excludeStart("ide", pragmas.excludeIdeData);
  3096. args: [],
  3097. source: "core\x0a\x09<inlineJS: 'return $core'>",
  3098. referencedClasses: [],
  3099. //>>excludeEnd("ide");
  3100. messageSends: []
  3101. }),
  3102. $globals.SmalltalkImage);
  3103. $core.addMethod(
  3104. $core.method({
  3105. selector: "createPackage:",
  3106. protocol: "packages",
  3107. fn: function (packageName){
  3108. var self=this,$self=this;
  3109. var package_,announcement;
  3110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3111. return $core.withContext(function($ctx1) {
  3112. //>>excludeEnd("ctx");
  3113. var $1;
  3114. package_=$self._basicCreatePackage_(packageName);
  3115. $1=$recv($globals.PackageAdded)._new();
  3116. $recv($1)._package_(package_);
  3117. announcement=$recv($1)._yourself();
  3118. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  3119. return package_;
  3120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3121. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  3122. //>>excludeEnd("ctx");
  3123. },
  3124. //>>excludeStart("ide", pragmas.excludeIdeData);
  3125. args: ["packageName"],
  3126. source: "createPackage: packageName\x0a\x09| package announcement |\x0a\x09\x0a\x09package := self basicCreatePackage: packageName.\x0a\x09\x0a\x09announcement := PackageAdded new\x0a\x09\x09package: package;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09SystemAnnouncer current announce: announcement.\x0a\x09\x0a\x09^ package",
  3127. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  3128. //>>excludeEnd("ide");
  3129. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  3130. }),
  3131. $globals.SmalltalkImage);
  3132. $core.addMethod(
  3133. $core.method({
  3134. selector: "defaultAmdNamespace",
  3135. protocol: "accessing amd",
  3136. fn: function (){
  3137. var self=this,$self=this;
  3138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3139. return $core.withContext(function($ctx1) {
  3140. //>>excludeEnd("ctx");
  3141. return "transport.defaultAmdNamespace"._settingValue();
  3142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3143. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  3144. //>>excludeEnd("ctx");
  3145. },
  3146. //>>excludeStart("ide", pragmas.excludeIdeData);
  3147. args: [],
  3148. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  3149. referencedClasses: [],
  3150. //>>excludeEnd("ide");
  3151. messageSends: ["settingValue"]
  3152. }),
  3153. $globals.SmalltalkImage);
  3154. $core.addMethod(
  3155. $core.method({
  3156. selector: "defaultAmdNamespace:",
  3157. protocol: "accessing amd",
  3158. fn: function (aString){
  3159. var self=this,$self=this;
  3160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3161. return $core.withContext(function($ctx1) {
  3162. //>>excludeEnd("ctx");
  3163. "transport.defaultAmdNamespace"._settingValue_(aString);
  3164. return self;
  3165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3166. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  3167. //>>excludeEnd("ctx");
  3168. },
  3169. //>>excludeStart("ide", pragmas.excludeIdeData);
  3170. args: ["aString"],
  3171. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  3172. referencedClasses: [],
  3173. //>>excludeEnd("ide");
  3174. messageSends: ["settingValue:"]
  3175. }),
  3176. $globals.SmalltalkImage);
  3177. $core.addMethod(
  3178. $core.method({
  3179. selector: "deleteClass:",
  3180. protocol: "private",
  3181. fn: function (aClass){
  3182. var self=this,$self=this;
  3183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3184. return $core.withContext(function($ctx1) {
  3185. //>>excludeEnd("ctx");
  3186. $core.removeClass(aClass);
  3187. return self;
  3188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3189. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  3190. //>>excludeEnd("ctx");
  3191. },
  3192. //>>excludeStart("ide", pragmas.excludeIdeData);
  3193. args: ["aClass"],
  3194. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  3195. referencedClasses: [],
  3196. //>>excludeEnd("ide");
  3197. messageSends: []
  3198. }),
  3199. $globals.SmalltalkImage);
  3200. $core.addMethod(
  3201. $core.method({
  3202. selector: "deleteGlobalJsVariable:",
  3203. protocol: "globals",
  3204. fn: function (aString){
  3205. var self=this,$self=this;
  3206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3207. return $core.withContext(function($ctx1) {
  3208. //>>excludeEnd("ctx");
  3209. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  3210. }));
  3211. return self;
  3212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3213. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  3214. //>>excludeEnd("ctx");
  3215. },
  3216. //>>excludeStart("ide", pragmas.excludeIdeData);
  3217. args: ["aString"],
  3218. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  3219. referencedClasses: [],
  3220. //>>excludeEnd("ide");
  3221. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  3222. }),
  3223. $globals.SmalltalkImage);
  3224. $core.addMethod(
  3225. $core.method({
  3226. selector: "existsJsGlobal:",
  3227. protocol: "testing",
  3228. fn: function (aString){
  3229. var self=this,$self=this;
  3230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3231. return $core.withContext(function($ctx1) {
  3232. //>>excludeEnd("ctx");
  3233. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  3234. return $recv($globals.Platform)._includesGlobal_(aString);
  3235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3236. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  3237. //>>excludeEnd("ctx");
  3238. },
  3239. //>>excludeStart("ide", pragmas.excludeIdeData);
  3240. args: ["aString"],
  3241. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  3242. referencedClasses: ["Platform"],
  3243. //>>excludeEnd("ide");
  3244. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  3245. }),
  3246. $globals.SmalltalkImage);
  3247. $core.addMethod(
  3248. $core.method({
  3249. selector: "globalJsVariables",
  3250. protocol: "globals",
  3251. fn: function (){
  3252. var self=this,$self=this;
  3253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3254. return $core.withContext(function($ctx1) {
  3255. //>>excludeEnd("ctx");
  3256. var $1,$receiver;
  3257. $1=$self["@globalJsVariables"];
  3258. if(($receiver = $1) == null || $receiver.a$nil){
  3259. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  3260. return $self["@globalJsVariables"];
  3261. } else {
  3262. return $1;
  3263. }
  3264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3265. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  3266. //>>excludeEnd("ctx");
  3267. },
  3268. //>>excludeStart("ide", pragmas.excludeIdeData);
  3269. args: [],
  3270. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  3271. referencedClasses: [],
  3272. //>>excludeEnd("ide");
  3273. messageSends: ["ifNil:"]
  3274. }),
  3275. $globals.SmalltalkImage);
  3276. $core.addMethod(
  3277. $core.method({
  3278. selector: "globals",
  3279. protocol: "accessing",
  3280. fn: function (){
  3281. var self=this,$self=this;
  3282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3283. return $core.withContext(function($ctx1) {
  3284. //>>excludeEnd("ctx");
  3285. return $globals;
  3286. return self;
  3287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3288. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  3289. //>>excludeEnd("ctx");
  3290. },
  3291. //>>excludeStart("ide", pragmas.excludeIdeData);
  3292. args: [],
  3293. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  3294. referencedClasses: [],
  3295. //>>excludeEnd("ide");
  3296. messageSends: []
  3297. }),
  3298. $globals.SmalltalkImage);
  3299. $core.addMethod(
  3300. $core.method({
  3301. selector: "includesKey:",
  3302. protocol: "accessing",
  3303. fn: function (aKey){
  3304. var self=this,$self=this;
  3305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3306. return $core.withContext(function($ctx1) {
  3307. //>>excludeEnd("ctx");
  3308. return $core.hasOwnProperty(aKey);
  3309. return self;
  3310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3311. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  3312. //>>excludeEnd("ctx");
  3313. },
  3314. //>>excludeStart("ide", pragmas.excludeIdeData);
  3315. args: ["aKey"],
  3316. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  3317. referencedClasses: [],
  3318. //>>excludeEnd("ide");
  3319. messageSends: []
  3320. }),
  3321. $globals.SmalltalkImage);
  3322. $core.addMethod(
  3323. $core.method({
  3324. selector: "isSmalltalkObject:",
  3325. protocol: "testing",
  3326. fn: function (anObject){
  3327. var self=this,$self=this;
  3328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3329. return $core.withContext(function($ctx1) {
  3330. //>>excludeEnd("ctx");
  3331. return anObject.a$cls != null;
  3332. return self;
  3333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3334. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  3335. //>>excludeEnd("ctx");
  3336. },
  3337. //>>excludeStart("ide", pragmas.excludeIdeData);
  3338. args: ["anObject"],
  3339. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'a$cls' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.a$cls != null'>",
  3340. referencedClasses: [],
  3341. //>>excludeEnd("ide");
  3342. messageSends: []
  3343. }),
  3344. $globals.SmalltalkImage);
  3345. $core.addMethod(
  3346. $core.method({
  3347. selector: "optOut:",
  3348. protocol: "accessing",
  3349. fn: function (anObject){
  3350. var self=this,$self=this;
  3351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3352. return $core.withContext(function($ctx1) {
  3353. //>>excludeEnd("ctx");
  3354. anObject.klass = null; anObject.a$cls = null;
  3355. return self;
  3356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3357. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  3358. //>>excludeEnd("ctx");
  3359. },
  3360. //>>excludeStart("ide", pragmas.excludeIdeData);
  3361. args: ["anObject"],
  3362. source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<inlineJS: 'anObject.klass = null; anObject.a$cls = null'>",
  3363. referencedClasses: [],
  3364. //>>excludeEnd("ide");
  3365. messageSends: []
  3366. }),
  3367. $globals.SmalltalkImage);
  3368. $core.addMethod(
  3369. $core.method({
  3370. selector: "packageAt:",
  3371. protocol: "packages",
  3372. fn: function (packageName){
  3373. var self=this,$self=this;
  3374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3375. return $core.withContext(function($ctx1) {
  3376. //>>excludeEnd("ctx");
  3377. $self._deprecatedAPI_("Use #packageAt:ifAbsent: directly.");
  3378. return $self._packageAt_ifAbsent_(packageName,(function(){
  3379. }));
  3380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3381. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  3382. //>>excludeEnd("ctx");
  3383. },
  3384. //>>excludeStart("ide", pragmas.excludeIdeData);
  3385. args: ["packageName"],
  3386. source: "packageAt: packageName\x0a\x09self deprecatedAPI: 'Use #packageAt:ifAbsent: directly.'.\x0a\x09^ self packageAt: packageName ifAbsent: []",
  3387. referencedClasses: [],
  3388. //>>excludeEnd("ide");
  3389. messageSends: ["deprecatedAPI:", "packageAt:ifAbsent:"]
  3390. }),
  3391. $globals.SmalltalkImage);
  3392. $core.addMethod(
  3393. $core.method({
  3394. selector: "packageAt:ifAbsent:",
  3395. protocol: "packages",
  3396. fn: function (packageName,aBlock){
  3397. var self=this,$self=this;
  3398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3399. return $core.withContext(function($ctx1) {
  3400. //>>excludeEnd("ctx");
  3401. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  3402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3403. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  3404. //>>excludeEnd("ctx");
  3405. },
  3406. //>>excludeStart("ide", pragmas.excludeIdeData);
  3407. args: ["packageName", "aBlock"],
  3408. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  3409. referencedClasses: [],
  3410. //>>excludeEnd("ide");
  3411. messageSends: ["at:ifAbsent:", "packageDictionary"]
  3412. }),
  3413. $globals.SmalltalkImage);
  3414. $core.addMethod(
  3415. $core.method({
  3416. selector: "packageAt:ifPresent:",
  3417. protocol: "packages",
  3418. fn: function (packageName,aBlock){
  3419. var self=this,$self=this;
  3420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3421. return $core.withContext(function($ctx1) {
  3422. //>>excludeEnd("ctx");
  3423. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  3424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3425. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  3426. //>>excludeEnd("ctx");
  3427. },
  3428. //>>excludeStart("ide", pragmas.excludeIdeData);
  3429. args: ["packageName", "aBlock"],
  3430. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  3431. referencedClasses: [],
  3432. //>>excludeEnd("ide");
  3433. messageSends: ["at:ifPresent:", "packageDictionary"]
  3434. }),
  3435. $globals.SmalltalkImage);
  3436. $core.addMethod(
  3437. $core.method({
  3438. selector: "packageDictionary",
  3439. protocol: "packages",
  3440. fn: function (){
  3441. var self=this,$self=this;
  3442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3443. return $core.withContext(function($ctx1) {
  3444. //>>excludeEnd("ctx");
  3445. var $1,$receiver;
  3446. $1=$self["@packageDictionary"];
  3447. if(($receiver = $1) == null || $receiver.a$nil){
  3448. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  3449. return $self["@packageDictionary"];
  3450. } else {
  3451. return $1;
  3452. }
  3453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3454. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  3455. //>>excludeEnd("ctx");
  3456. },
  3457. //>>excludeStart("ide", pragmas.excludeIdeData);
  3458. args: [],
  3459. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  3460. referencedClasses: ["Dictionary"],
  3461. //>>excludeEnd("ide");
  3462. messageSends: ["ifNil:", "new"]
  3463. }),
  3464. $globals.SmalltalkImage);
  3465. $core.addMethod(
  3466. $core.method({
  3467. selector: "packages",
  3468. protocol: "packages",
  3469. fn: function (){
  3470. var self=this,$self=this;
  3471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3472. return $core.withContext(function($ctx1) {
  3473. //>>excludeEnd("ctx");
  3474. return $recv($recv($self._packageDictionary())._values())._copy();
  3475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3476. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  3477. //>>excludeEnd("ctx");
  3478. },
  3479. //>>excludeStart("ide", pragmas.excludeIdeData);
  3480. args: [],
  3481. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  3482. referencedClasses: [],
  3483. //>>excludeEnd("ide");
  3484. messageSends: ["copy", "values", "packageDictionary"]
  3485. }),
  3486. $globals.SmalltalkImage);
  3487. $core.addMethod(
  3488. $core.method({
  3489. selector: "parse:",
  3490. protocol: "accessing",
  3491. fn: function (aString){
  3492. var self=this,$self=this;
  3493. var result;
  3494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3495. return $core.withContext(function($ctx1) {
  3496. //>>excludeEnd("ctx");
  3497. var $1;
  3498. $recv((function(){
  3499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3500. return $core.withContext(function($ctx2) {
  3501. //>>excludeEnd("ctx");
  3502. result=$self._basicParse_(aString);
  3503. return result;
  3504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3505. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3506. //>>excludeEnd("ctx");
  3507. }))._tryCatch_((function(ex){
  3508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3509. return $core.withContext(function($ctx2) {
  3510. //>>excludeEnd("ctx");
  3511. return $recv($self._parseError_parsing_(ex,aString))._signal();
  3512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3513. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  3514. //>>excludeEnd("ctx");
  3515. }));
  3516. $1=result;
  3517. $recv($1)._source_(aString);
  3518. return $recv($1)._yourself();
  3519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3520. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  3521. //>>excludeEnd("ctx");
  3522. },
  3523. //>>excludeStart("ide", pragmas.excludeIdeData);
  3524. args: ["aString"],
  3525. source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09[ result := self basicParse: aString ] \x0a\x09\x09tryCatch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
  3526. referencedClasses: [],
  3527. //>>excludeEnd("ide");
  3528. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  3529. }),
  3530. $globals.SmalltalkImage);
  3531. $core.addMethod(
  3532. $core.method({
  3533. selector: "parseError:parsing:",
  3534. protocol: "error handling",
  3535. fn: function (anException,aString){
  3536. var self=this,$self=this;
  3537. var pos;
  3538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3539. return $core.withContext(function($ctx1) {
  3540. //>>excludeEnd("ctx");
  3541. var $1,$2,$6,$5,$4,$3;
  3542. $1=$recv(anException)._basicAt_("location");
  3543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3544. $ctx1.sendIdx["basicAt:"]=1;
  3545. //>>excludeEnd("ctx");
  3546. pos=$recv($1)._start();
  3547. $2=$recv($globals.ParseError)._new();
  3548. $6=$recv("Parse error on line ".__comma($recv(pos)._line())).__comma(" column ");
  3549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3550. $ctx1.sendIdx[","]=4;
  3551. //>>excludeEnd("ctx");
  3552. $5=$recv($6).__comma($recv(pos)._column());
  3553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3554. $ctx1.sendIdx[","]=3;
  3555. //>>excludeEnd("ctx");
  3556. $4=$recv($5).__comma(" : Unexpected character ");
  3557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3558. $ctx1.sendIdx[","]=2;
  3559. //>>excludeEnd("ctx");
  3560. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  3561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3562. $ctx1.sendIdx[","]=1;
  3563. //>>excludeEnd("ctx");
  3564. return $recv($2)._messageText_($3);
  3565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3566. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString,pos:pos},$globals.SmalltalkImage)});
  3567. //>>excludeEnd("ctx");
  3568. },
  3569. //>>excludeStart("ide", pragmas.excludeIdeData);
  3570. args: ["anException", "aString"],
  3571. source: "parseError: anException parsing: aString\x0a\x09| pos |\x0a\x09pos := (anException basicAt: 'location') start.\x0a\x09^ ParseError new messageText: 'Parse error on line ', pos line ,' column ' , pos column ,' : Unexpected character ', (anException basicAt: 'found')",
  3572. referencedClasses: ["ParseError"],
  3573. //>>excludeEnd("ide");
  3574. messageSends: ["start", "basicAt:", "messageText:", "new", ",", "line", "column"]
  3575. }),
  3576. $globals.SmalltalkImage);
  3577. $core.addMethod(
  3578. $core.method({
  3579. selector: "pseudoVariableNames",
  3580. protocol: "accessing",
  3581. fn: function (){
  3582. var self=this,$self=this;
  3583. return ["self", "super", "nil", "true", "false", "thisContext"];
  3584. },
  3585. //>>excludeStart("ide", pragmas.excludeIdeData);
  3586. args: [],
  3587. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  3588. referencedClasses: [],
  3589. //>>excludeEnd("ide");
  3590. messageSends: []
  3591. }),
  3592. $globals.SmalltalkImage);
  3593. $core.addMethod(
  3594. $core.method({
  3595. selector: "readJSObject:",
  3596. protocol: "accessing",
  3597. fn: function (anObject){
  3598. var self=this,$self=this;
  3599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3600. return $core.withContext(function($ctx1) {
  3601. //>>excludeEnd("ctx");
  3602. return $core.readJSObject(anObject);
  3603. return self;
  3604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3605. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  3606. //>>excludeEnd("ctx");
  3607. },
  3608. //>>excludeStart("ide", pragmas.excludeIdeData);
  3609. args: ["anObject"],
  3610. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  3611. referencedClasses: [],
  3612. //>>excludeEnd("ide");
  3613. messageSends: []
  3614. }),
  3615. $globals.SmalltalkImage);
  3616. $core.addMethod(
  3617. $core.method({
  3618. selector: "removeClass:",
  3619. protocol: "classes",
  3620. fn: function (aClass){
  3621. var self=this,$self=this;
  3622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3623. return $core.withContext(function($ctx1) {
  3624. //>>excludeEnd("ctx");
  3625. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  3626. $1=$recv(aClass)._isMetaclass();
  3627. if($core.assert($1)){
  3628. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  3629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3630. $ctx1.sendIdx[","]=1;
  3631. //>>excludeEnd("ctx");
  3632. $self._error_($2);
  3633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3634. $ctx1.sendIdx["error:"]=1;
  3635. //>>excludeEnd("ctx");
  3636. }
  3637. $recv(aClass)._allSubclassesDo_((function(subclass){
  3638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3639. return $core.withContext(function($ctx2) {
  3640. //>>excludeEnd("ctx");
  3641. $5=$recv(aClass)._name();
  3642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3643. $ctx2.sendIdx["name"]=1;
  3644. //>>excludeEnd("ctx");
  3645. $4=$recv($5).__comma(" has a subclass: ");
  3646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3647. $ctx2.sendIdx[","]=3;
  3648. //>>excludeEnd("ctx");
  3649. $6=$recv(subclass)._name();
  3650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3651. $ctx2.sendIdx["name"]=2;
  3652. //>>excludeEnd("ctx");
  3653. $3=$recv($4).__comma($6);
  3654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3655. $ctx2.sendIdx[","]=2;
  3656. //>>excludeEnd("ctx");
  3657. return $self._error_($3);
  3658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3659. $ctx2.sendIdx["error:"]=2;
  3660. //>>excludeEnd("ctx");
  3661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3662. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  3663. //>>excludeEnd("ctx");
  3664. }));
  3665. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  3666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3667. return $core.withContext(function($ctx2) {
  3668. //>>excludeEnd("ctx");
  3669. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  3670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  3672. //>>excludeEnd("ctx");
  3673. }));
  3674. $self._deleteClass_(aClass);
  3675. $recv(aClass)._setTraitComposition_([]);
  3676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3677. $ctx1.sendIdx["setTraitComposition:"]=1;
  3678. //>>excludeEnd("ctx");
  3679. $7=$recv(aClass)._theMetaClass();
  3680. if(($receiver = $7) == null || $receiver.a$nil){
  3681. $7;
  3682. } else {
  3683. var meta;
  3684. meta=$receiver;
  3685. $recv(meta)._setTraitComposition_([]);
  3686. }
  3687. $8=$recv($globals.SystemAnnouncer)._current();
  3688. $10=$recv($globals.ClassRemoved)._new();
  3689. $recv($10)._theClass_(aClass);
  3690. $9=$recv($10)._yourself();
  3691. $recv($8)._announce_($9);
  3692. return self;
  3693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3694. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  3695. //>>excludeEnd("ctx");
  3696. },
  3697. //>>excludeStart("ide", pragmas.excludeIdeData);
  3698. args: ["aClass"],
  3699. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09aClass allSubclassesDo: [ :subclass | self error: aClass name, ' has a subclass: ', subclass name ].\x0a\x09aClass traitUsers ifNotEmpty: [ self error: aClass name, ' has trait users.' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09aClass setTraitComposition: #().\x0a\x09aClass theMetaClass ifNotNil: [ :meta | meta setTraitComposition: #() ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  3700. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  3701. //>>excludeEnd("ide");
  3702. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  3703. }),
  3704. $globals.SmalltalkImage);
  3705. $core.addMethod(
  3706. $core.method({
  3707. selector: "removePackage:",
  3708. protocol: "packages",
  3709. fn: function (packageName){
  3710. var self=this,$self=this;
  3711. var pkg;
  3712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3713. return $core.withContext(function($ctx1) {
  3714. //>>excludeEnd("ctx");
  3715. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  3716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3717. return $core.withContext(function($ctx2) {
  3718. //>>excludeEnd("ctx");
  3719. return $self._error_("Missing package: ".__comma(packageName));
  3720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3722. //>>excludeEnd("ctx");
  3723. }));
  3724. $recv($recv(pkg)._classes())._do_((function(each){
  3725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3726. return $core.withContext(function($ctx2) {
  3727. //>>excludeEnd("ctx");
  3728. return $self._removeClass_(each);
  3729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3730. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3731. //>>excludeEnd("ctx");
  3732. }));
  3733. $recv($self._packageDictionary())._removeKey_(packageName);
  3734. return self;
  3735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3736. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  3737. //>>excludeEnd("ctx");
  3738. },
  3739. //>>excludeStart("ide", pragmas.excludeIdeData);
  3740. args: ["packageName"],
  3741. source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09pkg classes do: [ :each |\x0a\x09\x09\x09self removeClass: each ].\x0a\x09self packageDictionary removeKey: packageName",
  3742. referencedClasses: [],
  3743. //>>excludeEnd("ide");
  3744. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  3745. }),
  3746. $globals.SmalltalkImage);
  3747. $core.addMethod(
  3748. $core.method({
  3749. selector: "renamePackage:to:",
  3750. protocol: "packages",
  3751. fn: function (packageName,newName){
  3752. var self=this,$self=this;
  3753. var pkg;
  3754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3755. return $core.withContext(function($ctx1) {
  3756. //>>excludeEnd("ctx");
  3757. var $1,$2,$3;
  3758. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  3759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3760. return $core.withContext(function($ctx2) {
  3761. //>>excludeEnd("ctx");
  3762. $1="Missing package: ".__comma(packageName);
  3763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3764. $ctx2.sendIdx[","]=1;
  3765. //>>excludeEnd("ctx");
  3766. return $self._error_($1);
  3767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3768. $ctx2.sendIdx["error:"]=1;
  3769. //>>excludeEnd("ctx");
  3770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3772. //>>excludeEnd("ctx");
  3773. }));
  3774. $self._packageAt_ifPresent_(newName,(function(){
  3775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3776. return $core.withContext(function($ctx2) {
  3777. //>>excludeEnd("ctx");
  3778. return $self._error_("Already exists a package called: ".__comma(newName));
  3779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3781. //>>excludeEnd("ctx");
  3782. }));
  3783. $2=pkg;
  3784. $recv($2)._name_(newName);
  3785. $recv($2)._beDirty();
  3786. $3=$self._packageDictionary();
  3787. $recv($3)._at_put_(newName,pkg);
  3788. $recv($3)._removeKey_(packageName);
  3789. return self;
  3790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3791. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  3792. //>>excludeEnd("ctx");
  3793. },
  3794. //>>excludeStart("ide", pragmas.excludeIdeData);
  3795. args: ["packageName", "newName"],
  3796. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09self packageAt: newName ifPresent: [ self error: 'Already exists a package called: ', newName ].\x0a\x09pkg name: newName; beDirty.\x0a\x09self packageDictionary\x0a\x09\x09at: newName put: pkg;\x0a\x09\x09removeKey: packageName",
  3797. referencedClasses: [],
  3798. //>>excludeEnd("ide");
  3799. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  3800. }),
  3801. $globals.SmalltalkImage);
  3802. $core.addMethod(
  3803. $core.method({
  3804. selector: "reservedWords",
  3805. protocol: "accessing",
  3806. fn: function (){
  3807. var self=this,$self=this;
  3808. return ["break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "export", "extends", "finally", "for", "function", "if", "import", "in", "instanceof", "new", "return", "super", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with", "yield", "let", "static", "arguments", "await", "enum", "implements", "interface", "package", "private", "protected", "public"];
  3809. },
  3810. //>>excludeStart("ide", pragmas.excludeIdeData);
  3811. args: [],
  3812. source: "reservedWords\x0a\x09^ #(\x0a\x09\x09\x22http://www.ecma-international.org/ecma-262/6.0/#sec-keywords\x22\x0a\x09\x09break case catch class const continue debugger\x0a\x09\x09default delete do else export extends finally\x0a\x09\x09for function if import in instanceof new\x0a\x09\x09return super switch this throw try typeof\x0a\x09\x09var void while with yield\x0a\x09\x09\x22in strict mode\x22\x0a\x09\x09let static\x0a\x09\x09\x22Amber protected words: these should not be compiled as-is when in code\x22\x0a\x09\x09arguments\x0a\x09\x09\x22http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words\x22\x0a\x09\x09await enum\x0a\x09\x09\x22in strict mode\x22\x0a\x09\x09implements interface package private protected public\x0a\x09)",
  3813. referencedClasses: [],
  3814. //>>excludeEnd("ide");
  3815. messageSends: []
  3816. }),
  3817. $globals.SmalltalkImage);
  3818. $core.addMethod(
  3819. $core.method({
  3820. selector: "settings",
  3821. protocol: "accessing",
  3822. fn: function (){
  3823. var self=this,$self=this;
  3824. return $globals.SmalltalkSettings;
  3825. },
  3826. //>>excludeStart("ide", pragmas.excludeIdeData);
  3827. args: [],
  3828. source: "settings\x0a\x09^ SmalltalkSettings",
  3829. referencedClasses: ["SmalltalkSettings"],
  3830. //>>excludeEnd("ide");
  3831. messageSends: []
  3832. }),
  3833. $globals.SmalltalkImage);
  3834. $core.addMethod(
  3835. $core.method({
  3836. selector: "sweepPackageDictionary",
  3837. protocol: "private",
  3838. fn: function(){
  3839. var self=this,$self=this;
  3840. var pd,adopted;
  3841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3842. return $core.withContext(function($ctx1) {
  3843. //>>excludeEnd("ctx");
  3844. pd=$recv($self._core())._packageDescriptors();
  3845. adopted=[];
  3846. $recv(pd)._keysAndValuesDo_((function(each){
  3847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3848. return $core.withContext(function($ctx2) {
  3849. //>>excludeEnd("ctx");
  3850. return $self._packageAt_ifPresent_(each,(function(){
  3851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3852. return $core.withContext(function($ctx3) {
  3853. //>>excludeEnd("ctx");
  3854. return $recv(adopted)._add_(each);
  3855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3856. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  3857. //>>excludeEnd("ctx");
  3858. }));
  3859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3860. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3861. //>>excludeEnd("ctx");
  3862. }));
  3863. $recv(adopted)._do_((function(key){
  3864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3865. return $core.withContext(function($ctx2) {
  3866. //>>excludeEnd("ctx");
  3867. return $recv(pd)._removeKey_(key);
  3868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3869. }, function($ctx2) {$ctx2.fillBlock({key:key},$ctx1,3)});
  3870. //>>excludeEnd("ctx");
  3871. }));
  3872. return self;
  3873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3874. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDictionary",{pd:pd,adopted:adopted},$globals.SmalltalkImage)});
  3875. //>>excludeEnd("ctx");
  3876. },
  3877. //>>excludeStart("ide", pragmas.excludeIdeData);
  3878. args: [],
  3879. source: "sweepPackageDictionary\x0a\x09| pd adopted |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09adopted := #().\x0a\x09pd keysAndValuesDo: [ :each | self packageAt: each ifPresent: [ adopted add: each ] ].\x0a\x09adopted do: [ :key | pd removeKey: key ]",
  3880. referencedClasses: [],
  3881. //>>excludeEnd("ide");
  3882. messageSends: ["packageDescriptors", "core", "keysAndValuesDo:", "packageAt:ifPresent:", "add:", "do:", "removeKey:"]
  3883. }),
  3884. $globals.SmalltalkImage);
  3885. $core.addMethod(
  3886. $core.method({
  3887. selector: "version",
  3888. protocol: "accessing",
  3889. fn: function (){
  3890. var self=this,$self=this;
  3891. return "0.22.0-pre";
  3892. },
  3893. //>>excludeStart("ide", pragmas.excludeIdeData);
  3894. args: [],
  3895. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.22.0-pre'",
  3896. referencedClasses: [],
  3897. //>>excludeEnd("ide");
  3898. messageSends: []
  3899. }),
  3900. $globals.SmalltalkImage);
  3901. $core.addMethod(
  3902. $core.method({
  3903. selector: "withArrivalsDo:",
  3904. protocol: "startup",
  3905. fn: function (aBlock){
  3906. var self=this,$self=this;
  3907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3908. return $core.withContext(function($ctx1) {
  3909. //>>excludeEnd("ctx");
  3910. $recv(aBlock)._value_($self._adoptPackageDictionary());
  3911. $self._sweepPackageDictionary();
  3912. return self;
  3913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3914. }, function($ctx1) {$ctx1.fill(self,"withArrivalsDo:",{aBlock:aBlock},$globals.SmalltalkImage)});
  3915. //>>excludeEnd("ctx");
  3916. },
  3917. //>>excludeStart("ide", pragmas.excludeIdeData);
  3918. args: ["aBlock"],
  3919. source: "withArrivalsDo: aBlock\x0a\x09aBlock value: self adoptPackageDictionary.\x0a\x09self sweepPackageDictionary",
  3920. referencedClasses: [],
  3921. //>>excludeEnd("ide");
  3922. messageSends: ["value:", "adoptPackageDictionary", "sweepPackageDictionary"]
  3923. }),
  3924. $globals.SmalltalkImage);
  3925. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  3926. $core.addMethod(
  3927. $core.method({
  3928. selector: "current",
  3929. protocol: "instance creation",
  3930. fn: function (){
  3931. var self=this,$self=this;
  3932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3933. return $core.withContext(function($ctx1) {
  3934. //>>excludeEnd("ctx");
  3935. var $1,$receiver;
  3936. $1=$self["@current"];
  3937. if(($receiver = $1) == null || $receiver.a$nil){
  3938. $self["@current"]=(
  3939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3940. $ctx1.supercall = true,
  3941. //>>excludeEnd("ctx");
  3942. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  3943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3944. $ctx1.supercall = false;
  3945. //>>excludeEnd("ctx");;
  3946. return $self["@current"];
  3947. } else {
  3948. $self._deprecatedAPI();
  3949. return $self["@current"];
  3950. }
  3951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3952. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  3953. //>>excludeEnd("ctx");
  3954. },
  3955. //>>excludeStart("ide", pragmas.excludeIdeData);
  3956. args: [],
  3957. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  3958. referencedClasses: [],
  3959. //>>excludeEnd("ide");
  3960. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  3961. }),
  3962. $globals.SmalltalkImage.a$cls);
  3963. $core.addMethod(
  3964. $core.method({
  3965. selector: "initialize",
  3966. protocol: "initialization",
  3967. fn: function (){
  3968. var self=this,$self=this;
  3969. var st;
  3970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3971. return $core.withContext(function($ctx1) {
  3972. //>>excludeEnd("ctx");
  3973. st=$self._current();
  3974. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  3975. return self;
  3976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3977. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  3978. //>>excludeEnd("ctx");
  3979. },
  3980. //>>excludeStart("ide", pragmas.excludeIdeData);
  3981. args: [],
  3982. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  3983. referencedClasses: [],
  3984. //>>excludeEnd("ide");
  3985. messageSends: ["current", "at:put:", "globals"]
  3986. }),
  3987. $globals.SmalltalkImage.a$cls);
  3988. $core.addMethod(
  3989. $core.method({
  3990. selector: "new",
  3991. protocol: "instance creation",
  3992. fn: function (){
  3993. var self=this,$self=this;
  3994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3995. return $core.withContext(function($ctx1) {
  3996. //>>excludeEnd("ctx");
  3997. $self._shouldNotImplement();
  3998. return self;
  3999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4000. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  4001. //>>excludeEnd("ctx");
  4002. },
  4003. //>>excludeStart("ide", pragmas.excludeIdeData);
  4004. args: [],
  4005. source: "new\x0a\x09self shouldNotImplement",
  4006. referencedClasses: [],
  4007. //>>excludeEnd("ide");
  4008. messageSends: ["shouldNotImplement"]
  4009. }),
  4010. $globals.SmalltalkImage.a$cls);
  4011. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  4012. $core.addMethod(
  4013. $core.method({
  4014. selector: "nextPutJSObject:",
  4015. protocol: "*Kernel-Infrastructure",
  4016. fn: function (aJSObject){
  4017. var self=this,$self=this;
  4018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4019. return $core.withContext(function($ctx1) {
  4020. //>>excludeEnd("ctx");
  4021. $self._nextPut_(aJSObject);
  4022. return self;
  4023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4024. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  4025. //>>excludeEnd("ctx");
  4026. },
  4027. //>>excludeStart("ide", pragmas.excludeIdeData);
  4028. args: ["aJSObject"],
  4029. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  4030. referencedClasses: [],
  4031. //>>excludeEnd("ide");
  4032. messageSends: ["nextPut:"]
  4033. }),
  4034. $globals.ProtoStream);
  4035. $core.addMethod(
  4036. $core.method({
  4037. selector: "asJavaScriptPropertyName",
  4038. protocol: "*Kernel-Infrastructure",
  4039. fn: function (){
  4040. var self=this,$self=this;
  4041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4042. return $core.withContext(function($ctx1) {
  4043. //>>excludeEnd("ctx");
  4044. return $core.st2prop(self);
  4045. return self;
  4046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4047. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  4048. //>>excludeEnd("ctx");
  4049. },
  4050. //>>excludeStart("ide", pragmas.excludeIdeData);
  4051. args: [],
  4052. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  4053. referencedClasses: [],
  4054. //>>excludeEnd("ide");
  4055. messageSends: []
  4056. }),
  4057. $globals.String);
  4058. $core.addMethod(
  4059. $core.method({
  4060. selector: "asSetting",
  4061. protocol: "*Kernel-Infrastructure",
  4062. fn: function (){
  4063. var self=this,$self=this;
  4064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4065. return $core.withContext(function($ctx1) {
  4066. //>>excludeEnd("ctx");
  4067. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  4068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4069. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  4070. //>>excludeEnd("ctx");
  4071. },
  4072. //>>excludeStart("ide", pragmas.excludeIdeData);
  4073. args: [],
  4074. source: "asSetting\x0a\x09\x22Answer aSetting dedicated to locally store a value using this string as key.\x0a\x09Nil will be the default value.\x22\x0a\x09^ Setting at: self ifAbsent: nil",
  4075. referencedClasses: ["Setting"],
  4076. //>>excludeEnd("ide");
  4077. messageSends: ["at:ifAbsent:"]
  4078. }),
  4079. $globals.String);
  4080. $core.addMethod(
  4081. $core.method({
  4082. selector: "asSettingIfAbsent:",
  4083. protocol: "*Kernel-Infrastructure",
  4084. fn: function (aDefaultValue){
  4085. var self=this,$self=this;
  4086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4087. return $core.withContext(function($ctx1) {
  4088. //>>excludeEnd("ctx");
  4089. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  4090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4091. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  4092. //>>excludeEnd("ctx");
  4093. },
  4094. //>>excludeStart("ide", pragmas.excludeIdeData);
  4095. args: ["aDefaultValue"],
  4096. source: "asSettingIfAbsent: aDefaultValue\x0a\x09\x22Answer aSetting dedicated to locally store a value using this string as key.\x0a\x09Make this setting to have aDefaultValue.\x22\x0a\x09^ Setting at: self ifAbsent: aDefaultValue",
  4097. referencedClasses: ["Setting"],
  4098. //>>excludeEnd("ide");
  4099. messageSends: ["at:ifAbsent:"]
  4100. }),
  4101. $globals.String);
  4102. $core.addMethod(
  4103. $core.method({
  4104. selector: "settingValue",
  4105. protocol: "*Kernel-Infrastructure",
  4106. fn: function (){
  4107. var self=this,$self=this;
  4108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4109. return $core.withContext(function($ctx1) {
  4110. //>>excludeEnd("ctx");
  4111. return $recv($self._asSetting())._value();
  4112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4113. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  4114. //>>excludeEnd("ctx");
  4115. },
  4116. //>>excludeStart("ide", pragmas.excludeIdeData);
  4117. args: [],
  4118. source: "settingValue\x0a\x09^ self asSetting value",
  4119. referencedClasses: [],
  4120. //>>excludeEnd("ide");
  4121. messageSends: ["value", "asSetting"]
  4122. }),
  4123. $globals.String);
  4124. $core.addMethod(
  4125. $core.method({
  4126. selector: "settingValue:",
  4127. protocol: "*Kernel-Infrastructure",
  4128. fn: function (aValue){
  4129. var self=this,$self=this;
  4130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4131. return $core.withContext(function($ctx1) {
  4132. //>>excludeEnd("ctx");
  4133. return $recv($self._asSetting())._value_(aValue);
  4134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4135. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  4136. //>>excludeEnd("ctx");
  4137. },
  4138. //>>excludeStart("ide", pragmas.excludeIdeData);
  4139. args: ["aValue"],
  4140. source: "settingValue: aValue\x0a\x09\x22Sets the value of the setting that will be locally stored using this string as key.\x0a\x09Note that aValue can be any object that can be stringifyed\x22\x0a\x09^ self asSetting value: aValue",
  4141. referencedClasses: [],
  4142. //>>excludeEnd("ide");
  4143. messageSends: ["value:", "asSetting"]
  4144. }),
  4145. $globals.String);
  4146. $core.addMethod(
  4147. $core.method({
  4148. selector: "settingValueIfAbsent:",
  4149. protocol: "*Kernel-Infrastructure",
  4150. fn: function (aDefaultValue){
  4151. var self=this,$self=this;
  4152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4153. return $core.withContext(function($ctx1) {
  4154. //>>excludeEnd("ctx");
  4155. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  4156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4157. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  4158. //>>excludeEnd("ctx");
  4159. },
  4160. //>>excludeStart("ide", pragmas.excludeIdeData);
  4161. args: ["aDefaultValue"],
  4162. source: "settingValueIfAbsent: aDefaultValue\x0a\x09\x22Answer the value of the locally stored setting using this string as key.\x0a\x09Use aDefaultValue in case no setting is found\x22\x0a\x09^ (self asSettingIfAbsent: aDefaultValue) value",
  4163. referencedClasses: [],
  4164. //>>excludeEnd("ide");
  4165. messageSends: ["value", "asSettingIfAbsent:"]
  4166. }),
  4167. $globals.String);
  4168. });