Kernel-Infrastructure.js 138 KB

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