1
0

Kernel-Infrastructure.js 152 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262
  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. $1=$recv($recv(split)._size()).__eq((1));
  1457. if($core.assert($1)){
  1458. return $recv(split)._first();
  1459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1460. $ctx2.sendIdx["first"]=1;
  1461. //>>excludeEnd("ctx");
  1462. } else {
  1463. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  1464. }
  1465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1466. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  1467. //>>excludeEnd("ctx");
  1468. }));
  1469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1470. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  1471. //>>excludeEnd("ctx");
  1472. },
  1473. //>>excludeStart("ide", pragmas.excludeIdeData);
  1474. args: ["anArray"],
  1475. 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 ]]",
  1476. referencedClasses: [],
  1477. //>>excludeEnd("ide");
  1478. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  1479. }),
  1480. $globals.Package);
  1481. $core.addMethod(
  1482. $core.method({
  1483. selector: "initialize",
  1484. protocol: "initialization",
  1485. fn: function (){
  1486. var self=this,$self=this;
  1487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1488. return $core.withContext(function($ctx1) {
  1489. //>>excludeEnd("ctx");
  1490. (
  1491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1492. $ctx1.supercall = true,
  1493. //>>excludeEnd("ctx");
  1494. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  1495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1496. $ctx1.supercall = false;
  1497. //>>excludeEnd("ctx");;
  1498. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  1499. $self["@evalBlock"]=nil;
  1500. $self["@dirty"]=nil;
  1501. $self["@imports"]=nil;
  1502. $self["@transport"]=nil;
  1503. return self;
  1504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1505. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  1506. //>>excludeEnd("ctx");
  1507. },
  1508. //>>excludeStart("ide", pragmas.excludeIdeData);
  1509. args: [],
  1510. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09transport := nil",
  1511. referencedClasses: ["PackageOrganizer"],
  1512. //>>excludeEnd("ide");
  1513. messageSends: ["initialize", "new"]
  1514. }),
  1515. $globals.Package);
  1516. $core.addMethod(
  1517. $core.method({
  1518. selector: "isDirty",
  1519. protocol: "testing",
  1520. fn: function (){
  1521. var self=this,$self=this;
  1522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1523. return $core.withContext(function($ctx1) {
  1524. //>>excludeEnd("ctx");
  1525. var $1,$receiver;
  1526. $1=$self["@dirty"];
  1527. if(($receiver = $1) == null || $receiver.a$nil){
  1528. return false;
  1529. } else {
  1530. return $1;
  1531. }
  1532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1533. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  1534. //>>excludeEnd("ctx");
  1535. },
  1536. //>>excludeStart("ide", pragmas.excludeIdeData);
  1537. args: [],
  1538. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  1539. referencedClasses: [],
  1540. //>>excludeEnd("ide");
  1541. messageSends: ["ifNil:"]
  1542. }),
  1543. $globals.Package);
  1544. $core.addMethod(
  1545. $core.method({
  1546. selector: "isPackage",
  1547. protocol: "testing",
  1548. fn: function (){
  1549. var self=this,$self=this;
  1550. return true;
  1551. },
  1552. //>>excludeStart("ide", pragmas.excludeIdeData);
  1553. args: [],
  1554. source: "isPackage\x0a\x09^ true",
  1555. referencedClasses: [],
  1556. //>>excludeEnd("ide");
  1557. messageSends: []
  1558. }),
  1559. $globals.Package);
  1560. $core.addMethod(
  1561. $core.method({
  1562. selector: "javaScriptDescriptor:",
  1563. protocol: "accessing",
  1564. fn: function (anObject){
  1565. var self=this,$self=this;
  1566. var basicEval,basicImports;
  1567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1568. return $core.withContext(function($ctx1) {
  1569. //>>excludeEnd("ctx");
  1570. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  1571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1572. return $core.withContext(function($ctx2) {
  1573. //>>excludeEnd("ctx");
  1574. return nil._asJavaScriptObject();
  1575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1577. //>>excludeEnd("ctx");
  1578. }));
  1579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1580. $ctx1.sendIdx["at:ifAbsent:"]=1;
  1581. //>>excludeEnd("ctx");
  1582. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  1583. return [];
  1584. }));
  1585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1586. $ctx1.sendIdx["at:ifAbsent:"]=2;
  1587. //>>excludeEnd("ctx");
  1588. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  1589. }));
  1590. $self._evalBlock_(basicEval);
  1591. $self._imports_($self._importsFromJson_(basicImports));
  1592. return self;
  1593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1594. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  1595. //>>excludeEnd("ctx");
  1596. },
  1597. //>>excludeStart("ide", pragmas.excludeIdeData);
  1598. args: ["anObject"],
  1599. 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)",
  1600. referencedClasses: [],
  1601. //>>excludeEnd("ide");
  1602. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "evalBlock:", "imports:", "importsFromJson:"]
  1603. }),
  1604. $globals.Package);
  1605. $core.addMethod(
  1606. $core.method({
  1607. selector: "loadDependencies",
  1608. protocol: "dependencies",
  1609. fn: function (){
  1610. var self=this,$self=this;
  1611. var classes,packages;
  1612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1613. return $core.withContext(function($ctx1) {
  1614. //>>excludeEnd("ctx");
  1615. var $1;
  1616. classes=$self._loadDependencyClasses();
  1617. $1=$recv($recv(classes)._collect_((function(each){
  1618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1619. return $core.withContext(function($ctx2) {
  1620. //>>excludeEnd("ctx");
  1621. return $recv(each)._package();
  1622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1623. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1624. //>>excludeEnd("ctx");
  1625. })))._asSet();
  1626. $recv($1)._remove_ifAbsent_(self,(function(){
  1627. }));
  1628. return $recv($1)._yourself();
  1629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1630. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  1631. //>>excludeEnd("ctx");
  1632. },
  1633. //>>excludeStart("ide", pragmas.excludeIdeData);
  1634. args: [],
  1635. 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",
  1636. referencedClasses: [],
  1637. //>>excludeEnd("ide");
  1638. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  1639. }),
  1640. $globals.Package);
  1641. $core.addMethod(
  1642. $core.method({
  1643. selector: "loadDependencyClasses",
  1644. protocol: "dependencies",
  1645. fn: function (){
  1646. var self=this,$self=this;
  1647. var starCategoryName;
  1648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1649. return $core.withContext(function($ctx1) {
  1650. //>>excludeEnd("ctx");
  1651. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  1652. starCategoryName="*".__comma($self._name());
  1653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1654. $ctx1.sendIdx[","]=1;
  1655. //>>excludeEnd("ctx");
  1656. $3=$self._classes();
  1657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1658. $ctx1.sendIdx["classes"]=1;
  1659. //>>excludeEnd("ctx");
  1660. $2=$recv($3)._collect_((function(each){
  1661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1662. return $core.withContext(function($ctx2) {
  1663. //>>excludeEnd("ctx");
  1664. return $recv(each)._superclass();
  1665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1666. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1667. //>>excludeEnd("ctx");
  1668. }));
  1669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1670. $ctx1.sendIdx["collect:"]=1;
  1671. //>>excludeEnd("ctx");
  1672. $1=$recv($2)._asSet();
  1673. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  1674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1675. return $core.withContext(function($ctx2) {
  1676. //>>excludeEnd("ctx");
  1677. $5=$recv(each)._protocols();
  1678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1679. $ctx2.sendIdx["protocols"]=1;
  1680. //>>excludeEnd("ctx");
  1681. $7=$recv(each)._theMetaClass();
  1682. if(($receiver = $7) == null || $receiver.a$nil){
  1683. $6=[];
  1684. } else {
  1685. var meta;
  1686. meta=$receiver;
  1687. $6=$recv(meta)._protocols();
  1688. }
  1689. $4=$recv($5).__comma($6);
  1690. return $recv($4)._includes_(starCategoryName);
  1691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1692. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  1693. //>>excludeEnd("ctx");
  1694. })));
  1695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1696. $ctx1.sendIdx["addAll:"]=1;
  1697. //>>excludeEnd("ctx");
  1698. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  1699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1700. return $core.withContext(function($ctx2) {
  1701. //>>excludeEnd("ctx");
  1702. return $recv($self._traitCompositions())._valuesDo_((function(each){
  1703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1704. return $core.withContext(function($ctx3) {
  1705. //>>excludeEnd("ctx");
  1706. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  1707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1708. return $core.withContext(function($ctx4) {
  1709. //>>excludeEnd("ctx");
  1710. return $recv(eachTT)._trait();
  1711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1712. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  1713. //>>excludeEnd("ctx");
  1714. })));
  1715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1716. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  1717. //>>excludeEnd("ctx");
  1718. }));
  1719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1720. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  1721. //>>excludeEnd("ctx");
  1722. })));
  1723. $recv($1)._remove_ifAbsent_(nil,(function(){
  1724. }));
  1725. return $recv($1)._yourself();
  1726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1727. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  1728. //>>excludeEnd("ctx");
  1729. },
  1730. //>>excludeStart("ide", pragmas.excludeIdeData);
  1731. args: [],
  1732. 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",
  1733. referencedClasses: ["Smalltalk", "Array"],
  1734. //>>excludeEnd("ide");
  1735. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  1736. }),
  1737. $globals.Package);
  1738. $core.addMethod(
  1739. $core.method({
  1740. selector: "name",
  1741. protocol: "accessing",
  1742. fn: function (){
  1743. var self=this,$self=this;
  1744. return $self["@name"];
  1745. },
  1746. //>>excludeStart("ide", pragmas.excludeIdeData);
  1747. args: [],
  1748. source: "name\x0a\x09^ name",
  1749. referencedClasses: [],
  1750. //>>excludeEnd("ide");
  1751. messageSends: []
  1752. }),
  1753. $globals.Package);
  1754. $core.addMethod(
  1755. $core.method({
  1756. selector: "name:",
  1757. protocol: "accessing",
  1758. fn: function (aString){
  1759. var self=this,$self=this;
  1760. $self["@name"]=aString;
  1761. return self;
  1762. },
  1763. //>>excludeStart("ide", pragmas.excludeIdeData);
  1764. args: ["aString"],
  1765. source: "name: aString\x0a\x09name := aString",
  1766. referencedClasses: [],
  1767. //>>excludeEnd("ide");
  1768. messageSends: []
  1769. }),
  1770. $globals.Package);
  1771. $core.addMethod(
  1772. $core.method({
  1773. selector: "organization",
  1774. protocol: "accessing",
  1775. fn: function (){
  1776. var self=this,$self=this;
  1777. return $self["@organization"];
  1778. },
  1779. //>>excludeStart("ide", pragmas.excludeIdeData);
  1780. args: [],
  1781. source: "organization\x0a\x09^ organization",
  1782. referencedClasses: [],
  1783. //>>excludeEnd("ide");
  1784. messageSends: []
  1785. }),
  1786. $globals.Package);
  1787. $core.addMethod(
  1788. $core.method({
  1789. selector: "printOn:",
  1790. protocol: "printing",
  1791. fn: function (aStream){
  1792. var self=this,$self=this;
  1793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1794. return $core.withContext(function($ctx1) {
  1795. //>>excludeEnd("ctx");
  1796. (
  1797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1798. $ctx1.supercall = true,
  1799. //>>excludeEnd("ctx");
  1800. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  1801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1802. $ctx1.supercall = false;
  1803. //>>excludeEnd("ctx");;
  1804. $recv(aStream)._nextPutAll_(" (");
  1805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1806. $ctx1.sendIdx["nextPutAll:"]=1;
  1807. //>>excludeEnd("ctx");
  1808. $recv(aStream)._nextPutAll_($self._name());
  1809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1810. $ctx1.sendIdx["nextPutAll:"]=2;
  1811. //>>excludeEnd("ctx");
  1812. $recv(aStream)._nextPutAll_(")");
  1813. return self;
  1814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1815. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  1816. //>>excludeEnd("ctx");
  1817. },
  1818. //>>excludeStart("ide", pragmas.excludeIdeData);
  1819. args: ["aStream"],
  1820. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  1821. referencedClasses: [],
  1822. //>>excludeEnd("ide");
  1823. messageSends: ["printOn:", "nextPutAll:", "name"]
  1824. }),
  1825. $globals.Package);
  1826. $core.addMethod(
  1827. $core.method({
  1828. selector: "setupClasses",
  1829. protocol: "classes",
  1830. fn: function (){
  1831. var self=this,$self=this;
  1832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1833. return $core.withContext(function($ctx1) {
  1834. //>>excludeEnd("ctx");
  1835. $recv($self._classes())._do_((function(each){
  1836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1837. return $core.withContext(function($ctx2) {
  1838. //>>excludeEnd("ctx");
  1839. return $recv(each)._initialize();
  1840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1842. //>>excludeEnd("ctx");
  1843. }));
  1844. return self;
  1845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1846. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  1847. //>>excludeEnd("ctx");
  1848. },
  1849. //>>excludeStart("ide", pragmas.excludeIdeData);
  1850. args: [],
  1851. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  1852. referencedClasses: [],
  1853. //>>excludeEnd("ide");
  1854. messageSends: ["do:", "classes", "initialize"]
  1855. }),
  1856. $globals.Package);
  1857. $core.addMethod(
  1858. $core.method({
  1859. selector: "sortedClasses",
  1860. protocol: "classes",
  1861. fn: function (){
  1862. var self=this,$self=this;
  1863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1864. return $core.withContext(function($ctx1) {
  1865. //>>excludeEnd("ctx");
  1866. return $recv($self._class())._sortedClasses_($self._classes());
  1867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1868. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  1869. //>>excludeEnd("ctx");
  1870. },
  1871. //>>excludeStart("ide", pragmas.excludeIdeData);
  1872. args: [],
  1873. 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",
  1874. referencedClasses: [],
  1875. //>>excludeEnd("ide");
  1876. messageSends: ["sortedClasses:", "class", "classes"]
  1877. }),
  1878. $globals.Package);
  1879. $core.addMethod(
  1880. $core.method({
  1881. selector: "sortedImportsAsArray",
  1882. protocol: "private",
  1883. fn: function (){
  1884. var self=this,$self=this;
  1885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1886. return $core.withContext(function($ctx1) {
  1887. //>>excludeEnd("ctx");
  1888. var $3,$2,$4,$1,$6,$5,$7;
  1889. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  1890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1891. return $core.withContext(function($ctx2) {
  1892. //>>excludeEnd("ctx");
  1893. $3=$recv(a)._isString();
  1894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1895. $ctx2.sendIdx["isString"]=1;
  1896. //>>excludeEnd("ctx");
  1897. $2=$recv($3)._not();
  1898. $4=$recv(b)._isString();
  1899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1900. $ctx2.sendIdx["isString"]=2;
  1901. //>>excludeEnd("ctx");
  1902. $1=$recv($2).__and($4);
  1903. return $recv($1)._or_((function(){
  1904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1905. return $core.withContext(function($ctx3) {
  1906. //>>excludeEnd("ctx");
  1907. $6=$recv(a)._isString();
  1908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1909. $ctx3.sendIdx["isString"]=3;
  1910. //>>excludeEnd("ctx");
  1911. $5=$recv($6).__eq($recv(b)._isString());
  1912. return $recv($5)._and_((function(){
  1913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1914. return $core.withContext(function($ctx4) {
  1915. //>>excludeEnd("ctx");
  1916. $7=$recv(a)._value();
  1917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1918. $ctx4.sendIdx["value"]=1;
  1919. //>>excludeEnd("ctx");
  1920. return $recv($7).__lt_eq($recv(b)._value());
  1921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1922. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  1923. //>>excludeEnd("ctx");
  1924. }));
  1925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1926. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1927. //>>excludeEnd("ctx");
  1928. }));
  1929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1930. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  1931. //>>excludeEnd("ctx");
  1932. }));
  1933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1934. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  1935. //>>excludeEnd("ctx");
  1936. },
  1937. //>>excludeStart("ide", pragmas.excludeIdeData);
  1938. args: [],
  1939. 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 ]]]",
  1940. referencedClasses: [],
  1941. //>>excludeEnd("ide");
  1942. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  1943. }),
  1944. $globals.Package);
  1945. $core.addMethod(
  1946. $core.method({
  1947. selector: "traitCompositions",
  1948. protocol: "dependencies",
  1949. fn: function (){
  1950. var self=this,$self=this;
  1951. var traitCompositions;
  1952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1953. return $core.withContext(function($ctx1) {
  1954. //>>excludeEnd("ctx");
  1955. var $1,$2,$3,$receiver;
  1956. traitCompositions=$recv($globals.Dictionary)._new();
  1957. $recv($self._classes())._do_((function(each){
  1958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1959. return $core.withContext(function($ctx2) {
  1960. //>>excludeEnd("ctx");
  1961. $1=traitCompositions;
  1962. $2=$recv(each)._traitComposition();
  1963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1964. $ctx2.sendIdx["traitComposition"]=1;
  1965. //>>excludeEnd("ctx");
  1966. $recv($1)._at_put_(each,$2);
  1967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1968. $ctx2.sendIdx["at:put:"]=1;
  1969. //>>excludeEnd("ctx");
  1970. $3=$recv(each)._theMetaClass();
  1971. if(($receiver = $3) == null || $receiver.a$nil){
  1972. return $3;
  1973. } else {
  1974. var meta;
  1975. meta=$receiver;
  1976. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  1977. }
  1978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1979. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1980. //>>excludeEnd("ctx");
  1981. }));
  1982. return $recv(traitCompositions)._reject_((function(each){
  1983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1984. return $core.withContext(function($ctx2) {
  1985. //>>excludeEnd("ctx");
  1986. return $recv(each)._isEmpty();
  1987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1988. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1989. //>>excludeEnd("ctx");
  1990. }));
  1991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1992. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  1993. //>>excludeEnd("ctx");
  1994. },
  1995. //>>excludeStart("ide", pragmas.excludeIdeData);
  1996. args: [],
  1997. 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 ]",
  1998. referencedClasses: ["Dictionary"],
  1999. //>>excludeEnd("ide");
  2000. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  2001. }),
  2002. $globals.Package);
  2003. $core.addMethod(
  2004. $core.method({
  2005. selector: "transport",
  2006. protocol: "accessing",
  2007. fn: function (){
  2008. var self=this,$self=this;
  2009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2010. return $core.withContext(function($ctx1) {
  2011. //>>excludeEnd("ctx");
  2012. var $1,$receiver;
  2013. $1=$self["@transport"];
  2014. if(($receiver = $1) == null || $receiver.a$nil){
  2015. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  2016. return $self["@transport"];
  2017. } else {
  2018. return $1;
  2019. }
  2020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2021. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  2022. //>>excludeEnd("ctx");
  2023. },
  2024. //>>excludeStart("ide", pragmas.excludeIdeData);
  2025. args: [],
  2026. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  2027. referencedClasses: ["PackageTransport"],
  2028. //>>excludeEnd("ide");
  2029. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  2030. }),
  2031. $globals.Package);
  2032. $core.addMethod(
  2033. $core.method({
  2034. selector: "transport:",
  2035. protocol: "accessing",
  2036. fn: function (aPackageTransport){
  2037. var self=this,$self=this;
  2038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2039. return $core.withContext(function($ctx1) {
  2040. //>>excludeEnd("ctx");
  2041. $self["@transport"]=aPackageTransport;
  2042. $recv(aPackageTransport)._package_(self);
  2043. return self;
  2044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2045. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  2046. //>>excludeEnd("ctx");
  2047. },
  2048. //>>excludeStart("ide", pragmas.excludeIdeData);
  2049. args: ["aPackageTransport"],
  2050. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  2051. referencedClasses: [],
  2052. //>>excludeEnd("ide");
  2053. messageSends: ["package:"]
  2054. }),
  2055. $globals.Package);
  2056. $core.addMethod(
  2057. $core.method({
  2058. selector: "validateImports:",
  2059. protocol: "validation",
  2060. fn: function (aCollection){
  2061. var self=this,$self=this;
  2062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2063. return $core.withContext(function($ctx1) {
  2064. //>>excludeEnd("ctx");
  2065. var $1,$2,$5,$4,$3,$6;
  2066. $recv(aCollection)._do_((function(import_){
  2067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2068. return $core.withContext(function($ctx2) {
  2069. //>>excludeEnd("ctx");
  2070. $1=$recv(import_)._isString();
  2071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2072. $ctx2.sendIdx["isString"]=1;
  2073. //>>excludeEnd("ctx");
  2074. if(!$core.assert($1)){
  2075. $2=$recv(import_)._respondsTo_("key");
  2076. if(!$core.assert($2)){
  2077. $self._error_("Imports must be Strings or Associations");
  2078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2079. $ctx2.sendIdx["error:"]=1;
  2080. //>>excludeEnd("ctx");
  2081. }
  2082. $5=$recv(import_)._key();
  2083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2084. $ctx2.sendIdx["key"]=1;
  2085. //>>excludeEnd("ctx");
  2086. $4=$recv($5)._isString();
  2087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2088. $ctx2.sendIdx["isString"]=2;
  2089. //>>excludeEnd("ctx");
  2090. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  2091. if(!$core.assert($3)){
  2092. $self._error_("Key and value must be Strings");
  2093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2094. $ctx2.sendIdx["error:"]=2;
  2095. //>>excludeEnd("ctx");
  2096. }
  2097. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  2098. if(!$core.assert($6)){
  2099. return $self._error_("Keys must be identifiers");
  2100. }
  2101. }
  2102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2103. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  2104. //>>excludeEnd("ctx");
  2105. }));
  2106. return self;
  2107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2108. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  2109. //>>excludeEnd("ctx");
  2110. },
  2111. //>>excludeStart("ide", pragmas.excludeIdeData);
  2112. args: ["aCollection"],
  2113. 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' ]]]",
  2114. referencedClasses: [],
  2115. //>>excludeEnd("ide");
  2116. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  2117. }),
  2118. $globals.Package);
  2119. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  2120. $core.addMethod(
  2121. $core.method({
  2122. selector: "named:",
  2123. protocol: "accessing",
  2124. fn: function (aPackageName){
  2125. var self=this,$self=this;
  2126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2127. return $core.withContext(function($ctx1) {
  2128. //>>excludeEnd("ctx");
  2129. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  2130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2131. return $core.withContext(function($ctx2) {
  2132. //>>excludeEnd("ctx");
  2133. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  2134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2136. //>>excludeEnd("ctx");
  2137. }));
  2138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2139. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  2140. //>>excludeEnd("ctx");
  2141. },
  2142. //>>excludeStart("ide", pragmas.excludeIdeData);
  2143. args: ["aPackageName"],
  2144. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  2145. referencedClasses: ["Smalltalk"],
  2146. //>>excludeEnd("ide");
  2147. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  2148. }),
  2149. $globals.Package.a$cls);
  2150. $core.addMethod(
  2151. $core.method({
  2152. selector: "named:ifAbsent:",
  2153. protocol: "accessing",
  2154. fn: function (aPackageName,aBlock){
  2155. var self=this,$self=this;
  2156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2157. return $core.withContext(function($ctx1) {
  2158. //>>excludeEnd("ctx");
  2159. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  2160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2161. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  2162. //>>excludeEnd("ctx");
  2163. },
  2164. //>>excludeStart("ide", pragmas.excludeIdeData);
  2165. args: ["aPackageName", "aBlock"],
  2166. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  2167. referencedClasses: ["Smalltalk"],
  2168. //>>excludeEnd("ide");
  2169. messageSends: ["packageAt:ifAbsent:"]
  2170. }),
  2171. $globals.Package.a$cls);
  2172. $core.addMethod(
  2173. $core.method({
  2174. selector: "named:imports:transport:",
  2175. protocol: "accessing",
  2176. fn: function (aPackageName,anArray,aTransport){
  2177. var self=this,$self=this;
  2178. var pkg;
  2179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2180. return $core.withContext(function($ctx1) {
  2181. //>>excludeEnd("ctx");
  2182. pkg=$self._named_(aPackageName);
  2183. $recv(pkg)._imports_(anArray);
  2184. $recv(pkg)._transport_(aTransport);
  2185. return pkg;
  2186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2187. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  2188. //>>excludeEnd("ctx");
  2189. },
  2190. //>>excludeStart("ide", pragmas.excludeIdeData);
  2191. args: ["aPackageName", "anArray", "aTransport"],
  2192. 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",
  2193. referencedClasses: [],
  2194. //>>excludeEnd("ide");
  2195. messageSends: ["named:", "imports:", "transport:"]
  2196. }),
  2197. $globals.Package.a$cls);
  2198. $core.addMethod(
  2199. $core.method({
  2200. selector: "named:javaScriptDescriptor:",
  2201. protocol: "instance creation",
  2202. fn: function (aString,anObject){
  2203. var self=this,$self=this;
  2204. var pkg;
  2205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2206. return $core.withContext(function($ctx1) {
  2207. //>>excludeEnd("ctx");
  2208. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  2209. $recv(pkg)._javaScriptDescriptor_(anObject);
  2210. return pkg;
  2211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2212. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  2213. //>>excludeEnd("ctx");
  2214. },
  2215. //>>excludeStart("ide", pragmas.excludeIdeData);
  2216. args: ["aString", "anObject"],
  2217. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  2218. referencedClasses: ["Smalltalk"],
  2219. //>>excludeEnd("ide");
  2220. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  2221. }),
  2222. $globals.Package.a$cls);
  2223. $core.addMethod(
  2224. $core.method({
  2225. selector: "named:transport:",
  2226. protocol: "accessing",
  2227. fn: function (aPackageName,aTransport){
  2228. var self=this,$self=this;
  2229. var pkg;
  2230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2231. return $core.withContext(function($ctx1) {
  2232. //>>excludeEnd("ctx");
  2233. pkg=$self._named_(aPackageName);
  2234. $recv(pkg)._transport_(aTransport);
  2235. return pkg;
  2236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2237. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  2238. //>>excludeEnd("ctx");
  2239. },
  2240. //>>excludeStart("ide", pragmas.excludeIdeData);
  2241. args: ["aPackageName", "aTransport"],
  2242. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  2243. referencedClasses: [],
  2244. //>>excludeEnd("ide");
  2245. messageSends: ["named:", "transport:"]
  2246. }),
  2247. $globals.Package.a$cls);
  2248. $core.addMethod(
  2249. $core.method({
  2250. selector: "new:",
  2251. protocol: "instance creation",
  2252. fn: function (aString){
  2253. var self=this,$self=this;
  2254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2255. return $core.withContext(function($ctx1) {
  2256. //>>excludeEnd("ctx");
  2257. var $1;
  2258. $1=$recv($globals.Package)._new();
  2259. $recv($1)._name_(aString);
  2260. return $recv($1)._yourself();
  2261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2262. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  2263. //>>excludeEnd("ctx");
  2264. },
  2265. //>>excludeStart("ide", pragmas.excludeIdeData);
  2266. args: ["aString"],
  2267. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  2268. referencedClasses: ["Package"],
  2269. //>>excludeEnd("ide");
  2270. messageSends: ["name:", "new", "yourself"]
  2271. }),
  2272. $globals.Package.a$cls);
  2273. $core.addMethod(
  2274. $core.method({
  2275. selector: "sortedClasses:",
  2276. protocol: "sorting",
  2277. fn: function (classes){
  2278. var self=this,$self=this;
  2279. var children,others,nodes,expandedClasses;
  2280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2281. return $core.withContext(function($ctx1) {
  2282. //>>excludeEnd("ctx");
  2283. var $1,$3,$2;
  2284. children=[];
  2285. others=[];
  2286. $recv(classes)._do_((function(each){
  2287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2288. return $core.withContext(function($ctx2) {
  2289. //>>excludeEnd("ctx");
  2290. $1=$recv(classes)._includes_($recv(each)._superclass());
  2291. if($core.assert($1)){
  2292. return $recv(others)._add_(each);
  2293. } else {
  2294. return $recv(children)._add_(each);
  2295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2296. $ctx2.sendIdx["add:"]=1;
  2297. //>>excludeEnd("ctx");
  2298. }
  2299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2300. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2301. //>>excludeEnd("ctx");
  2302. }));
  2303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2304. $ctx1.sendIdx["do:"]=1;
  2305. //>>excludeEnd("ctx");
  2306. nodes=$recv(children)._collect_((function(each){
  2307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2308. return $core.withContext(function($ctx2) {
  2309. //>>excludeEnd("ctx");
  2310. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  2311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  2313. //>>excludeEnd("ctx");
  2314. }));
  2315. nodes=$recv(nodes)._sorted_((function(a,b){
  2316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2317. return $core.withContext(function($ctx2) {
  2318. //>>excludeEnd("ctx");
  2319. $3=$recv(a)._theClass();
  2320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2321. $ctx2.sendIdx["theClass"]=1;
  2322. //>>excludeEnd("ctx");
  2323. $2=$recv($3)._name();
  2324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2325. $ctx2.sendIdx["name"]=1;
  2326. //>>excludeEnd("ctx");
  2327. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  2328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2329. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  2330. //>>excludeEnd("ctx");
  2331. }));
  2332. expandedClasses=$recv($globals.Array)._new();
  2333. $recv(nodes)._do_((function(aNode){
  2334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2335. return $core.withContext(function($ctx2) {
  2336. //>>excludeEnd("ctx");
  2337. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  2338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2339. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  2340. //>>excludeEnd("ctx");
  2341. }));
  2342. return expandedClasses;
  2343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2344. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  2345. //>>excludeEnd("ctx");
  2346. },
  2347. //>>excludeStart("ide", pragmas.excludeIdeData);
  2348. args: ["classes"],
  2349. 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",
  2350. referencedClasses: ["ClassSorterNode", "Array"],
  2351. //>>excludeEnd("ide");
  2352. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  2353. }),
  2354. $globals.Package.a$cls);
  2355. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  2356. //>>excludeStart("ide", pragmas.excludeIdeData);
  2357. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  2358. //>>excludeEnd("ide");
  2359. $core.addMethod(
  2360. $core.method({
  2361. selector: "announcer",
  2362. protocol: "accessing",
  2363. fn: function (){
  2364. var self=this,$self=this;
  2365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2366. return $core.withContext(function($ctx1) {
  2367. //>>excludeEnd("ctx");
  2368. return $recv($globals.SystemAnnouncer)._current();
  2369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2370. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  2371. //>>excludeEnd("ctx");
  2372. },
  2373. //>>excludeStart("ide", pragmas.excludeIdeData);
  2374. args: [],
  2375. source: "announcer\x0a\x09^ SystemAnnouncer current",
  2376. referencedClasses: ["SystemAnnouncer"],
  2377. //>>excludeEnd("ide");
  2378. messageSends: ["current"]
  2379. }),
  2380. $globals.PackageStateObserver);
  2381. $core.addMethod(
  2382. $core.method({
  2383. selector: "observeSystem",
  2384. protocol: "actions",
  2385. fn: function (){
  2386. var self=this,$self=this;
  2387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2388. return $core.withContext(function($ctx1) {
  2389. //>>excludeEnd("ctx");
  2390. var $1;
  2391. $1=$self._announcer();
  2392. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  2393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2394. $ctx1.sendIdx["on:send:to:"]=1;
  2395. //>>excludeEnd("ctx");
  2396. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  2397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2398. $ctx1.sendIdx["on:send:to:"]=2;
  2399. //>>excludeEnd("ctx");
  2400. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  2401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2402. $ctx1.sendIdx["on:send:to:"]=3;
  2403. //>>excludeEnd("ctx");
  2404. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  2405. return self;
  2406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2407. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  2408. //>>excludeEnd("ctx");
  2409. },
  2410. //>>excludeStart("ide", pragmas.excludeIdeData);
  2411. args: [],
  2412. 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",
  2413. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  2414. //>>excludeEnd("ide");
  2415. messageSends: ["on:send:to:", "announcer"]
  2416. }),
  2417. $globals.PackageStateObserver);
  2418. $core.addMethod(
  2419. $core.method({
  2420. selector: "onClassModification:",
  2421. protocol: "reactions",
  2422. fn: function (anAnnouncement){
  2423. var self=this,$self=this;
  2424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2425. return $core.withContext(function($ctx1) {
  2426. //>>excludeEnd("ctx");
  2427. var $1,$receiver;
  2428. $1=$recv(anAnnouncement)._theClass();
  2429. if(($receiver = $1) == null || $receiver.a$nil){
  2430. $1;
  2431. } else {
  2432. var theClass;
  2433. theClass=$receiver;
  2434. $recv($recv(theClass)._package())._beDirty();
  2435. }
  2436. return self;
  2437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2438. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2439. //>>excludeEnd("ctx");
  2440. },
  2441. //>>excludeStart("ide", pragmas.excludeIdeData);
  2442. args: ["anAnnouncement"],
  2443. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  2444. referencedClasses: [],
  2445. //>>excludeEnd("ide");
  2446. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  2447. }),
  2448. $globals.PackageStateObserver);
  2449. $core.addMethod(
  2450. $core.method({
  2451. selector: "onMethodModification:",
  2452. protocol: "reactions",
  2453. fn: function (anAnnouncement){
  2454. var self=this,$self=this;
  2455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2456. return $core.withContext(function($ctx1) {
  2457. //>>excludeEnd("ctx");
  2458. var $1,$receiver;
  2459. $1=$recv($recv(anAnnouncement)._method())._package();
  2460. if(($receiver = $1) == null || $receiver.a$nil){
  2461. $1;
  2462. } else {
  2463. var package_;
  2464. package_=$receiver;
  2465. $recv(package_)._beDirty();
  2466. }
  2467. return self;
  2468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2469. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2470. //>>excludeEnd("ctx");
  2471. },
  2472. //>>excludeStart("ide", pragmas.excludeIdeData);
  2473. args: ["anAnnouncement"],
  2474. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  2475. referencedClasses: [],
  2476. //>>excludeEnd("ide");
  2477. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  2478. }),
  2479. $globals.PackageStateObserver);
  2480. $core.addMethod(
  2481. $core.method({
  2482. selector: "onPackageAdded:",
  2483. protocol: "reactions",
  2484. fn: function (anAnnouncement){
  2485. var self=this,$self=this;
  2486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2487. return $core.withContext(function($ctx1) {
  2488. //>>excludeEnd("ctx");
  2489. $recv($recv(anAnnouncement)._package())._beDirty();
  2490. return self;
  2491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2492. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2493. //>>excludeEnd("ctx");
  2494. },
  2495. //>>excludeStart("ide", pragmas.excludeIdeData);
  2496. args: ["anAnnouncement"],
  2497. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  2498. referencedClasses: [],
  2499. //>>excludeEnd("ide");
  2500. messageSends: ["beDirty", "package"]
  2501. }),
  2502. $globals.PackageStateObserver);
  2503. $core.addMethod(
  2504. $core.method({
  2505. selector: "onProtocolModification:",
  2506. protocol: "reactions",
  2507. fn: function (anAnnouncement){
  2508. var self=this,$self=this;
  2509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2510. return $core.withContext(function($ctx1) {
  2511. //>>excludeEnd("ctx");
  2512. var $1,$receiver;
  2513. $1=$recv(anAnnouncement)._package();
  2514. if(($receiver = $1) == null || $receiver.a$nil){
  2515. $1;
  2516. } else {
  2517. var package_;
  2518. package_=$receiver;
  2519. $recv(package_)._beDirty();
  2520. }
  2521. return self;
  2522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2523. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2524. //>>excludeEnd("ctx");
  2525. },
  2526. //>>excludeStart("ide", pragmas.excludeIdeData);
  2527. args: ["anAnnouncement"],
  2528. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  2529. referencedClasses: [],
  2530. //>>excludeEnd("ide");
  2531. messageSends: ["ifNotNil:", "package", "beDirty"]
  2532. }),
  2533. $globals.PackageStateObserver);
  2534. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  2535. $core.addMethod(
  2536. $core.method({
  2537. selector: "current",
  2538. protocol: "accessing",
  2539. fn: function (){
  2540. var self=this,$self=this;
  2541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2542. return $core.withContext(function($ctx1) {
  2543. //>>excludeEnd("ctx");
  2544. var $1,$receiver;
  2545. $1=$self["@current"];
  2546. if(($receiver = $1) == null || $receiver.a$nil){
  2547. $self["@current"]=$self._new();
  2548. return $self["@current"];
  2549. } else {
  2550. return $1;
  2551. }
  2552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2553. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  2554. //>>excludeEnd("ctx");
  2555. },
  2556. //>>excludeStart("ide", pragmas.excludeIdeData);
  2557. args: [],
  2558. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  2559. referencedClasses: [],
  2560. //>>excludeEnd("ide");
  2561. messageSends: ["ifNil:", "new"]
  2562. }),
  2563. $globals.PackageStateObserver.a$cls);
  2564. $core.addMethod(
  2565. $core.method({
  2566. selector: "initialize",
  2567. protocol: "initialization",
  2568. fn: function (){
  2569. var self=this,$self=this;
  2570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2571. return $core.withContext(function($ctx1) {
  2572. //>>excludeEnd("ctx");
  2573. $recv($self._current())._observeSystem();
  2574. return self;
  2575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2576. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  2577. //>>excludeEnd("ctx");
  2578. },
  2579. //>>excludeStart("ide", pragmas.excludeIdeData);
  2580. args: [],
  2581. source: "initialize\x0a\x09self current observeSystem",
  2582. referencedClasses: [],
  2583. //>>excludeEnd("ide");
  2584. messageSends: ["observeSystem", "current"]
  2585. }),
  2586. $globals.PackageStateObserver.a$cls);
  2587. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  2588. //>>excludeStart("ide", pragmas.excludeIdeData);
  2589. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  2590. //>>excludeEnd("ide");
  2591. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  2592. //>>excludeStart("ide", pragmas.excludeIdeData);
  2593. $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`";
  2594. //>>excludeEnd("ide");
  2595. $core.addMethod(
  2596. $core.method({
  2597. selector: "defaultValue",
  2598. protocol: "accessing",
  2599. fn: function (){
  2600. var self=this,$self=this;
  2601. return $self["@defaultValue"];
  2602. },
  2603. //>>excludeStart("ide", pragmas.excludeIdeData);
  2604. args: [],
  2605. source: "defaultValue\x0a\x09^ defaultValue",
  2606. referencedClasses: [],
  2607. //>>excludeEnd("ide");
  2608. messageSends: []
  2609. }),
  2610. $globals.Setting);
  2611. $core.addMethod(
  2612. $core.method({
  2613. selector: "defaultValue:",
  2614. protocol: "accessing",
  2615. fn: function (aStringifiableObject){
  2616. var self=this,$self=this;
  2617. $self["@defaultValue"]=aStringifiableObject;
  2618. return self;
  2619. },
  2620. //>>excludeStart("ide", pragmas.excludeIdeData);
  2621. args: ["aStringifiableObject"],
  2622. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  2623. referencedClasses: [],
  2624. //>>excludeEnd("ide");
  2625. messageSends: []
  2626. }),
  2627. $globals.Setting);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "key",
  2631. protocol: "accessing",
  2632. fn: function (){
  2633. var self=this,$self=this;
  2634. return $self["@key"];
  2635. },
  2636. //>>excludeStart("ide", pragmas.excludeIdeData);
  2637. args: [],
  2638. source: "key\x0a\x09^ key",
  2639. referencedClasses: [],
  2640. //>>excludeEnd("ide");
  2641. messageSends: []
  2642. }),
  2643. $globals.Setting);
  2644. $core.addMethod(
  2645. $core.method({
  2646. selector: "key:",
  2647. protocol: "accessing",
  2648. fn: function (aString){
  2649. var self=this,$self=this;
  2650. $self["@key"]=aString;
  2651. return self;
  2652. },
  2653. //>>excludeStart("ide", pragmas.excludeIdeData);
  2654. args: ["aString"],
  2655. source: "key: aString\x0a\x09key := aString",
  2656. referencedClasses: [],
  2657. //>>excludeEnd("ide");
  2658. messageSends: []
  2659. }),
  2660. $globals.Setting);
  2661. $core.addMethod(
  2662. $core.method({
  2663. selector: "value",
  2664. protocol: "accessing",
  2665. fn: function (){
  2666. var self=this,$self=this;
  2667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2668. return $core.withContext(function($ctx1) {
  2669. //>>excludeEnd("ctx");
  2670. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  2671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2672. return $core.withContext(function($ctx2) {
  2673. //>>excludeEnd("ctx");
  2674. return $self._defaultValue();
  2675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2677. //>>excludeEnd("ctx");
  2678. }));
  2679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2680. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  2681. //>>excludeEnd("ctx");
  2682. },
  2683. //>>excludeStart("ide", pragmas.excludeIdeData);
  2684. args: [],
  2685. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  2686. referencedClasses: ["Smalltalk"],
  2687. //>>excludeEnd("ide");
  2688. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  2689. }),
  2690. $globals.Setting);
  2691. $core.addMethod(
  2692. $core.method({
  2693. selector: "value:",
  2694. protocol: "accessing",
  2695. fn: function (aStringifiableObject){
  2696. var self=this,$self=this;
  2697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2698. return $core.withContext(function($ctx1) {
  2699. //>>excludeEnd("ctx");
  2700. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  2701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2702. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  2703. //>>excludeEnd("ctx");
  2704. },
  2705. //>>excludeStart("ide", pragmas.excludeIdeData);
  2706. args: ["aStringifiableObject"],
  2707. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  2708. referencedClasses: ["Smalltalk"],
  2709. //>>excludeEnd("ide");
  2710. messageSends: ["at:put:", "settings", "key"]
  2711. }),
  2712. $globals.Setting);
  2713. $core.addMethod(
  2714. $core.method({
  2715. selector: "at:ifAbsent:",
  2716. protocol: "instance creation",
  2717. fn: function (aString,aDefaultValue){
  2718. var self=this,$self=this;
  2719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2720. return $core.withContext(function($ctx1) {
  2721. //>>excludeEnd("ctx");
  2722. var $1;
  2723. $1=(
  2724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2725. $ctx1.supercall = true,
  2726. //>>excludeEnd("ctx");
  2727. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  2728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2729. $ctx1.supercall = false;
  2730. //>>excludeEnd("ctx");;
  2731. $recv($1)._key_(aString);
  2732. $recv($1)._defaultValue_(aDefaultValue);
  2733. return $recv($1)._yourself();
  2734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2735. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  2736. //>>excludeEnd("ctx");
  2737. },
  2738. //>>excludeStart("ide", pragmas.excludeIdeData);
  2739. args: ["aString", "aDefaultValue"],
  2740. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  2741. referencedClasses: [],
  2742. //>>excludeEnd("ide");
  2743. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  2744. }),
  2745. $globals.Setting.a$cls);
  2746. $core.addMethod(
  2747. $core.method({
  2748. selector: "new",
  2749. protocol: "instance creation",
  2750. fn: function (){
  2751. var self=this,$self=this;
  2752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2753. return $core.withContext(function($ctx1) {
  2754. //>>excludeEnd("ctx");
  2755. $self._shouldNotImplement();
  2756. return self;
  2757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2758. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  2759. //>>excludeEnd("ctx");
  2760. },
  2761. //>>excludeStart("ide", pragmas.excludeIdeData);
  2762. args: [],
  2763. source: "new\x0a\x09self shouldNotImplement",
  2764. referencedClasses: [],
  2765. //>>excludeEnd("ide");
  2766. messageSends: ["shouldNotImplement"]
  2767. }),
  2768. $globals.Setting.a$cls);
  2769. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  2770. //>>excludeStart("ide", pragmas.excludeIdeData);
  2771. $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.";
  2772. //>>excludeEnd("ide");
  2773. $core.addMethod(
  2774. $core.method({
  2775. selector: "addGlobalJsVariable:",
  2776. protocol: "globals",
  2777. fn: function (aString){
  2778. var self=this,$self=this;
  2779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2780. return $core.withContext(function($ctx1) {
  2781. //>>excludeEnd("ctx");
  2782. $recv($self._globalJsVariables())._add_(aString);
  2783. return self;
  2784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2785. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  2786. //>>excludeEnd("ctx");
  2787. },
  2788. //>>excludeStart("ide", pragmas.excludeIdeData);
  2789. args: ["aString"],
  2790. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  2791. referencedClasses: [],
  2792. //>>excludeEnd("ide");
  2793. messageSends: ["add:", "globalJsVariables"]
  2794. }),
  2795. $globals.SmalltalkImage);
  2796. $core.addMethod(
  2797. $core.method({
  2798. selector: "adoptPackageDescriptors",
  2799. protocol: "private",
  2800. fn: function (){
  2801. var self=this,$self=this;
  2802. var pkgs;
  2803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2804. return $core.withContext(function($ctx1) {
  2805. //>>excludeEnd("ctx");
  2806. pkgs=$recv($globals.Set)._new();
  2807. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  2808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2809. return $core.withContext(function($ctx2) {
  2810. //>>excludeEnd("ctx");
  2811. return $recv(pkgs)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  2812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2813. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2814. //>>excludeEnd("ctx");
  2815. }));
  2816. return pkgs;
  2817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2818. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{pkgs:pkgs},$globals.SmalltalkImage)});
  2819. //>>excludeEnd("ctx");
  2820. },
  2821. //>>excludeStart("ide", pragmas.excludeIdeData);
  2822. args: [],
  2823. 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",
  2824. referencedClasses: ["Set", "Package"],
  2825. //>>excludeEnd("ide");
  2826. messageSends: ["new", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:"]
  2827. }),
  2828. $globals.SmalltalkImage);
  2829. $core.addMethod(
  2830. $core.method({
  2831. selector: "amdRequire",
  2832. protocol: "accessing amd",
  2833. fn: function (){
  2834. var self=this,$self=this;
  2835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2836. return $core.withContext(function($ctx1) {
  2837. //>>excludeEnd("ctx");
  2838. return $recv($self._core())._at_("amdRequire");
  2839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2840. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  2841. //>>excludeEnd("ctx");
  2842. },
  2843. //>>excludeStart("ide", pragmas.excludeIdeData);
  2844. args: [],
  2845. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  2846. referencedClasses: [],
  2847. //>>excludeEnd("ide");
  2848. messageSends: ["at:", "core"]
  2849. }),
  2850. $globals.SmalltalkImage);
  2851. $core.addMethod(
  2852. $core.method({
  2853. selector: "asSmalltalkException:",
  2854. protocol: "error handling",
  2855. fn: function (anObject){
  2856. var self=this,$self=this;
  2857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2858. return $core.withContext(function($ctx1) {
  2859. //>>excludeEnd("ctx");
  2860. var $1;
  2861. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  2862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2863. return $core.withContext(function($ctx2) {
  2864. //>>excludeEnd("ctx");
  2865. return $recv(anObject)._isKindOf_($globals.Error);
  2866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2868. //>>excludeEnd("ctx");
  2869. }));
  2870. if($core.assert($1)){
  2871. return anObject;
  2872. } else {
  2873. return $recv($globals.JavaScriptException)._on_(anObject);
  2874. }
  2875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2876. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  2877. //>>excludeEnd("ctx");
  2878. },
  2879. //>>excludeStart("ide", pragmas.excludeIdeData);
  2880. args: ["anObject"],
  2881. 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 ]",
  2882. referencedClasses: ["Error", "JavaScriptException"],
  2883. //>>excludeEnd("ide");
  2884. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  2885. }),
  2886. $globals.SmalltalkImage);
  2887. $core.addMethod(
  2888. $core.method({
  2889. selector: "basicCreatePackage:",
  2890. protocol: "private",
  2891. fn: function (packageName){
  2892. var self=this,$self=this;
  2893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2894. return $core.withContext(function($ctx1) {
  2895. //>>excludeEnd("ctx");
  2896. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  2897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2898. return $core.withContext(function($ctx2) {
  2899. //>>excludeEnd("ctx");
  2900. return $recv($globals.Package)._new_(packageName);
  2901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2903. //>>excludeEnd("ctx");
  2904. }));
  2905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2906. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  2907. //>>excludeEnd("ctx");
  2908. },
  2909. //>>excludeStart("ide", pragmas.excludeIdeData);
  2910. args: ["packageName"],
  2911. 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 ]",
  2912. referencedClasses: ["Package"],
  2913. //>>excludeEnd("ide");
  2914. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  2915. }),
  2916. $globals.SmalltalkImage);
  2917. $core.addMethod(
  2918. $core.method({
  2919. selector: "basicParse:",
  2920. protocol: "private",
  2921. fn: function (aString){
  2922. var self=this,$self=this;
  2923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2924. return $core.withContext(function($ctx1) {
  2925. //>>excludeEnd("ctx");
  2926. return $recv($globals.SmalltalkParser)._parse_(aString);
  2927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2928. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  2929. //>>excludeEnd("ctx");
  2930. },
  2931. //>>excludeStart("ide", pragmas.excludeIdeData);
  2932. args: ["aString"],
  2933. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  2934. referencedClasses: ["SmalltalkParser"],
  2935. //>>excludeEnd("ide");
  2936. messageSends: ["parse:"]
  2937. }),
  2938. $globals.SmalltalkImage);
  2939. $core.addMethod(
  2940. $core.method({
  2941. selector: "cancelOptOut:",
  2942. protocol: "accessing",
  2943. fn: function (anObject){
  2944. var self=this,$self=this;
  2945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2946. return $core.withContext(function($ctx1) {
  2947. //>>excludeEnd("ctx");
  2948. delete anObject.klass; delete anObject.a$cls;;
  2949. return self;
  2950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2951. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  2952. //>>excludeEnd("ctx");
  2953. },
  2954. //>>excludeStart("ide", pragmas.excludeIdeData);
  2955. args: ["anObject"],
  2956. 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;'>",
  2957. referencedClasses: [],
  2958. //>>excludeEnd("ide");
  2959. messageSends: []
  2960. }),
  2961. $globals.SmalltalkImage);
  2962. $core.addMethod(
  2963. $core.method({
  2964. selector: "classes",
  2965. protocol: "classes",
  2966. fn: function (){
  2967. var self=this,$self=this;
  2968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2969. return $core.withContext(function($ctx1) {
  2970. //>>excludeEnd("ctx");
  2971. return $recv($recv($self._core())._traitsOrClasses())._copy();
  2972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2973. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  2974. //>>excludeEnd("ctx");
  2975. },
  2976. //>>excludeStart("ide", pragmas.excludeIdeData);
  2977. args: [],
  2978. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  2979. referencedClasses: [],
  2980. //>>excludeEnd("ide");
  2981. messageSends: ["copy", "traitsOrClasses", "core"]
  2982. }),
  2983. $globals.SmalltalkImage);
  2984. $core.addMethod(
  2985. $core.method({
  2986. selector: "core",
  2987. protocol: "accessing",
  2988. fn: function (){
  2989. var self=this,$self=this;
  2990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2991. return $core.withContext(function($ctx1) {
  2992. //>>excludeEnd("ctx");
  2993. return $core;
  2994. return self;
  2995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2996. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  2997. //>>excludeEnd("ctx");
  2998. },
  2999. //>>excludeStart("ide", pragmas.excludeIdeData);
  3000. args: [],
  3001. source: "core\x0a\x09<inlineJS: 'return $core'>",
  3002. referencedClasses: [],
  3003. //>>excludeEnd("ide");
  3004. messageSends: []
  3005. }),
  3006. $globals.SmalltalkImage);
  3007. $core.addMethod(
  3008. $core.method({
  3009. selector: "createPackage:",
  3010. protocol: "packages",
  3011. fn: function (packageName){
  3012. var self=this,$self=this;
  3013. var package_,announcement;
  3014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3015. return $core.withContext(function($ctx1) {
  3016. //>>excludeEnd("ctx");
  3017. var $1;
  3018. package_=$self._basicCreatePackage_(packageName);
  3019. $1=$recv($globals.PackageAdded)._new();
  3020. $recv($1)._package_(package_);
  3021. announcement=$recv($1)._yourself();
  3022. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  3023. return package_;
  3024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3025. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  3026. //>>excludeEnd("ctx");
  3027. },
  3028. //>>excludeStart("ide", pragmas.excludeIdeData);
  3029. args: ["packageName"],
  3030. 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",
  3031. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  3032. //>>excludeEnd("ide");
  3033. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  3034. }),
  3035. $globals.SmalltalkImage);
  3036. $core.addMethod(
  3037. $core.method({
  3038. selector: "defaultAmdNamespace",
  3039. protocol: "accessing amd",
  3040. fn: function (){
  3041. var self=this,$self=this;
  3042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3043. return $core.withContext(function($ctx1) {
  3044. //>>excludeEnd("ctx");
  3045. return "transport.defaultAmdNamespace"._settingValue();
  3046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3047. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  3048. //>>excludeEnd("ctx");
  3049. },
  3050. //>>excludeStart("ide", pragmas.excludeIdeData);
  3051. args: [],
  3052. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  3053. referencedClasses: [],
  3054. //>>excludeEnd("ide");
  3055. messageSends: ["settingValue"]
  3056. }),
  3057. $globals.SmalltalkImage);
  3058. $core.addMethod(
  3059. $core.method({
  3060. selector: "defaultAmdNamespace:",
  3061. protocol: "accessing amd",
  3062. fn: function (aString){
  3063. var self=this,$self=this;
  3064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3065. return $core.withContext(function($ctx1) {
  3066. //>>excludeEnd("ctx");
  3067. "transport.defaultAmdNamespace"._settingValue_(aString);
  3068. return self;
  3069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3070. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  3071. //>>excludeEnd("ctx");
  3072. },
  3073. //>>excludeStart("ide", pragmas.excludeIdeData);
  3074. args: ["aString"],
  3075. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  3076. referencedClasses: [],
  3077. //>>excludeEnd("ide");
  3078. messageSends: ["settingValue:"]
  3079. }),
  3080. $globals.SmalltalkImage);
  3081. $core.addMethod(
  3082. $core.method({
  3083. selector: "deleteClass:",
  3084. protocol: "private",
  3085. fn: function (aClass){
  3086. var self=this,$self=this;
  3087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3088. return $core.withContext(function($ctx1) {
  3089. //>>excludeEnd("ctx");
  3090. $core.removeClass(aClass);
  3091. return self;
  3092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3093. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  3094. //>>excludeEnd("ctx");
  3095. },
  3096. //>>excludeStart("ide", pragmas.excludeIdeData);
  3097. args: ["aClass"],
  3098. 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)'>",
  3099. referencedClasses: [],
  3100. //>>excludeEnd("ide");
  3101. messageSends: []
  3102. }),
  3103. $globals.SmalltalkImage);
  3104. $core.addMethod(
  3105. $core.method({
  3106. selector: "deleteGlobalJsVariable:",
  3107. protocol: "globals",
  3108. fn: function (aString){
  3109. var self=this,$self=this;
  3110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3111. return $core.withContext(function($ctx1) {
  3112. //>>excludeEnd("ctx");
  3113. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  3114. }));
  3115. return self;
  3116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3117. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  3118. //>>excludeEnd("ctx");
  3119. },
  3120. //>>excludeStart("ide", pragmas.excludeIdeData);
  3121. args: ["aString"],
  3122. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  3123. referencedClasses: [],
  3124. //>>excludeEnd("ide");
  3125. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  3126. }),
  3127. $globals.SmalltalkImage);
  3128. $core.addMethod(
  3129. $core.method({
  3130. selector: "existsJsGlobal:",
  3131. protocol: "testing",
  3132. fn: function (aString){
  3133. var self=this,$self=this;
  3134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3135. return $core.withContext(function($ctx1) {
  3136. //>>excludeEnd("ctx");
  3137. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  3138. return $recv($globals.Platform)._includesGlobal_(aString);
  3139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3140. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  3141. //>>excludeEnd("ctx");
  3142. },
  3143. //>>excludeStart("ide", pragmas.excludeIdeData);
  3144. args: ["aString"],
  3145. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  3146. referencedClasses: ["Platform"],
  3147. //>>excludeEnd("ide");
  3148. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  3149. }),
  3150. $globals.SmalltalkImage);
  3151. $core.addMethod(
  3152. $core.method({
  3153. selector: "globalJsVariables",
  3154. protocol: "globals",
  3155. fn: function (){
  3156. var self=this,$self=this;
  3157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3158. return $core.withContext(function($ctx1) {
  3159. //>>excludeEnd("ctx");
  3160. var $1,$receiver;
  3161. $1=$self["@globalJsVariables"];
  3162. if(($receiver = $1) == null || $receiver.a$nil){
  3163. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  3164. return $self["@globalJsVariables"];
  3165. } else {
  3166. return $1;
  3167. }
  3168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3169. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  3170. //>>excludeEnd("ctx");
  3171. },
  3172. //>>excludeStart("ide", pragmas.excludeIdeData);
  3173. args: [],
  3174. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  3175. referencedClasses: [],
  3176. //>>excludeEnd("ide");
  3177. messageSends: ["ifNil:"]
  3178. }),
  3179. $globals.SmalltalkImage);
  3180. $core.addMethod(
  3181. $core.method({
  3182. selector: "globals",
  3183. protocol: "accessing",
  3184. fn: function (){
  3185. var self=this,$self=this;
  3186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3187. return $core.withContext(function($ctx1) {
  3188. //>>excludeEnd("ctx");
  3189. return $globals;
  3190. return self;
  3191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3192. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  3193. //>>excludeEnd("ctx");
  3194. },
  3195. //>>excludeStart("ide", pragmas.excludeIdeData);
  3196. args: [],
  3197. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  3198. referencedClasses: [],
  3199. //>>excludeEnd("ide");
  3200. messageSends: []
  3201. }),
  3202. $globals.SmalltalkImage);
  3203. $core.addMethod(
  3204. $core.method({
  3205. selector: "includesKey:",
  3206. protocol: "accessing",
  3207. fn: function (aKey){
  3208. var self=this,$self=this;
  3209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3210. return $core.withContext(function($ctx1) {
  3211. //>>excludeEnd("ctx");
  3212. return $core.hasOwnProperty(aKey);
  3213. return self;
  3214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3215. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  3216. //>>excludeEnd("ctx");
  3217. },
  3218. //>>excludeStart("ide", pragmas.excludeIdeData);
  3219. args: ["aKey"],
  3220. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  3221. referencedClasses: [],
  3222. //>>excludeEnd("ide");
  3223. messageSends: []
  3224. }),
  3225. $globals.SmalltalkImage);
  3226. $core.addMethod(
  3227. $core.method({
  3228. selector: "isSmalltalkObject:",
  3229. protocol: "testing",
  3230. fn: function (anObject){
  3231. var self=this,$self=this;
  3232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3233. return $core.withContext(function($ctx1) {
  3234. //>>excludeEnd("ctx");
  3235. return anObject.a$cls != null;
  3236. return self;
  3237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3238. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  3239. //>>excludeEnd("ctx");
  3240. },
  3241. //>>excludeStart("ide", pragmas.excludeIdeData);
  3242. args: ["anObject"],
  3243. 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'>",
  3244. referencedClasses: [],
  3245. //>>excludeEnd("ide");
  3246. messageSends: []
  3247. }),
  3248. $globals.SmalltalkImage);
  3249. $core.addMethod(
  3250. $core.method({
  3251. selector: "optOut:",
  3252. protocol: "accessing",
  3253. fn: function (anObject){
  3254. var self=this,$self=this;
  3255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3256. return $core.withContext(function($ctx1) {
  3257. //>>excludeEnd("ctx");
  3258. anObject.klass = null; anObject.a$cls = null;
  3259. return self;
  3260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3261. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  3262. //>>excludeEnd("ctx");
  3263. },
  3264. //>>excludeStart("ide", pragmas.excludeIdeData);
  3265. args: ["anObject"],
  3266. 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'>",
  3267. referencedClasses: [],
  3268. //>>excludeEnd("ide");
  3269. messageSends: []
  3270. }),
  3271. $globals.SmalltalkImage);
  3272. $core.addMethod(
  3273. $core.method({
  3274. selector: "packageAt:ifAbsent:",
  3275. protocol: "packages",
  3276. fn: function (packageName,aBlock){
  3277. var self=this,$self=this;
  3278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3279. return $core.withContext(function($ctx1) {
  3280. //>>excludeEnd("ctx");
  3281. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  3282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3283. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  3284. //>>excludeEnd("ctx");
  3285. },
  3286. //>>excludeStart("ide", pragmas.excludeIdeData);
  3287. args: ["packageName", "aBlock"],
  3288. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  3289. referencedClasses: [],
  3290. //>>excludeEnd("ide");
  3291. messageSends: ["at:ifAbsent:", "packageDictionary"]
  3292. }),
  3293. $globals.SmalltalkImage);
  3294. $core.addMethod(
  3295. $core.method({
  3296. selector: "packageAt:ifPresent:",
  3297. protocol: "packages",
  3298. fn: function (packageName,aBlock){
  3299. var self=this,$self=this;
  3300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3301. return $core.withContext(function($ctx1) {
  3302. //>>excludeEnd("ctx");
  3303. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  3304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3305. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  3306. //>>excludeEnd("ctx");
  3307. },
  3308. //>>excludeStart("ide", pragmas.excludeIdeData);
  3309. args: ["packageName", "aBlock"],
  3310. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  3311. referencedClasses: [],
  3312. //>>excludeEnd("ide");
  3313. messageSends: ["at:ifPresent:", "packageDictionary"]
  3314. }),
  3315. $globals.SmalltalkImage);
  3316. $core.addMethod(
  3317. $core.method({
  3318. selector: "packageDictionary",
  3319. protocol: "packages",
  3320. fn: function (){
  3321. var self=this,$self=this;
  3322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3323. return $core.withContext(function($ctx1) {
  3324. //>>excludeEnd("ctx");
  3325. var $1,$receiver;
  3326. $1=$self["@packageDictionary"];
  3327. if(($receiver = $1) == null || $receiver.a$nil){
  3328. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  3329. return $self["@packageDictionary"];
  3330. } else {
  3331. return $1;
  3332. }
  3333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3334. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  3335. //>>excludeEnd("ctx");
  3336. },
  3337. //>>excludeStart("ide", pragmas.excludeIdeData);
  3338. args: [],
  3339. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  3340. referencedClasses: ["Dictionary"],
  3341. //>>excludeEnd("ide");
  3342. messageSends: ["ifNil:", "new"]
  3343. }),
  3344. $globals.SmalltalkImage);
  3345. $core.addMethod(
  3346. $core.method({
  3347. selector: "packages",
  3348. protocol: "packages",
  3349. fn: function (){
  3350. var self=this,$self=this;
  3351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3352. return $core.withContext(function($ctx1) {
  3353. //>>excludeEnd("ctx");
  3354. return $recv($recv($self._packageDictionary())._values())._copy();
  3355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3356. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  3357. //>>excludeEnd("ctx");
  3358. },
  3359. //>>excludeStart("ide", pragmas.excludeIdeData);
  3360. args: [],
  3361. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  3362. referencedClasses: [],
  3363. //>>excludeEnd("ide");
  3364. messageSends: ["copy", "values", "packageDictionary"]
  3365. }),
  3366. $globals.SmalltalkImage);
  3367. $core.addMethod(
  3368. $core.method({
  3369. selector: "parse:",
  3370. protocol: "accessing",
  3371. fn: function (aString){
  3372. var self=this,$self=this;
  3373. var result;
  3374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3375. return $core.withContext(function($ctx1) {
  3376. //>>excludeEnd("ctx");
  3377. var $1;
  3378. $recv((function(){
  3379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3380. return $core.withContext(function($ctx2) {
  3381. //>>excludeEnd("ctx");
  3382. result=$self._basicParse_(aString);
  3383. return result;
  3384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3385. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3386. //>>excludeEnd("ctx");
  3387. }))._tryCatch_((function(ex){
  3388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3389. return $core.withContext(function($ctx2) {
  3390. //>>excludeEnd("ctx");
  3391. return $recv($self._parseError_parsing_(ex,aString))._signal();
  3392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3393. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  3394. //>>excludeEnd("ctx");
  3395. }));
  3396. $1=result;
  3397. $recv($1)._source_(aString);
  3398. return $recv($1)._yourself();
  3399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3400. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  3401. //>>excludeEnd("ctx");
  3402. },
  3403. //>>excludeStart("ide", pragmas.excludeIdeData);
  3404. args: ["aString"],
  3405. 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",
  3406. referencedClasses: [],
  3407. //>>excludeEnd("ide");
  3408. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  3409. }),
  3410. $globals.SmalltalkImage);
  3411. $core.addMethod(
  3412. $core.method({
  3413. selector: "parseError:parsing:",
  3414. protocol: "error handling",
  3415. fn: function (anException,aString){
  3416. var self=this,$self=this;
  3417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3418. return $core.withContext(function($ctx1) {
  3419. //>>excludeEnd("ctx");
  3420. var $1,$2,$9,$8,$7,$6,$5,$4,$3,$receiver;
  3421. $1=$recv(anException)._basicAt_("location");
  3422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3423. $ctx1.sendIdx["basicAt:"]=1;
  3424. //>>excludeEnd("ctx");
  3425. if(($receiver = $1) == null || $receiver.a$nil){
  3426. return $recv(anException)._pass();
  3427. } else {
  3428. var loc;
  3429. loc=$receiver;
  3430. $2=$recv($globals.ParseError)._new();
  3431. $9=$recv(loc)._start();
  3432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3433. $ctx1.sendIdx["start"]=1;
  3434. //>>excludeEnd("ctx");
  3435. $8=$recv($9)._line();
  3436. $7="Parse error on line ".__comma($8);
  3437. $6=$recv($7).__comma(" column ");
  3438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3439. $ctx1.sendIdx[","]=4;
  3440. //>>excludeEnd("ctx");
  3441. $5=$recv($6).__comma($recv($recv(loc)._start())._column());
  3442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3443. $ctx1.sendIdx[","]=3;
  3444. //>>excludeEnd("ctx");
  3445. $4=$recv($5).__comma(" : Unexpected character ");
  3446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3447. $ctx1.sendIdx[","]=2;
  3448. //>>excludeEnd("ctx");
  3449. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  3450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3451. $ctx1.sendIdx[","]=1;
  3452. //>>excludeEnd("ctx");
  3453. $recv($2)._messageText_($3);
  3454. return $recv($2)._yourself();
  3455. }
  3456. return self;
  3457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3458. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  3459. //>>excludeEnd("ctx");
  3460. },
  3461. //>>excludeStart("ide", pragmas.excludeIdeData);
  3462. args: ["anException", "aString"],
  3463. source: "parseError: anException parsing: aString\x0a\x09(anException basicAt: 'location')\x0a\x09\x09ifNil: [ ^ anException pass ]\x0a\x09\x09ifNotNil: [ :loc |\x0a\x09\x09\x09^ ParseError new \x0a\x09\x09\x09\x09messageText: \x0a\x09\x09\x09\x09\x09'Parse error on line ', loc start line ,\x0a\x09\x09\x09\x09\x09' column ' , loc start column ,\x0a\x09\x09\x09\x09\x09' : Unexpected character ', (anException basicAt: 'found');\x0a\x09\x09\x09\x09yourself ]",
  3464. referencedClasses: ["ParseError"],
  3465. //>>excludeEnd("ide");
  3466. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  3467. }),
  3468. $globals.SmalltalkImage);
  3469. $core.addMethod(
  3470. $core.method({
  3471. selector: "postLoad",
  3472. protocol: "image",
  3473. fn: function (){
  3474. var self=this,$self=this;
  3475. var pkgs,classes;
  3476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3477. return $core.withContext(function($ctx1) {
  3478. //>>excludeEnd("ctx");
  3479. var $1;
  3480. pkgs=$self._adoptPackageDescriptors();
  3481. $recv(pkgs)._do_("beClean");
  3482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3483. $ctx1.sendIdx["do:"]=1;
  3484. //>>excludeEnd("ctx");
  3485. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  3486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3487. return $core.withContext(function($ctx2) {
  3488. //>>excludeEnd("ctx");
  3489. return $recv(pkgs)._includes_($recv(each)._package());
  3490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3491. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3492. //>>excludeEnd("ctx");
  3493. }));
  3494. $recv(classes)._do_((function(each){
  3495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3496. return $core.withContext(function($ctx2) {
  3497. //>>excludeEnd("ctx");
  3498. $1=$recv(each).__eq($self._class());
  3499. if(!$core.assert($1)){
  3500. return $recv(each)._initialize();
  3501. }
  3502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3503. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3504. //>>excludeEnd("ctx");
  3505. }));
  3506. $self._sweepPackageDescriptors_(pkgs);
  3507. return self;
  3508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3509. }, function($ctx1) {$ctx1.fill(self,"postLoad",{pkgs:pkgs,classes:classes},$globals.SmalltalkImage)});
  3510. //>>excludeEnd("ctx");
  3511. },
  3512. //>>excludeStart("ide", pragmas.excludeIdeData);
  3513. args: [],
  3514. 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",
  3515. referencedClasses: ["Smalltalk"],
  3516. //>>excludeEnd("ide");
  3517. messageSends: ["adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  3518. }),
  3519. $globals.SmalltalkImage);
  3520. $core.addMethod(
  3521. $core.method({
  3522. selector: "pseudoVariableNames",
  3523. protocol: "accessing",
  3524. fn: function (){
  3525. var self=this,$self=this;
  3526. return ["self", "super", "nil", "true", "false", "thisContext"];
  3527. },
  3528. //>>excludeStart("ide", pragmas.excludeIdeData);
  3529. args: [],
  3530. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  3531. referencedClasses: [],
  3532. //>>excludeEnd("ide");
  3533. messageSends: []
  3534. }),
  3535. $globals.SmalltalkImage);
  3536. $core.addMethod(
  3537. $core.method({
  3538. selector: "readJSObject:",
  3539. protocol: "accessing",
  3540. fn: function (anObject){
  3541. var self=this,$self=this;
  3542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3543. return $core.withContext(function($ctx1) {
  3544. //>>excludeEnd("ctx");
  3545. return $core.readJSObject(anObject);
  3546. return self;
  3547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3548. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  3549. //>>excludeEnd("ctx");
  3550. },
  3551. //>>excludeStart("ide", pragmas.excludeIdeData);
  3552. args: ["anObject"],
  3553. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  3554. referencedClasses: [],
  3555. //>>excludeEnd("ide");
  3556. messageSends: []
  3557. }),
  3558. $globals.SmalltalkImage);
  3559. $core.addMethod(
  3560. $core.method({
  3561. selector: "removeClass:",
  3562. protocol: "classes",
  3563. fn: function (aClass){
  3564. var self=this,$self=this;
  3565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3566. return $core.withContext(function($ctx1) {
  3567. //>>excludeEnd("ctx");
  3568. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  3569. $1=$recv(aClass)._isMetaclass();
  3570. if($core.assert($1)){
  3571. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  3572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3573. $ctx1.sendIdx[","]=1;
  3574. //>>excludeEnd("ctx");
  3575. $self._error_($2);
  3576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3577. $ctx1.sendIdx["error:"]=1;
  3578. //>>excludeEnd("ctx");
  3579. }
  3580. $recv(aClass)._allSubclassesDo_((function(subclass){
  3581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3582. return $core.withContext(function($ctx2) {
  3583. //>>excludeEnd("ctx");
  3584. $5=$recv(aClass)._name();
  3585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3586. $ctx2.sendIdx["name"]=1;
  3587. //>>excludeEnd("ctx");
  3588. $4=$recv($5).__comma(" has a subclass: ");
  3589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3590. $ctx2.sendIdx[","]=3;
  3591. //>>excludeEnd("ctx");
  3592. $6=$recv(subclass)._name();
  3593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3594. $ctx2.sendIdx["name"]=2;
  3595. //>>excludeEnd("ctx");
  3596. $3=$recv($4).__comma($6);
  3597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3598. $ctx2.sendIdx[","]=2;
  3599. //>>excludeEnd("ctx");
  3600. return $self._error_($3);
  3601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3602. $ctx2.sendIdx["error:"]=2;
  3603. //>>excludeEnd("ctx");
  3604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3605. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  3606. //>>excludeEnd("ctx");
  3607. }));
  3608. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  3609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3610. return $core.withContext(function($ctx2) {
  3611. //>>excludeEnd("ctx");
  3612. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  3613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  3615. //>>excludeEnd("ctx");
  3616. }));
  3617. $self._deleteClass_(aClass);
  3618. $recv(aClass)._setTraitComposition_([]);
  3619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3620. $ctx1.sendIdx["setTraitComposition:"]=1;
  3621. //>>excludeEnd("ctx");
  3622. $7=$recv(aClass)._theMetaClass();
  3623. if(($receiver = $7) == null || $receiver.a$nil){
  3624. $7;
  3625. } else {
  3626. var meta;
  3627. meta=$receiver;
  3628. $recv(meta)._setTraitComposition_([]);
  3629. }
  3630. $8=$recv($globals.SystemAnnouncer)._current();
  3631. $10=$recv($globals.ClassRemoved)._new();
  3632. $recv($10)._theClass_(aClass);
  3633. $9=$recv($10)._yourself();
  3634. $recv($8)._announce_($9);
  3635. return self;
  3636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3637. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  3638. //>>excludeEnd("ctx");
  3639. },
  3640. //>>excludeStart("ide", pragmas.excludeIdeData);
  3641. args: ["aClass"],
  3642. 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)",
  3643. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  3644. //>>excludeEnd("ide");
  3645. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  3646. }),
  3647. $globals.SmalltalkImage);
  3648. $core.addMethod(
  3649. $core.method({
  3650. selector: "removePackage:",
  3651. protocol: "packages",
  3652. fn: function (packageName){
  3653. var self=this,$self=this;
  3654. var pkg;
  3655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3656. return $core.withContext(function($ctx1) {
  3657. //>>excludeEnd("ctx");
  3658. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  3659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3660. return $core.withContext(function($ctx2) {
  3661. //>>excludeEnd("ctx");
  3662. return $self._error_("Missing package: ".__comma(packageName));
  3663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3664. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3665. //>>excludeEnd("ctx");
  3666. }));
  3667. $recv($recv(pkg)._classes())._do_((function(each){
  3668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3669. return $core.withContext(function($ctx2) {
  3670. //>>excludeEnd("ctx");
  3671. return $self._removeClass_(each);
  3672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3673. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3674. //>>excludeEnd("ctx");
  3675. }));
  3676. $recv($self._packageDictionary())._removeKey_(packageName);
  3677. return self;
  3678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3679. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  3680. //>>excludeEnd("ctx");
  3681. },
  3682. //>>excludeStart("ide", pragmas.excludeIdeData);
  3683. args: ["packageName"],
  3684. 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",
  3685. referencedClasses: [],
  3686. //>>excludeEnd("ide");
  3687. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  3688. }),
  3689. $globals.SmalltalkImage);
  3690. $core.addMethod(
  3691. $core.method({
  3692. selector: "renamePackage:to:",
  3693. protocol: "packages",
  3694. fn: function (packageName,newName){
  3695. var self=this,$self=this;
  3696. var pkg;
  3697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3698. return $core.withContext(function($ctx1) {
  3699. //>>excludeEnd("ctx");
  3700. var $1,$2,$3;
  3701. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  3702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3703. return $core.withContext(function($ctx2) {
  3704. //>>excludeEnd("ctx");
  3705. $1="Missing package: ".__comma(packageName);
  3706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3707. $ctx2.sendIdx[","]=1;
  3708. //>>excludeEnd("ctx");
  3709. return $self._error_($1);
  3710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3711. $ctx2.sendIdx["error:"]=1;
  3712. //>>excludeEnd("ctx");
  3713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3715. //>>excludeEnd("ctx");
  3716. }));
  3717. $self._packageAt_ifPresent_(newName,(function(){
  3718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3719. return $core.withContext(function($ctx2) {
  3720. //>>excludeEnd("ctx");
  3721. return $self._error_("Already exists a package called: ".__comma(newName));
  3722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3724. //>>excludeEnd("ctx");
  3725. }));
  3726. $2=pkg;
  3727. $recv($2)._name_(newName);
  3728. $recv($2)._beDirty();
  3729. $3=$self._packageDictionary();
  3730. $recv($3)._at_put_(newName,pkg);
  3731. $recv($3)._removeKey_(packageName);
  3732. return self;
  3733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3734. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  3735. //>>excludeEnd("ctx");
  3736. },
  3737. //>>excludeStart("ide", pragmas.excludeIdeData);
  3738. args: ["packageName", "newName"],
  3739. 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",
  3740. referencedClasses: [],
  3741. //>>excludeEnd("ide");
  3742. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  3743. }),
  3744. $globals.SmalltalkImage);
  3745. $core.addMethod(
  3746. $core.method({
  3747. selector: "reservedWords",
  3748. protocol: "accessing",
  3749. fn: function (){
  3750. var self=this,$self=this;
  3751. 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"];
  3752. },
  3753. //>>excludeStart("ide", pragmas.excludeIdeData);
  3754. args: [],
  3755. 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)",
  3756. referencedClasses: [],
  3757. //>>excludeEnd("ide");
  3758. messageSends: []
  3759. }),
  3760. $globals.SmalltalkImage);
  3761. $core.addMethod(
  3762. $core.method({
  3763. selector: "settings",
  3764. protocol: "accessing",
  3765. fn: function (){
  3766. var self=this,$self=this;
  3767. return $globals.SmalltalkSettings;
  3768. },
  3769. //>>excludeStart("ide", pragmas.excludeIdeData);
  3770. args: [],
  3771. source: "settings\x0a\x09^ SmalltalkSettings",
  3772. referencedClasses: ["SmalltalkSettings"],
  3773. //>>excludeEnd("ide");
  3774. messageSends: []
  3775. }),
  3776. $globals.SmalltalkImage);
  3777. $core.addMethod(
  3778. $core.method({
  3779. selector: "sweepPackageDescriptors:",
  3780. protocol: "private",
  3781. fn: function (pkgs){
  3782. var self=this,$self=this;
  3783. var pd;
  3784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3785. return $core.withContext(function($ctx1) {
  3786. //>>excludeEnd("ctx");
  3787. pd=$recv($self._core())._packageDescriptors();
  3788. $recv(pkgs)._do_((function(each){
  3789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3790. return $core.withContext(function($ctx2) {
  3791. //>>excludeEnd("ctx");
  3792. return $recv(pd)._removeKey_($recv(each)._name());
  3793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3794. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3795. //>>excludeEnd("ctx");
  3796. }));
  3797. return self;
  3798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3799. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd},$globals.SmalltalkImage)});
  3800. //>>excludeEnd("ctx");
  3801. },
  3802. //>>excludeStart("ide", pragmas.excludeIdeData);
  3803. args: ["pkgs"],
  3804. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  3805. referencedClasses: [],
  3806. //>>excludeEnd("ide");
  3807. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  3808. }),
  3809. $globals.SmalltalkImage);
  3810. $core.addMethod(
  3811. $core.method({
  3812. selector: "version",
  3813. protocol: "accessing",
  3814. fn: function (){
  3815. var self=this,$self=this;
  3816. return "0.23.0-pre";
  3817. },
  3818. //>>excludeStart("ide", pragmas.excludeIdeData);
  3819. args: [],
  3820. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.23.0-pre'",
  3821. referencedClasses: [],
  3822. //>>excludeEnd("ide");
  3823. messageSends: []
  3824. }),
  3825. $globals.SmalltalkImage);
  3826. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  3827. $core.addMethod(
  3828. $core.method({
  3829. selector: "current",
  3830. protocol: "instance creation",
  3831. fn: function (){
  3832. var self=this,$self=this;
  3833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3834. return $core.withContext(function($ctx1) {
  3835. //>>excludeEnd("ctx");
  3836. var $1,$receiver;
  3837. $1=$self["@current"];
  3838. if(($receiver = $1) == null || $receiver.a$nil){
  3839. $self["@current"]=(
  3840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3841. $ctx1.supercall = true,
  3842. //>>excludeEnd("ctx");
  3843. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  3844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3845. $ctx1.supercall = false;
  3846. //>>excludeEnd("ctx");;
  3847. return $self["@current"];
  3848. } else {
  3849. $self._deprecatedAPI();
  3850. return $self["@current"];
  3851. }
  3852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3853. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  3854. //>>excludeEnd("ctx");
  3855. },
  3856. //>>excludeStart("ide", pragmas.excludeIdeData);
  3857. args: [],
  3858. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  3859. referencedClasses: [],
  3860. //>>excludeEnd("ide");
  3861. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  3862. }),
  3863. $globals.SmalltalkImage.a$cls);
  3864. $core.addMethod(
  3865. $core.method({
  3866. selector: "initialize",
  3867. protocol: "initialization",
  3868. fn: function (){
  3869. var self=this,$self=this;
  3870. var st;
  3871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3872. return $core.withContext(function($ctx1) {
  3873. //>>excludeEnd("ctx");
  3874. st=$self._current();
  3875. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  3876. return self;
  3877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3878. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  3879. //>>excludeEnd("ctx");
  3880. },
  3881. //>>excludeStart("ide", pragmas.excludeIdeData);
  3882. args: [],
  3883. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  3884. referencedClasses: [],
  3885. //>>excludeEnd("ide");
  3886. messageSends: ["current", "at:put:", "globals"]
  3887. }),
  3888. $globals.SmalltalkImage.a$cls);
  3889. $core.addMethod(
  3890. $core.method({
  3891. selector: "new",
  3892. protocol: "instance creation",
  3893. fn: function (){
  3894. var self=this,$self=this;
  3895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3896. return $core.withContext(function($ctx1) {
  3897. //>>excludeEnd("ctx");
  3898. $self._shouldNotImplement();
  3899. return self;
  3900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3901. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  3902. //>>excludeEnd("ctx");
  3903. },
  3904. //>>excludeStart("ide", pragmas.excludeIdeData);
  3905. args: [],
  3906. source: "new\x0a\x09self shouldNotImplement",
  3907. referencedClasses: [],
  3908. //>>excludeEnd("ide");
  3909. messageSends: ["shouldNotImplement"]
  3910. }),
  3911. $globals.SmalltalkImage.a$cls);
  3912. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  3913. $core.addMethod(
  3914. $core.method({
  3915. selector: "nextPutJSObject:",
  3916. protocol: "*Kernel-Infrastructure",
  3917. fn: function (aJSObject){
  3918. var self=this,$self=this;
  3919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3920. return $core.withContext(function($ctx1) {
  3921. //>>excludeEnd("ctx");
  3922. $self._nextPut_(aJSObject);
  3923. return self;
  3924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3925. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  3926. //>>excludeEnd("ctx");
  3927. },
  3928. //>>excludeStart("ide", pragmas.excludeIdeData);
  3929. args: ["aJSObject"],
  3930. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  3931. referencedClasses: [],
  3932. //>>excludeEnd("ide");
  3933. messageSends: ["nextPut:"]
  3934. }),
  3935. $globals.ProtoStream);
  3936. $core.addMethod(
  3937. $core.method({
  3938. selector: "asJavaScriptPropertyName",
  3939. protocol: "*Kernel-Infrastructure",
  3940. fn: function (){
  3941. var self=this,$self=this;
  3942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3943. return $core.withContext(function($ctx1) {
  3944. //>>excludeEnd("ctx");
  3945. return $core.st2prop(self);
  3946. return self;
  3947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3948. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  3949. //>>excludeEnd("ctx");
  3950. },
  3951. //>>excludeStart("ide", pragmas.excludeIdeData);
  3952. args: [],
  3953. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  3954. referencedClasses: [],
  3955. //>>excludeEnd("ide");
  3956. messageSends: []
  3957. }),
  3958. $globals.String);
  3959. $core.addMethod(
  3960. $core.method({
  3961. selector: "asSetting",
  3962. protocol: "*Kernel-Infrastructure",
  3963. fn: function (){
  3964. var self=this,$self=this;
  3965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3966. return $core.withContext(function($ctx1) {
  3967. //>>excludeEnd("ctx");
  3968. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  3969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3970. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  3971. //>>excludeEnd("ctx");
  3972. },
  3973. //>>excludeStart("ide", pragmas.excludeIdeData);
  3974. args: [],
  3975. 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",
  3976. referencedClasses: ["Setting"],
  3977. //>>excludeEnd("ide");
  3978. messageSends: ["at:ifAbsent:"]
  3979. }),
  3980. $globals.String);
  3981. $core.addMethod(
  3982. $core.method({
  3983. selector: "asSettingIfAbsent:",
  3984. protocol: "*Kernel-Infrastructure",
  3985. fn: function (aDefaultValue){
  3986. var self=this,$self=this;
  3987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3988. return $core.withContext(function($ctx1) {
  3989. //>>excludeEnd("ctx");
  3990. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  3991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3992. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  3993. //>>excludeEnd("ctx");
  3994. },
  3995. //>>excludeStart("ide", pragmas.excludeIdeData);
  3996. args: ["aDefaultValue"],
  3997. 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",
  3998. referencedClasses: ["Setting"],
  3999. //>>excludeEnd("ide");
  4000. messageSends: ["at:ifAbsent:"]
  4001. }),
  4002. $globals.String);
  4003. $core.addMethod(
  4004. $core.method({
  4005. selector: "settingValue",
  4006. protocol: "*Kernel-Infrastructure",
  4007. fn: function (){
  4008. var self=this,$self=this;
  4009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4010. return $core.withContext(function($ctx1) {
  4011. //>>excludeEnd("ctx");
  4012. return $recv($self._asSetting())._value();
  4013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4014. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  4015. //>>excludeEnd("ctx");
  4016. },
  4017. //>>excludeStart("ide", pragmas.excludeIdeData);
  4018. args: [],
  4019. source: "settingValue\x0a\x09^ self asSetting value",
  4020. referencedClasses: [],
  4021. //>>excludeEnd("ide");
  4022. messageSends: ["value", "asSetting"]
  4023. }),
  4024. $globals.String);
  4025. $core.addMethod(
  4026. $core.method({
  4027. selector: "settingValue:",
  4028. protocol: "*Kernel-Infrastructure",
  4029. fn: function (aValue){
  4030. var self=this,$self=this;
  4031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4032. return $core.withContext(function($ctx1) {
  4033. //>>excludeEnd("ctx");
  4034. return $recv($self._asSetting())._value_(aValue);
  4035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4036. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  4037. //>>excludeEnd("ctx");
  4038. },
  4039. //>>excludeStart("ide", pragmas.excludeIdeData);
  4040. args: ["aValue"],
  4041. 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",
  4042. referencedClasses: [],
  4043. //>>excludeEnd("ide");
  4044. messageSends: ["value:", "asSetting"]
  4045. }),
  4046. $globals.String);
  4047. $core.addMethod(
  4048. $core.method({
  4049. selector: "settingValueIfAbsent:",
  4050. protocol: "*Kernel-Infrastructure",
  4051. fn: function (aDefaultValue){
  4052. var self=this,$self=this;
  4053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4054. return $core.withContext(function($ctx1) {
  4055. //>>excludeEnd("ctx");
  4056. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  4057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4058. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  4059. //>>excludeEnd("ctx");
  4060. },
  4061. //>>excludeStart("ide", pragmas.excludeIdeData);
  4062. args: ["aDefaultValue"],
  4063. 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",
  4064. referencedClasses: [],
  4065. //>>excludeEnd("ide");
  4066. messageSends: ["value", "asSettingIfAbsent:"]
  4067. }),
  4068. $globals.String);
  4069. });