Kernel-Infrastructure.js 152 KB

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