Kernel-Infrastructure.js 126 KB

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