Kernel-Infrastructure.js 133 KB

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