Kernel-Infrastructure.js 154 KB

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