Kernel-Infrastructure.js 134 KB

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