Kernel-Infrastructure.js 146 KB

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