Kernel-Infrastructure.js 151 KB

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