Kernel-Infrastructure.js 128 KB

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