1
0

Kernel-Infrastructure.js 149 KB

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