Kernel-Infrastructure.js 155 KB

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