Kernel-Infrastructure.js 152 KB

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