Kernel-Infrastructure.js 149 KB

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