2
0

Kernel-Infrastructure.js 131 KB

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