Kernel-Infrastructure.js 122 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497
  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: "asJSON",
  46. protocol: "enumerating",
  47. fn: function (){
  48. var self=this;
  49. return self["@jsObject"];
  50. },
  51. //>>excludeStart("ide", pragmas.excludeIdeData);
  52. args: [],
  53. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-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. $1=$recv($2)._asSet();
  1246. $recv($1)._remove_ifAbsent_(nil,(function(){
  1247. }));
  1248. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  1249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1250. return $core.withContext(function($ctx2) {
  1251. //>>excludeEnd("ctx");
  1252. $5=$recv(each)._protocols();
  1253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1254. $ctx2.sendIdx["protocols"]=1;
  1255. //>>excludeEnd("ctx");
  1256. $7=$recv(each)._theMetaClass();
  1257. if(($receiver = $7) == null || $receiver.isNil){
  1258. $6=[];
  1259. } else {
  1260. var meta;
  1261. meta=$receiver;
  1262. $6=$recv(meta)._protocols();
  1263. }
  1264. $4=$recv($5).__comma($6);
  1265. return $recv($4)._includes_(starCategoryName);
  1266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1267. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1268. //>>excludeEnd("ctx");
  1269. })));
  1270. return $recv($1)._yourself();
  1271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1272. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  1273. //>>excludeEnd("ctx");
  1274. },
  1275. //>>excludeStart("ide", pragmas.excludeIdeData);
  1276. args: [],
  1277. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk classes select: [ :each |\x0a\x09\x09\x09each protocols, (each theMetaClass ifNil: [ #() ] ifNotNil: [ :meta | meta protocols])\x0a\x09\x09\x09\x09includes: starCategoryName ]);\x0a\x09\x09yourself",
  1278. referencedClasses: ["Smalltalk"],
  1279. //>>excludeEnd("ide");
  1280. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "yourself"]
  1281. }),
  1282. $globals.Package);
  1283. $core.addMethod(
  1284. $core.method({
  1285. selector: "name",
  1286. protocol: "accessing",
  1287. fn: function (){
  1288. var self=this;
  1289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1290. return $core.withContext(function($ctx1) {
  1291. //>>excludeEnd("ctx");
  1292. return self.pkgName;
  1293. return self;
  1294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1295. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  1296. //>>excludeEnd("ctx");
  1297. },
  1298. //>>excludeStart("ide", pragmas.excludeIdeData);
  1299. args: [],
  1300. source: "name\x0a\x09<inlineJS: 'return self.pkgName'>",
  1301. referencedClasses: [],
  1302. //>>excludeEnd("ide");
  1303. messageSends: []
  1304. }),
  1305. $globals.Package);
  1306. $core.addMethod(
  1307. $core.method({
  1308. selector: "name:",
  1309. protocol: "accessing",
  1310. fn: function (aString){
  1311. var self=this;
  1312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1313. return $core.withContext(function($ctx1) {
  1314. //>>excludeEnd("ctx");
  1315. self._basicName_(aString);
  1316. self._beDirty();
  1317. return self;
  1318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1319. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  1320. //>>excludeEnd("ctx");
  1321. },
  1322. //>>excludeStart("ide", pragmas.excludeIdeData);
  1323. args: ["aString"],
  1324. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  1325. referencedClasses: [],
  1326. //>>excludeEnd("ide");
  1327. messageSends: ["basicName:", "beDirty"]
  1328. }),
  1329. $globals.Package);
  1330. $core.addMethod(
  1331. $core.method({
  1332. selector: "organization",
  1333. protocol: "accessing",
  1334. fn: function (){
  1335. var self=this;
  1336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1337. return $core.withContext(function($ctx1) {
  1338. //>>excludeEnd("ctx");
  1339. return self._basicAt_("organization");
  1340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1341. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  1342. //>>excludeEnd("ctx");
  1343. },
  1344. //>>excludeStart("ide", pragmas.excludeIdeData);
  1345. args: [],
  1346. source: "organization\x0a\x09^ self basicAt: 'organization'",
  1347. referencedClasses: [],
  1348. //>>excludeEnd("ide");
  1349. messageSends: ["basicAt:"]
  1350. }),
  1351. $globals.Package);
  1352. $core.addMethod(
  1353. $core.method({
  1354. selector: "printOn:",
  1355. protocol: "printing",
  1356. fn: function (aStream){
  1357. var self=this;
  1358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1359. return $core.withContext(function($ctx1) {
  1360. //>>excludeEnd("ctx");
  1361. (
  1362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1363. $ctx1.supercall = true,
  1364. //>>excludeEnd("ctx");
  1365. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  1366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1367. $ctx1.supercall = false;
  1368. //>>excludeEnd("ctx");;
  1369. $recv(aStream)._nextPutAll_(" (");
  1370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1371. $ctx1.sendIdx["nextPutAll:"]=1;
  1372. //>>excludeEnd("ctx");
  1373. $recv(aStream)._nextPutAll_(self._name());
  1374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1375. $ctx1.sendIdx["nextPutAll:"]=2;
  1376. //>>excludeEnd("ctx");
  1377. $recv(aStream)._nextPutAll_(")");
  1378. return self;
  1379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1380. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  1381. //>>excludeEnd("ctx");
  1382. },
  1383. //>>excludeStart("ide", pragmas.excludeIdeData);
  1384. args: ["aStream"],
  1385. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  1386. referencedClasses: [],
  1387. //>>excludeEnd("ide");
  1388. messageSends: ["printOn:", "nextPutAll:", "name"]
  1389. }),
  1390. $globals.Package);
  1391. $core.addMethod(
  1392. $core.method({
  1393. selector: "setupClasses",
  1394. protocol: "classes",
  1395. fn: function (){
  1396. var self=this;
  1397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1398. return $core.withContext(function($ctx1) {
  1399. //>>excludeEnd("ctx");
  1400. $recv(self._classes())._do_((function(each){
  1401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1402. return $core.withContext(function($ctx2) {
  1403. //>>excludeEnd("ctx");
  1404. return $recv(each)._initialize();
  1405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1407. //>>excludeEnd("ctx");
  1408. }));
  1409. return self;
  1410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1411. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  1412. //>>excludeEnd("ctx");
  1413. },
  1414. //>>excludeStart("ide", pragmas.excludeIdeData);
  1415. args: [],
  1416. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  1417. referencedClasses: [],
  1418. //>>excludeEnd("ide");
  1419. messageSends: ["do:", "classes", "initialize"]
  1420. }),
  1421. $globals.Package);
  1422. $core.addMethod(
  1423. $core.method({
  1424. selector: "sortedClasses",
  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. return $recv(self._class())._sortedClasses_(self._classes());
  1432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1433. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  1434. //>>excludeEnd("ctx");
  1435. },
  1436. //>>excludeStart("ide", pragmas.excludeIdeData);
  1437. args: [],
  1438. 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",
  1439. referencedClasses: [],
  1440. //>>excludeEnd("ide");
  1441. messageSends: ["sortedClasses:", "class", "classes"]
  1442. }),
  1443. $globals.Package);
  1444. $core.addMethod(
  1445. $core.method({
  1446. selector: "sortedImportsAsArray",
  1447. protocol: "private",
  1448. fn: function (){
  1449. var self=this;
  1450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1451. return $core.withContext(function($ctx1) {
  1452. //>>excludeEnd("ctx");
  1453. var $3,$2,$4,$1,$6,$5,$7;
  1454. return $recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  1455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1456. return $core.withContext(function($ctx2) {
  1457. //>>excludeEnd("ctx");
  1458. $3=$recv(a)._isString();
  1459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1460. $ctx2.sendIdx["isString"]=1;
  1461. //>>excludeEnd("ctx");
  1462. $2=$recv($3)._not();
  1463. $4=$recv(b)._isString();
  1464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1465. $ctx2.sendIdx["isString"]=2;
  1466. //>>excludeEnd("ctx");
  1467. $1=$recv($2).__and($4);
  1468. return $recv($1)._or_((function(){
  1469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1470. return $core.withContext(function($ctx3) {
  1471. //>>excludeEnd("ctx");
  1472. $6=$recv(a)._isString();
  1473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1474. $ctx3.sendIdx["isString"]=3;
  1475. //>>excludeEnd("ctx");
  1476. $5=$recv($6).__eq($recv(b)._isString());
  1477. return $recv($5)._and_((function(){
  1478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1479. return $core.withContext(function($ctx4) {
  1480. //>>excludeEnd("ctx");
  1481. $7=$recv(a)._value();
  1482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1483. $ctx4.sendIdx["value"]=1;
  1484. //>>excludeEnd("ctx");
  1485. return $recv($7).__lt_eq($recv(b)._value());
  1486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1487. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  1488. //>>excludeEnd("ctx");
  1489. }));
  1490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1491. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1492. //>>excludeEnd("ctx");
  1493. }));
  1494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1495. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  1496. //>>excludeEnd("ctx");
  1497. }));
  1498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1499. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  1500. //>>excludeEnd("ctx");
  1501. },
  1502. //>>excludeStart("ide", pragmas.excludeIdeData);
  1503. args: [],
  1504. 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 ]]]",
  1505. referencedClasses: [],
  1506. //>>excludeEnd("ide");
  1507. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  1508. }),
  1509. $globals.Package);
  1510. $core.addMethod(
  1511. $core.method({
  1512. selector: "transport",
  1513. protocol: "accessing",
  1514. fn: function (){
  1515. var self=this;
  1516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1517. return $core.withContext(function($ctx1) {
  1518. //>>excludeEnd("ctx");
  1519. var $1,$2,$receiver;
  1520. $1=self["@transport"];
  1521. if(($receiver = $1) == null || $receiver.isNil){
  1522. $2=$recv($globals.PackageTransport)._fromJson_(self._basicTransport());
  1523. $recv($2)._package_(self);
  1524. self["@transport"]=$recv($2)._yourself();
  1525. return self["@transport"];
  1526. } else {
  1527. return $1;
  1528. }
  1529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1530. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  1531. //>>excludeEnd("ctx");
  1532. },
  1533. //>>excludeStart("ide", pragmas.excludeIdeData);
  1534. args: [],
  1535. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  1536. referencedClasses: ["PackageTransport"],
  1537. //>>excludeEnd("ide");
  1538. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  1539. }),
  1540. $globals.Package);
  1541. $core.addMethod(
  1542. $core.method({
  1543. selector: "transport:",
  1544. protocol: "accessing",
  1545. fn: function (aPackageTransport){
  1546. var self=this;
  1547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1548. return $core.withContext(function($ctx1) {
  1549. //>>excludeEnd("ctx");
  1550. self["@transport"]=aPackageTransport;
  1551. $recv(aPackageTransport)._package_(self);
  1552. return self;
  1553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1554. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  1555. //>>excludeEnd("ctx");
  1556. },
  1557. //>>excludeStart("ide", pragmas.excludeIdeData);
  1558. args: ["aPackageTransport"],
  1559. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  1560. referencedClasses: [],
  1561. //>>excludeEnd("ide");
  1562. messageSends: ["package:"]
  1563. }),
  1564. $globals.Package);
  1565. $core.addMethod(
  1566. $core.method({
  1567. selector: "validateImports:",
  1568. protocol: "validation",
  1569. fn: function (aCollection){
  1570. var self=this;
  1571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1572. return $core.withContext(function($ctx1) {
  1573. //>>excludeEnd("ctx");
  1574. var $1,$2,$5,$4,$3,$6;
  1575. $recv(aCollection)._do_((function(import_){
  1576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1577. return $core.withContext(function($ctx2) {
  1578. //>>excludeEnd("ctx");
  1579. $1=$recv(import_)._isString();
  1580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1581. $ctx2.sendIdx["isString"]=1;
  1582. //>>excludeEnd("ctx");
  1583. if(!$core.assert($1)){
  1584. $2=$recv(import_)._respondsTo_("key");
  1585. if(!$core.assert($2)){
  1586. self._error_("Imports must be Strings or Associations");
  1587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1588. $ctx2.sendIdx["error:"]=1;
  1589. //>>excludeEnd("ctx");
  1590. }
  1591. $5=$recv(import_)._key();
  1592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1593. $ctx2.sendIdx["key"]=1;
  1594. //>>excludeEnd("ctx");
  1595. $4=$recv($5)._isString();
  1596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1597. $ctx2.sendIdx["isString"]=2;
  1598. //>>excludeEnd("ctx");
  1599. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  1600. if(!$core.assert($3)){
  1601. self._error_("Key and value must be Strings");
  1602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1603. $ctx2.sendIdx["error:"]=2;
  1604. //>>excludeEnd("ctx");
  1605. }
  1606. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  1607. if(!$core.assert($6)){
  1608. return self._error_("Keys must be identifiers");
  1609. }
  1610. }
  1611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1612. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  1613. //>>excludeEnd("ctx");
  1614. }));
  1615. return self;
  1616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1617. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  1618. //>>excludeEnd("ctx");
  1619. },
  1620. //>>excludeStart("ide", pragmas.excludeIdeData);
  1621. args: ["aCollection"],
  1622. 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' ]]]",
  1623. referencedClasses: [],
  1624. //>>excludeEnd("ide");
  1625. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  1626. }),
  1627. $globals.Package);
  1628. $globals.Package.klass.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  1629. $core.addMethod(
  1630. $core.method({
  1631. selector: "named:",
  1632. protocol: "accessing",
  1633. fn: function (aPackageName){
  1634. var self=this;
  1635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1636. return $core.withContext(function($ctx1) {
  1637. //>>excludeEnd("ctx");
  1638. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  1639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1640. return $core.withContext(function($ctx2) {
  1641. //>>excludeEnd("ctx");
  1642. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  1643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1644. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1645. //>>excludeEnd("ctx");
  1646. }));
  1647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1648. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  1649. //>>excludeEnd("ctx");
  1650. },
  1651. //>>excludeStart("ide", pragmas.excludeIdeData);
  1652. args: ["aPackageName"],
  1653. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  1654. referencedClasses: ["Smalltalk"],
  1655. //>>excludeEnd("ide");
  1656. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  1657. }),
  1658. $globals.Package.klass);
  1659. $core.addMethod(
  1660. $core.method({
  1661. selector: "named:ifAbsent:",
  1662. protocol: "accessing",
  1663. fn: function (aPackageName,aBlock){
  1664. var self=this;
  1665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1666. return $core.withContext(function($ctx1) {
  1667. //>>excludeEnd("ctx");
  1668. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  1669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1670. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  1671. //>>excludeEnd("ctx");
  1672. },
  1673. //>>excludeStart("ide", pragmas.excludeIdeData);
  1674. args: ["aPackageName", "aBlock"],
  1675. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  1676. referencedClasses: ["Smalltalk"],
  1677. //>>excludeEnd("ide");
  1678. messageSends: ["packageAt:ifAbsent:"]
  1679. }),
  1680. $globals.Package.klass);
  1681. $core.addMethod(
  1682. $core.method({
  1683. selector: "named:imports:transport:",
  1684. protocol: "accessing",
  1685. fn: function (aPackageName,anArray,aTransport){
  1686. var self=this;
  1687. var package_;
  1688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1689. return $core.withContext(function($ctx1) {
  1690. //>>excludeEnd("ctx");
  1691. package_=self._named_(aPackageName);
  1692. $recv(package_)._imports_(anArray);
  1693. $recv(package_)._transport_(aTransport);
  1694. return package_;
  1695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1696. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  1697. //>>excludeEnd("ctx");
  1698. },
  1699. //>>excludeStart("ide", pragmas.excludeIdeData);
  1700. args: ["aPackageName", "anArray", "aTransport"],
  1701. 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",
  1702. referencedClasses: [],
  1703. //>>excludeEnd("ide");
  1704. messageSends: ["named:", "imports:", "transport:"]
  1705. }),
  1706. $globals.Package.klass);
  1707. $core.addMethod(
  1708. $core.method({
  1709. selector: "named:transport:",
  1710. protocol: "accessing",
  1711. fn: function (aPackageName,aTransport){
  1712. var self=this;
  1713. var package_;
  1714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1715. return $core.withContext(function($ctx1) {
  1716. //>>excludeEnd("ctx");
  1717. package_=self._named_(aPackageName);
  1718. $recv(package_)._transport_(aTransport);
  1719. return package_;
  1720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1721. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  1722. //>>excludeEnd("ctx");
  1723. },
  1724. //>>excludeStart("ide", pragmas.excludeIdeData);
  1725. args: ["aPackageName", "aTransport"],
  1726. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  1727. referencedClasses: [],
  1728. //>>excludeEnd("ide");
  1729. messageSends: ["named:", "transport:"]
  1730. }),
  1731. $globals.Package.klass);
  1732. $core.addMethod(
  1733. $core.method({
  1734. selector: "sortedClasses:",
  1735. protocol: "sorting",
  1736. fn: function (classes){
  1737. var self=this;
  1738. var children,others,nodes,expandedClasses;
  1739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1740. return $core.withContext(function($ctx1) {
  1741. //>>excludeEnd("ctx");
  1742. var $1,$3,$2;
  1743. children=[];
  1744. others=[];
  1745. $recv(classes)._do_((function(each){
  1746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1747. return $core.withContext(function($ctx2) {
  1748. //>>excludeEnd("ctx");
  1749. $1=$recv(classes)._includes_($recv(each)._superclass());
  1750. if($core.assert($1)){
  1751. return $recv(others)._add_(each);
  1752. } else {
  1753. return $recv(children)._add_(each);
  1754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1755. $ctx2.sendIdx["add:"]=1;
  1756. //>>excludeEnd("ctx");
  1757. }
  1758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1760. //>>excludeEnd("ctx");
  1761. }));
  1762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1763. $ctx1.sendIdx["do:"]=1;
  1764. //>>excludeEnd("ctx");
  1765. nodes=$recv(children)._collect_((function(each){
  1766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1767. return $core.withContext(function($ctx2) {
  1768. //>>excludeEnd("ctx");
  1769. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  1770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1771. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  1772. //>>excludeEnd("ctx");
  1773. }));
  1774. nodes=$recv(nodes)._sorted_((function(a,b){
  1775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1776. return $core.withContext(function($ctx2) {
  1777. //>>excludeEnd("ctx");
  1778. $3=$recv(a)._theClass();
  1779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1780. $ctx2.sendIdx["theClass"]=1;
  1781. //>>excludeEnd("ctx");
  1782. $2=$recv($3)._name();
  1783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1784. $ctx2.sendIdx["name"]=1;
  1785. //>>excludeEnd("ctx");
  1786. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  1787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1788. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  1789. //>>excludeEnd("ctx");
  1790. }));
  1791. expandedClasses=$recv($globals.Array)._new();
  1792. $recv(nodes)._do_((function(aNode){
  1793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1794. return $core.withContext(function($ctx2) {
  1795. //>>excludeEnd("ctx");
  1796. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  1797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1798. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  1799. //>>excludeEnd("ctx");
  1800. }));
  1801. return expandedClasses;
  1802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1803. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  1804. //>>excludeEnd("ctx");
  1805. },
  1806. //>>excludeStart("ide", pragmas.excludeIdeData);
  1807. args: ["classes"],
  1808. 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",
  1809. referencedClasses: ["ClassSorterNode", "Array"],
  1810. //>>excludeEnd("ide");
  1811. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  1812. }),
  1813. $globals.Package.klass);
  1814. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  1815. //>>excludeStart("ide", pragmas.excludeIdeData);
  1816. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  1817. //>>excludeEnd("ide");
  1818. $core.addMethod(
  1819. $core.method({
  1820. selector: "announcer",
  1821. protocol: "accessing",
  1822. fn: function (){
  1823. var self=this;
  1824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1825. return $core.withContext(function($ctx1) {
  1826. //>>excludeEnd("ctx");
  1827. return $recv($globals.SystemAnnouncer)._current();
  1828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1829. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  1830. //>>excludeEnd("ctx");
  1831. },
  1832. //>>excludeStart("ide", pragmas.excludeIdeData);
  1833. args: [],
  1834. source: "announcer\x0a\x09^ SystemAnnouncer current",
  1835. referencedClasses: ["SystemAnnouncer"],
  1836. //>>excludeEnd("ide");
  1837. messageSends: ["current"]
  1838. }),
  1839. $globals.PackageStateObserver);
  1840. $core.addMethod(
  1841. $core.method({
  1842. selector: "observeSystem",
  1843. protocol: "actions",
  1844. fn: function (){
  1845. var self=this;
  1846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1847. return $core.withContext(function($ctx1) {
  1848. //>>excludeEnd("ctx");
  1849. var $1;
  1850. $1=self._announcer();
  1851. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  1852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1853. $ctx1.sendIdx["on:send:to:"]=1;
  1854. //>>excludeEnd("ctx");
  1855. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  1856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1857. $ctx1.sendIdx["on:send:to:"]=2;
  1858. //>>excludeEnd("ctx");
  1859. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  1860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1861. $ctx1.sendIdx["on:send:to:"]=3;
  1862. //>>excludeEnd("ctx");
  1863. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  1864. return self;
  1865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1866. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  1867. //>>excludeEnd("ctx");
  1868. },
  1869. //>>excludeStart("ide", pragmas.excludeIdeData);
  1870. args: [],
  1871. 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",
  1872. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  1873. //>>excludeEnd("ide");
  1874. messageSends: ["on:send:to:", "announcer"]
  1875. }),
  1876. $globals.PackageStateObserver);
  1877. $core.addMethod(
  1878. $core.method({
  1879. selector: "onClassModification:",
  1880. protocol: "reactions",
  1881. fn: function (anAnnouncement){
  1882. var self=this;
  1883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1884. return $core.withContext(function($ctx1) {
  1885. //>>excludeEnd("ctx");
  1886. var $1,$receiver;
  1887. $1=$recv(anAnnouncement)._theClass();
  1888. if(($receiver = $1) == null || $receiver.isNil){
  1889. $1;
  1890. } else {
  1891. var theClass;
  1892. theClass=$receiver;
  1893. $recv($recv(theClass)._package())._beDirty();
  1894. }
  1895. return self;
  1896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1897. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  1898. //>>excludeEnd("ctx");
  1899. },
  1900. //>>excludeStart("ide", pragmas.excludeIdeData);
  1901. args: ["anAnnouncement"],
  1902. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  1903. referencedClasses: [],
  1904. //>>excludeEnd("ide");
  1905. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  1906. }),
  1907. $globals.PackageStateObserver);
  1908. $core.addMethod(
  1909. $core.method({
  1910. selector: "onMethodModification:",
  1911. protocol: "reactions",
  1912. fn: function (anAnnouncement){
  1913. var self=this;
  1914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1915. return $core.withContext(function($ctx1) {
  1916. //>>excludeEnd("ctx");
  1917. var $1,$receiver;
  1918. $1=$recv($recv(anAnnouncement)._method())._package();
  1919. if(($receiver = $1) == null || $receiver.isNil){
  1920. $1;
  1921. } else {
  1922. var package_;
  1923. package_=$receiver;
  1924. $recv(package_)._beDirty();
  1925. }
  1926. return self;
  1927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1928. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  1929. //>>excludeEnd("ctx");
  1930. },
  1931. //>>excludeStart("ide", pragmas.excludeIdeData);
  1932. args: ["anAnnouncement"],
  1933. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  1934. referencedClasses: [],
  1935. //>>excludeEnd("ide");
  1936. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  1937. }),
  1938. $globals.PackageStateObserver);
  1939. $core.addMethod(
  1940. $core.method({
  1941. selector: "onPackageAdded:",
  1942. protocol: "reactions",
  1943. fn: function (anAnnouncement){
  1944. var self=this;
  1945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1946. return $core.withContext(function($ctx1) {
  1947. //>>excludeEnd("ctx");
  1948. $recv($recv(anAnnouncement)._package())._beDirty();
  1949. return self;
  1950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1951. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  1952. //>>excludeEnd("ctx");
  1953. },
  1954. //>>excludeStart("ide", pragmas.excludeIdeData);
  1955. args: ["anAnnouncement"],
  1956. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  1957. referencedClasses: [],
  1958. //>>excludeEnd("ide");
  1959. messageSends: ["beDirty", "package"]
  1960. }),
  1961. $globals.PackageStateObserver);
  1962. $core.addMethod(
  1963. $core.method({
  1964. selector: "onProtocolModification:",
  1965. protocol: "reactions",
  1966. fn: function (anAnnouncement){
  1967. var self=this;
  1968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1969. return $core.withContext(function($ctx1) {
  1970. //>>excludeEnd("ctx");
  1971. var $1,$receiver;
  1972. $1=$recv(anAnnouncement)._package();
  1973. if(($receiver = $1) == null || $receiver.isNil){
  1974. $1;
  1975. } else {
  1976. var package_;
  1977. package_=$receiver;
  1978. $recv(package_)._beDirty();
  1979. }
  1980. return self;
  1981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1982. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  1983. //>>excludeEnd("ctx");
  1984. },
  1985. //>>excludeStart("ide", pragmas.excludeIdeData);
  1986. args: ["anAnnouncement"],
  1987. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  1988. referencedClasses: [],
  1989. //>>excludeEnd("ide");
  1990. messageSends: ["ifNotNil:", "package", "beDirty"]
  1991. }),
  1992. $globals.PackageStateObserver);
  1993. $globals.PackageStateObserver.klass.iVarNames = ["current"];
  1994. $core.addMethod(
  1995. $core.method({
  1996. selector: "current",
  1997. protocol: "accessing",
  1998. fn: function (){
  1999. var self=this;
  2000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2001. return $core.withContext(function($ctx1) {
  2002. //>>excludeEnd("ctx");
  2003. var $1,$receiver;
  2004. $1=self["@current"];
  2005. if(($receiver = $1) == null || $receiver.isNil){
  2006. self["@current"]=self._new();
  2007. return self["@current"];
  2008. } else {
  2009. return $1;
  2010. }
  2011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2012. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  2013. //>>excludeEnd("ctx");
  2014. },
  2015. //>>excludeStart("ide", pragmas.excludeIdeData);
  2016. args: [],
  2017. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  2018. referencedClasses: [],
  2019. //>>excludeEnd("ide");
  2020. messageSends: ["ifNil:", "new"]
  2021. }),
  2022. $globals.PackageStateObserver.klass);
  2023. $core.addMethod(
  2024. $core.method({
  2025. selector: "initialize",
  2026. protocol: "initialization",
  2027. fn: function (){
  2028. var self=this;
  2029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2030. return $core.withContext(function($ctx1) {
  2031. //>>excludeEnd("ctx");
  2032. $recv(self._current())._observeSystem();
  2033. return self;
  2034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2035. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  2036. //>>excludeEnd("ctx");
  2037. },
  2038. //>>excludeStart("ide", pragmas.excludeIdeData);
  2039. args: [],
  2040. source: "initialize\x0a\x09self current observeSystem",
  2041. referencedClasses: [],
  2042. //>>excludeEnd("ide");
  2043. messageSends: ["observeSystem", "current"]
  2044. }),
  2045. $globals.PackageStateObserver.klass);
  2046. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  2047. //>>excludeStart("ide", pragmas.excludeIdeData);
  2048. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  2049. //>>excludeEnd("ide");
  2050. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  2051. //>>excludeStart("ide", pragmas.excludeIdeData);
  2052. $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`";
  2053. //>>excludeEnd("ide");
  2054. $core.addMethod(
  2055. $core.method({
  2056. selector: "defaultValue",
  2057. protocol: "accessing",
  2058. fn: function (){
  2059. var self=this;
  2060. return self["@defaultValue"];
  2061. },
  2062. //>>excludeStart("ide", pragmas.excludeIdeData);
  2063. args: [],
  2064. source: "defaultValue\x0a\x09^ defaultValue",
  2065. referencedClasses: [],
  2066. //>>excludeEnd("ide");
  2067. messageSends: []
  2068. }),
  2069. $globals.Setting);
  2070. $core.addMethod(
  2071. $core.method({
  2072. selector: "defaultValue:",
  2073. protocol: "accessing",
  2074. fn: function (aStringifiableObject){
  2075. var self=this;
  2076. self["@defaultValue"]=aStringifiableObject;
  2077. return self;
  2078. },
  2079. //>>excludeStart("ide", pragmas.excludeIdeData);
  2080. args: ["aStringifiableObject"],
  2081. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  2082. referencedClasses: [],
  2083. //>>excludeEnd("ide");
  2084. messageSends: []
  2085. }),
  2086. $globals.Setting);
  2087. $core.addMethod(
  2088. $core.method({
  2089. selector: "key",
  2090. protocol: "accessing",
  2091. fn: function (){
  2092. var self=this;
  2093. return self["@key"];
  2094. },
  2095. //>>excludeStart("ide", pragmas.excludeIdeData);
  2096. args: [],
  2097. source: "key\x0a\x09^ key",
  2098. referencedClasses: [],
  2099. //>>excludeEnd("ide");
  2100. messageSends: []
  2101. }),
  2102. $globals.Setting);
  2103. $core.addMethod(
  2104. $core.method({
  2105. selector: "key:",
  2106. protocol: "accessing",
  2107. fn: function (aString){
  2108. var self=this;
  2109. self["@key"]=aString;
  2110. return self;
  2111. },
  2112. //>>excludeStart("ide", pragmas.excludeIdeData);
  2113. args: ["aString"],
  2114. source: "key: aString\x0a\x09key := aString",
  2115. referencedClasses: [],
  2116. //>>excludeEnd("ide");
  2117. messageSends: []
  2118. }),
  2119. $globals.Setting);
  2120. $core.addMethod(
  2121. $core.method({
  2122. selector: "value",
  2123. protocol: "accessing",
  2124. fn: function (){
  2125. var self=this;
  2126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2127. return $core.withContext(function($ctx1) {
  2128. //>>excludeEnd("ctx");
  2129. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_(self._key(),(function(){
  2130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2131. return $core.withContext(function($ctx2) {
  2132. //>>excludeEnd("ctx");
  2133. return self._defaultValue();
  2134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2136. //>>excludeEnd("ctx");
  2137. }));
  2138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2139. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  2140. //>>excludeEnd("ctx");
  2141. },
  2142. //>>excludeStart("ide", pragmas.excludeIdeData);
  2143. args: [],
  2144. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  2145. referencedClasses: ["Smalltalk"],
  2146. //>>excludeEnd("ide");
  2147. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  2148. }),
  2149. $globals.Setting);
  2150. $core.addMethod(
  2151. $core.method({
  2152. selector: "value:",
  2153. protocol: "accessing",
  2154. fn: function (aStringifiableObject){
  2155. var self=this;
  2156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2157. return $core.withContext(function($ctx1) {
  2158. //>>excludeEnd("ctx");
  2159. return $recv($recv($globals.Smalltalk)._settings())._at_put_(self._key(),aStringifiableObject);
  2160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2161. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  2162. //>>excludeEnd("ctx");
  2163. },
  2164. //>>excludeStart("ide", pragmas.excludeIdeData);
  2165. args: ["aStringifiableObject"],
  2166. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  2167. referencedClasses: ["Smalltalk"],
  2168. //>>excludeEnd("ide");
  2169. messageSends: ["at:put:", "settings", "key"]
  2170. }),
  2171. $globals.Setting);
  2172. $core.addMethod(
  2173. $core.method({
  2174. selector: "at:ifAbsent:",
  2175. protocol: "instance creation",
  2176. fn: function (aString,aDefaultValue){
  2177. var self=this;
  2178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2179. return $core.withContext(function($ctx1) {
  2180. //>>excludeEnd("ctx");
  2181. var $1;
  2182. $1=(
  2183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2184. $ctx1.supercall = true,
  2185. //>>excludeEnd("ctx");
  2186. ($globals.Setting.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  2187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2188. $ctx1.supercall = false;
  2189. //>>excludeEnd("ctx");;
  2190. $recv($1)._key_(aString);
  2191. $recv($1)._defaultValue_(aDefaultValue);
  2192. return $recv($1)._yourself();
  2193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2194. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  2195. //>>excludeEnd("ctx");
  2196. },
  2197. //>>excludeStart("ide", pragmas.excludeIdeData);
  2198. args: ["aString", "aDefaultValue"],
  2199. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  2200. referencedClasses: [],
  2201. //>>excludeEnd("ide");
  2202. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  2203. }),
  2204. $globals.Setting.klass);
  2205. $core.addMethod(
  2206. $core.method({
  2207. selector: "new",
  2208. protocol: "instance creation",
  2209. fn: function (){
  2210. var self=this;
  2211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2212. return $core.withContext(function($ctx1) {
  2213. //>>excludeEnd("ctx");
  2214. self._shouldNotImplement();
  2215. return self;
  2216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2217. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  2218. //>>excludeEnd("ctx");
  2219. },
  2220. //>>excludeStart("ide", pragmas.excludeIdeData);
  2221. args: [],
  2222. source: "new\x0a\x09self shouldNotImplement",
  2223. referencedClasses: [],
  2224. //>>excludeEnd("ide");
  2225. messageSends: ["shouldNotImplement"]
  2226. }),
  2227. $globals.Setting.klass);
  2228. $core.addClass("SmalltalkImage", $globals.Object, [], "Kernel-Infrastructure");
  2229. //>>excludeStart("ide", pragmas.excludeIdeData);
  2230. $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.";
  2231. //>>excludeEnd("ide");
  2232. $core.addMethod(
  2233. $core.method({
  2234. selector: "addGlobalJsVariable:",
  2235. protocol: "globals",
  2236. fn: function (aString){
  2237. var self=this;
  2238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2239. return $core.withContext(function($ctx1) {
  2240. //>>excludeEnd("ctx");
  2241. $recv(self._globalJsVariables())._add_(aString);
  2242. return self;
  2243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2244. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  2245. //>>excludeEnd("ctx");
  2246. },
  2247. //>>excludeStart("ide", pragmas.excludeIdeData);
  2248. args: ["aString"],
  2249. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  2250. referencedClasses: [],
  2251. //>>excludeEnd("ide");
  2252. messageSends: ["add:", "globalJsVariables"]
  2253. }),
  2254. $globals.SmalltalkImage);
  2255. $core.addMethod(
  2256. $core.method({
  2257. selector: "amdRequire",
  2258. protocol: "accessing amd",
  2259. fn: function (){
  2260. var self=this;
  2261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2262. return $core.withContext(function($ctx1) {
  2263. //>>excludeEnd("ctx");
  2264. return $recv(self._core())._at_("amdRequire");
  2265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2266. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  2267. //>>excludeEnd("ctx");
  2268. },
  2269. //>>excludeStart("ide", pragmas.excludeIdeData);
  2270. args: [],
  2271. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  2272. referencedClasses: [],
  2273. //>>excludeEnd("ide");
  2274. messageSends: ["at:", "core"]
  2275. }),
  2276. $globals.SmalltalkImage);
  2277. $core.addMethod(
  2278. $core.method({
  2279. selector: "asSmalltalkException:",
  2280. protocol: "error handling",
  2281. fn: function (anObject){
  2282. var self=this;
  2283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2284. return $core.withContext(function($ctx1) {
  2285. //>>excludeEnd("ctx");
  2286. var $1;
  2287. $1=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  2288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2289. return $core.withContext(function($ctx2) {
  2290. //>>excludeEnd("ctx");
  2291. return $recv(anObject)._isKindOf_($globals.Error);
  2292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2294. //>>excludeEnd("ctx");
  2295. }));
  2296. if($core.assert($1)){
  2297. return anObject;
  2298. } else {
  2299. return $recv($globals.JavaScriptException)._on_(anObject);
  2300. }
  2301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2302. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  2303. //>>excludeEnd("ctx");
  2304. },
  2305. //>>excludeStart("ide", pragmas.excludeIdeData);
  2306. args: ["anObject"],
  2307. 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 ]",
  2308. referencedClasses: ["Error", "JavaScriptException"],
  2309. //>>excludeEnd("ide");
  2310. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  2311. }),
  2312. $globals.SmalltalkImage);
  2313. $core.addMethod(
  2314. $core.method({
  2315. selector: "basicCreatePackage:",
  2316. protocol: "private",
  2317. fn: function (packageName){
  2318. var self=this;
  2319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2320. return $core.withContext(function($ctx1) {
  2321. //>>excludeEnd("ctx");
  2322. return $core.addPackage(packageName);
  2323. return self;
  2324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2325. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  2326. //>>excludeEnd("ctx");
  2327. },
  2328. //>>excludeStart("ide", pragmas.excludeIdeData);
  2329. args: ["packageName"],
  2330. 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)'>",
  2331. referencedClasses: [],
  2332. //>>excludeEnd("ide");
  2333. messageSends: []
  2334. }),
  2335. $globals.SmalltalkImage);
  2336. $core.addMethod(
  2337. $core.method({
  2338. selector: "basicParse:",
  2339. protocol: "private",
  2340. fn: function (aString){
  2341. var self=this;
  2342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2343. return $core.withContext(function($ctx1) {
  2344. //>>excludeEnd("ctx");
  2345. return $recv($globals.SmalltalkParser)._parse_(aString);
  2346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2347. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  2348. //>>excludeEnd("ctx");
  2349. },
  2350. //>>excludeStart("ide", pragmas.excludeIdeData);
  2351. args: ["aString"],
  2352. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  2353. referencedClasses: ["SmalltalkParser"],
  2354. //>>excludeEnd("ide");
  2355. messageSends: ["parse:"]
  2356. }),
  2357. $globals.SmalltalkImage);
  2358. $core.addMethod(
  2359. $core.method({
  2360. selector: "basicRegisterPackage:",
  2361. protocol: "private",
  2362. fn: function (aPackage){
  2363. var self=this;
  2364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2365. return $core.withContext(function($ctx1) {
  2366. //>>excludeEnd("ctx");
  2367. $core.packages[aPackage.pkgName]=aPackage;
  2368. return self;
  2369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2370. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  2371. //>>excludeEnd("ctx");
  2372. },
  2373. //>>excludeStart("ide", pragmas.excludeIdeData);
  2374. args: ["aPackage"],
  2375. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<inlineJS: '$core.packages[aPackage.pkgName]=aPackage'>",
  2376. referencedClasses: [],
  2377. //>>excludeEnd("ide");
  2378. messageSends: []
  2379. }),
  2380. $globals.SmalltalkImage);
  2381. $core.addMethod(
  2382. $core.method({
  2383. selector: "cancelOptOut:",
  2384. protocol: "accessing",
  2385. fn: function (anObject){
  2386. var self=this;
  2387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2388. return $core.withContext(function($ctx1) {
  2389. //>>excludeEnd("ctx");
  2390. delete anObject.klass;
  2391. return self;
  2392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2393. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  2394. //>>excludeEnd("ctx");
  2395. },
  2396. //>>excludeStart("ide", pragmas.excludeIdeData);
  2397. args: ["anObject"],
  2398. 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'>",
  2399. referencedClasses: [],
  2400. //>>excludeEnd("ide");
  2401. messageSends: []
  2402. }),
  2403. $globals.SmalltalkImage);
  2404. $core.addMethod(
  2405. $core.method({
  2406. selector: "classes",
  2407. protocol: "classes",
  2408. fn: function (){
  2409. var self=this;
  2410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2411. return $core.withContext(function($ctx1) {
  2412. //>>excludeEnd("ctx");
  2413. return $core.classes();
  2414. return self;
  2415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2416. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  2417. //>>excludeEnd("ctx");
  2418. },
  2419. //>>excludeStart("ide", pragmas.excludeIdeData);
  2420. args: [],
  2421. source: "classes\x0a\x09<inlineJS: 'return $core.classes()'>",
  2422. referencedClasses: [],
  2423. //>>excludeEnd("ide");
  2424. messageSends: []
  2425. }),
  2426. $globals.SmalltalkImage);
  2427. $core.addMethod(
  2428. $core.method({
  2429. selector: "core",
  2430. protocol: "accessing",
  2431. fn: function (){
  2432. var self=this;
  2433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2434. return $core.withContext(function($ctx1) {
  2435. //>>excludeEnd("ctx");
  2436. return $core;
  2437. return self;
  2438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2439. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  2440. //>>excludeEnd("ctx");
  2441. },
  2442. //>>excludeStart("ide", pragmas.excludeIdeData);
  2443. args: [],
  2444. source: "core\x0a\x09<inlineJS: 'return $core'>",
  2445. referencedClasses: [],
  2446. //>>excludeEnd("ide");
  2447. messageSends: []
  2448. }),
  2449. $globals.SmalltalkImage);
  2450. $core.addMethod(
  2451. $core.method({
  2452. selector: "createPackage:",
  2453. protocol: "packages",
  2454. fn: function (packageName){
  2455. var self=this;
  2456. var package_,announcement;
  2457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2458. return $core.withContext(function($ctx1) {
  2459. //>>excludeEnd("ctx");
  2460. var $1;
  2461. package_=self._basicCreatePackage_(packageName);
  2462. $1=$recv($globals.PackageAdded)._new();
  2463. $recv($1)._package_(package_);
  2464. announcement=$recv($1)._yourself();
  2465. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  2466. return package_;
  2467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2468. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  2469. //>>excludeEnd("ctx");
  2470. },
  2471. //>>excludeStart("ide", pragmas.excludeIdeData);
  2472. args: ["packageName"],
  2473. 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",
  2474. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  2475. //>>excludeEnd("ide");
  2476. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  2477. }),
  2478. $globals.SmalltalkImage);
  2479. $core.addMethod(
  2480. $core.method({
  2481. selector: "defaultAmdNamespace",
  2482. protocol: "accessing amd",
  2483. fn: function (){
  2484. var self=this;
  2485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2486. return $core.withContext(function($ctx1) {
  2487. //>>excludeEnd("ctx");
  2488. return "transport.defaultAmdNamespace"._settingValue();
  2489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2490. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  2491. //>>excludeEnd("ctx");
  2492. },
  2493. //>>excludeStart("ide", pragmas.excludeIdeData);
  2494. args: [],
  2495. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  2496. referencedClasses: [],
  2497. //>>excludeEnd("ide");
  2498. messageSends: ["settingValue"]
  2499. }),
  2500. $globals.SmalltalkImage);
  2501. $core.addMethod(
  2502. $core.method({
  2503. selector: "defaultAmdNamespace:",
  2504. protocol: "accessing amd",
  2505. fn: function (aString){
  2506. var self=this;
  2507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2508. return $core.withContext(function($ctx1) {
  2509. //>>excludeEnd("ctx");
  2510. "transport.defaultAmdNamespace"._settingValue_(aString);
  2511. return self;
  2512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2513. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  2514. //>>excludeEnd("ctx");
  2515. },
  2516. //>>excludeStart("ide", pragmas.excludeIdeData);
  2517. args: ["aString"],
  2518. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  2519. referencedClasses: [],
  2520. //>>excludeEnd("ide");
  2521. messageSends: ["settingValue:"]
  2522. }),
  2523. $globals.SmalltalkImage);
  2524. $core.addMethod(
  2525. $core.method({
  2526. selector: "deleteClass:",
  2527. protocol: "private",
  2528. fn: function (aClass){
  2529. var self=this;
  2530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2531. return $core.withContext(function($ctx1) {
  2532. //>>excludeEnd("ctx");
  2533. $core.removeClass(aClass);
  2534. return self;
  2535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2536. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  2537. //>>excludeEnd("ctx");
  2538. },
  2539. //>>excludeStart("ide", pragmas.excludeIdeData);
  2540. args: ["aClass"],
  2541. 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)'>",
  2542. referencedClasses: [],
  2543. //>>excludeEnd("ide");
  2544. messageSends: []
  2545. }),
  2546. $globals.SmalltalkImage);
  2547. $core.addMethod(
  2548. $core.method({
  2549. selector: "deleteGlobalJsVariable:",
  2550. protocol: "globals",
  2551. fn: function (aString){
  2552. var self=this;
  2553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2554. return $core.withContext(function($ctx1) {
  2555. //>>excludeEnd("ctx");
  2556. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  2557. }));
  2558. return self;
  2559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2560. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  2561. //>>excludeEnd("ctx");
  2562. },
  2563. //>>excludeStart("ide", pragmas.excludeIdeData);
  2564. args: ["aString"],
  2565. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  2566. referencedClasses: [],
  2567. //>>excludeEnd("ide");
  2568. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  2569. }),
  2570. $globals.SmalltalkImage);
  2571. $core.addMethod(
  2572. $core.method({
  2573. selector: "deletePackage:",
  2574. protocol: "private",
  2575. fn: function (packageName){
  2576. var self=this;
  2577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2578. return $core.withContext(function($ctx1) {
  2579. //>>excludeEnd("ctx");
  2580. delete $core.packages[packageName];
  2581. return self;
  2582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2583. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  2584. //>>excludeEnd("ctx");
  2585. },
  2586. //>>excludeStart("ide", pragmas.excludeIdeData);
  2587. args: ["packageName"],
  2588. 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]'>",
  2589. referencedClasses: [],
  2590. //>>excludeEnd("ide");
  2591. messageSends: []
  2592. }),
  2593. $globals.SmalltalkImage);
  2594. $core.addMethod(
  2595. $core.method({
  2596. selector: "existsJsGlobal:",
  2597. protocol: "testing",
  2598. fn: function (aString){
  2599. var self=this;
  2600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2601. return $core.withContext(function($ctx1) {
  2602. //>>excludeEnd("ctx");
  2603. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  2604. return true;
  2605. }),(function(){
  2606. return false;
  2607. }));
  2608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2609. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  2610. //>>excludeEnd("ctx");
  2611. },
  2612. //>>excludeStart("ide", pragmas.excludeIdeData);
  2613. args: ["aString"],
  2614. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  2615. referencedClasses: ["Platform"],
  2616. //>>excludeEnd("ide");
  2617. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  2618. }),
  2619. $globals.SmalltalkImage);
  2620. $core.addMethod(
  2621. $core.method({
  2622. selector: "globalJsVariables",
  2623. protocol: "globals",
  2624. fn: function (){
  2625. var self=this;
  2626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2627. return $core.withContext(function($ctx1) {
  2628. //>>excludeEnd("ctx");
  2629. return $core.globalJsVariables;
  2630. return self;
  2631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2632. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  2633. //>>excludeEnd("ctx");
  2634. },
  2635. //>>excludeStart("ide", pragmas.excludeIdeData);
  2636. args: [],
  2637. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<inlineJS: 'return $core.globalJsVariables'>",
  2638. referencedClasses: [],
  2639. //>>excludeEnd("ide");
  2640. messageSends: []
  2641. }),
  2642. $globals.SmalltalkImage);
  2643. $core.addMethod(
  2644. $core.method({
  2645. selector: "globals",
  2646. protocol: "accessing",
  2647. fn: function (){
  2648. var self=this;
  2649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2650. return $core.withContext(function($ctx1) {
  2651. //>>excludeEnd("ctx");
  2652. return $globals;
  2653. return self;
  2654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2655. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  2656. //>>excludeEnd("ctx");
  2657. },
  2658. //>>excludeStart("ide", pragmas.excludeIdeData);
  2659. args: [],
  2660. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  2661. referencedClasses: [],
  2662. //>>excludeEnd("ide");
  2663. messageSends: []
  2664. }),
  2665. $globals.SmalltalkImage);
  2666. $core.addMethod(
  2667. $core.method({
  2668. selector: "includesKey:",
  2669. protocol: "accessing",
  2670. fn: function (aKey){
  2671. var self=this;
  2672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2673. return $core.withContext(function($ctx1) {
  2674. //>>excludeEnd("ctx");
  2675. return $core.hasOwnProperty(aKey);
  2676. return self;
  2677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2678. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  2679. //>>excludeEnd("ctx");
  2680. },
  2681. //>>excludeStart("ide", pragmas.excludeIdeData);
  2682. args: ["aKey"],
  2683. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  2684. referencedClasses: [],
  2685. //>>excludeEnd("ide");
  2686. messageSends: []
  2687. }),
  2688. $globals.SmalltalkImage);
  2689. $core.addMethod(
  2690. $core.method({
  2691. selector: "isSmalltalkObject:",
  2692. protocol: "testing",
  2693. fn: function (anObject){
  2694. var self=this;
  2695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2696. return $core.withContext(function($ctx1) {
  2697. //>>excludeEnd("ctx");
  2698. return anObject.klass != null;
  2699. return self;
  2700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2701. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  2702. //>>excludeEnd("ctx");
  2703. },
  2704. //>>excludeStart("ide", pragmas.excludeIdeData);
  2705. args: ["anObject"],
  2706. 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'>",
  2707. referencedClasses: [],
  2708. //>>excludeEnd("ide");
  2709. messageSends: []
  2710. }),
  2711. $globals.SmalltalkImage);
  2712. $core.addMethod(
  2713. $core.method({
  2714. selector: "optOut:",
  2715. protocol: "accessing",
  2716. fn: function (anObject){
  2717. var self=this;
  2718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2719. return $core.withContext(function($ctx1) {
  2720. //>>excludeEnd("ctx");
  2721. anObject.klass = null;
  2722. return self;
  2723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2724. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  2725. //>>excludeEnd("ctx");
  2726. },
  2727. //>>excludeStart("ide", pragmas.excludeIdeData);
  2728. args: ["anObject"],
  2729. 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'>",
  2730. referencedClasses: [],
  2731. //>>excludeEnd("ide");
  2732. messageSends: []
  2733. }),
  2734. $globals.SmalltalkImage);
  2735. $core.addMethod(
  2736. $core.method({
  2737. selector: "packageAt:",
  2738. protocol: "packages",
  2739. fn: function (packageName){
  2740. var self=this;
  2741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2742. return $core.withContext(function($ctx1) {
  2743. //>>excludeEnd("ctx");
  2744. return $core.packages[packageName];
  2745. return self;
  2746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2747. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  2748. //>>excludeEnd("ctx");
  2749. },
  2750. //>>excludeStart("ide", pragmas.excludeIdeData);
  2751. args: ["packageName"],
  2752. source: "packageAt: packageName\x0a\x09<inlineJS: 'return $core.packages[packageName]'>",
  2753. referencedClasses: [],
  2754. //>>excludeEnd("ide");
  2755. messageSends: []
  2756. }),
  2757. $globals.SmalltalkImage);
  2758. $core.addMethod(
  2759. $core.method({
  2760. selector: "packageAt:ifAbsent:",
  2761. protocol: "packages",
  2762. fn: function (packageName,aBlock){
  2763. var self=this;
  2764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2765. return $core.withContext(function($ctx1) {
  2766. //>>excludeEnd("ctx");
  2767. var $1;
  2768. $1=self._packageAt_(packageName);
  2769. return $recv($1)._ifNil_(aBlock);
  2770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2771. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  2772. //>>excludeEnd("ctx");
  2773. },
  2774. //>>excludeStart("ide", pragmas.excludeIdeData);
  2775. args: ["packageName", "aBlock"],
  2776. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  2777. referencedClasses: [],
  2778. //>>excludeEnd("ide");
  2779. messageSends: ["ifNil:", "packageAt:"]
  2780. }),
  2781. $globals.SmalltalkImage);
  2782. $core.addMethod(
  2783. $core.method({
  2784. selector: "packages",
  2785. protocol: "packages",
  2786. fn: function (){
  2787. var self=this;
  2788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2789. return $core.withContext(function($ctx1) {
  2790. //>>excludeEnd("ctx");
  2791. return Object.keys($core.packages).map(function(k) {
  2792. return $core.packages[k];
  2793. })
  2794. ;
  2795. return self;
  2796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2797. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  2798. //>>excludeEnd("ctx");
  2799. },
  2800. //>>excludeStart("ide", pragmas.excludeIdeData);
  2801. args: [],
  2802. 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'>",
  2803. referencedClasses: [],
  2804. //>>excludeEnd("ide");
  2805. messageSends: []
  2806. }),
  2807. $globals.SmalltalkImage);
  2808. $core.addMethod(
  2809. $core.method({
  2810. selector: "parse:",
  2811. protocol: "accessing",
  2812. fn: function (aString){
  2813. var self=this;
  2814. var result;
  2815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2816. return $core.withContext(function($ctx1) {
  2817. //>>excludeEnd("ctx");
  2818. var $1;
  2819. $recv((function(){
  2820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2821. return $core.withContext(function($ctx2) {
  2822. //>>excludeEnd("ctx");
  2823. result=self._basicParse_(aString);
  2824. return result;
  2825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2826. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2827. //>>excludeEnd("ctx");
  2828. }))._tryCatch_((function(ex){
  2829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2830. return $core.withContext(function($ctx2) {
  2831. //>>excludeEnd("ctx");
  2832. return $recv(self._parseError_parsing_(ex,aString))._signal();
  2833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2834. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  2835. //>>excludeEnd("ctx");
  2836. }));
  2837. $1=result;
  2838. $recv($1)._source_(aString);
  2839. return $recv($1)._yourself();
  2840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2841. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  2842. //>>excludeEnd("ctx");
  2843. },
  2844. //>>excludeStart("ide", pragmas.excludeIdeData);
  2845. args: ["aString"],
  2846. 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",
  2847. referencedClasses: [],
  2848. //>>excludeEnd("ide");
  2849. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  2850. }),
  2851. $globals.SmalltalkImage);
  2852. $core.addMethod(
  2853. $core.method({
  2854. selector: "parseError:parsing:",
  2855. protocol: "error handling",
  2856. fn: function (anException,aString){
  2857. var self=this;
  2858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2859. return $core.withContext(function($ctx1) {
  2860. //>>excludeEnd("ctx");
  2861. var $1,$7,$6,$5,$8,$4,$3,$2;
  2862. $1=$recv($globals.ParseError)._new();
  2863. $7=$recv(anException)._basicAt_("line");
  2864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2865. $ctx1.sendIdx["basicAt:"]=1;
  2866. //>>excludeEnd("ctx");
  2867. $6="Parse error on line ".__comma($7);
  2868. $5=$recv($6).__comma(" column ");
  2869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2870. $ctx1.sendIdx[","]=4;
  2871. //>>excludeEnd("ctx");
  2872. $8=$recv(anException)._basicAt_("column");
  2873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2874. $ctx1.sendIdx["basicAt:"]=2;
  2875. //>>excludeEnd("ctx");
  2876. $4=$recv($5).__comma($8);
  2877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2878. $ctx1.sendIdx[","]=3;
  2879. //>>excludeEnd("ctx");
  2880. $3=$recv($4).__comma(" : Unexpected character ");
  2881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2882. $ctx1.sendIdx[","]=2;
  2883. //>>excludeEnd("ctx");
  2884. $2=$recv($3).__comma($recv(anException)._basicAt_("found"));
  2885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2886. $ctx1.sendIdx[","]=1;
  2887. //>>excludeEnd("ctx");
  2888. return $recv($1)._messageText_($2);
  2889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2890. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  2891. //>>excludeEnd("ctx");
  2892. },
  2893. //>>excludeStart("ide", pragmas.excludeIdeData);
  2894. args: ["anException", "aString"],
  2895. 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')",
  2896. referencedClasses: ["ParseError"],
  2897. //>>excludeEnd("ide");
  2898. messageSends: ["messageText:", "new", ",", "basicAt:"]
  2899. }),
  2900. $globals.SmalltalkImage);
  2901. $core.addMethod(
  2902. $core.method({
  2903. selector: "pseudoVariableNames",
  2904. protocol: "accessing",
  2905. fn: function (){
  2906. var self=this;
  2907. return ["self", "super", "nil", "true", "false", "thisContext"];
  2908. },
  2909. //>>excludeStart("ide", pragmas.excludeIdeData);
  2910. args: [],
  2911. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  2912. referencedClasses: [],
  2913. //>>excludeEnd("ide");
  2914. messageSends: []
  2915. }),
  2916. $globals.SmalltalkImage);
  2917. $core.addMethod(
  2918. $core.method({
  2919. selector: "readJSObject:",
  2920. protocol: "accessing",
  2921. fn: function (anObject){
  2922. var self=this;
  2923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2924. return $core.withContext(function($ctx1) {
  2925. //>>excludeEnd("ctx");
  2926. return $core.readJSObject(anObject);
  2927. return self;
  2928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2929. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  2930. //>>excludeEnd("ctx");
  2931. },
  2932. //>>excludeStart("ide", pragmas.excludeIdeData);
  2933. args: ["anObject"],
  2934. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  2935. referencedClasses: [],
  2936. //>>excludeEnd("ide");
  2937. messageSends: []
  2938. }),
  2939. $globals.SmalltalkImage);
  2940. $core.addMethod(
  2941. $core.method({
  2942. selector: "removeClass:",
  2943. protocol: "classes",
  2944. fn: function (aClass){
  2945. var self=this;
  2946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2947. return $core.withContext(function($ctx1) {
  2948. //>>excludeEnd("ctx");
  2949. var $1,$2,$4,$3;
  2950. $1=$recv(aClass)._isMetaclass();
  2951. if($core.assert($1)){
  2952. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  2953. }
  2954. self._deleteClass_(aClass);
  2955. $2=$recv($globals.SystemAnnouncer)._current();
  2956. $4=$recv($globals.ClassRemoved)._new();
  2957. $recv($4)._theClass_(aClass);
  2958. $3=$recv($4)._yourself();
  2959. $recv($2)._announce_($3);
  2960. return self;
  2961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2962. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  2963. //>>excludeEnd("ctx");
  2964. },
  2965. //>>excludeStart("ide", pragmas.excludeIdeData);
  2966. args: ["aClass"],
  2967. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  2968. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  2969. //>>excludeEnd("ide");
  2970. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  2971. }),
  2972. $globals.SmalltalkImage);
  2973. $core.addMethod(
  2974. $core.method({
  2975. selector: "removePackage:",
  2976. protocol: "packages",
  2977. fn: function (packageName){
  2978. var self=this;
  2979. var pkg;
  2980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2981. return $core.withContext(function($ctx1) {
  2982. //>>excludeEnd("ctx");
  2983. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  2984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2985. return $core.withContext(function($ctx2) {
  2986. //>>excludeEnd("ctx");
  2987. return self._error_("Missing package: ".__comma(packageName));
  2988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2990. //>>excludeEnd("ctx");
  2991. }));
  2992. $recv($recv(pkg)._classes())._do_((function(each){
  2993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2994. return $core.withContext(function($ctx2) {
  2995. //>>excludeEnd("ctx");
  2996. return self._removeClass_(each);
  2997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2998. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2999. //>>excludeEnd("ctx");
  3000. }));
  3001. self._deletePackage_(packageName);
  3002. return self;
  3003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3004. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  3005. //>>excludeEnd("ctx");
  3006. },
  3007. //>>excludeStart("ide", pragmas.excludeIdeData);
  3008. args: ["packageName"],
  3009. 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",
  3010. referencedClasses: [],
  3011. //>>excludeEnd("ide");
  3012. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  3013. }),
  3014. $globals.SmalltalkImage);
  3015. $core.addMethod(
  3016. $core.method({
  3017. selector: "renamePackage:to:",
  3018. protocol: "packages",
  3019. fn: function (packageName,newName){
  3020. var self=this;
  3021. var pkg;
  3022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3023. return $core.withContext(function($ctx1) {
  3024. //>>excludeEnd("ctx");
  3025. var $1,$2,$receiver;
  3026. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  3027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3028. return $core.withContext(function($ctx2) {
  3029. //>>excludeEnd("ctx");
  3030. $1="Missing package: ".__comma(packageName);
  3031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3032. $ctx2.sendIdx[","]=1;
  3033. //>>excludeEnd("ctx");
  3034. return self._error_($1);
  3035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3036. $ctx2.sendIdx["error:"]=1;
  3037. //>>excludeEnd("ctx");
  3038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3040. //>>excludeEnd("ctx");
  3041. }));
  3042. $2=self._packageAt_(newName);
  3043. if(($receiver = $2) == null || $receiver.isNil){
  3044. $2;
  3045. } else {
  3046. self._error_("Already exists a package called: ".__comma(newName));
  3047. }
  3048. $recv(pkg)._name_(newName);
  3049. self._basicRegisterPackage_(pkg);
  3050. self._deletePackage_(packageName);
  3051. return self;
  3052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3053. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  3054. //>>excludeEnd("ctx");
  3055. },
  3056. //>>excludeStart("ide", pragmas.excludeIdeData);
  3057. args: ["packageName", "newName"],
  3058. 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.",
  3059. referencedClasses: [],
  3060. //>>excludeEnd("ide");
  3061. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  3062. }),
  3063. $globals.SmalltalkImage);
  3064. $core.addMethod(
  3065. $core.method({
  3066. selector: "reservedWords",
  3067. protocol: "accessing",
  3068. fn: function (){
  3069. var self=this;
  3070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3071. return $core.withContext(function($ctx1) {
  3072. //>>excludeEnd("ctx");
  3073. return $core.reservedWords;
  3074. return self;
  3075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3076. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  3077. //>>excludeEnd("ctx");
  3078. },
  3079. //>>excludeStart("ide", pragmas.excludeIdeData);
  3080. args: [],
  3081. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<inlineJS: 'return $core.reservedWords'>",
  3082. referencedClasses: [],
  3083. //>>excludeEnd("ide");
  3084. messageSends: []
  3085. }),
  3086. $globals.SmalltalkImage);
  3087. $core.addMethod(
  3088. $core.method({
  3089. selector: "settings",
  3090. protocol: "accessing",
  3091. fn: function (){
  3092. var self=this;
  3093. return $globals.SmalltalkSettings;
  3094. },
  3095. //>>excludeStart("ide", pragmas.excludeIdeData);
  3096. args: [],
  3097. source: "settings\x0a\x09^ SmalltalkSettings",
  3098. referencedClasses: ["SmalltalkSettings"],
  3099. //>>excludeEnd("ide");
  3100. messageSends: []
  3101. }),
  3102. $globals.SmalltalkImage);
  3103. $core.addMethod(
  3104. $core.method({
  3105. selector: "version",
  3106. protocol: "accessing",
  3107. fn: function (){
  3108. var self=this;
  3109. return "0.19.0-pre";
  3110. },
  3111. //>>excludeStart("ide", pragmas.excludeIdeData);
  3112. args: [],
  3113. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.19.0-pre'",
  3114. referencedClasses: [],
  3115. //>>excludeEnd("ide");
  3116. messageSends: []
  3117. }),
  3118. $globals.SmalltalkImage);
  3119. $globals.SmalltalkImage.klass.iVarNames = ["current"];
  3120. $core.addMethod(
  3121. $core.method({
  3122. selector: "current",
  3123. protocol: "instance creation",
  3124. fn: function (){
  3125. var self=this;
  3126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3127. return $core.withContext(function($ctx1) {
  3128. //>>excludeEnd("ctx");
  3129. var $1,$receiver;
  3130. $1=self["@current"];
  3131. if(($receiver = $1) == null || $receiver.isNil){
  3132. self["@current"]=(
  3133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3134. $ctx1.supercall = true,
  3135. //>>excludeEnd("ctx");
  3136. ($globals.SmalltalkImage.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  3137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3138. $ctx1.supercall = false;
  3139. //>>excludeEnd("ctx");;
  3140. return self["@current"];
  3141. } else {
  3142. self._deprecatedAPI();
  3143. return self["@current"];
  3144. }
  3145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3146. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  3147. //>>excludeEnd("ctx");
  3148. },
  3149. //>>excludeStart("ide", pragmas.excludeIdeData);
  3150. args: [],
  3151. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  3152. referencedClasses: [],
  3153. //>>excludeEnd("ide");
  3154. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  3155. }),
  3156. $globals.SmalltalkImage.klass);
  3157. $core.addMethod(
  3158. $core.method({
  3159. selector: "initialize",
  3160. protocol: "initialization",
  3161. fn: function (){
  3162. var self=this;
  3163. var st;
  3164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3165. return $core.withContext(function($ctx1) {
  3166. //>>excludeEnd("ctx");
  3167. st=self._current();
  3168. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  3169. return self;
  3170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3171. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  3172. //>>excludeEnd("ctx");
  3173. },
  3174. //>>excludeStart("ide", pragmas.excludeIdeData);
  3175. args: [],
  3176. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  3177. referencedClasses: [],
  3178. //>>excludeEnd("ide");
  3179. messageSends: ["current", "at:put:", "globals"]
  3180. }),
  3181. $globals.SmalltalkImage.klass);
  3182. $core.addMethod(
  3183. $core.method({
  3184. selector: "new",
  3185. protocol: "instance creation",
  3186. fn: function (){
  3187. var self=this;
  3188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3189. return $core.withContext(function($ctx1) {
  3190. //>>excludeEnd("ctx");
  3191. self._shouldNotImplement();
  3192. return self;
  3193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3194. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  3195. //>>excludeEnd("ctx");
  3196. },
  3197. //>>excludeStart("ide", pragmas.excludeIdeData);
  3198. args: [],
  3199. source: "new\x0a\x09self shouldNotImplement",
  3200. referencedClasses: [],
  3201. //>>excludeEnd("ide");
  3202. messageSends: ["shouldNotImplement"]
  3203. }),
  3204. $globals.SmalltalkImage.klass);
  3205. $core.addMethod(
  3206. $core.method({
  3207. selector: "asJavaScriptPropertyName",
  3208. protocol: "*Kernel-Infrastructure",
  3209. fn: function (){
  3210. var self=this;
  3211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3212. return $core.withContext(function($ctx1) {
  3213. //>>excludeEnd("ctx");
  3214. return $core.st2prop(self);
  3215. return self;
  3216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3217. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  3218. //>>excludeEnd("ctx");
  3219. },
  3220. //>>excludeStart("ide", pragmas.excludeIdeData);
  3221. args: [],
  3222. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  3223. referencedClasses: [],
  3224. //>>excludeEnd("ide");
  3225. messageSends: []
  3226. }),
  3227. $globals.String);
  3228. $core.addMethod(
  3229. $core.method({
  3230. selector: "asSetting",
  3231. protocol: "*Kernel-Infrastructure",
  3232. fn: function (){
  3233. var self=this;
  3234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3235. return $core.withContext(function($ctx1) {
  3236. //>>excludeEnd("ctx");
  3237. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  3238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3239. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  3240. //>>excludeEnd("ctx");
  3241. },
  3242. //>>excludeStart("ide", pragmas.excludeIdeData);
  3243. args: [],
  3244. 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",
  3245. referencedClasses: ["Setting"],
  3246. //>>excludeEnd("ide");
  3247. messageSends: ["at:ifAbsent:"]
  3248. }),
  3249. $globals.String);
  3250. $core.addMethod(
  3251. $core.method({
  3252. selector: "asSettingIfAbsent:",
  3253. protocol: "*Kernel-Infrastructure",
  3254. fn: function (aDefaultValue){
  3255. var self=this;
  3256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3257. return $core.withContext(function($ctx1) {
  3258. //>>excludeEnd("ctx");
  3259. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  3260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3261. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  3262. //>>excludeEnd("ctx");
  3263. },
  3264. //>>excludeStart("ide", pragmas.excludeIdeData);
  3265. args: ["aDefaultValue"],
  3266. 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",
  3267. referencedClasses: ["Setting"],
  3268. //>>excludeEnd("ide");
  3269. messageSends: ["at:ifAbsent:"]
  3270. }),
  3271. $globals.String);
  3272. $core.addMethod(
  3273. $core.method({
  3274. selector: "settingValue",
  3275. protocol: "*Kernel-Infrastructure",
  3276. fn: function (){
  3277. var self=this;
  3278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3279. return $core.withContext(function($ctx1) {
  3280. //>>excludeEnd("ctx");
  3281. return $recv(self._asSetting())._value();
  3282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3283. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  3284. //>>excludeEnd("ctx");
  3285. },
  3286. //>>excludeStart("ide", pragmas.excludeIdeData);
  3287. args: [],
  3288. source: "settingValue\x0a\x09^ self asSetting value",
  3289. referencedClasses: [],
  3290. //>>excludeEnd("ide");
  3291. messageSends: ["value", "asSetting"]
  3292. }),
  3293. $globals.String);
  3294. $core.addMethod(
  3295. $core.method({
  3296. selector: "settingValue:",
  3297. protocol: "*Kernel-Infrastructure",
  3298. fn: function (aValue){
  3299. var self=this;
  3300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3301. return $core.withContext(function($ctx1) {
  3302. //>>excludeEnd("ctx");
  3303. return $recv(self._asSetting())._value_(aValue);
  3304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3305. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  3306. //>>excludeEnd("ctx");
  3307. },
  3308. //>>excludeStart("ide", pragmas.excludeIdeData);
  3309. args: ["aValue"],
  3310. 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",
  3311. referencedClasses: [],
  3312. //>>excludeEnd("ide");
  3313. messageSends: ["value:", "asSetting"]
  3314. }),
  3315. $globals.String);
  3316. $core.addMethod(
  3317. $core.method({
  3318. selector: "settingValueIfAbsent:",
  3319. protocol: "*Kernel-Infrastructure",
  3320. fn: function (aDefaultValue){
  3321. var self=this;
  3322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3323. return $core.withContext(function($ctx1) {
  3324. //>>excludeEnd("ctx");
  3325. return $recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  3326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3327. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  3328. //>>excludeEnd("ctx");
  3329. },
  3330. //>>excludeStart("ide", pragmas.excludeIdeData);
  3331. args: ["aDefaultValue"],
  3332. 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",
  3333. referencedClasses: [],
  3334. //>>excludeEnd("ide");
  3335. messageSends: ["value", "asSettingIfAbsent:"]
  3336. }),
  3337. $globals.String);
  3338. });