Kernel-Infrastructure.js 155 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362
  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;
  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. $recv(anObject)._at_ifPresent_("isReady",(function(aPromise){
  1627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1628. return $core.withContext(function($ctx2) {
  1629. //>>excludeEnd("ctx");
  1630. return $self._isReady_(aPromise);
  1631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1632. }, function($ctx2) {$ctx2.fillBlock({aPromise:aPromise},$ctx1,4)});
  1633. //>>excludeEnd("ctx");
  1634. }));
  1635. $self._evalBlock_(basicEval);
  1636. $self._imports_($self._importsFromJson_(basicImports));
  1637. return self;
  1638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1639. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  1640. //>>excludeEnd("ctx");
  1641. },
  1642. //>>excludeStart("ide", pragmas.excludeIdeData);
  1643. args: ["anObject"],
  1644. source: "javaScriptDescriptor: anObject\x0a\x09| basicEval basicImports |\x0a\x0a\x09basicEval := anObject at: 'innerEval' ifAbsent: [ nil asJavaScriptObject ].\x0a\x09basicImports := anObject at: 'imports' ifAbsent: [ #() ].\x0a\x09basicTransport := anObject at: 'transport' ifAbsent: [].\x0a\x09anObject at: 'isReady' ifPresent: [ :aPromise | self isReady: aPromise ].\x0a\x0a\x09self\x0a\x09\x09evalBlock: basicEval;\x0a\x09\x09imports: (self importsFromJson: basicImports)",
  1645. referencedClasses: [],
  1646. //>>excludeEnd("ide");
  1647. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "at:ifPresent:", "isReady:", "evalBlock:", "imports:", "importsFromJson:"]
  1648. }),
  1649. $globals.Package);
  1650. $core.addMethod(
  1651. $core.method({
  1652. selector: "loadDependencies",
  1653. protocol: "dependencies",
  1654. fn: function (){
  1655. var self=this,$self=this;
  1656. var classes,packages;
  1657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1658. return $core.withContext(function($ctx1) {
  1659. //>>excludeEnd("ctx");
  1660. var $1;
  1661. classes=$self._loadDependencyClasses();
  1662. $1=$recv($recv(classes)._collect_((function(each){
  1663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1664. return $core.withContext(function($ctx2) {
  1665. //>>excludeEnd("ctx");
  1666. return $recv(each)._package();
  1667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1668. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1669. //>>excludeEnd("ctx");
  1670. })))._asSet();
  1671. $recv($1)._remove_ifAbsent_(self,(function(){
  1672. }));
  1673. return $recv($1)._yourself();
  1674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1675. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  1676. //>>excludeEnd("ctx");
  1677. },
  1678. //>>excludeStart("ide", pragmas.excludeIdeData);
  1679. args: [],
  1680. 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",
  1681. referencedClasses: [],
  1682. //>>excludeEnd("ide");
  1683. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  1684. }),
  1685. $globals.Package);
  1686. $core.addMethod(
  1687. $core.method({
  1688. selector: "loadDependencyClasses",
  1689. protocol: "dependencies",
  1690. fn: function (){
  1691. var self=this,$self=this;
  1692. var starCategoryName;
  1693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1694. return $core.withContext(function($ctx1) {
  1695. //>>excludeEnd("ctx");
  1696. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  1697. starCategoryName="*".__comma($self._name());
  1698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1699. $ctx1.sendIdx[","]=1;
  1700. //>>excludeEnd("ctx");
  1701. $3=$self._classes();
  1702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1703. $ctx1.sendIdx["classes"]=1;
  1704. //>>excludeEnd("ctx");
  1705. $2=$recv($3)._collect_((function(each){
  1706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1707. return $core.withContext(function($ctx2) {
  1708. //>>excludeEnd("ctx");
  1709. return $recv(each)._superclass();
  1710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1711. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1712. //>>excludeEnd("ctx");
  1713. }));
  1714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1715. $ctx1.sendIdx["collect:"]=1;
  1716. //>>excludeEnd("ctx");
  1717. $1=$recv($2)._asSet();
  1718. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  1719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1720. return $core.withContext(function($ctx2) {
  1721. //>>excludeEnd("ctx");
  1722. $5=$recv(each)._protocols();
  1723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1724. $ctx2.sendIdx["protocols"]=1;
  1725. //>>excludeEnd("ctx");
  1726. $7=$recv(each)._theMetaClass();
  1727. if(($receiver = $7) == null || $receiver.a$nil){
  1728. $6=[];
  1729. } else {
  1730. var meta;
  1731. meta=$receiver;
  1732. $6=$recv(meta)._protocols();
  1733. }
  1734. $4=$recv($5).__comma($6);
  1735. return $recv($4)._includes_(starCategoryName);
  1736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1737. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  1738. //>>excludeEnd("ctx");
  1739. })));
  1740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1741. $ctx1.sendIdx["addAll:"]=1;
  1742. //>>excludeEnd("ctx");
  1743. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  1744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1745. return $core.withContext(function($ctx2) {
  1746. //>>excludeEnd("ctx");
  1747. return $recv($self._traitCompositions())._valuesDo_((function(each){
  1748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1749. return $core.withContext(function($ctx3) {
  1750. //>>excludeEnd("ctx");
  1751. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  1752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1753. return $core.withContext(function($ctx4) {
  1754. //>>excludeEnd("ctx");
  1755. return $recv(eachTT)._trait();
  1756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1757. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  1758. //>>excludeEnd("ctx");
  1759. })));
  1760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1761. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  1762. //>>excludeEnd("ctx");
  1763. }));
  1764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1765. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  1766. //>>excludeEnd("ctx");
  1767. })));
  1768. $recv($1)._remove_ifAbsent_(nil,(function(){
  1769. }));
  1770. return $recv($1)._yourself();
  1771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1772. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  1773. //>>excludeEnd("ctx");
  1774. },
  1775. //>>excludeStart("ide", pragmas.excludeIdeData);
  1776. args: [],
  1777. 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",
  1778. referencedClasses: ["Smalltalk", "Array"],
  1779. //>>excludeEnd("ide");
  1780. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  1781. }),
  1782. $globals.Package);
  1783. $core.addMethod(
  1784. $core.method({
  1785. selector: "name",
  1786. protocol: "accessing",
  1787. fn: function (){
  1788. var self=this,$self=this;
  1789. return $self["@name"];
  1790. },
  1791. //>>excludeStart("ide", pragmas.excludeIdeData);
  1792. args: [],
  1793. source: "name\x0a\x09^ name",
  1794. referencedClasses: [],
  1795. //>>excludeEnd("ide");
  1796. messageSends: []
  1797. }),
  1798. $globals.Package);
  1799. $core.addMethod(
  1800. $core.method({
  1801. selector: "name:",
  1802. protocol: "accessing",
  1803. fn: function (aString){
  1804. var self=this,$self=this;
  1805. $self["@name"]=aString;
  1806. return self;
  1807. },
  1808. //>>excludeStart("ide", pragmas.excludeIdeData);
  1809. args: ["aString"],
  1810. source: "name: aString\x0a\x09name := aString",
  1811. referencedClasses: [],
  1812. //>>excludeEnd("ide");
  1813. messageSends: []
  1814. }),
  1815. $globals.Package);
  1816. $core.addMethod(
  1817. $core.method({
  1818. selector: "organization",
  1819. protocol: "accessing",
  1820. fn: function (){
  1821. var self=this,$self=this;
  1822. return $self["@organization"];
  1823. },
  1824. //>>excludeStart("ide", pragmas.excludeIdeData);
  1825. args: [],
  1826. source: "organization\x0a\x09^ organization",
  1827. referencedClasses: [],
  1828. //>>excludeEnd("ide");
  1829. messageSends: []
  1830. }),
  1831. $globals.Package);
  1832. $core.addMethod(
  1833. $core.method({
  1834. selector: "printOn:",
  1835. protocol: "printing",
  1836. fn: function (aStream){
  1837. var self=this,$self=this;
  1838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1839. return $core.withContext(function($ctx1) {
  1840. //>>excludeEnd("ctx");
  1841. (
  1842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1843. $ctx1.supercall = true,
  1844. //>>excludeEnd("ctx");
  1845. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  1846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1847. $ctx1.supercall = false;
  1848. //>>excludeEnd("ctx");;
  1849. $recv(aStream)._nextPutAll_(" (");
  1850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1851. $ctx1.sendIdx["nextPutAll:"]=1;
  1852. //>>excludeEnd("ctx");
  1853. $recv(aStream)._nextPutAll_($self._name());
  1854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1855. $ctx1.sendIdx["nextPutAll:"]=2;
  1856. //>>excludeEnd("ctx");
  1857. $recv(aStream)._nextPutAll_(")");
  1858. return self;
  1859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1860. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  1861. //>>excludeEnd("ctx");
  1862. },
  1863. //>>excludeStart("ide", pragmas.excludeIdeData);
  1864. args: ["aStream"],
  1865. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  1866. referencedClasses: [],
  1867. //>>excludeEnd("ide");
  1868. messageSends: ["printOn:", "nextPutAll:", "name"]
  1869. }),
  1870. $globals.Package);
  1871. $core.addMethod(
  1872. $core.method({
  1873. selector: "setupClasses",
  1874. protocol: "classes",
  1875. fn: function (){
  1876. var self=this,$self=this;
  1877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1878. return $core.withContext(function($ctx1) {
  1879. //>>excludeEnd("ctx");
  1880. $recv($self._classes())._do_((function(each){
  1881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1882. return $core.withContext(function($ctx2) {
  1883. //>>excludeEnd("ctx");
  1884. return $recv(each)._initialize();
  1885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1886. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1887. //>>excludeEnd("ctx");
  1888. }));
  1889. return self;
  1890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1891. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  1892. //>>excludeEnd("ctx");
  1893. },
  1894. //>>excludeStart("ide", pragmas.excludeIdeData);
  1895. args: [],
  1896. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  1897. referencedClasses: [],
  1898. //>>excludeEnd("ide");
  1899. messageSends: ["do:", "classes", "initialize"]
  1900. }),
  1901. $globals.Package);
  1902. $core.addMethod(
  1903. $core.method({
  1904. selector: "sortedClasses",
  1905. protocol: "classes",
  1906. fn: function (){
  1907. var self=this,$self=this;
  1908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1909. return $core.withContext(function($ctx1) {
  1910. //>>excludeEnd("ctx");
  1911. return $recv($self._class())._sortedClasses_($self._classes());
  1912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1913. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  1914. //>>excludeEnd("ctx");
  1915. },
  1916. //>>excludeStart("ide", pragmas.excludeIdeData);
  1917. args: [],
  1918. 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",
  1919. referencedClasses: [],
  1920. //>>excludeEnd("ide");
  1921. messageSends: ["sortedClasses:", "class", "classes"]
  1922. }),
  1923. $globals.Package);
  1924. $core.addMethod(
  1925. $core.method({
  1926. selector: "sortedImportsAsArray",
  1927. protocol: "private",
  1928. fn: function (){
  1929. var self=this,$self=this;
  1930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1931. return $core.withContext(function($ctx1) {
  1932. //>>excludeEnd("ctx");
  1933. var $3,$2,$4,$1,$6,$5,$7;
  1934. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  1935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1936. return $core.withContext(function($ctx2) {
  1937. //>>excludeEnd("ctx");
  1938. $3=$recv(a)._isString();
  1939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1940. $ctx2.sendIdx["isString"]=1;
  1941. //>>excludeEnd("ctx");
  1942. $2=$recv($3)._not();
  1943. $4=$recv(b)._isString();
  1944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1945. $ctx2.sendIdx["isString"]=2;
  1946. //>>excludeEnd("ctx");
  1947. $1=$recv($2).__and($4);
  1948. return $recv($1)._or_((function(){
  1949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1950. return $core.withContext(function($ctx3) {
  1951. //>>excludeEnd("ctx");
  1952. $6=$recv(a)._isString();
  1953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1954. $ctx3.sendIdx["isString"]=3;
  1955. //>>excludeEnd("ctx");
  1956. $5=$recv($6).__eq($recv(b)._isString());
  1957. return $recv($5)._and_((function(){
  1958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1959. return $core.withContext(function($ctx4) {
  1960. //>>excludeEnd("ctx");
  1961. $7=$recv(a)._value();
  1962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1963. $ctx4.sendIdx["value"]=1;
  1964. //>>excludeEnd("ctx");
  1965. return $recv($7).__lt_eq($recv(b)._value());
  1966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1967. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  1968. //>>excludeEnd("ctx");
  1969. }));
  1970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1971. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1972. //>>excludeEnd("ctx");
  1973. }));
  1974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1975. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  1976. //>>excludeEnd("ctx");
  1977. }));
  1978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1979. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  1980. //>>excludeEnd("ctx");
  1981. },
  1982. //>>excludeStart("ide", pragmas.excludeIdeData);
  1983. args: [],
  1984. 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 ]]]",
  1985. referencedClasses: [],
  1986. //>>excludeEnd("ide");
  1987. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  1988. }),
  1989. $globals.Package);
  1990. $core.addMethod(
  1991. $core.method({
  1992. selector: "traitCompositions",
  1993. protocol: "dependencies",
  1994. fn: function (){
  1995. var self=this,$self=this;
  1996. var traitCompositions;
  1997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1998. return $core.withContext(function($ctx1) {
  1999. //>>excludeEnd("ctx");
  2000. var $1,$2,$3,$receiver;
  2001. traitCompositions=$recv($globals.Dictionary)._new();
  2002. $recv($self._classes())._do_((function(each){
  2003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2004. return $core.withContext(function($ctx2) {
  2005. //>>excludeEnd("ctx");
  2006. $1=traitCompositions;
  2007. $2=$recv(each)._traitComposition();
  2008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2009. $ctx2.sendIdx["traitComposition"]=1;
  2010. //>>excludeEnd("ctx");
  2011. $recv($1)._at_put_(each,$2);
  2012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2013. $ctx2.sendIdx["at:put:"]=1;
  2014. //>>excludeEnd("ctx");
  2015. $3=$recv(each)._theMetaClass();
  2016. if(($receiver = $3) == null || $receiver.a$nil){
  2017. return $3;
  2018. } else {
  2019. var meta;
  2020. meta=$receiver;
  2021. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  2022. }
  2023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2024. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2025. //>>excludeEnd("ctx");
  2026. }));
  2027. return $recv(traitCompositions)._reject_((function(each){
  2028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2029. return $core.withContext(function($ctx2) {
  2030. //>>excludeEnd("ctx");
  2031. return $recv(each)._isEmpty();
  2032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2033. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  2034. //>>excludeEnd("ctx");
  2035. }));
  2036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2037. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  2038. //>>excludeEnd("ctx");
  2039. },
  2040. //>>excludeStart("ide", pragmas.excludeIdeData);
  2041. args: [],
  2042. 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 ]",
  2043. referencedClasses: ["Dictionary"],
  2044. //>>excludeEnd("ide");
  2045. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  2046. }),
  2047. $globals.Package);
  2048. $core.addMethod(
  2049. $core.method({
  2050. selector: "transport",
  2051. protocol: "accessing",
  2052. fn: function (){
  2053. var self=this,$self=this;
  2054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2055. return $core.withContext(function($ctx1) {
  2056. //>>excludeEnd("ctx");
  2057. var $1,$receiver;
  2058. $1=$self["@transport"];
  2059. if(($receiver = $1) == null || $receiver.a$nil){
  2060. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  2061. return $self["@transport"];
  2062. } else {
  2063. return $1;
  2064. }
  2065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2066. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  2067. //>>excludeEnd("ctx");
  2068. },
  2069. //>>excludeStart("ide", pragmas.excludeIdeData);
  2070. args: [],
  2071. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  2072. referencedClasses: ["PackageTransport"],
  2073. //>>excludeEnd("ide");
  2074. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  2075. }),
  2076. $globals.Package);
  2077. $core.addMethod(
  2078. $core.method({
  2079. selector: "transport:",
  2080. protocol: "accessing",
  2081. fn: function (aPackageTransport){
  2082. var self=this,$self=this;
  2083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2084. return $core.withContext(function($ctx1) {
  2085. //>>excludeEnd("ctx");
  2086. $self["@transport"]=aPackageTransport;
  2087. $recv(aPackageTransport)._package_(self);
  2088. return self;
  2089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2090. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  2091. //>>excludeEnd("ctx");
  2092. },
  2093. //>>excludeStart("ide", pragmas.excludeIdeData);
  2094. args: ["aPackageTransport"],
  2095. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  2096. referencedClasses: [],
  2097. //>>excludeEnd("ide");
  2098. messageSends: ["package:"]
  2099. }),
  2100. $globals.Package);
  2101. $core.addMethod(
  2102. $core.method({
  2103. selector: "validateImports:",
  2104. protocol: "validation",
  2105. fn: function (aCollection){
  2106. var self=this,$self=this;
  2107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2108. return $core.withContext(function($ctx1) {
  2109. //>>excludeEnd("ctx");
  2110. var $1,$2,$5,$4,$3,$6;
  2111. $recv(aCollection)._do_((function(import_){
  2112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2113. return $core.withContext(function($ctx2) {
  2114. //>>excludeEnd("ctx");
  2115. $1=$recv(import_)._isString();
  2116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2117. $ctx2.sendIdx["isString"]=1;
  2118. //>>excludeEnd("ctx");
  2119. if(!$core.assert($1)){
  2120. $2=$recv(import_)._respondsTo_("key");
  2121. if(!$core.assert($2)){
  2122. $self._error_("Imports must be Strings or Associations");
  2123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2124. $ctx2.sendIdx["error:"]=1;
  2125. //>>excludeEnd("ctx");
  2126. }
  2127. $5=$recv(import_)._key();
  2128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2129. $ctx2.sendIdx["key"]=1;
  2130. //>>excludeEnd("ctx");
  2131. $4=$recv($5)._isString();
  2132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2133. $ctx2.sendIdx["isString"]=2;
  2134. //>>excludeEnd("ctx");
  2135. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  2136. if(!$core.assert($3)){
  2137. $self._error_("Key and value must be Strings");
  2138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2139. $ctx2.sendIdx["error:"]=2;
  2140. //>>excludeEnd("ctx");
  2141. }
  2142. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  2143. if(!$core.assert($6)){
  2144. return $self._error_("Keys must be identifiers");
  2145. }
  2146. }
  2147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2148. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  2149. //>>excludeEnd("ctx");
  2150. }));
  2151. return self;
  2152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2153. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  2154. //>>excludeEnd("ctx");
  2155. },
  2156. //>>excludeStart("ide", pragmas.excludeIdeData);
  2157. args: ["aCollection"],
  2158. 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' ]]]",
  2159. referencedClasses: [],
  2160. //>>excludeEnd("ide");
  2161. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  2162. }),
  2163. $globals.Package);
  2164. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  2165. $core.addMethod(
  2166. $core.method({
  2167. selector: "named:",
  2168. protocol: "accessing",
  2169. fn: function (aPackageName){
  2170. var self=this,$self=this;
  2171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2172. return $core.withContext(function($ctx1) {
  2173. //>>excludeEnd("ctx");
  2174. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  2175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2176. return $core.withContext(function($ctx2) {
  2177. //>>excludeEnd("ctx");
  2178. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  2179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2181. //>>excludeEnd("ctx");
  2182. }));
  2183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2184. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  2185. //>>excludeEnd("ctx");
  2186. },
  2187. //>>excludeStart("ide", pragmas.excludeIdeData);
  2188. args: ["aPackageName"],
  2189. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  2190. referencedClasses: ["Smalltalk"],
  2191. //>>excludeEnd("ide");
  2192. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  2193. }),
  2194. $globals.Package.a$cls);
  2195. $core.addMethod(
  2196. $core.method({
  2197. selector: "named:ifAbsent:",
  2198. protocol: "accessing",
  2199. fn: function (aPackageName,aBlock){
  2200. var self=this,$self=this;
  2201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2202. return $core.withContext(function($ctx1) {
  2203. //>>excludeEnd("ctx");
  2204. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  2205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2206. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  2207. //>>excludeEnd("ctx");
  2208. },
  2209. //>>excludeStart("ide", pragmas.excludeIdeData);
  2210. args: ["aPackageName", "aBlock"],
  2211. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  2212. referencedClasses: ["Smalltalk"],
  2213. //>>excludeEnd("ide");
  2214. messageSends: ["packageAt:ifAbsent:"]
  2215. }),
  2216. $globals.Package.a$cls);
  2217. $core.addMethod(
  2218. $core.method({
  2219. selector: "named:imports:transport:",
  2220. protocol: "accessing",
  2221. fn: function (aPackageName,anArray,aTransport){
  2222. var self=this,$self=this;
  2223. var pkg;
  2224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2225. return $core.withContext(function($ctx1) {
  2226. //>>excludeEnd("ctx");
  2227. pkg=$self._named_(aPackageName);
  2228. $recv(pkg)._imports_(anArray);
  2229. $recv(pkg)._transport_(aTransport);
  2230. return pkg;
  2231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2232. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  2233. //>>excludeEnd("ctx");
  2234. },
  2235. //>>excludeStart("ide", pragmas.excludeIdeData);
  2236. args: ["aPackageName", "anArray", "aTransport"],
  2237. 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",
  2238. referencedClasses: [],
  2239. //>>excludeEnd("ide");
  2240. messageSends: ["named:", "imports:", "transport:"]
  2241. }),
  2242. $globals.Package.a$cls);
  2243. $core.addMethod(
  2244. $core.method({
  2245. selector: "named:javaScriptDescriptor:",
  2246. protocol: "instance creation",
  2247. fn: function (aString,anObject){
  2248. var self=this,$self=this;
  2249. var pkg;
  2250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2251. return $core.withContext(function($ctx1) {
  2252. //>>excludeEnd("ctx");
  2253. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  2254. $recv(pkg)._javaScriptDescriptor_(anObject);
  2255. return pkg;
  2256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2257. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  2258. //>>excludeEnd("ctx");
  2259. },
  2260. //>>excludeStart("ide", pragmas.excludeIdeData);
  2261. args: ["aString", "anObject"],
  2262. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  2263. referencedClasses: ["Smalltalk"],
  2264. //>>excludeEnd("ide");
  2265. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  2266. }),
  2267. $globals.Package.a$cls);
  2268. $core.addMethod(
  2269. $core.method({
  2270. selector: "named:transport:",
  2271. protocol: "accessing",
  2272. fn: function (aPackageName,aTransport){
  2273. var self=this,$self=this;
  2274. var pkg;
  2275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2276. return $core.withContext(function($ctx1) {
  2277. //>>excludeEnd("ctx");
  2278. pkg=$self._named_(aPackageName);
  2279. $recv(pkg)._transport_(aTransport);
  2280. return pkg;
  2281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2282. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  2283. //>>excludeEnd("ctx");
  2284. },
  2285. //>>excludeStart("ide", pragmas.excludeIdeData);
  2286. args: ["aPackageName", "aTransport"],
  2287. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  2288. referencedClasses: [],
  2289. //>>excludeEnd("ide");
  2290. messageSends: ["named:", "transport:"]
  2291. }),
  2292. $globals.Package.a$cls);
  2293. $core.addMethod(
  2294. $core.method({
  2295. selector: "new:",
  2296. protocol: "instance creation",
  2297. fn: function (aString){
  2298. var self=this,$self=this;
  2299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2300. return $core.withContext(function($ctx1) {
  2301. //>>excludeEnd("ctx");
  2302. var $1;
  2303. $1=$recv($globals.Package)._new();
  2304. $recv($1)._name_(aString);
  2305. return $recv($1)._yourself();
  2306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2307. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  2308. //>>excludeEnd("ctx");
  2309. },
  2310. //>>excludeStart("ide", pragmas.excludeIdeData);
  2311. args: ["aString"],
  2312. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  2313. referencedClasses: ["Package"],
  2314. //>>excludeEnd("ide");
  2315. messageSends: ["name:", "new", "yourself"]
  2316. }),
  2317. $globals.Package.a$cls);
  2318. $core.addMethod(
  2319. $core.method({
  2320. selector: "sortedClasses:",
  2321. protocol: "sorting",
  2322. fn: function (classes){
  2323. var self=this,$self=this;
  2324. var children,others,nodes,expandedClasses;
  2325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2326. return $core.withContext(function($ctx1) {
  2327. //>>excludeEnd("ctx");
  2328. var $1,$3,$2;
  2329. children=[];
  2330. others=[];
  2331. $recv(classes)._do_((function(each){
  2332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2333. return $core.withContext(function($ctx2) {
  2334. //>>excludeEnd("ctx");
  2335. $1=$recv(classes)._includes_($recv(each)._superclass());
  2336. if($core.assert($1)){
  2337. return $recv(others)._add_(each);
  2338. } else {
  2339. return $recv(children)._add_(each);
  2340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2341. $ctx2.sendIdx["add:"]=1;
  2342. //>>excludeEnd("ctx");
  2343. }
  2344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2345. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2346. //>>excludeEnd("ctx");
  2347. }));
  2348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2349. $ctx1.sendIdx["do:"]=1;
  2350. //>>excludeEnd("ctx");
  2351. nodes=$recv(children)._collect_((function(each){
  2352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2353. return $core.withContext(function($ctx2) {
  2354. //>>excludeEnd("ctx");
  2355. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  2356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  2358. //>>excludeEnd("ctx");
  2359. }));
  2360. nodes=$recv(nodes)._sorted_((function(a,b){
  2361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2362. return $core.withContext(function($ctx2) {
  2363. //>>excludeEnd("ctx");
  2364. $3=$recv(a)._theClass();
  2365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2366. $ctx2.sendIdx["theClass"]=1;
  2367. //>>excludeEnd("ctx");
  2368. $2=$recv($3)._name();
  2369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2370. $ctx2.sendIdx["name"]=1;
  2371. //>>excludeEnd("ctx");
  2372. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  2373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2374. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  2375. //>>excludeEnd("ctx");
  2376. }));
  2377. expandedClasses=$recv($globals.Array)._new();
  2378. $recv(nodes)._do_((function(aNode){
  2379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2380. return $core.withContext(function($ctx2) {
  2381. //>>excludeEnd("ctx");
  2382. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  2383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2384. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  2385. //>>excludeEnd("ctx");
  2386. }));
  2387. return expandedClasses;
  2388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2389. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  2390. //>>excludeEnd("ctx");
  2391. },
  2392. //>>excludeStart("ide", pragmas.excludeIdeData);
  2393. args: ["classes"],
  2394. 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",
  2395. referencedClasses: ["ClassSorterNode", "Array"],
  2396. //>>excludeEnd("ide");
  2397. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  2398. }),
  2399. $globals.Package.a$cls);
  2400. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  2401. //>>excludeStart("ide", pragmas.excludeIdeData);
  2402. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  2403. //>>excludeEnd("ide");
  2404. $core.addMethod(
  2405. $core.method({
  2406. selector: "announcer",
  2407. protocol: "accessing",
  2408. fn: function (){
  2409. var self=this,$self=this;
  2410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2411. return $core.withContext(function($ctx1) {
  2412. //>>excludeEnd("ctx");
  2413. return $recv($globals.SystemAnnouncer)._current();
  2414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2415. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  2416. //>>excludeEnd("ctx");
  2417. },
  2418. //>>excludeStart("ide", pragmas.excludeIdeData);
  2419. args: [],
  2420. source: "announcer\x0a\x09^ SystemAnnouncer current",
  2421. referencedClasses: ["SystemAnnouncer"],
  2422. //>>excludeEnd("ide");
  2423. messageSends: ["current"]
  2424. }),
  2425. $globals.PackageStateObserver);
  2426. $core.addMethod(
  2427. $core.method({
  2428. selector: "observeSystem",
  2429. protocol: "actions",
  2430. fn: function (){
  2431. var self=this,$self=this;
  2432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2433. return $core.withContext(function($ctx1) {
  2434. //>>excludeEnd("ctx");
  2435. var $1;
  2436. $1=$self._announcer();
  2437. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  2438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2439. $ctx1.sendIdx["on:send:to:"]=1;
  2440. //>>excludeEnd("ctx");
  2441. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  2442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2443. $ctx1.sendIdx["on:send:to:"]=2;
  2444. //>>excludeEnd("ctx");
  2445. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  2446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2447. $ctx1.sendIdx["on:send:to:"]=3;
  2448. //>>excludeEnd("ctx");
  2449. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  2450. return self;
  2451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2452. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  2453. //>>excludeEnd("ctx");
  2454. },
  2455. //>>excludeStart("ide", pragmas.excludeIdeData);
  2456. args: [],
  2457. 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",
  2458. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  2459. //>>excludeEnd("ide");
  2460. messageSends: ["on:send:to:", "announcer"]
  2461. }),
  2462. $globals.PackageStateObserver);
  2463. $core.addMethod(
  2464. $core.method({
  2465. selector: "onClassModification:",
  2466. protocol: "reactions",
  2467. fn: function (anAnnouncement){
  2468. var self=this,$self=this;
  2469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2470. return $core.withContext(function($ctx1) {
  2471. //>>excludeEnd("ctx");
  2472. var $1,$receiver;
  2473. $1=$recv(anAnnouncement)._theClass();
  2474. if(($receiver = $1) == null || $receiver.a$nil){
  2475. $1;
  2476. } else {
  2477. var theClass;
  2478. theClass=$receiver;
  2479. $recv($recv(theClass)._package())._beDirty();
  2480. }
  2481. return self;
  2482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2483. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2484. //>>excludeEnd("ctx");
  2485. },
  2486. //>>excludeStart("ide", pragmas.excludeIdeData);
  2487. args: ["anAnnouncement"],
  2488. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  2489. referencedClasses: [],
  2490. //>>excludeEnd("ide");
  2491. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  2492. }),
  2493. $globals.PackageStateObserver);
  2494. $core.addMethod(
  2495. $core.method({
  2496. selector: "onMethodModification:",
  2497. protocol: "reactions",
  2498. fn: function (anAnnouncement){
  2499. var self=this,$self=this;
  2500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2501. return $core.withContext(function($ctx1) {
  2502. //>>excludeEnd("ctx");
  2503. var $1,$receiver;
  2504. $1=$recv($recv(anAnnouncement)._method())._package();
  2505. if(($receiver = $1) == null || $receiver.a$nil){
  2506. $1;
  2507. } else {
  2508. var package_;
  2509. package_=$receiver;
  2510. $recv(package_)._beDirty();
  2511. }
  2512. return self;
  2513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2514. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2515. //>>excludeEnd("ctx");
  2516. },
  2517. //>>excludeStart("ide", pragmas.excludeIdeData);
  2518. args: ["anAnnouncement"],
  2519. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  2520. referencedClasses: [],
  2521. //>>excludeEnd("ide");
  2522. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  2523. }),
  2524. $globals.PackageStateObserver);
  2525. $core.addMethod(
  2526. $core.method({
  2527. selector: "onPackageAdded:",
  2528. protocol: "reactions",
  2529. fn: function (anAnnouncement){
  2530. var self=this,$self=this;
  2531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2532. return $core.withContext(function($ctx1) {
  2533. //>>excludeEnd("ctx");
  2534. $recv($recv(anAnnouncement)._package())._beDirty();
  2535. return self;
  2536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2537. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2538. //>>excludeEnd("ctx");
  2539. },
  2540. //>>excludeStart("ide", pragmas.excludeIdeData);
  2541. args: ["anAnnouncement"],
  2542. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  2543. referencedClasses: [],
  2544. //>>excludeEnd("ide");
  2545. messageSends: ["beDirty", "package"]
  2546. }),
  2547. $globals.PackageStateObserver);
  2548. $core.addMethod(
  2549. $core.method({
  2550. selector: "onProtocolModification:",
  2551. protocol: "reactions",
  2552. fn: function (anAnnouncement){
  2553. var self=this,$self=this;
  2554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2555. return $core.withContext(function($ctx1) {
  2556. //>>excludeEnd("ctx");
  2557. var $1,$receiver;
  2558. $1=$recv(anAnnouncement)._package();
  2559. if(($receiver = $1) == null || $receiver.a$nil){
  2560. $1;
  2561. } else {
  2562. var package_;
  2563. package_=$receiver;
  2564. $recv(package_)._beDirty();
  2565. }
  2566. return self;
  2567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2568. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2569. //>>excludeEnd("ctx");
  2570. },
  2571. //>>excludeStart("ide", pragmas.excludeIdeData);
  2572. args: ["anAnnouncement"],
  2573. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  2574. referencedClasses: [],
  2575. //>>excludeEnd("ide");
  2576. messageSends: ["ifNotNil:", "package", "beDirty"]
  2577. }),
  2578. $globals.PackageStateObserver);
  2579. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  2580. $core.addMethod(
  2581. $core.method({
  2582. selector: "current",
  2583. protocol: "accessing",
  2584. fn: function (){
  2585. var self=this,$self=this;
  2586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2587. return $core.withContext(function($ctx1) {
  2588. //>>excludeEnd("ctx");
  2589. var $1,$receiver;
  2590. $1=$self["@current"];
  2591. if(($receiver = $1) == null || $receiver.a$nil){
  2592. $self["@current"]=$self._new();
  2593. return $self["@current"];
  2594. } else {
  2595. return $1;
  2596. }
  2597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2598. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  2599. //>>excludeEnd("ctx");
  2600. },
  2601. //>>excludeStart("ide", pragmas.excludeIdeData);
  2602. args: [],
  2603. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  2604. referencedClasses: [],
  2605. //>>excludeEnd("ide");
  2606. messageSends: ["ifNil:", "new"]
  2607. }),
  2608. $globals.PackageStateObserver.a$cls);
  2609. $core.addMethod(
  2610. $core.method({
  2611. selector: "initialize",
  2612. protocol: "initialization",
  2613. fn: function (){
  2614. var self=this,$self=this;
  2615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2616. return $core.withContext(function($ctx1) {
  2617. //>>excludeEnd("ctx");
  2618. $recv($self._current())._observeSystem();
  2619. return self;
  2620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2621. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  2622. //>>excludeEnd("ctx");
  2623. },
  2624. //>>excludeStart("ide", pragmas.excludeIdeData);
  2625. args: [],
  2626. source: "initialize\x0a\x09self current observeSystem",
  2627. referencedClasses: [],
  2628. //>>excludeEnd("ide");
  2629. messageSends: ["observeSystem", "current"]
  2630. }),
  2631. $globals.PackageStateObserver.a$cls);
  2632. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  2633. //>>excludeStart("ide", pragmas.excludeIdeData);
  2634. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  2635. //>>excludeEnd("ide");
  2636. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  2637. //>>excludeStart("ide", pragmas.excludeIdeData);
  2638. $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`";
  2639. //>>excludeEnd("ide");
  2640. $core.addMethod(
  2641. $core.method({
  2642. selector: "defaultValue",
  2643. protocol: "accessing",
  2644. fn: function (){
  2645. var self=this,$self=this;
  2646. return $self["@defaultValue"];
  2647. },
  2648. //>>excludeStart("ide", pragmas.excludeIdeData);
  2649. args: [],
  2650. source: "defaultValue\x0a\x09^ defaultValue",
  2651. referencedClasses: [],
  2652. //>>excludeEnd("ide");
  2653. messageSends: []
  2654. }),
  2655. $globals.Setting);
  2656. $core.addMethod(
  2657. $core.method({
  2658. selector: "defaultValue:",
  2659. protocol: "accessing",
  2660. fn: function (aStringifiableObject){
  2661. var self=this,$self=this;
  2662. $self["@defaultValue"]=aStringifiableObject;
  2663. return self;
  2664. },
  2665. //>>excludeStart("ide", pragmas.excludeIdeData);
  2666. args: ["aStringifiableObject"],
  2667. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  2668. referencedClasses: [],
  2669. //>>excludeEnd("ide");
  2670. messageSends: []
  2671. }),
  2672. $globals.Setting);
  2673. $core.addMethod(
  2674. $core.method({
  2675. selector: "key",
  2676. protocol: "accessing",
  2677. fn: function (){
  2678. var self=this,$self=this;
  2679. return $self["@key"];
  2680. },
  2681. //>>excludeStart("ide", pragmas.excludeIdeData);
  2682. args: [],
  2683. source: "key\x0a\x09^ key",
  2684. referencedClasses: [],
  2685. //>>excludeEnd("ide");
  2686. messageSends: []
  2687. }),
  2688. $globals.Setting);
  2689. $core.addMethod(
  2690. $core.method({
  2691. selector: "key:",
  2692. protocol: "accessing",
  2693. fn: function (aString){
  2694. var self=this,$self=this;
  2695. $self["@key"]=aString;
  2696. return self;
  2697. },
  2698. //>>excludeStart("ide", pragmas.excludeIdeData);
  2699. args: ["aString"],
  2700. source: "key: aString\x0a\x09key := aString",
  2701. referencedClasses: [],
  2702. //>>excludeEnd("ide");
  2703. messageSends: []
  2704. }),
  2705. $globals.Setting);
  2706. $core.addMethod(
  2707. $core.method({
  2708. selector: "value",
  2709. protocol: "accessing",
  2710. fn: function (){
  2711. var self=this,$self=this;
  2712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2713. return $core.withContext(function($ctx1) {
  2714. //>>excludeEnd("ctx");
  2715. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  2716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2717. return $core.withContext(function($ctx2) {
  2718. //>>excludeEnd("ctx");
  2719. return $self._defaultValue();
  2720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2722. //>>excludeEnd("ctx");
  2723. }));
  2724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2725. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  2726. //>>excludeEnd("ctx");
  2727. },
  2728. //>>excludeStart("ide", pragmas.excludeIdeData);
  2729. args: [],
  2730. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  2731. referencedClasses: ["Smalltalk"],
  2732. //>>excludeEnd("ide");
  2733. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  2734. }),
  2735. $globals.Setting);
  2736. $core.addMethod(
  2737. $core.method({
  2738. selector: "value:",
  2739. protocol: "accessing",
  2740. fn: function (aStringifiableObject){
  2741. var self=this,$self=this;
  2742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2743. return $core.withContext(function($ctx1) {
  2744. //>>excludeEnd("ctx");
  2745. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  2746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2747. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  2748. //>>excludeEnd("ctx");
  2749. },
  2750. //>>excludeStart("ide", pragmas.excludeIdeData);
  2751. args: ["aStringifiableObject"],
  2752. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  2753. referencedClasses: ["Smalltalk"],
  2754. //>>excludeEnd("ide");
  2755. messageSends: ["at:put:", "settings", "key"]
  2756. }),
  2757. $globals.Setting);
  2758. $core.addMethod(
  2759. $core.method({
  2760. selector: "at:ifAbsent:",
  2761. protocol: "instance creation",
  2762. fn: function (aString,aDefaultValue){
  2763. var self=this,$self=this;
  2764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2765. return $core.withContext(function($ctx1) {
  2766. //>>excludeEnd("ctx");
  2767. var $1;
  2768. $1=(
  2769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2770. $ctx1.supercall = true,
  2771. //>>excludeEnd("ctx");
  2772. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  2773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2774. $ctx1.supercall = false;
  2775. //>>excludeEnd("ctx");;
  2776. $recv($1)._key_(aString);
  2777. $recv($1)._defaultValue_(aDefaultValue);
  2778. return $recv($1)._yourself();
  2779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2780. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  2781. //>>excludeEnd("ctx");
  2782. },
  2783. //>>excludeStart("ide", pragmas.excludeIdeData);
  2784. args: ["aString", "aDefaultValue"],
  2785. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  2786. referencedClasses: [],
  2787. //>>excludeEnd("ide");
  2788. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  2789. }),
  2790. $globals.Setting.a$cls);
  2791. $core.addMethod(
  2792. $core.method({
  2793. selector: "new",
  2794. protocol: "instance creation",
  2795. fn: function (){
  2796. var self=this,$self=this;
  2797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2798. return $core.withContext(function($ctx1) {
  2799. //>>excludeEnd("ctx");
  2800. $self._shouldNotImplement();
  2801. return self;
  2802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2803. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  2804. //>>excludeEnd("ctx");
  2805. },
  2806. //>>excludeStart("ide", pragmas.excludeIdeData);
  2807. args: [],
  2808. source: "new\x0a\x09self shouldNotImplement",
  2809. referencedClasses: [],
  2810. //>>excludeEnd("ide");
  2811. messageSends: ["shouldNotImplement"]
  2812. }),
  2813. $globals.Setting.a$cls);
  2814. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  2815. //>>excludeStart("ide", pragmas.excludeIdeData);
  2816. $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.";
  2817. //>>excludeEnd("ide");
  2818. $core.addMethod(
  2819. $core.method({
  2820. selector: "addGlobalJsVariable:",
  2821. protocol: "globals",
  2822. fn: function (aString){
  2823. var self=this,$self=this;
  2824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2825. return $core.withContext(function($ctx1) {
  2826. //>>excludeEnd("ctx");
  2827. $recv($self._globalJsVariables())._add_(aString);
  2828. return self;
  2829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2830. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  2831. //>>excludeEnd("ctx");
  2832. },
  2833. //>>excludeStart("ide", pragmas.excludeIdeData);
  2834. args: ["aString"],
  2835. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  2836. referencedClasses: [],
  2837. //>>excludeEnd("ide");
  2838. messageSends: ["add:", "globalJsVariables"]
  2839. }),
  2840. $globals.SmalltalkImage);
  2841. $core.addMethod(
  2842. $core.method({
  2843. selector: "adoptPackageDescriptors",
  2844. protocol: "private",
  2845. fn: function (){
  2846. var self=this,$self=this;
  2847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2848. return $core.withContext(function($ctx1) {
  2849. //>>excludeEnd("ctx");
  2850. return $self._tryAdoptPackageDescriptorsBeyond_($recv($globals.Set)._new());
  2851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2852. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{},$globals.SmalltalkImage)});
  2853. //>>excludeEnd("ctx");
  2854. },
  2855. //>>excludeStart("ide", pragmas.excludeIdeData);
  2856. args: [],
  2857. source: "adoptPackageDescriptors\x0a\x09^ self tryAdoptPackageDescriptorsBeyond: Set new",
  2858. referencedClasses: ["Set"],
  2859. //>>excludeEnd("ide");
  2860. messageSends: ["tryAdoptPackageDescriptorsBeyond:", "new"]
  2861. }),
  2862. $globals.SmalltalkImage);
  2863. $core.addMethod(
  2864. $core.method({
  2865. selector: "amdRequire",
  2866. protocol: "accessing amd",
  2867. fn: function (){
  2868. var self=this,$self=this;
  2869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2870. return $core.withContext(function($ctx1) {
  2871. //>>excludeEnd("ctx");
  2872. return $recv($self._core())._at_("amdRequire");
  2873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2874. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  2875. //>>excludeEnd("ctx");
  2876. },
  2877. //>>excludeStart("ide", pragmas.excludeIdeData);
  2878. args: [],
  2879. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  2880. referencedClasses: [],
  2881. //>>excludeEnd("ide");
  2882. messageSends: ["at:", "core"]
  2883. }),
  2884. $globals.SmalltalkImage);
  2885. $core.addMethod(
  2886. $core.method({
  2887. selector: "asSmalltalkException:",
  2888. protocol: "error handling",
  2889. fn: function (anObject){
  2890. var self=this,$self=this;
  2891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2892. return $core.withContext(function($ctx1) {
  2893. //>>excludeEnd("ctx");
  2894. var $1;
  2895. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  2896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2897. return $core.withContext(function($ctx2) {
  2898. //>>excludeEnd("ctx");
  2899. return $recv(anObject)._isKindOf_($globals.Error);
  2900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2902. //>>excludeEnd("ctx");
  2903. }));
  2904. if($core.assert($1)){
  2905. return anObject;
  2906. } else {
  2907. return $recv($globals.JavaScriptException)._on_(anObject);
  2908. }
  2909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2910. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  2911. //>>excludeEnd("ctx");
  2912. },
  2913. //>>excludeStart("ide", pragmas.excludeIdeData);
  2914. args: ["anObject"],
  2915. 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 ]",
  2916. referencedClasses: ["Error", "JavaScriptException"],
  2917. //>>excludeEnd("ide");
  2918. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  2919. }),
  2920. $globals.SmalltalkImage);
  2921. $core.addMethod(
  2922. $core.method({
  2923. selector: "basicCreatePackage:",
  2924. protocol: "private",
  2925. fn: function (packageName){
  2926. var self=this,$self=this;
  2927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2928. return $core.withContext(function($ctx1) {
  2929. //>>excludeEnd("ctx");
  2930. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  2931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2932. return $core.withContext(function($ctx2) {
  2933. //>>excludeEnd("ctx");
  2934. return $recv($globals.Package)._new_(packageName);
  2935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2937. //>>excludeEnd("ctx");
  2938. }));
  2939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2940. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  2941. //>>excludeEnd("ctx");
  2942. },
  2943. //>>excludeStart("ide", pragmas.excludeIdeData);
  2944. args: ["packageName"],
  2945. 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 ]",
  2946. referencedClasses: ["Package"],
  2947. //>>excludeEnd("ide");
  2948. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  2949. }),
  2950. $globals.SmalltalkImage);
  2951. $core.addMethod(
  2952. $core.method({
  2953. selector: "basicParse:",
  2954. protocol: "private",
  2955. fn: function (aString){
  2956. var self=this,$self=this;
  2957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2958. return $core.withContext(function($ctx1) {
  2959. //>>excludeEnd("ctx");
  2960. return $recv($globals.SmalltalkParser)._parse_(aString);
  2961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2962. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  2963. //>>excludeEnd("ctx");
  2964. },
  2965. //>>excludeStart("ide", pragmas.excludeIdeData);
  2966. args: ["aString"],
  2967. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  2968. referencedClasses: ["SmalltalkParser"],
  2969. //>>excludeEnd("ide");
  2970. messageSends: ["parse:"]
  2971. }),
  2972. $globals.SmalltalkImage);
  2973. $core.addMethod(
  2974. $core.method({
  2975. selector: "cancelOptOut:",
  2976. protocol: "accessing",
  2977. fn: function (anObject){
  2978. var self=this,$self=this;
  2979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2980. return $core.withContext(function($ctx1) {
  2981. //>>excludeEnd("ctx");
  2982. delete anObject.a$cls;;
  2983. return self;
  2984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2985. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  2986. //>>excludeEnd("ctx");
  2987. },
  2988. //>>excludeStart("ide", pragmas.excludeIdeData);
  2989. args: ["anObject"],
  2990. 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.a$cls;'>",
  2991. referencedClasses: [],
  2992. //>>excludeEnd("ide");
  2993. messageSends: []
  2994. }),
  2995. $globals.SmalltalkImage);
  2996. $core.addMethod(
  2997. $core.method({
  2998. selector: "classes",
  2999. protocol: "classes",
  3000. fn: function (){
  3001. var self=this,$self=this;
  3002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3003. return $core.withContext(function($ctx1) {
  3004. //>>excludeEnd("ctx");
  3005. return $recv($recv($self._core())._traitsOrClasses())._copy();
  3006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3007. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  3008. //>>excludeEnd("ctx");
  3009. },
  3010. //>>excludeStart("ide", pragmas.excludeIdeData);
  3011. args: [],
  3012. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  3013. referencedClasses: [],
  3014. //>>excludeEnd("ide");
  3015. messageSends: ["copy", "traitsOrClasses", "core"]
  3016. }),
  3017. $globals.SmalltalkImage);
  3018. $core.addMethod(
  3019. $core.method({
  3020. selector: "core",
  3021. protocol: "accessing",
  3022. fn: function (){
  3023. var self=this,$self=this;
  3024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3025. return $core.withContext(function($ctx1) {
  3026. //>>excludeEnd("ctx");
  3027. return $core;
  3028. return self;
  3029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3030. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  3031. //>>excludeEnd("ctx");
  3032. },
  3033. //>>excludeStart("ide", pragmas.excludeIdeData);
  3034. args: [],
  3035. source: "core\x0a\x09<inlineJS: 'return $core'>",
  3036. referencedClasses: [],
  3037. //>>excludeEnd("ide");
  3038. messageSends: []
  3039. }),
  3040. $globals.SmalltalkImage);
  3041. $core.addMethod(
  3042. $core.method({
  3043. selector: "createPackage:",
  3044. protocol: "packages",
  3045. fn: function (packageName){
  3046. var self=this,$self=this;
  3047. var package_,announcement;
  3048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3049. return $core.withContext(function($ctx1) {
  3050. //>>excludeEnd("ctx");
  3051. var $1;
  3052. package_=$self._basicCreatePackage_(packageName);
  3053. $1=$recv($globals.PackageAdded)._new();
  3054. $recv($1)._package_(package_);
  3055. announcement=$recv($1)._yourself();
  3056. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  3057. return package_;
  3058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3059. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  3060. //>>excludeEnd("ctx");
  3061. },
  3062. //>>excludeStart("ide", pragmas.excludeIdeData);
  3063. args: ["packageName"],
  3064. 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",
  3065. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  3066. //>>excludeEnd("ide");
  3067. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  3068. }),
  3069. $globals.SmalltalkImage);
  3070. $core.addMethod(
  3071. $core.method({
  3072. selector: "defaultAmdNamespace",
  3073. protocol: "accessing amd",
  3074. fn: function (){
  3075. var self=this,$self=this;
  3076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3077. return $core.withContext(function($ctx1) {
  3078. //>>excludeEnd("ctx");
  3079. return "transport.defaultAmdNamespace"._settingValue();
  3080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3081. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  3082. //>>excludeEnd("ctx");
  3083. },
  3084. //>>excludeStart("ide", pragmas.excludeIdeData);
  3085. args: [],
  3086. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  3087. referencedClasses: [],
  3088. //>>excludeEnd("ide");
  3089. messageSends: ["settingValue"]
  3090. }),
  3091. $globals.SmalltalkImage);
  3092. $core.addMethod(
  3093. $core.method({
  3094. selector: "defaultAmdNamespace:",
  3095. protocol: "accessing amd",
  3096. fn: function (aString){
  3097. var self=this,$self=this;
  3098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3099. return $core.withContext(function($ctx1) {
  3100. //>>excludeEnd("ctx");
  3101. "transport.defaultAmdNamespace"._settingValue_(aString);
  3102. return self;
  3103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3104. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  3105. //>>excludeEnd("ctx");
  3106. },
  3107. //>>excludeStart("ide", pragmas.excludeIdeData);
  3108. args: ["aString"],
  3109. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  3110. referencedClasses: [],
  3111. //>>excludeEnd("ide");
  3112. messageSends: ["settingValue:"]
  3113. }),
  3114. $globals.SmalltalkImage);
  3115. $core.addMethod(
  3116. $core.method({
  3117. selector: "deleteClass:",
  3118. protocol: "private",
  3119. fn: function (aClass){
  3120. var self=this,$self=this;
  3121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3122. return $core.withContext(function($ctx1) {
  3123. //>>excludeEnd("ctx");
  3124. $core.removeClass(aClass);
  3125. return self;
  3126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3127. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  3128. //>>excludeEnd("ctx");
  3129. },
  3130. //>>excludeStart("ide", pragmas.excludeIdeData);
  3131. args: ["aClass"],
  3132. 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)'>",
  3133. referencedClasses: [],
  3134. //>>excludeEnd("ide");
  3135. messageSends: []
  3136. }),
  3137. $globals.SmalltalkImage);
  3138. $core.addMethod(
  3139. $core.method({
  3140. selector: "deleteGlobalJsVariable:",
  3141. protocol: "globals",
  3142. fn: function (aString){
  3143. var self=this,$self=this;
  3144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3145. return $core.withContext(function($ctx1) {
  3146. //>>excludeEnd("ctx");
  3147. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  3148. }));
  3149. return self;
  3150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3151. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  3152. //>>excludeEnd("ctx");
  3153. },
  3154. //>>excludeStart("ide", pragmas.excludeIdeData);
  3155. args: ["aString"],
  3156. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  3157. referencedClasses: [],
  3158. //>>excludeEnd("ide");
  3159. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  3160. }),
  3161. $globals.SmalltalkImage);
  3162. $core.addMethod(
  3163. $core.method({
  3164. selector: "existsJsGlobal:",
  3165. protocol: "testing",
  3166. fn: function (aString){
  3167. var self=this,$self=this;
  3168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3169. return $core.withContext(function($ctx1) {
  3170. //>>excludeEnd("ctx");
  3171. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  3172. return $recv($globals.Platform)._includesGlobal_(aString);
  3173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3174. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  3175. //>>excludeEnd("ctx");
  3176. },
  3177. //>>excludeStart("ide", pragmas.excludeIdeData);
  3178. args: ["aString"],
  3179. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  3180. referencedClasses: ["Platform"],
  3181. //>>excludeEnd("ide");
  3182. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  3183. }),
  3184. $globals.SmalltalkImage);
  3185. $core.addMethod(
  3186. $core.method({
  3187. selector: "globalJsVariables",
  3188. protocol: "globals",
  3189. fn: function (){
  3190. var self=this,$self=this;
  3191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3192. return $core.withContext(function($ctx1) {
  3193. //>>excludeEnd("ctx");
  3194. var $1,$receiver;
  3195. $1=$self["@globalJsVariables"];
  3196. if(($receiver = $1) == null || $receiver.a$nil){
  3197. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  3198. return $self["@globalJsVariables"];
  3199. } else {
  3200. return $1;
  3201. }
  3202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3203. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  3204. //>>excludeEnd("ctx");
  3205. },
  3206. //>>excludeStart("ide", pragmas.excludeIdeData);
  3207. args: [],
  3208. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  3209. referencedClasses: [],
  3210. //>>excludeEnd("ide");
  3211. messageSends: ["ifNil:"]
  3212. }),
  3213. $globals.SmalltalkImage);
  3214. $core.addMethod(
  3215. $core.method({
  3216. selector: "globals",
  3217. protocol: "accessing",
  3218. fn: function (){
  3219. var self=this,$self=this;
  3220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3221. return $core.withContext(function($ctx1) {
  3222. //>>excludeEnd("ctx");
  3223. return $globals;
  3224. return self;
  3225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3226. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  3227. //>>excludeEnd("ctx");
  3228. },
  3229. //>>excludeStart("ide", pragmas.excludeIdeData);
  3230. args: [],
  3231. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  3232. referencedClasses: [],
  3233. //>>excludeEnd("ide");
  3234. messageSends: []
  3235. }),
  3236. $globals.SmalltalkImage);
  3237. $core.addMethod(
  3238. $core.method({
  3239. selector: "includesKey:",
  3240. protocol: "accessing",
  3241. fn: function (aKey){
  3242. var self=this,$self=this;
  3243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3244. return $core.withContext(function($ctx1) {
  3245. //>>excludeEnd("ctx");
  3246. return $core.hasOwnProperty(aKey);
  3247. return self;
  3248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3249. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  3250. //>>excludeEnd("ctx");
  3251. },
  3252. //>>excludeStart("ide", pragmas.excludeIdeData);
  3253. args: ["aKey"],
  3254. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  3255. referencedClasses: [],
  3256. //>>excludeEnd("ide");
  3257. messageSends: []
  3258. }),
  3259. $globals.SmalltalkImage);
  3260. $core.addMethod(
  3261. $core.method({
  3262. selector: "isSmalltalkObject:",
  3263. protocol: "testing",
  3264. fn: function (anObject){
  3265. var self=this,$self=this;
  3266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3267. return $core.withContext(function($ctx1) {
  3268. //>>excludeEnd("ctx");
  3269. return anObject.a$cls != null;
  3270. return self;
  3271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3272. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  3273. //>>excludeEnd("ctx");
  3274. },
  3275. //>>excludeStart("ide", pragmas.excludeIdeData);
  3276. args: ["anObject"],
  3277. 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'>",
  3278. referencedClasses: [],
  3279. //>>excludeEnd("ide");
  3280. messageSends: []
  3281. }),
  3282. $globals.SmalltalkImage);
  3283. $core.addMethod(
  3284. $core.method({
  3285. selector: "optOut:",
  3286. protocol: "accessing",
  3287. fn: function (anObject){
  3288. var self=this,$self=this;
  3289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3290. return $core.withContext(function($ctx1) {
  3291. //>>excludeEnd("ctx");
  3292. anObject.a$cls = null;
  3293. return self;
  3294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3295. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  3296. //>>excludeEnd("ctx");
  3297. },
  3298. //>>excludeStart("ide", pragmas.excludeIdeData);
  3299. args: ["anObject"],
  3300. 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.a$cls = null'>",
  3301. referencedClasses: [],
  3302. //>>excludeEnd("ide");
  3303. messageSends: []
  3304. }),
  3305. $globals.SmalltalkImage);
  3306. $core.addMethod(
  3307. $core.method({
  3308. selector: "packageAt:ifAbsent:",
  3309. protocol: "packages",
  3310. fn: function (packageName,aBlock){
  3311. var self=this,$self=this;
  3312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3313. return $core.withContext(function($ctx1) {
  3314. //>>excludeEnd("ctx");
  3315. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  3316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3317. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  3318. //>>excludeEnd("ctx");
  3319. },
  3320. //>>excludeStart("ide", pragmas.excludeIdeData);
  3321. args: ["packageName", "aBlock"],
  3322. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  3323. referencedClasses: [],
  3324. //>>excludeEnd("ide");
  3325. messageSends: ["at:ifAbsent:", "packageDictionary"]
  3326. }),
  3327. $globals.SmalltalkImage);
  3328. $core.addMethod(
  3329. $core.method({
  3330. selector: "packageAt:ifPresent:",
  3331. protocol: "packages",
  3332. fn: function (packageName,aBlock){
  3333. var self=this,$self=this;
  3334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3335. return $core.withContext(function($ctx1) {
  3336. //>>excludeEnd("ctx");
  3337. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  3338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3339. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  3340. //>>excludeEnd("ctx");
  3341. },
  3342. //>>excludeStart("ide", pragmas.excludeIdeData);
  3343. args: ["packageName", "aBlock"],
  3344. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  3345. referencedClasses: [],
  3346. //>>excludeEnd("ide");
  3347. messageSends: ["at:ifPresent:", "packageDictionary"]
  3348. }),
  3349. $globals.SmalltalkImage);
  3350. $core.addMethod(
  3351. $core.method({
  3352. selector: "packageDictionary",
  3353. protocol: "packages",
  3354. fn: function (){
  3355. var self=this,$self=this;
  3356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3357. return $core.withContext(function($ctx1) {
  3358. //>>excludeEnd("ctx");
  3359. var $1,$receiver;
  3360. $1=$self["@packageDictionary"];
  3361. if(($receiver = $1) == null || $receiver.a$nil){
  3362. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  3363. return $self["@packageDictionary"];
  3364. } else {
  3365. return $1;
  3366. }
  3367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3368. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  3369. //>>excludeEnd("ctx");
  3370. },
  3371. //>>excludeStart("ide", pragmas.excludeIdeData);
  3372. args: [],
  3373. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  3374. referencedClasses: ["Dictionary"],
  3375. //>>excludeEnd("ide");
  3376. messageSends: ["ifNil:", "new"]
  3377. }),
  3378. $globals.SmalltalkImage);
  3379. $core.addMethod(
  3380. $core.method({
  3381. selector: "packages",
  3382. protocol: "packages",
  3383. fn: function (){
  3384. var self=this,$self=this;
  3385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3386. return $core.withContext(function($ctx1) {
  3387. //>>excludeEnd("ctx");
  3388. return $recv($recv($self._packageDictionary())._values())._copy();
  3389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3390. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  3391. //>>excludeEnd("ctx");
  3392. },
  3393. //>>excludeStart("ide", pragmas.excludeIdeData);
  3394. args: [],
  3395. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  3396. referencedClasses: [],
  3397. //>>excludeEnd("ide");
  3398. messageSends: ["copy", "values", "packageDictionary"]
  3399. }),
  3400. $globals.SmalltalkImage);
  3401. $core.addMethod(
  3402. $core.method({
  3403. selector: "parse:",
  3404. protocol: "accessing",
  3405. fn: function (aString){
  3406. var self=this,$self=this;
  3407. var result;
  3408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3409. return $core.withContext(function($ctx1) {
  3410. //>>excludeEnd("ctx");
  3411. var $1;
  3412. $recv((function(){
  3413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3414. return $core.withContext(function($ctx2) {
  3415. //>>excludeEnd("ctx");
  3416. result=$self._basicParse_(aString);
  3417. return result;
  3418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3420. //>>excludeEnd("ctx");
  3421. }))._tryCatch_((function(ex){
  3422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3423. return $core.withContext(function($ctx2) {
  3424. //>>excludeEnd("ctx");
  3425. return $recv($self._parseError_parsing_(ex,aString))._signal();
  3426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3427. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  3428. //>>excludeEnd("ctx");
  3429. }));
  3430. $1=result;
  3431. $recv($1)._source_(aString);
  3432. return $recv($1)._yourself();
  3433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3434. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  3435. //>>excludeEnd("ctx");
  3436. },
  3437. //>>excludeStart("ide", pragmas.excludeIdeData);
  3438. args: ["aString"],
  3439. 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",
  3440. referencedClasses: [],
  3441. //>>excludeEnd("ide");
  3442. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  3443. }),
  3444. $globals.SmalltalkImage);
  3445. $core.addMethod(
  3446. $core.method({
  3447. selector: "parseError:parsing:",
  3448. protocol: "error handling",
  3449. fn: function (anException,aString){
  3450. var self=this,$self=this;
  3451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3452. return $core.withContext(function($ctx1) {
  3453. //>>excludeEnd("ctx");
  3454. var $1,$2,$9,$8,$7,$6,$5,$4,$3,$receiver;
  3455. $1=$recv(anException)._basicAt_("location");
  3456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3457. $ctx1.sendIdx["basicAt:"]=1;
  3458. //>>excludeEnd("ctx");
  3459. if(($receiver = $1) == null || $receiver.a$nil){
  3460. return $recv(anException)._pass();
  3461. } else {
  3462. var loc;
  3463. loc=$receiver;
  3464. $2=$recv($globals.ParseError)._new();
  3465. $9=$recv(loc)._start();
  3466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3467. $ctx1.sendIdx["start"]=1;
  3468. //>>excludeEnd("ctx");
  3469. $8=$recv($9)._line();
  3470. $7="Parse error on line ".__comma($8);
  3471. $6=$recv($7).__comma(" column ");
  3472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3473. $ctx1.sendIdx[","]=4;
  3474. //>>excludeEnd("ctx");
  3475. $5=$recv($6).__comma($recv($recv(loc)._start())._column());
  3476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3477. $ctx1.sendIdx[","]=3;
  3478. //>>excludeEnd("ctx");
  3479. $4=$recv($5).__comma(" : Unexpected character ");
  3480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3481. $ctx1.sendIdx[","]=2;
  3482. //>>excludeEnd("ctx");
  3483. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  3484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3485. $ctx1.sendIdx[","]=1;
  3486. //>>excludeEnd("ctx");
  3487. $recv($2)._messageText_($3);
  3488. return $recv($2)._yourself();
  3489. }
  3490. return self;
  3491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3492. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  3493. //>>excludeEnd("ctx");
  3494. },
  3495. //>>excludeStart("ide", pragmas.excludeIdeData);
  3496. args: ["anException", "aString"],
  3497. 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 ]",
  3498. referencedClasses: ["ParseError"],
  3499. //>>excludeEnd("ide");
  3500. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  3501. }),
  3502. $globals.SmalltalkImage);
  3503. $core.addMethod(
  3504. $core.method({
  3505. selector: "postLoad",
  3506. protocol: "image",
  3507. fn: function (){
  3508. var self=this,$self=this;
  3509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3510. return $core.withContext(function($ctx1) {
  3511. //>>excludeEnd("ctx");
  3512. var $1;
  3513. return $recv($self._adoptPackageDescriptors())._then_((function(pkgs){
  3514. var classes;
  3515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3516. return $core.withContext(function($ctx2) {
  3517. //>>excludeEnd("ctx");
  3518. $recv(pkgs)._do_("beClean");
  3519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3520. $ctx2.sendIdx["do:"]=1;
  3521. //>>excludeEnd("ctx");
  3522. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  3523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3524. return $core.withContext(function($ctx3) {
  3525. //>>excludeEnd("ctx");
  3526. return $recv(pkgs)._includes_($recv(each)._package());
  3527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3528. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  3529. //>>excludeEnd("ctx");
  3530. }));
  3531. $recv(classes)._do_((function(each){
  3532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3533. return $core.withContext(function($ctx3) {
  3534. //>>excludeEnd("ctx");
  3535. $1=$recv(each).__eq($self._class());
  3536. if(!$core.assert($1)){
  3537. return $recv(each)._initialize();
  3538. }
  3539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3540. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  3541. //>>excludeEnd("ctx");
  3542. }));
  3543. return $self._sweepPackageDescriptors_(pkgs);
  3544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3545. }, function($ctx2) {$ctx2.fillBlock({pkgs:pkgs,classes:classes},$ctx1,1)});
  3546. //>>excludeEnd("ctx");
  3547. }));
  3548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3549. }, function($ctx1) {$ctx1.fill(self,"postLoad",{},$globals.SmalltalkImage)});
  3550. //>>excludeEnd("ctx");
  3551. },
  3552. //>>excludeStart("ide", pragmas.excludeIdeData);
  3553. args: [],
  3554. source: "postLoad\x0a\x09^ self adoptPackageDescriptors then: [ :pkgs |\x0a\x09\x09| classes |\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 ]",
  3555. referencedClasses: ["Smalltalk"],
  3556. //>>excludeEnd("ide");
  3557. messageSends: ["then:", "adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  3558. }),
  3559. $globals.SmalltalkImage);
  3560. $core.addMethod(
  3561. $core.method({
  3562. selector: "pseudoVariableNames",
  3563. protocol: "accessing",
  3564. fn: function (){
  3565. var self=this,$self=this;
  3566. return ["self", "super", "nil", "true", "false", "thisContext"];
  3567. },
  3568. //>>excludeStart("ide", pragmas.excludeIdeData);
  3569. args: [],
  3570. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  3571. referencedClasses: [],
  3572. //>>excludeEnd("ide");
  3573. messageSends: []
  3574. }),
  3575. $globals.SmalltalkImage);
  3576. $core.addMethod(
  3577. $core.method({
  3578. selector: "readJSObject:",
  3579. protocol: "accessing",
  3580. fn: function (anObject){
  3581. var self=this,$self=this;
  3582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3583. return $core.withContext(function($ctx1) {
  3584. //>>excludeEnd("ctx");
  3585. return $core.readJSObject(anObject);
  3586. return self;
  3587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3588. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  3589. //>>excludeEnd("ctx");
  3590. },
  3591. //>>excludeStart("ide", pragmas.excludeIdeData);
  3592. args: ["anObject"],
  3593. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  3594. referencedClasses: [],
  3595. //>>excludeEnd("ide");
  3596. messageSends: []
  3597. }),
  3598. $globals.SmalltalkImage);
  3599. $core.addMethod(
  3600. $core.method({
  3601. selector: "removeClass:",
  3602. protocol: "classes",
  3603. fn: function (aClass){
  3604. var self=this,$self=this;
  3605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3606. return $core.withContext(function($ctx1) {
  3607. //>>excludeEnd("ctx");
  3608. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  3609. $1=$recv(aClass)._isMetaclass();
  3610. if($core.assert($1)){
  3611. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  3612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3613. $ctx1.sendIdx[","]=1;
  3614. //>>excludeEnd("ctx");
  3615. $self._error_($2);
  3616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3617. $ctx1.sendIdx["error:"]=1;
  3618. //>>excludeEnd("ctx");
  3619. }
  3620. $recv(aClass)._allSubclassesDo_((function(subclass){
  3621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3622. return $core.withContext(function($ctx2) {
  3623. //>>excludeEnd("ctx");
  3624. $5=$recv(aClass)._name();
  3625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3626. $ctx2.sendIdx["name"]=1;
  3627. //>>excludeEnd("ctx");
  3628. $4=$recv($5).__comma(" has a subclass: ");
  3629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3630. $ctx2.sendIdx[","]=3;
  3631. //>>excludeEnd("ctx");
  3632. $6=$recv(subclass)._name();
  3633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3634. $ctx2.sendIdx["name"]=2;
  3635. //>>excludeEnd("ctx");
  3636. $3=$recv($4).__comma($6);
  3637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3638. $ctx2.sendIdx[","]=2;
  3639. //>>excludeEnd("ctx");
  3640. return $self._error_($3);
  3641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3642. $ctx2.sendIdx["error:"]=2;
  3643. //>>excludeEnd("ctx");
  3644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3645. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  3646. //>>excludeEnd("ctx");
  3647. }));
  3648. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  3649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3650. return $core.withContext(function($ctx2) {
  3651. //>>excludeEnd("ctx");
  3652. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  3653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  3655. //>>excludeEnd("ctx");
  3656. }));
  3657. $self._deleteClass_(aClass);
  3658. $recv(aClass)._setTraitComposition_([]);
  3659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3660. $ctx1.sendIdx["setTraitComposition:"]=1;
  3661. //>>excludeEnd("ctx");
  3662. $7=$recv(aClass)._theMetaClass();
  3663. if(($receiver = $7) == null || $receiver.a$nil){
  3664. $7;
  3665. } else {
  3666. var meta;
  3667. meta=$receiver;
  3668. $recv(meta)._setTraitComposition_([]);
  3669. }
  3670. $8=$recv($globals.SystemAnnouncer)._current();
  3671. $10=$recv($globals.ClassRemoved)._new();
  3672. $recv($10)._theClass_(aClass);
  3673. $9=$recv($10)._yourself();
  3674. $recv($8)._announce_($9);
  3675. return self;
  3676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3677. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  3678. //>>excludeEnd("ctx");
  3679. },
  3680. //>>excludeStart("ide", pragmas.excludeIdeData);
  3681. args: ["aClass"],
  3682. 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)",
  3683. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  3684. //>>excludeEnd("ide");
  3685. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  3686. }),
  3687. $globals.SmalltalkImage);
  3688. $core.addMethod(
  3689. $core.method({
  3690. selector: "removePackage:",
  3691. protocol: "packages",
  3692. fn: function (packageName){
  3693. var self=this,$self=this;
  3694. var pkg;
  3695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3696. return $core.withContext(function($ctx1) {
  3697. //>>excludeEnd("ctx");
  3698. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  3699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3700. return $core.withContext(function($ctx2) {
  3701. //>>excludeEnd("ctx");
  3702. return $self._error_("Missing package: ".__comma(packageName));
  3703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3705. //>>excludeEnd("ctx");
  3706. }));
  3707. $recv($recv(pkg)._classes())._do_((function(each){
  3708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3709. return $core.withContext(function($ctx2) {
  3710. //>>excludeEnd("ctx");
  3711. return $self._removeClass_(each);
  3712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3713. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3714. //>>excludeEnd("ctx");
  3715. }));
  3716. $recv($self._packageDictionary())._removeKey_(packageName);
  3717. return self;
  3718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3719. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  3720. //>>excludeEnd("ctx");
  3721. },
  3722. //>>excludeStart("ide", pragmas.excludeIdeData);
  3723. args: ["packageName"],
  3724. 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",
  3725. referencedClasses: [],
  3726. //>>excludeEnd("ide");
  3727. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  3728. }),
  3729. $globals.SmalltalkImage);
  3730. $core.addMethod(
  3731. $core.method({
  3732. selector: "renamePackage:to:",
  3733. protocol: "packages",
  3734. fn: function (packageName,newName){
  3735. var self=this,$self=this;
  3736. var pkg;
  3737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3738. return $core.withContext(function($ctx1) {
  3739. //>>excludeEnd("ctx");
  3740. var $1,$2,$3;
  3741. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  3742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3743. return $core.withContext(function($ctx2) {
  3744. //>>excludeEnd("ctx");
  3745. $1="Missing package: ".__comma(packageName);
  3746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3747. $ctx2.sendIdx[","]=1;
  3748. //>>excludeEnd("ctx");
  3749. return $self._error_($1);
  3750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3751. $ctx2.sendIdx["error:"]=1;
  3752. //>>excludeEnd("ctx");
  3753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3755. //>>excludeEnd("ctx");
  3756. }));
  3757. $self._packageAt_ifPresent_(newName,(function(){
  3758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3759. return $core.withContext(function($ctx2) {
  3760. //>>excludeEnd("ctx");
  3761. return $self._error_("Already exists a package called: ".__comma(newName));
  3762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3764. //>>excludeEnd("ctx");
  3765. }));
  3766. $2=pkg;
  3767. $recv($2)._name_(newName);
  3768. $recv($2)._beDirty();
  3769. $3=$self._packageDictionary();
  3770. $recv($3)._at_put_(newName,pkg);
  3771. $recv($3)._removeKey_(packageName);
  3772. return self;
  3773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3774. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  3775. //>>excludeEnd("ctx");
  3776. },
  3777. //>>excludeStart("ide", pragmas.excludeIdeData);
  3778. args: ["packageName", "newName"],
  3779. 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",
  3780. referencedClasses: [],
  3781. //>>excludeEnd("ide");
  3782. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  3783. }),
  3784. $globals.SmalltalkImage);
  3785. $core.addMethod(
  3786. $core.method({
  3787. selector: "reservedWords",
  3788. protocol: "accessing",
  3789. fn: function (){
  3790. var self=this,$self=this;
  3791. 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"];
  3792. },
  3793. //>>excludeStart("ide", pragmas.excludeIdeData);
  3794. args: [],
  3795. 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)",
  3796. referencedClasses: [],
  3797. //>>excludeEnd("ide");
  3798. messageSends: []
  3799. }),
  3800. $globals.SmalltalkImage);
  3801. $core.addMethod(
  3802. $core.method({
  3803. selector: "settings",
  3804. protocol: "accessing",
  3805. fn: function (){
  3806. var self=this,$self=this;
  3807. return $globals.SmalltalkSettings;
  3808. },
  3809. //>>excludeStart("ide", pragmas.excludeIdeData);
  3810. args: [],
  3811. source: "settings\x0a\x09^ SmalltalkSettings",
  3812. referencedClasses: ["SmalltalkSettings"],
  3813. //>>excludeEnd("ide");
  3814. messageSends: []
  3815. }),
  3816. $globals.SmalltalkImage);
  3817. $core.addMethod(
  3818. $core.method({
  3819. selector: "sweepPackageDescriptors:",
  3820. protocol: "private",
  3821. fn: function (pkgs){
  3822. var self=this,$self=this;
  3823. var pd;
  3824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3825. return $core.withContext(function($ctx1) {
  3826. //>>excludeEnd("ctx");
  3827. pd=$recv($self._core())._packageDescriptors();
  3828. $recv(pkgs)._do_((function(each){
  3829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3830. return $core.withContext(function($ctx2) {
  3831. //>>excludeEnd("ctx");
  3832. return $recv(pd)._removeKey_($recv(each)._name());
  3833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3834. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3835. //>>excludeEnd("ctx");
  3836. }));
  3837. return self;
  3838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3839. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd},$globals.SmalltalkImage)});
  3840. //>>excludeEnd("ctx");
  3841. },
  3842. //>>excludeStart("ide", pragmas.excludeIdeData);
  3843. args: ["pkgs"],
  3844. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  3845. referencedClasses: [],
  3846. //>>excludeEnd("ide");
  3847. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  3848. }),
  3849. $globals.SmalltalkImage);
  3850. $core.addMethod(
  3851. $core.method({
  3852. selector: "tryAdoptPackageDescriptorsBeyond:",
  3853. protocol: "private",
  3854. fn: function (aSet){
  3855. var self=this,$self=this;
  3856. var original;
  3857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3858. return $core.withContext(function($ctx1) {
  3859. //>>excludeEnd("ctx");
  3860. var $1;
  3861. original=$recv(aSet)._copy();
  3862. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  3863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3864. return $core.withContext(function($ctx2) {
  3865. //>>excludeEnd("ctx");
  3866. return $recv(aSet)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  3867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3868. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  3869. //>>excludeEnd("ctx");
  3870. }));
  3871. $1=$recv(aSet)._allSatisfy_((function(each){
  3872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3873. return $core.withContext(function($ctx2) {
  3874. //>>excludeEnd("ctx");
  3875. return $recv(original)._includes_(each);
  3876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3877. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3878. //>>excludeEnd("ctx");
  3879. }));
  3880. if($core.assert($1)){
  3881. return $recv($globals.Promise)._value_(aSet);
  3882. } else {
  3883. return $recv($recv($globals.Promise)._all_($recv(aSet)._collect_("isReady")))._then_((function(){
  3884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3885. return $core.withContext(function($ctx2) {
  3886. //>>excludeEnd("ctx");
  3887. return $self._tryAdoptPackageDescriptorsBeyond_(aSet);
  3888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  3890. //>>excludeEnd("ctx");
  3891. }));
  3892. }
  3893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3894. }, function($ctx1) {$ctx1.fill(self,"tryAdoptPackageDescriptorsBeyond:",{aSet:aSet,original:original},$globals.SmalltalkImage)});
  3895. //>>excludeEnd("ctx");
  3896. },
  3897. //>>excludeStart("ide", pragmas.excludeIdeData);
  3898. args: ["aSet"],
  3899. source: "tryAdoptPackageDescriptorsBeyond: aSet\x0a\x09| original |\x0a\x09original := aSet copy.\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value |\x0a\x09\x09aSet add: (Package named: key javaScriptDescriptor: value) ].\x0a\x09^ (aSet allSatisfy: [ :each | original includes: each ])\x0a\x09\x09ifFalse: [ (Promise all: (aSet collect: #isReady)) then: [ self tryAdoptPackageDescriptorsBeyond: aSet ] ]\x0a\x09\x09ifTrue: [ Promise value: aSet ]",
  3900. referencedClasses: ["Package", "Promise"],
  3901. //>>excludeEnd("ide");
  3902. messageSends: ["copy", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:", "ifFalse:ifTrue:", "allSatisfy:", "includes:", "then:", "all:", "collect:", "tryAdoptPackageDescriptorsBeyond:", "value:"]
  3903. }),
  3904. $globals.SmalltalkImage);
  3905. $core.addMethod(
  3906. $core.method({
  3907. selector: "version",
  3908. protocol: "accessing",
  3909. fn: function (){
  3910. var self=this,$self=this;
  3911. return "0.23.0-pre";
  3912. },
  3913. //>>excludeStart("ide", pragmas.excludeIdeData);
  3914. args: [],
  3915. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.23.0-pre'",
  3916. referencedClasses: [],
  3917. //>>excludeEnd("ide");
  3918. messageSends: []
  3919. }),
  3920. $globals.SmalltalkImage);
  3921. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  3922. $core.addMethod(
  3923. $core.method({
  3924. selector: "current",
  3925. protocol: "instance creation",
  3926. fn: function (){
  3927. var self=this,$self=this;
  3928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3929. return $core.withContext(function($ctx1) {
  3930. //>>excludeEnd("ctx");
  3931. var $1,$receiver;
  3932. $1=$self["@current"];
  3933. if(($receiver = $1) == null || $receiver.a$nil){
  3934. $self["@current"]=(
  3935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3936. $ctx1.supercall = true,
  3937. //>>excludeEnd("ctx");
  3938. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  3939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3940. $ctx1.supercall = false;
  3941. //>>excludeEnd("ctx");;
  3942. return $self["@current"];
  3943. } else {
  3944. $self._deprecatedAPI();
  3945. return $self["@current"];
  3946. }
  3947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3948. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  3949. //>>excludeEnd("ctx");
  3950. },
  3951. //>>excludeStart("ide", pragmas.excludeIdeData);
  3952. args: [],
  3953. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  3954. referencedClasses: [],
  3955. //>>excludeEnd("ide");
  3956. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  3957. }),
  3958. $globals.SmalltalkImage.a$cls);
  3959. $core.addMethod(
  3960. $core.method({
  3961. selector: "initialize",
  3962. protocol: "initialization",
  3963. fn: function (){
  3964. var self=this,$self=this;
  3965. var st;
  3966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3967. return $core.withContext(function($ctx1) {
  3968. //>>excludeEnd("ctx");
  3969. st=$self._current();
  3970. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  3971. return self;
  3972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3973. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  3974. //>>excludeEnd("ctx");
  3975. },
  3976. //>>excludeStart("ide", pragmas.excludeIdeData);
  3977. args: [],
  3978. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  3979. referencedClasses: [],
  3980. //>>excludeEnd("ide");
  3981. messageSends: ["current", "at:put:", "globals"]
  3982. }),
  3983. $globals.SmalltalkImage.a$cls);
  3984. $core.addMethod(
  3985. $core.method({
  3986. selector: "new",
  3987. protocol: "instance creation",
  3988. fn: function (){
  3989. var self=this,$self=this;
  3990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3991. return $core.withContext(function($ctx1) {
  3992. //>>excludeEnd("ctx");
  3993. $self._shouldNotImplement();
  3994. return self;
  3995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3996. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  3997. //>>excludeEnd("ctx");
  3998. },
  3999. //>>excludeStart("ide", pragmas.excludeIdeData);
  4000. args: [],
  4001. source: "new\x0a\x09self shouldNotImplement",
  4002. referencedClasses: [],
  4003. //>>excludeEnd("ide");
  4004. messageSends: ["shouldNotImplement"]
  4005. }),
  4006. $globals.SmalltalkImage.a$cls);
  4007. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  4008. $core.addMethod(
  4009. $core.method({
  4010. selector: "nextPutJSObject:",
  4011. protocol: "*Kernel-Infrastructure",
  4012. fn: function (aJSObject){
  4013. var self=this,$self=this;
  4014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4015. return $core.withContext(function($ctx1) {
  4016. //>>excludeEnd("ctx");
  4017. $self._nextPut_(aJSObject);
  4018. return self;
  4019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4020. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  4021. //>>excludeEnd("ctx");
  4022. },
  4023. //>>excludeStart("ide", pragmas.excludeIdeData);
  4024. args: ["aJSObject"],
  4025. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  4026. referencedClasses: [],
  4027. //>>excludeEnd("ide");
  4028. messageSends: ["nextPut:"]
  4029. }),
  4030. $globals.ProtoStream);
  4031. $core.addMethod(
  4032. $core.method({
  4033. selector: "asJavaScriptPropertyName",
  4034. protocol: "*Kernel-Infrastructure",
  4035. fn: function (){
  4036. var self=this,$self=this;
  4037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4038. return $core.withContext(function($ctx1) {
  4039. //>>excludeEnd("ctx");
  4040. return $core.st2prop(self);
  4041. return self;
  4042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4043. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  4044. //>>excludeEnd("ctx");
  4045. },
  4046. //>>excludeStart("ide", pragmas.excludeIdeData);
  4047. args: [],
  4048. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  4049. referencedClasses: [],
  4050. //>>excludeEnd("ide");
  4051. messageSends: []
  4052. }),
  4053. $globals.String);
  4054. $core.addMethod(
  4055. $core.method({
  4056. selector: "asSetting",
  4057. protocol: "*Kernel-Infrastructure",
  4058. fn: function (){
  4059. var self=this,$self=this;
  4060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4061. return $core.withContext(function($ctx1) {
  4062. //>>excludeEnd("ctx");
  4063. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  4064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4065. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  4066. //>>excludeEnd("ctx");
  4067. },
  4068. //>>excludeStart("ide", pragmas.excludeIdeData);
  4069. args: [],
  4070. 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",
  4071. referencedClasses: ["Setting"],
  4072. //>>excludeEnd("ide");
  4073. messageSends: ["at:ifAbsent:"]
  4074. }),
  4075. $globals.String);
  4076. $core.addMethod(
  4077. $core.method({
  4078. selector: "asSettingIfAbsent:",
  4079. protocol: "*Kernel-Infrastructure",
  4080. fn: function (aDefaultValue){
  4081. var self=this,$self=this;
  4082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4083. return $core.withContext(function($ctx1) {
  4084. //>>excludeEnd("ctx");
  4085. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  4086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4087. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  4088. //>>excludeEnd("ctx");
  4089. },
  4090. //>>excludeStart("ide", pragmas.excludeIdeData);
  4091. args: ["aDefaultValue"],
  4092. 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",
  4093. referencedClasses: ["Setting"],
  4094. //>>excludeEnd("ide");
  4095. messageSends: ["at:ifAbsent:"]
  4096. }),
  4097. $globals.String);
  4098. $core.addMethod(
  4099. $core.method({
  4100. selector: "settingValue",
  4101. protocol: "*Kernel-Infrastructure",
  4102. fn: function (){
  4103. var self=this,$self=this;
  4104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4105. return $core.withContext(function($ctx1) {
  4106. //>>excludeEnd("ctx");
  4107. return $recv($self._asSetting())._value();
  4108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4109. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  4110. //>>excludeEnd("ctx");
  4111. },
  4112. //>>excludeStart("ide", pragmas.excludeIdeData);
  4113. args: [],
  4114. source: "settingValue\x0a\x09^ self asSetting value",
  4115. referencedClasses: [],
  4116. //>>excludeEnd("ide");
  4117. messageSends: ["value", "asSetting"]
  4118. }),
  4119. $globals.String);
  4120. $core.addMethod(
  4121. $core.method({
  4122. selector: "settingValue:",
  4123. protocol: "*Kernel-Infrastructure",
  4124. fn: function (aValue){
  4125. var self=this,$self=this;
  4126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4127. return $core.withContext(function($ctx1) {
  4128. //>>excludeEnd("ctx");
  4129. return $recv($self._asSetting())._value_(aValue);
  4130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4131. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  4132. //>>excludeEnd("ctx");
  4133. },
  4134. //>>excludeStart("ide", pragmas.excludeIdeData);
  4135. args: ["aValue"],
  4136. 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",
  4137. referencedClasses: [],
  4138. //>>excludeEnd("ide");
  4139. messageSends: ["value:", "asSetting"]
  4140. }),
  4141. $globals.String);
  4142. $core.addMethod(
  4143. $core.method({
  4144. selector: "settingValueIfAbsent:",
  4145. protocol: "*Kernel-Infrastructure",
  4146. fn: function (aDefaultValue){
  4147. var self=this,$self=this;
  4148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4149. return $core.withContext(function($ctx1) {
  4150. //>>excludeEnd("ctx");
  4151. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  4152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4153. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  4154. //>>excludeEnd("ctx");
  4155. },
  4156. //>>excludeStart("ide", pragmas.excludeIdeData);
  4157. args: ["aDefaultValue"],
  4158. 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",
  4159. referencedClasses: [],
  4160. //>>excludeEnd("ide");
  4161. messageSends: ["value", "asSettingIfAbsent:"]
  4162. }),
  4163. $globals.String);
  4164. });