Kernel-Infrastructure.js 157 KB

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