Kernel-Infrastructure.js 152 KB

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