Kernel-Infrastructure.js 140 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898
  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.addClass("Package", $globals.Object, ["transport", "imports", "dirty"], "Kernel-Infrastructure");
  884. //>>excludeStart("ide", pragmas.excludeIdeData);
  885. $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'";
  886. //>>excludeEnd("ide");
  887. $core.addMethod(
  888. $core.method({
  889. selector: "basicImports",
  890. protocol: "private",
  891. fn: function (){
  892. var self=this,$self=this;
  893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  894. return $core.withContext(function($ctx1) {
  895. //>>excludeEnd("ctx");
  896. return self.imports || [];
  897. return self;
  898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  899. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  900. //>>excludeEnd("ctx");
  901. },
  902. //>>excludeStart("ide", pragmas.excludeIdeData);
  903. args: [],
  904. source: "basicImports\x0a\x09\x22Answer the imports literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<inlineJS: 'return self.imports || []'>",
  905. referencedClasses: [],
  906. //>>excludeEnd("ide");
  907. messageSends: []
  908. }),
  909. $globals.Package);
  910. $core.addMethod(
  911. $core.method({
  912. selector: "basicName:",
  913. protocol: "private",
  914. fn: function (aString){
  915. var self=this,$self=this;
  916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  917. return $core.withContext(function($ctx1) {
  918. //>>excludeEnd("ctx");
  919. self.pkgName = aString;
  920. return self;
  921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  922. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  923. //>>excludeEnd("ctx");
  924. },
  925. //>>excludeStart("ide", pragmas.excludeIdeData);
  926. args: ["aString"],
  927. source: "basicName: aString\x0a\x09<inlineJS: 'self.pkgName = aString'>",
  928. referencedClasses: [],
  929. //>>excludeEnd("ide");
  930. messageSends: []
  931. }),
  932. $globals.Package);
  933. $core.addMethod(
  934. $core.method({
  935. selector: "basicTransport",
  936. protocol: "private",
  937. fn: function (){
  938. var self=this,$self=this;
  939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  940. return $core.withContext(function($ctx1) {
  941. //>>excludeEnd("ctx");
  942. return self.transport;
  943. return self;
  944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  945. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  946. //>>excludeEnd("ctx");
  947. },
  948. //>>excludeStart("ide", pragmas.excludeIdeData);
  949. args: [],
  950. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<inlineJS: 'return self.transport'>",
  951. referencedClasses: [],
  952. //>>excludeEnd("ide");
  953. messageSends: []
  954. }),
  955. $globals.Package);
  956. $core.addMethod(
  957. $core.method({
  958. selector: "beClean",
  959. protocol: "accessing",
  960. fn: function (){
  961. var self=this,$self=this;
  962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  963. return $core.withContext(function($ctx1) {
  964. //>>excludeEnd("ctx");
  965. var $1,$3,$2;
  966. $self["@dirty"]=false;
  967. $1=$recv($globals.SystemAnnouncer)._current();
  968. $3=$recv($globals.PackageClean)._new();
  969. $recv($3)._package_(self);
  970. $2=$recv($3)._yourself();
  971. $recv($1)._announce_($2);
  972. return self;
  973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  974. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  975. //>>excludeEnd("ctx");
  976. },
  977. //>>excludeStart("ide", pragmas.excludeIdeData);
  978. args: [],
  979. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  980. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  981. //>>excludeEnd("ide");
  982. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  983. }),
  984. $globals.Package);
  985. $core.addMethod(
  986. $core.method({
  987. selector: "beDirty",
  988. protocol: "accessing",
  989. fn: function (){
  990. var self=this,$self=this;
  991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  992. return $core.withContext(function($ctx1) {
  993. //>>excludeEnd("ctx");
  994. var $1,$3,$2;
  995. $self["@dirty"]=true;
  996. $1=$recv($globals.SystemAnnouncer)._current();
  997. $3=$recv($globals.PackageDirty)._new();
  998. $recv($3)._package_(self);
  999. $2=$recv($3)._yourself();
  1000. $recv($1)._announce_($2);
  1001. return self;
  1002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1003. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  1004. //>>excludeEnd("ctx");
  1005. },
  1006. //>>excludeStart("ide", pragmas.excludeIdeData);
  1007. args: [],
  1008. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  1009. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  1010. //>>excludeEnd("ide");
  1011. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  1012. }),
  1013. $globals.Package);
  1014. $core.addMethod(
  1015. $core.method({
  1016. selector: "classTemplate",
  1017. protocol: "accessing",
  1018. fn: function (){
  1019. var self=this,$self=this;
  1020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1021. return $core.withContext(function($ctx1) {
  1022. //>>excludeEnd("ctx");
  1023. return $recv($globals.String)._streamContents_((function(stream){
  1024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1025. return $core.withContext(function($ctx2) {
  1026. //>>excludeEnd("ctx");
  1027. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  1028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1029. $ctx2.sendIdx["write:"]=1;
  1030. //>>excludeEnd("ctx");
  1031. $recv(stream)._lf();
  1032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1033. $ctx2.sendIdx["lf"]=1;
  1034. //>>excludeEnd("ctx");
  1035. $recv(stream)._tab();
  1036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1037. $ctx2.sendIdx["tab"]=1;
  1038. //>>excludeEnd("ctx");
  1039. $recv(stream)._write_("instanceVariableNames: ''");
  1040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1041. $ctx2.sendIdx["write:"]=2;
  1042. //>>excludeEnd("ctx");
  1043. $recv(stream)._lf();
  1044. $recv(stream)._tab();
  1045. $recv(stream)._write_("package: ");
  1046. return $recv(stream)._print_($self._name());
  1047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1048. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1049. //>>excludeEnd("ctx");
  1050. }));
  1051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1052. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  1053. //>>excludeEnd("ctx");
  1054. },
  1055. //>>excludeStart("ide", pragmas.excludeIdeData);
  1056. args: [],
  1057. 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 ]",
  1058. referencedClasses: ["String"],
  1059. //>>excludeEnd("ide");
  1060. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  1061. }),
  1062. $globals.Package);
  1063. $core.addMethod(
  1064. $core.method({
  1065. selector: "classes",
  1066. protocol: "classes",
  1067. fn: function (){
  1068. var self=this,$self=this;
  1069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1070. return $core.withContext(function($ctx1) {
  1071. //>>excludeEnd("ctx");
  1072. return $recv($self._organization())._elements();
  1073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1074. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  1075. //>>excludeEnd("ctx");
  1076. },
  1077. //>>excludeStart("ide", pragmas.excludeIdeData);
  1078. args: [],
  1079. source: "classes\x0a\x09^ self organization elements",
  1080. referencedClasses: [],
  1081. //>>excludeEnd("ide");
  1082. messageSends: ["elements", "organization"]
  1083. }),
  1084. $globals.Package);
  1085. $core.addMethod(
  1086. $core.method({
  1087. selector: "definition",
  1088. protocol: "accessing",
  1089. fn: function (){
  1090. var self=this,$self=this;
  1091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1092. return $core.withContext(function($ctx1) {
  1093. //>>excludeEnd("ctx");
  1094. var $1;
  1095. return $recv($globals.String)._streamContents_((function(stream){
  1096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1097. return $core.withContext(function($ctx2) {
  1098. //>>excludeEnd("ctx");
  1099. $1=$recv($self._class())._name();
  1100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1101. $ctx2.sendIdx["name"]=1;
  1102. //>>excludeEnd("ctx");
  1103. $recv(stream)._write_($1);
  1104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1105. $ctx2.sendIdx["write:"]=1;
  1106. //>>excludeEnd("ctx");
  1107. $recv(stream)._lf();
  1108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1109. $ctx2.sendIdx["lf"]=1;
  1110. //>>excludeEnd("ctx");
  1111. $recv(stream)._tab();
  1112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1113. $ctx2.sendIdx["tab"]=1;
  1114. //>>excludeEnd("ctx");
  1115. $recv(stream)._write_("named: ");
  1116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1117. $ctx2.sendIdx["write:"]=2;
  1118. //>>excludeEnd("ctx");
  1119. $recv(stream)._print_($self._name());
  1120. $recv(stream)._lf();
  1121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1122. $ctx2.sendIdx["lf"]=2;
  1123. //>>excludeEnd("ctx");
  1124. $recv(stream)._tab();
  1125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1126. $ctx2.sendIdx["tab"]=2;
  1127. //>>excludeEnd("ctx");
  1128. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  1129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1130. $ctx2.sendIdx["write:"]=3;
  1131. //>>excludeEnd("ctx");
  1132. $recv(stream)._lf();
  1133. $recv(stream)._tab();
  1134. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  1135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1136. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1137. //>>excludeEnd("ctx");
  1138. }));
  1139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1140. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  1141. //>>excludeEnd("ctx");
  1142. },
  1143. //>>excludeStart("ide", pragmas.excludeIdeData);
  1144. args: [],
  1145. 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. ')' } ]",
  1146. referencedClasses: ["String"],
  1147. //>>excludeEnd("ide");
  1148. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  1149. }),
  1150. $globals.Package);
  1151. $core.addMethod(
  1152. $core.method({
  1153. selector: "imports",
  1154. protocol: "accessing",
  1155. fn: function (){
  1156. var self=this,$self=this;
  1157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1158. return $core.withContext(function($ctx1) {
  1159. //>>excludeEnd("ctx");
  1160. var $1,$receiver;
  1161. $1=$self["@imports"];
  1162. if(($receiver = $1) == null || $receiver.a$nil){
  1163. var parsed;
  1164. parsed=$self._importsFromJson_($self._basicImports());
  1165. parsed;
  1166. $self._imports_(parsed);
  1167. return $self["@imports"];
  1168. } else {
  1169. return $1;
  1170. }
  1171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1172. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  1173. //>>excludeEnd("ctx");
  1174. },
  1175. //>>excludeStart("ide", pragmas.excludeIdeData);
  1176. args: [],
  1177. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09| parsed |\x0a\x09\x09parsed := self importsFromJson: self basicImports.\x0a\x09\x09self imports: parsed.\x0a\x09\x09imports ]",
  1178. referencedClasses: [],
  1179. //>>excludeEnd("ide");
  1180. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  1181. }),
  1182. $globals.Package);
  1183. $core.addMethod(
  1184. $core.method({
  1185. selector: "imports:",
  1186. protocol: "accessing",
  1187. fn: function (anArray){
  1188. var self=this,$self=this;
  1189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1190. return $core.withContext(function($ctx1) {
  1191. //>>excludeEnd("ctx");
  1192. $self._validateImports_(anArray);
  1193. $self["@imports"]=$recv(anArray)._asSet();
  1194. return self;
  1195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1196. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  1197. //>>excludeEnd("ctx");
  1198. },
  1199. //>>excludeStart("ide", pragmas.excludeIdeData);
  1200. args: ["anArray"],
  1201. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  1202. referencedClasses: [],
  1203. //>>excludeEnd("ide");
  1204. messageSends: ["validateImports:", "asSet"]
  1205. }),
  1206. $globals.Package);
  1207. $core.addMethod(
  1208. $core.method({
  1209. selector: "importsAsJson",
  1210. protocol: "converting",
  1211. fn: function (){
  1212. var self=this,$self=this;
  1213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1214. return $core.withContext(function($ctx1) {
  1215. //>>excludeEnd("ctx");
  1216. var $1;
  1217. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  1218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1219. return $core.withContext(function($ctx2) {
  1220. //>>excludeEnd("ctx");
  1221. $1=$recv(each)._isString();
  1222. if($core.assert($1)){
  1223. return each;
  1224. } else {
  1225. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  1226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1227. $ctx2.sendIdx[","]=1;
  1228. //>>excludeEnd("ctx");
  1229. }
  1230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1232. //>>excludeEnd("ctx");
  1233. }));
  1234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1235. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  1236. //>>excludeEnd("ctx");
  1237. },
  1238. //>>excludeStart("ide", pragmas.excludeIdeData);
  1239. args: [],
  1240. 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 ]]",
  1241. referencedClasses: [],
  1242. //>>excludeEnd("ide");
  1243. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  1244. }),
  1245. $globals.Package);
  1246. $core.addMethod(
  1247. $core.method({
  1248. selector: "importsDefinition",
  1249. protocol: "accessing",
  1250. fn: function (){
  1251. var self=this,$self=this;
  1252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1253. return $core.withContext(function($ctx1) {
  1254. //>>excludeEnd("ctx");
  1255. return $recv($globals.String)._streamContents_((function(stream){
  1256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1257. return $core.withContext(function($ctx2) {
  1258. //>>excludeEnd("ctx");
  1259. $recv(stream)._write_("{");
  1260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1261. $ctx2.sendIdx["write:"]=1;
  1262. //>>excludeEnd("ctx");
  1263. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  1264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1265. return $core.withContext(function($ctx3) {
  1266. //>>excludeEnd("ctx");
  1267. return $recv(stream)._print_(each);
  1268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1269. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  1270. //>>excludeEnd("ctx");
  1271. }),(function(){
  1272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1273. return $core.withContext(function($ctx3) {
  1274. //>>excludeEnd("ctx");
  1275. return $recv(stream)._write_(". ");
  1276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1277. $ctx3.sendIdx["write:"]=2;
  1278. //>>excludeEnd("ctx");
  1279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1280. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  1281. //>>excludeEnd("ctx");
  1282. }));
  1283. return $recv(stream)._write_("}");
  1284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1285. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  1286. //>>excludeEnd("ctx");
  1287. }));
  1288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1289. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  1290. //>>excludeEnd("ctx");
  1291. },
  1292. //>>excludeStart("ide", pragmas.excludeIdeData);
  1293. args: [],
  1294. 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: '}' ]",
  1295. referencedClasses: ["String"],
  1296. //>>excludeEnd("ide");
  1297. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  1298. }),
  1299. $globals.Package);
  1300. $core.addMethod(
  1301. $core.method({
  1302. selector: "importsFromJson:",
  1303. protocol: "converting",
  1304. fn: function (anArray){
  1305. var self=this,$self=this;
  1306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1307. return $core.withContext(function($ctx1) {
  1308. //>>excludeEnd("ctx");
  1309. var $1;
  1310. return $recv(anArray)._collect_((function(each){
  1311. var split;
  1312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1313. return $core.withContext(function($ctx2) {
  1314. //>>excludeEnd("ctx");
  1315. split=$recv(each)._tokenize_("=");
  1316. split;
  1317. $1=$recv($recv(split)._size()).__eq((1));
  1318. if($core.assert($1)){
  1319. return $recv(split)._first();
  1320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1321. $ctx2.sendIdx["first"]=1;
  1322. //>>excludeEnd("ctx");
  1323. } else {
  1324. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  1325. }
  1326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1327. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  1328. //>>excludeEnd("ctx");
  1329. }));
  1330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1331. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  1332. //>>excludeEnd("ctx");
  1333. },
  1334. //>>excludeStart("ide", pragmas.excludeIdeData);
  1335. args: ["anArray"],
  1336. 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 ]]",
  1337. referencedClasses: [],
  1338. //>>excludeEnd("ide");
  1339. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  1340. }),
  1341. $globals.Package);
  1342. $core.addMethod(
  1343. $core.method({
  1344. selector: "isDirty",
  1345. protocol: "testing",
  1346. fn: function (){
  1347. var self=this,$self=this;
  1348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1349. return $core.withContext(function($ctx1) {
  1350. //>>excludeEnd("ctx");
  1351. var $1,$receiver;
  1352. $1=$self["@dirty"];
  1353. if(($receiver = $1) == null || $receiver.a$nil){
  1354. return false;
  1355. } else {
  1356. return $1;
  1357. }
  1358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1359. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  1360. //>>excludeEnd("ctx");
  1361. },
  1362. //>>excludeStart("ide", pragmas.excludeIdeData);
  1363. args: [],
  1364. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  1365. referencedClasses: [],
  1366. //>>excludeEnd("ide");
  1367. messageSends: ["ifNil:"]
  1368. }),
  1369. $globals.Package);
  1370. $core.addMethod(
  1371. $core.method({
  1372. selector: "isPackage",
  1373. protocol: "testing",
  1374. fn: function (){
  1375. var self=this,$self=this;
  1376. return true;
  1377. },
  1378. //>>excludeStart("ide", pragmas.excludeIdeData);
  1379. args: [],
  1380. source: "isPackage\x0a\x09^ true",
  1381. referencedClasses: [],
  1382. //>>excludeEnd("ide");
  1383. messageSends: []
  1384. }),
  1385. $globals.Package);
  1386. $core.addMethod(
  1387. $core.method({
  1388. selector: "loadDependencies",
  1389. protocol: "dependencies",
  1390. fn: function (){
  1391. var self=this,$self=this;
  1392. var classes,packages;
  1393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1394. return $core.withContext(function($ctx1) {
  1395. //>>excludeEnd("ctx");
  1396. var $1;
  1397. classes=$self._loadDependencyClasses();
  1398. $1=$recv($recv(classes)._collect_((function(each){
  1399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1400. return $core.withContext(function($ctx2) {
  1401. //>>excludeEnd("ctx");
  1402. return $recv(each)._package();
  1403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1404. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1405. //>>excludeEnd("ctx");
  1406. })))._asSet();
  1407. $recv($1)._remove_ifAbsent_(self,(function(){
  1408. }));
  1409. return $recv($1)._yourself();
  1410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1411. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  1412. //>>excludeEnd("ctx");
  1413. },
  1414. //>>excludeStart("ide", pragmas.excludeIdeData);
  1415. args: [],
  1416. 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",
  1417. referencedClasses: [],
  1418. //>>excludeEnd("ide");
  1419. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  1420. }),
  1421. $globals.Package);
  1422. $core.addMethod(
  1423. $core.method({
  1424. selector: "loadDependencyClasses",
  1425. protocol: "dependencies",
  1426. fn: function (){
  1427. var self=this,$self=this;
  1428. var starCategoryName;
  1429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1430. return $core.withContext(function($ctx1) {
  1431. //>>excludeEnd("ctx");
  1432. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  1433. starCategoryName="*".__comma($self._name());
  1434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1435. $ctx1.sendIdx[","]=1;
  1436. //>>excludeEnd("ctx");
  1437. $3=$self._classes();
  1438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1439. $ctx1.sendIdx["classes"]=1;
  1440. //>>excludeEnd("ctx");
  1441. $2=$recv($3)._collect_((function(each){
  1442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1443. return $core.withContext(function($ctx2) {
  1444. //>>excludeEnd("ctx");
  1445. return $recv(each)._superclass();
  1446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1447. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1448. //>>excludeEnd("ctx");
  1449. }));
  1450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1451. $ctx1.sendIdx["collect:"]=1;
  1452. //>>excludeEnd("ctx");
  1453. $1=$recv($2)._asSet();
  1454. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  1455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1456. return $core.withContext(function($ctx2) {
  1457. //>>excludeEnd("ctx");
  1458. $5=$recv(each)._protocols();
  1459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1460. $ctx2.sendIdx["protocols"]=1;
  1461. //>>excludeEnd("ctx");
  1462. $7=$recv(each)._theMetaClass();
  1463. if(($receiver = $7) == null || $receiver.a$nil){
  1464. $6=[];
  1465. } else {
  1466. var meta;
  1467. meta=$receiver;
  1468. $6=$recv(meta)._protocols();
  1469. }
  1470. $4=$recv($5).__comma($6);
  1471. return $recv($4)._includes_(starCategoryName);
  1472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  1474. //>>excludeEnd("ctx");
  1475. })));
  1476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1477. $ctx1.sendIdx["addAll:"]=1;
  1478. //>>excludeEnd("ctx");
  1479. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  1480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1481. return $core.withContext(function($ctx2) {
  1482. //>>excludeEnd("ctx");
  1483. return $recv($self._traitCompositions())._valuesDo_((function(each){
  1484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1485. return $core.withContext(function($ctx3) {
  1486. //>>excludeEnd("ctx");
  1487. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  1488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1489. return $core.withContext(function($ctx4) {
  1490. //>>excludeEnd("ctx");
  1491. return $recv(eachTT)._trait();
  1492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1493. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  1494. //>>excludeEnd("ctx");
  1495. })));
  1496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1497. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  1498. //>>excludeEnd("ctx");
  1499. }));
  1500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1501. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  1502. //>>excludeEnd("ctx");
  1503. })));
  1504. $recv($1)._remove_ifAbsent_(nil,(function(){
  1505. }));
  1506. return $recv($1)._yourself();
  1507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1508. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  1509. //>>excludeEnd("ctx");
  1510. },
  1511. //>>excludeStart("ide", pragmas.excludeIdeData);
  1512. args: [],
  1513. 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",
  1514. referencedClasses: ["Smalltalk", "Array"],
  1515. //>>excludeEnd("ide");
  1516. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  1517. }),
  1518. $globals.Package);
  1519. $core.addMethod(
  1520. $core.method({
  1521. selector: "name",
  1522. protocol: "accessing",
  1523. fn: function (){
  1524. var self=this,$self=this;
  1525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1526. return $core.withContext(function($ctx1) {
  1527. //>>excludeEnd("ctx");
  1528. return self.pkgName;
  1529. return self;
  1530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1531. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  1532. //>>excludeEnd("ctx");
  1533. },
  1534. //>>excludeStart("ide", pragmas.excludeIdeData);
  1535. args: [],
  1536. source: "name\x0a\x09<inlineJS: 'return self.pkgName'>",
  1537. referencedClasses: [],
  1538. //>>excludeEnd("ide");
  1539. messageSends: []
  1540. }),
  1541. $globals.Package);
  1542. $core.addMethod(
  1543. $core.method({
  1544. selector: "name:",
  1545. protocol: "accessing",
  1546. fn: function (aString){
  1547. var self=this,$self=this;
  1548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1549. return $core.withContext(function($ctx1) {
  1550. //>>excludeEnd("ctx");
  1551. $self._basicName_(aString);
  1552. $self._beDirty();
  1553. return self;
  1554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1555. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  1556. //>>excludeEnd("ctx");
  1557. },
  1558. //>>excludeStart("ide", pragmas.excludeIdeData);
  1559. args: ["aString"],
  1560. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  1561. referencedClasses: [],
  1562. //>>excludeEnd("ide");
  1563. messageSends: ["basicName:", "beDirty"]
  1564. }),
  1565. $globals.Package);
  1566. $core.addMethod(
  1567. $core.method({
  1568. selector: "organization",
  1569. protocol: "accessing",
  1570. fn: function (){
  1571. var self=this,$self=this;
  1572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1573. return $core.withContext(function($ctx1) {
  1574. //>>excludeEnd("ctx");
  1575. return $self._basicAt_("organization");
  1576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1577. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  1578. //>>excludeEnd("ctx");
  1579. },
  1580. //>>excludeStart("ide", pragmas.excludeIdeData);
  1581. args: [],
  1582. source: "organization\x0a\x09^ self basicAt: 'organization'",
  1583. referencedClasses: [],
  1584. //>>excludeEnd("ide");
  1585. messageSends: ["basicAt:"]
  1586. }),
  1587. $globals.Package);
  1588. $core.addMethod(
  1589. $core.method({
  1590. selector: "printOn:",
  1591. protocol: "printing",
  1592. fn: function (aStream){
  1593. var self=this,$self=this;
  1594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1595. return $core.withContext(function($ctx1) {
  1596. //>>excludeEnd("ctx");
  1597. (
  1598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1599. $ctx1.supercall = true,
  1600. //>>excludeEnd("ctx");
  1601. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  1602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1603. $ctx1.supercall = false;
  1604. //>>excludeEnd("ctx");;
  1605. $recv(aStream)._nextPutAll_(" (");
  1606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1607. $ctx1.sendIdx["nextPutAll:"]=1;
  1608. //>>excludeEnd("ctx");
  1609. $recv(aStream)._nextPutAll_($self._name());
  1610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1611. $ctx1.sendIdx["nextPutAll:"]=2;
  1612. //>>excludeEnd("ctx");
  1613. $recv(aStream)._nextPutAll_(")");
  1614. return self;
  1615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1616. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  1617. //>>excludeEnd("ctx");
  1618. },
  1619. //>>excludeStart("ide", pragmas.excludeIdeData);
  1620. args: ["aStream"],
  1621. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  1622. referencedClasses: [],
  1623. //>>excludeEnd("ide");
  1624. messageSends: ["printOn:", "nextPutAll:", "name"]
  1625. }),
  1626. $globals.Package);
  1627. $core.addMethod(
  1628. $core.method({
  1629. selector: "setupClasses",
  1630. protocol: "classes",
  1631. fn: function (){
  1632. var self=this,$self=this;
  1633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1634. return $core.withContext(function($ctx1) {
  1635. //>>excludeEnd("ctx");
  1636. $recv($self._classes())._do_((function(each){
  1637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1638. return $core.withContext(function($ctx2) {
  1639. //>>excludeEnd("ctx");
  1640. return $recv(each)._initialize();
  1641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1642. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1643. //>>excludeEnd("ctx");
  1644. }));
  1645. return self;
  1646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1647. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  1648. //>>excludeEnd("ctx");
  1649. },
  1650. //>>excludeStart("ide", pragmas.excludeIdeData);
  1651. args: [],
  1652. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  1653. referencedClasses: [],
  1654. //>>excludeEnd("ide");
  1655. messageSends: ["do:", "classes", "initialize"]
  1656. }),
  1657. $globals.Package);
  1658. $core.addMethod(
  1659. $core.method({
  1660. selector: "sortedClasses",
  1661. protocol: "classes",
  1662. fn: function (){
  1663. var self=this,$self=this;
  1664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1665. return $core.withContext(function($ctx1) {
  1666. //>>excludeEnd("ctx");
  1667. return $recv($self._class())._sortedClasses_($self._classes());
  1668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1669. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  1670. //>>excludeEnd("ctx");
  1671. },
  1672. //>>excludeStart("ide", pragmas.excludeIdeData);
  1673. args: [],
  1674. 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",
  1675. referencedClasses: [],
  1676. //>>excludeEnd("ide");
  1677. messageSends: ["sortedClasses:", "class", "classes"]
  1678. }),
  1679. $globals.Package);
  1680. $core.addMethod(
  1681. $core.method({
  1682. selector: "sortedImportsAsArray",
  1683. protocol: "private",
  1684. fn: function (){
  1685. var self=this,$self=this;
  1686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1687. return $core.withContext(function($ctx1) {
  1688. //>>excludeEnd("ctx");
  1689. var $3,$2,$4,$1,$6,$5,$7;
  1690. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  1691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1692. return $core.withContext(function($ctx2) {
  1693. //>>excludeEnd("ctx");
  1694. $3=$recv(a)._isString();
  1695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1696. $ctx2.sendIdx["isString"]=1;
  1697. //>>excludeEnd("ctx");
  1698. $2=$recv($3)._not();
  1699. $4=$recv(b)._isString();
  1700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1701. $ctx2.sendIdx["isString"]=2;
  1702. //>>excludeEnd("ctx");
  1703. $1=$recv($2).__and($4);
  1704. return $recv($1)._or_((function(){
  1705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1706. return $core.withContext(function($ctx3) {
  1707. //>>excludeEnd("ctx");
  1708. $6=$recv(a)._isString();
  1709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1710. $ctx3.sendIdx["isString"]=3;
  1711. //>>excludeEnd("ctx");
  1712. $5=$recv($6).__eq($recv(b)._isString());
  1713. return $recv($5)._and_((function(){
  1714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1715. return $core.withContext(function($ctx4) {
  1716. //>>excludeEnd("ctx");
  1717. $7=$recv(a)._value();
  1718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1719. $ctx4.sendIdx["value"]=1;
  1720. //>>excludeEnd("ctx");
  1721. return $recv($7).__lt_eq($recv(b)._value());
  1722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1723. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  1724. //>>excludeEnd("ctx");
  1725. }));
  1726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1727. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1728. //>>excludeEnd("ctx");
  1729. }));
  1730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1731. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  1732. //>>excludeEnd("ctx");
  1733. }));
  1734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1735. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  1736. //>>excludeEnd("ctx");
  1737. },
  1738. //>>excludeStart("ide", pragmas.excludeIdeData);
  1739. args: [],
  1740. 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 ]]]",
  1741. referencedClasses: [],
  1742. //>>excludeEnd("ide");
  1743. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  1744. }),
  1745. $globals.Package);
  1746. $core.addMethod(
  1747. $core.method({
  1748. selector: "traitCompositions",
  1749. protocol: "dependencies",
  1750. fn: function (){
  1751. var self=this,$self=this;
  1752. var traitCompositions;
  1753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1754. return $core.withContext(function($ctx1) {
  1755. //>>excludeEnd("ctx");
  1756. var $1,$2,$3,$receiver;
  1757. traitCompositions=$recv($globals.Dictionary)._new();
  1758. $recv($self._classes())._do_((function(each){
  1759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1760. return $core.withContext(function($ctx2) {
  1761. //>>excludeEnd("ctx");
  1762. $1=traitCompositions;
  1763. $2=$recv(each)._traitComposition();
  1764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1765. $ctx2.sendIdx["traitComposition"]=1;
  1766. //>>excludeEnd("ctx");
  1767. $recv($1)._at_put_(each,$2);
  1768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1769. $ctx2.sendIdx["at:put:"]=1;
  1770. //>>excludeEnd("ctx");
  1771. $3=$recv(each)._theMetaClass();
  1772. if(($receiver = $3) == null || $receiver.a$nil){
  1773. return $3;
  1774. } else {
  1775. var meta;
  1776. meta=$receiver;
  1777. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  1778. }
  1779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1780. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1781. //>>excludeEnd("ctx");
  1782. }));
  1783. return $recv(traitCompositions)._reject_((function(each){
  1784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1785. return $core.withContext(function($ctx2) {
  1786. //>>excludeEnd("ctx");
  1787. return $recv(each)._isEmpty();
  1788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1790. //>>excludeEnd("ctx");
  1791. }));
  1792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1793. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  1794. //>>excludeEnd("ctx");
  1795. },
  1796. //>>excludeStart("ide", pragmas.excludeIdeData);
  1797. args: [],
  1798. 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 ]",
  1799. referencedClasses: ["Dictionary"],
  1800. //>>excludeEnd("ide");
  1801. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  1802. }),
  1803. $globals.Package);
  1804. $core.addMethod(
  1805. $core.method({
  1806. selector: "transport",
  1807. protocol: "accessing",
  1808. fn: function (){
  1809. var self=this,$self=this;
  1810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1811. return $core.withContext(function($ctx1) {
  1812. //>>excludeEnd("ctx");
  1813. var $1,$2,$receiver;
  1814. $1=$self["@transport"];
  1815. if(($receiver = $1) == null || $receiver.a$nil){
  1816. $2=$recv($globals.PackageTransport)._fromJson_($self._basicTransport());
  1817. $recv($2)._package_(self);
  1818. $self["@transport"]=$recv($2)._yourself();
  1819. return $self["@transport"];
  1820. } else {
  1821. return $1;
  1822. }
  1823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1824. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  1825. //>>excludeEnd("ctx");
  1826. },
  1827. //>>excludeStart("ide", pragmas.excludeIdeData);
  1828. args: [],
  1829. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  1830. referencedClasses: ["PackageTransport"],
  1831. //>>excludeEnd("ide");
  1832. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  1833. }),
  1834. $globals.Package);
  1835. $core.addMethod(
  1836. $core.method({
  1837. selector: "transport:",
  1838. protocol: "accessing",
  1839. fn: function (aPackageTransport){
  1840. var self=this,$self=this;
  1841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1842. return $core.withContext(function($ctx1) {
  1843. //>>excludeEnd("ctx");
  1844. $self["@transport"]=aPackageTransport;
  1845. $recv(aPackageTransport)._package_(self);
  1846. return self;
  1847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1848. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  1849. //>>excludeEnd("ctx");
  1850. },
  1851. //>>excludeStart("ide", pragmas.excludeIdeData);
  1852. args: ["aPackageTransport"],
  1853. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  1854. referencedClasses: [],
  1855. //>>excludeEnd("ide");
  1856. messageSends: ["package:"]
  1857. }),
  1858. $globals.Package);
  1859. $core.addMethod(
  1860. $core.method({
  1861. selector: "validateImports:",
  1862. protocol: "validation",
  1863. fn: function (aCollection){
  1864. var self=this,$self=this;
  1865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1866. return $core.withContext(function($ctx1) {
  1867. //>>excludeEnd("ctx");
  1868. var $1,$2,$5,$4,$3,$6;
  1869. $recv(aCollection)._do_((function(import_){
  1870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1871. return $core.withContext(function($ctx2) {
  1872. //>>excludeEnd("ctx");
  1873. $1=$recv(import_)._isString();
  1874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1875. $ctx2.sendIdx["isString"]=1;
  1876. //>>excludeEnd("ctx");
  1877. if(!$core.assert($1)){
  1878. $2=$recv(import_)._respondsTo_("key");
  1879. if(!$core.assert($2)){
  1880. $self._error_("Imports must be Strings or Associations");
  1881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1882. $ctx2.sendIdx["error:"]=1;
  1883. //>>excludeEnd("ctx");
  1884. }
  1885. $5=$recv(import_)._key();
  1886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1887. $ctx2.sendIdx["key"]=1;
  1888. //>>excludeEnd("ctx");
  1889. $4=$recv($5)._isString();
  1890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1891. $ctx2.sendIdx["isString"]=2;
  1892. //>>excludeEnd("ctx");
  1893. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  1894. if(!$core.assert($3)){
  1895. $self._error_("Key and value must be Strings");
  1896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1897. $ctx2.sendIdx["error:"]=2;
  1898. //>>excludeEnd("ctx");
  1899. }
  1900. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  1901. if(!$core.assert($6)){
  1902. return $self._error_("Keys must be identifiers");
  1903. }
  1904. }
  1905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1906. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  1907. //>>excludeEnd("ctx");
  1908. }));
  1909. return self;
  1910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1911. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  1912. //>>excludeEnd("ctx");
  1913. },
  1914. //>>excludeStart("ide", pragmas.excludeIdeData);
  1915. args: ["aCollection"],
  1916. 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' ]]]",
  1917. referencedClasses: [],
  1918. //>>excludeEnd("ide");
  1919. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  1920. }),
  1921. $globals.Package);
  1922. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  1923. $core.addMethod(
  1924. $core.method({
  1925. selector: "named:",
  1926. protocol: "accessing",
  1927. fn: function (aPackageName){
  1928. var self=this,$self=this;
  1929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1930. return $core.withContext(function($ctx1) {
  1931. //>>excludeEnd("ctx");
  1932. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  1933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1934. return $core.withContext(function($ctx2) {
  1935. //>>excludeEnd("ctx");
  1936. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  1937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1939. //>>excludeEnd("ctx");
  1940. }));
  1941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1942. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  1943. //>>excludeEnd("ctx");
  1944. },
  1945. //>>excludeStart("ide", pragmas.excludeIdeData);
  1946. args: ["aPackageName"],
  1947. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  1948. referencedClasses: ["Smalltalk"],
  1949. //>>excludeEnd("ide");
  1950. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  1951. }),
  1952. $globals.Package.a$cls);
  1953. $core.addMethod(
  1954. $core.method({
  1955. selector: "named:ifAbsent:",
  1956. protocol: "accessing",
  1957. fn: function (aPackageName,aBlock){
  1958. var self=this,$self=this;
  1959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1960. return $core.withContext(function($ctx1) {
  1961. //>>excludeEnd("ctx");
  1962. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  1963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1964. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  1965. //>>excludeEnd("ctx");
  1966. },
  1967. //>>excludeStart("ide", pragmas.excludeIdeData);
  1968. args: ["aPackageName", "aBlock"],
  1969. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  1970. referencedClasses: ["Smalltalk"],
  1971. //>>excludeEnd("ide");
  1972. messageSends: ["packageAt:ifAbsent:"]
  1973. }),
  1974. $globals.Package.a$cls);
  1975. $core.addMethod(
  1976. $core.method({
  1977. selector: "named:imports:transport:",
  1978. protocol: "accessing",
  1979. fn: function (aPackageName,anArray,aTransport){
  1980. var self=this,$self=this;
  1981. var package_;
  1982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1983. return $core.withContext(function($ctx1) {
  1984. //>>excludeEnd("ctx");
  1985. package_=$self._named_(aPackageName);
  1986. $recv(package_)._imports_(anArray);
  1987. $recv(package_)._transport_(aTransport);
  1988. return package_;
  1989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1990. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.a$cls)});
  1991. //>>excludeEnd("ctx");
  1992. },
  1993. //>>excludeStart("ide", pragmas.excludeIdeData);
  1994. args: ["aPackageName", "anArray", "aTransport"],
  1995. 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",
  1996. referencedClasses: [],
  1997. //>>excludeEnd("ide");
  1998. messageSends: ["named:", "imports:", "transport:"]
  1999. }),
  2000. $globals.Package.a$cls);
  2001. $core.addMethod(
  2002. $core.method({
  2003. selector: "named:transport:",
  2004. protocol: "accessing",
  2005. fn: function (aPackageName,aTransport){
  2006. var self=this,$self=this;
  2007. var package_;
  2008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2009. return $core.withContext(function($ctx1) {
  2010. //>>excludeEnd("ctx");
  2011. package_=$self._named_(aPackageName);
  2012. $recv(package_)._transport_(aTransport);
  2013. return package_;
  2014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2015. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.a$cls)});
  2016. //>>excludeEnd("ctx");
  2017. },
  2018. //>>excludeStart("ide", pragmas.excludeIdeData);
  2019. args: ["aPackageName", "aTransport"],
  2020. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  2021. referencedClasses: [],
  2022. //>>excludeEnd("ide");
  2023. messageSends: ["named:", "transport:"]
  2024. }),
  2025. $globals.Package.a$cls);
  2026. $core.addMethod(
  2027. $core.method({
  2028. selector: "sortedClasses:",
  2029. protocol: "sorting",
  2030. fn: function (classes){
  2031. var self=this,$self=this;
  2032. var children,others,nodes,expandedClasses;
  2033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2034. return $core.withContext(function($ctx1) {
  2035. //>>excludeEnd("ctx");
  2036. var $1,$3,$2;
  2037. children=[];
  2038. others=[];
  2039. $recv(classes)._do_((function(each){
  2040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2041. return $core.withContext(function($ctx2) {
  2042. //>>excludeEnd("ctx");
  2043. $1=$recv(classes)._includes_($recv(each)._superclass());
  2044. if($core.assert($1)){
  2045. return $recv(others)._add_(each);
  2046. } else {
  2047. return $recv(children)._add_(each);
  2048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2049. $ctx2.sendIdx["add:"]=1;
  2050. //>>excludeEnd("ctx");
  2051. }
  2052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2053. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2054. //>>excludeEnd("ctx");
  2055. }));
  2056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2057. $ctx1.sendIdx["do:"]=1;
  2058. //>>excludeEnd("ctx");
  2059. nodes=$recv(children)._collect_((function(each){
  2060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2061. return $core.withContext(function($ctx2) {
  2062. //>>excludeEnd("ctx");
  2063. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  2064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2065. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  2066. //>>excludeEnd("ctx");
  2067. }));
  2068. nodes=$recv(nodes)._sorted_((function(a,b){
  2069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2070. return $core.withContext(function($ctx2) {
  2071. //>>excludeEnd("ctx");
  2072. $3=$recv(a)._theClass();
  2073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2074. $ctx2.sendIdx["theClass"]=1;
  2075. //>>excludeEnd("ctx");
  2076. $2=$recv($3)._name();
  2077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2078. $ctx2.sendIdx["name"]=1;
  2079. //>>excludeEnd("ctx");
  2080. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  2081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2082. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  2083. //>>excludeEnd("ctx");
  2084. }));
  2085. expandedClasses=$recv($globals.Array)._new();
  2086. $recv(nodes)._do_((function(aNode){
  2087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2088. return $core.withContext(function($ctx2) {
  2089. //>>excludeEnd("ctx");
  2090. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  2091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2092. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  2093. //>>excludeEnd("ctx");
  2094. }));
  2095. return expandedClasses;
  2096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2097. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  2098. //>>excludeEnd("ctx");
  2099. },
  2100. //>>excludeStart("ide", pragmas.excludeIdeData);
  2101. args: ["classes"],
  2102. 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",
  2103. referencedClasses: ["ClassSorterNode", "Array"],
  2104. //>>excludeEnd("ide");
  2105. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  2106. }),
  2107. $globals.Package.a$cls);
  2108. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  2109. //>>excludeStart("ide", pragmas.excludeIdeData);
  2110. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  2111. //>>excludeEnd("ide");
  2112. $core.addMethod(
  2113. $core.method({
  2114. selector: "announcer",
  2115. protocol: "accessing",
  2116. fn: function (){
  2117. var self=this,$self=this;
  2118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2119. return $core.withContext(function($ctx1) {
  2120. //>>excludeEnd("ctx");
  2121. return $recv($globals.SystemAnnouncer)._current();
  2122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2123. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  2124. //>>excludeEnd("ctx");
  2125. },
  2126. //>>excludeStart("ide", pragmas.excludeIdeData);
  2127. args: [],
  2128. source: "announcer\x0a\x09^ SystemAnnouncer current",
  2129. referencedClasses: ["SystemAnnouncer"],
  2130. //>>excludeEnd("ide");
  2131. messageSends: ["current"]
  2132. }),
  2133. $globals.PackageStateObserver);
  2134. $core.addMethod(
  2135. $core.method({
  2136. selector: "observeSystem",
  2137. protocol: "actions",
  2138. fn: function (){
  2139. var self=this,$self=this;
  2140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2141. return $core.withContext(function($ctx1) {
  2142. //>>excludeEnd("ctx");
  2143. var $1;
  2144. $1=$self._announcer();
  2145. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  2146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2147. $ctx1.sendIdx["on:send:to:"]=1;
  2148. //>>excludeEnd("ctx");
  2149. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  2150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2151. $ctx1.sendIdx["on:send:to:"]=2;
  2152. //>>excludeEnd("ctx");
  2153. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  2154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2155. $ctx1.sendIdx["on:send:to:"]=3;
  2156. //>>excludeEnd("ctx");
  2157. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  2158. return self;
  2159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2160. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  2161. //>>excludeEnd("ctx");
  2162. },
  2163. //>>excludeStart("ide", pragmas.excludeIdeData);
  2164. args: [],
  2165. 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",
  2166. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  2167. //>>excludeEnd("ide");
  2168. messageSends: ["on:send:to:", "announcer"]
  2169. }),
  2170. $globals.PackageStateObserver);
  2171. $core.addMethod(
  2172. $core.method({
  2173. selector: "onClassModification:",
  2174. protocol: "reactions",
  2175. fn: function (anAnnouncement){
  2176. var self=this,$self=this;
  2177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2178. return $core.withContext(function($ctx1) {
  2179. //>>excludeEnd("ctx");
  2180. var $1,$receiver;
  2181. $1=$recv(anAnnouncement)._theClass();
  2182. if(($receiver = $1) == null || $receiver.a$nil){
  2183. $1;
  2184. } else {
  2185. var theClass;
  2186. theClass=$receiver;
  2187. $recv($recv(theClass)._package())._beDirty();
  2188. }
  2189. return self;
  2190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2191. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2192. //>>excludeEnd("ctx");
  2193. },
  2194. //>>excludeStart("ide", pragmas.excludeIdeData);
  2195. args: ["anAnnouncement"],
  2196. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  2197. referencedClasses: [],
  2198. //>>excludeEnd("ide");
  2199. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  2200. }),
  2201. $globals.PackageStateObserver);
  2202. $core.addMethod(
  2203. $core.method({
  2204. selector: "onMethodModification:",
  2205. protocol: "reactions",
  2206. fn: function (anAnnouncement){
  2207. var self=this,$self=this;
  2208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2209. return $core.withContext(function($ctx1) {
  2210. //>>excludeEnd("ctx");
  2211. var $1,$receiver;
  2212. $1=$recv($recv(anAnnouncement)._method())._package();
  2213. if(($receiver = $1) == null || $receiver.a$nil){
  2214. $1;
  2215. } else {
  2216. var package_;
  2217. package_=$receiver;
  2218. $recv(package_)._beDirty();
  2219. }
  2220. return self;
  2221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2222. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2223. //>>excludeEnd("ctx");
  2224. },
  2225. //>>excludeStart("ide", pragmas.excludeIdeData);
  2226. args: ["anAnnouncement"],
  2227. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  2228. referencedClasses: [],
  2229. //>>excludeEnd("ide");
  2230. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  2231. }),
  2232. $globals.PackageStateObserver);
  2233. $core.addMethod(
  2234. $core.method({
  2235. selector: "onPackageAdded:",
  2236. protocol: "reactions",
  2237. fn: function (anAnnouncement){
  2238. var self=this,$self=this;
  2239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2240. return $core.withContext(function($ctx1) {
  2241. //>>excludeEnd("ctx");
  2242. $recv($recv(anAnnouncement)._package())._beDirty();
  2243. return self;
  2244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2245. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2246. //>>excludeEnd("ctx");
  2247. },
  2248. //>>excludeStart("ide", pragmas.excludeIdeData);
  2249. args: ["anAnnouncement"],
  2250. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  2251. referencedClasses: [],
  2252. //>>excludeEnd("ide");
  2253. messageSends: ["beDirty", "package"]
  2254. }),
  2255. $globals.PackageStateObserver);
  2256. $core.addMethod(
  2257. $core.method({
  2258. selector: "onProtocolModification:",
  2259. protocol: "reactions",
  2260. fn: function (anAnnouncement){
  2261. var self=this,$self=this;
  2262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2263. return $core.withContext(function($ctx1) {
  2264. //>>excludeEnd("ctx");
  2265. var $1,$receiver;
  2266. $1=$recv(anAnnouncement)._package();
  2267. if(($receiver = $1) == null || $receiver.a$nil){
  2268. $1;
  2269. } else {
  2270. var package_;
  2271. package_=$receiver;
  2272. $recv(package_)._beDirty();
  2273. }
  2274. return self;
  2275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2276. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  2277. //>>excludeEnd("ctx");
  2278. },
  2279. //>>excludeStart("ide", pragmas.excludeIdeData);
  2280. args: ["anAnnouncement"],
  2281. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  2282. referencedClasses: [],
  2283. //>>excludeEnd("ide");
  2284. messageSends: ["ifNotNil:", "package", "beDirty"]
  2285. }),
  2286. $globals.PackageStateObserver);
  2287. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  2288. $core.addMethod(
  2289. $core.method({
  2290. selector: "current",
  2291. protocol: "accessing",
  2292. fn: function (){
  2293. var self=this,$self=this;
  2294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2295. return $core.withContext(function($ctx1) {
  2296. //>>excludeEnd("ctx");
  2297. var $1,$receiver;
  2298. $1=$self["@current"];
  2299. if(($receiver = $1) == null || $receiver.a$nil){
  2300. $self["@current"]=$self._new();
  2301. return $self["@current"];
  2302. } else {
  2303. return $1;
  2304. }
  2305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2306. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  2307. //>>excludeEnd("ctx");
  2308. },
  2309. //>>excludeStart("ide", pragmas.excludeIdeData);
  2310. args: [],
  2311. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  2312. referencedClasses: [],
  2313. //>>excludeEnd("ide");
  2314. messageSends: ["ifNil:", "new"]
  2315. }),
  2316. $globals.PackageStateObserver.a$cls);
  2317. $core.addMethod(
  2318. $core.method({
  2319. selector: "initialize",
  2320. protocol: "initialization",
  2321. fn: function (){
  2322. var self=this,$self=this;
  2323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2324. return $core.withContext(function($ctx1) {
  2325. //>>excludeEnd("ctx");
  2326. $recv($self._current())._observeSystem();
  2327. return self;
  2328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2329. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  2330. //>>excludeEnd("ctx");
  2331. },
  2332. //>>excludeStart("ide", pragmas.excludeIdeData);
  2333. args: [],
  2334. source: "initialize\x0a\x09self current observeSystem",
  2335. referencedClasses: [],
  2336. //>>excludeEnd("ide");
  2337. messageSends: ["observeSystem", "current"]
  2338. }),
  2339. $globals.PackageStateObserver.a$cls);
  2340. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  2341. //>>excludeStart("ide", pragmas.excludeIdeData);
  2342. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  2343. //>>excludeEnd("ide");
  2344. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  2345. //>>excludeStart("ide", pragmas.excludeIdeData);
  2346. $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`";
  2347. //>>excludeEnd("ide");
  2348. $core.addMethod(
  2349. $core.method({
  2350. selector: "defaultValue",
  2351. protocol: "accessing",
  2352. fn: function (){
  2353. var self=this,$self=this;
  2354. return $self["@defaultValue"];
  2355. },
  2356. //>>excludeStart("ide", pragmas.excludeIdeData);
  2357. args: [],
  2358. source: "defaultValue\x0a\x09^ defaultValue",
  2359. referencedClasses: [],
  2360. //>>excludeEnd("ide");
  2361. messageSends: []
  2362. }),
  2363. $globals.Setting);
  2364. $core.addMethod(
  2365. $core.method({
  2366. selector: "defaultValue:",
  2367. protocol: "accessing",
  2368. fn: function (aStringifiableObject){
  2369. var self=this,$self=this;
  2370. $self["@defaultValue"]=aStringifiableObject;
  2371. return self;
  2372. },
  2373. //>>excludeStart("ide", pragmas.excludeIdeData);
  2374. args: ["aStringifiableObject"],
  2375. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  2376. referencedClasses: [],
  2377. //>>excludeEnd("ide");
  2378. messageSends: []
  2379. }),
  2380. $globals.Setting);
  2381. $core.addMethod(
  2382. $core.method({
  2383. selector: "key",
  2384. protocol: "accessing",
  2385. fn: function (){
  2386. var self=this,$self=this;
  2387. return $self["@key"];
  2388. },
  2389. //>>excludeStart("ide", pragmas.excludeIdeData);
  2390. args: [],
  2391. source: "key\x0a\x09^ key",
  2392. referencedClasses: [],
  2393. //>>excludeEnd("ide");
  2394. messageSends: []
  2395. }),
  2396. $globals.Setting);
  2397. $core.addMethod(
  2398. $core.method({
  2399. selector: "key:",
  2400. protocol: "accessing",
  2401. fn: function (aString){
  2402. var self=this,$self=this;
  2403. $self["@key"]=aString;
  2404. return self;
  2405. },
  2406. //>>excludeStart("ide", pragmas.excludeIdeData);
  2407. args: ["aString"],
  2408. source: "key: aString\x0a\x09key := aString",
  2409. referencedClasses: [],
  2410. //>>excludeEnd("ide");
  2411. messageSends: []
  2412. }),
  2413. $globals.Setting);
  2414. $core.addMethod(
  2415. $core.method({
  2416. selector: "value",
  2417. protocol: "accessing",
  2418. fn: function (){
  2419. var self=this,$self=this;
  2420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2421. return $core.withContext(function($ctx1) {
  2422. //>>excludeEnd("ctx");
  2423. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  2424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2425. return $core.withContext(function($ctx2) {
  2426. //>>excludeEnd("ctx");
  2427. return $self._defaultValue();
  2428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2430. //>>excludeEnd("ctx");
  2431. }));
  2432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2433. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  2434. //>>excludeEnd("ctx");
  2435. },
  2436. //>>excludeStart("ide", pragmas.excludeIdeData);
  2437. args: [],
  2438. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  2439. referencedClasses: ["Smalltalk"],
  2440. //>>excludeEnd("ide");
  2441. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  2442. }),
  2443. $globals.Setting);
  2444. $core.addMethod(
  2445. $core.method({
  2446. selector: "value:",
  2447. protocol: "accessing",
  2448. fn: function (aStringifiableObject){
  2449. var self=this,$self=this;
  2450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2451. return $core.withContext(function($ctx1) {
  2452. //>>excludeEnd("ctx");
  2453. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  2454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2455. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  2456. //>>excludeEnd("ctx");
  2457. },
  2458. //>>excludeStart("ide", pragmas.excludeIdeData);
  2459. args: ["aStringifiableObject"],
  2460. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  2461. referencedClasses: ["Smalltalk"],
  2462. //>>excludeEnd("ide");
  2463. messageSends: ["at:put:", "settings", "key"]
  2464. }),
  2465. $globals.Setting);
  2466. $core.addMethod(
  2467. $core.method({
  2468. selector: "at:ifAbsent:",
  2469. protocol: "instance creation",
  2470. fn: function (aString,aDefaultValue){
  2471. var self=this,$self=this;
  2472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2473. return $core.withContext(function($ctx1) {
  2474. //>>excludeEnd("ctx");
  2475. var $1;
  2476. $1=(
  2477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2478. $ctx1.supercall = true,
  2479. //>>excludeEnd("ctx");
  2480. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  2481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2482. $ctx1.supercall = false;
  2483. //>>excludeEnd("ctx");;
  2484. $recv($1)._key_(aString);
  2485. $recv($1)._defaultValue_(aDefaultValue);
  2486. return $recv($1)._yourself();
  2487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2488. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  2489. //>>excludeEnd("ctx");
  2490. },
  2491. //>>excludeStart("ide", pragmas.excludeIdeData);
  2492. args: ["aString", "aDefaultValue"],
  2493. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  2494. referencedClasses: [],
  2495. //>>excludeEnd("ide");
  2496. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  2497. }),
  2498. $globals.Setting.a$cls);
  2499. $core.addMethod(
  2500. $core.method({
  2501. selector: "new",
  2502. protocol: "instance creation",
  2503. fn: function (){
  2504. var self=this,$self=this;
  2505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2506. return $core.withContext(function($ctx1) {
  2507. //>>excludeEnd("ctx");
  2508. $self._shouldNotImplement();
  2509. return self;
  2510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2511. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  2512. //>>excludeEnd("ctx");
  2513. },
  2514. //>>excludeStart("ide", pragmas.excludeIdeData);
  2515. args: [],
  2516. source: "new\x0a\x09self shouldNotImplement",
  2517. referencedClasses: [],
  2518. //>>excludeEnd("ide");
  2519. messageSends: ["shouldNotImplement"]
  2520. }),
  2521. $globals.Setting.a$cls);
  2522. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables"], "Kernel-Infrastructure");
  2523. //>>excludeStart("ide", pragmas.excludeIdeData);
  2524. $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.";
  2525. //>>excludeEnd("ide");
  2526. $core.addMethod(
  2527. $core.method({
  2528. selector: "addGlobalJsVariable:",
  2529. protocol: "globals",
  2530. fn: function (aString){
  2531. var self=this,$self=this;
  2532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2533. return $core.withContext(function($ctx1) {
  2534. //>>excludeEnd("ctx");
  2535. $recv($self._globalJsVariables())._add_(aString);
  2536. return self;
  2537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2538. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  2539. //>>excludeEnd("ctx");
  2540. },
  2541. //>>excludeStart("ide", pragmas.excludeIdeData);
  2542. args: ["aString"],
  2543. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  2544. referencedClasses: [],
  2545. //>>excludeEnd("ide");
  2546. messageSends: ["add:", "globalJsVariables"]
  2547. }),
  2548. $globals.SmalltalkImage);
  2549. $core.addMethod(
  2550. $core.method({
  2551. selector: "adoptPackageDictionary",
  2552. protocol: "private",
  2553. fn: function (){
  2554. var self=this,$self=this;
  2555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2556. return $core.withContext(function($ctx1) {
  2557. //>>excludeEnd("ctx");
  2558. $core.packages=self._readJSObject_($core.packages)._asHashedCollection();
  2559. return self;
  2560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2561. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDictionary",{},$globals.SmalltalkImage)});
  2562. //>>excludeEnd("ctx");
  2563. },
  2564. //>>excludeStart("ide", pragmas.excludeIdeData);
  2565. args: [],
  2566. source: "adoptPackageDictionary\x0a\x09<inlineJS: '$core.packages=self._readJSObject_($core.packages)._asHashedCollection()'>",
  2567. referencedClasses: [],
  2568. //>>excludeEnd("ide");
  2569. messageSends: []
  2570. }),
  2571. $globals.SmalltalkImage);
  2572. $core.addMethod(
  2573. $core.method({
  2574. selector: "amdRequire",
  2575. protocol: "accessing amd",
  2576. fn: function (){
  2577. var self=this,$self=this;
  2578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2579. return $core.withContext(function($ctx1) {
  2580. //>>excludeEnd("ctx");
  2581. return $recv($self._core())._at_("amdRequire");
  2582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2583. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  2584. //>>excludeEnd("ctx");
  2585. },
  2586. //>>excludeStart("ide", pragmas.excludeIdeData);
  2587. args: [],
  2588. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  2589. referencedClasses: [],
  2590. //>>excludeEnd("ide");
  2591. messageSends: ["at:", "core"]
  2592. }),
  2593. $globals.SmalltalkImage);
  2594. $core.addMethod(
  2595. $core.method({
  2596. selector: "asSmalltalkException:",
  2597. protocol: "error handling",
  2598. fn: function (anObject){
  2599. var self=this,$self=this;
  2600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2601. return $core.withContext(function($ctx1) {
  2602. //>>excludeEnd("ctx");
  2603. var $1;
  2604. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  2605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2606. return $core.withContext(function($ctx2) {
  2607. //>>excludeEnd("ctx");
  2608. return $recv(anObject)._isKindOf_($globals.Error);
  2609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2611. //>>excludeEnd("ctx");
  2612. }));
  2613. if($core.assert($1)){
  2614. return anObject;
  2615. } else {
  2616. return $recv($globals.JavaScriptException)._on_(anObject);
  2617. }
  2618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2619. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  2620. //>>excludeEnd("ctx");
  2621. },
  2622. //>>excludeStart("ide", pragmas.excludeIdeData);
  2623. args: ["anObject"],
  2624. 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 ]",
  2625. referencedClasses: ["Error", "JavaScriptException"],
  2626. //>>excludeEnd("ide");
  2627. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  2628. }),
  2629. $globals.SmalltalkImage);
  2630. $core.addMethod(
  2631. $core.method({
  2632. selector: "basicCreatePackage:",
  2633. protocol: "private",
  2634. fn: function (packageName){
  2635. var self=this,$self=this;
  2636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2637. return $core.withContext(function($ctx1) {
  2638. //>>excludeEnd("ctx");
  2639. return $core.addPackage(packageName);
  2640. return self;
  2641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2642. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  2643. //>>excludeEnd("ctx");
  2644. },
  2645. //>>excludeStart("ide", pragmas.excludeIdeData);
  2646. args: ["packageName"],
  2647. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<inlineJS: 'return $core.addPackage(packageName)'>",
  2648. referencedClasses: [],
  2649. //>>excludeEnd("ide");
  2650. messageSends: []
  2651. }),
  2652. $globals.SmalltalkImage);
  2653. $core.addMethod(
  2654. $core.method({
  2655. selector: "basicParse:",
  2656. protocol: "private",
  2657. fn: function (aString){
  2658. var self=this,$self=this;
  2659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2660. return $core.withContext(function($ctx1) {
  2661. //>>excludeEnd("ctx");
  2662. return $recv($globals.SmalltalkParser)._parse_(aString);
  2663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2664. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  2665. //>>excludeEnd("ctx");
  2666. },
  2667. //>>excludeStart("ide", pragmas.excludeIdeData);
  2668. args: ["aString"],
  2669. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  2670. referencedClasses: ["SmalltalkParser"],
  2671. //>>excludeEnd("ide");
  2672. messageSends: ["parse:"]
  2673. }),
  2674. $globals.SmalltalkImage);
  2675. $core.addMethod(
  2676. $core.method({
  2677. selector: "cancelOptOut:",
  2678. protocol: "accessing",
  2679. fn: function (anObject){
  2680. var self=this,$self=this;
  2681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2682. return $core.withContext(function($ctx1) {
  2683. //>>excludeEnd("ctx");
  2684. delete anObject.klass; delete anObject.a$cls;;
  2685. return self;
  2686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2687. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  2688. //>>excludeEnd("ctx");
  2689. },
  2690. //>>excludeStart("ide", pragmas.excludeIdeData);
  2691. args: ["anObject"],
  2692. 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;'>",
  2693. referencedClasses: [],
  2694. //>>excludeEnd("ide");
  2695. messageSends: []
  2696. }),
  2697. $globals.SmalltalkImage);
  2698. $core.addMethod(
  2699. $core.method({
  2700. selector: "classes",
  2701. protocol: "classes",
  2702. fn: function (){
  2703. var self=this,$self=this;
  2704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2705. return $core.withContext(function($ctx1) {
  2706. //>>excludeEnd("ctx");
  2707. return $core.classes();
  2708. return self;
  2709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2710. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  2711. //>>excludeEnd("ctx");
  2712. },
  2713. //>>excludeStart("ide", pragmas.excludeIdeData);
  2714. args: [],
  2715. source: "classes\x0a\x09<inlineJS: 'return $core.classes()'>",
  2716. referencedClasses: [],
  2717. //>>excludeEnd("ide");
  2718. messageSends: []
  2719. }),
  2720. $globals.SmalltalkImage);
  2721. $core.addMethod(
  2722. $core.method({
  2723. selector: "core",
  2724. protocol: "accessing",
  2725. fn: function (){
  2726. var self=this,$self=this;
  2727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2728. return $core.withContext(function($ctx1) {
  2729. //>>excludeEnd("ctx");
  2730. return $core;
  2731. return self;
  2732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2733. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  2734. //>>excludeEnd("ctx");
  2735. },
  2736. //>>excludeStart("ide", pragmas.excludeIdeData);
  2737. args: [],
  2738. source: "core\x0a\x09<inlineJS: 'return $core'>",
  2739. referencedClasses: [],
  2740. //>>excludeEnd("ide");
  2741. messageSends: []
  2742. }),
  2743. $globals.SmalltalkImage);
  2744. $core.addMethod(
  2745. $core.method({
  2746. selector: "createPackage:",
  2747. protocol: "packages",
  2748. fn: function (packageName){
  2749. var self=this,$self=this;
  2750. var package_,announcement;
  2751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2752. return $core.withContext(function($ctx1) {
  2753. //>>excludeEnd("ctx");
  2754. var $1;
  2755. package_=$self._basicCreatePackage_(packageName);
  2756. $1=$recv($globals.PackageAdded)._new();
  2757. $recv($1)._package_(package_);
  2758. announcement=$recv($1)._yourself();
  2759. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  2760. return package_;
  2761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2762. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  2763. //>>excludeEnd("ctx");
  2764. },
  2765. //>>excludeStart("ide", pragmas.excludeIdeData);
  2766. args: ["packageName"],
  2767. 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",
  2768. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  2769. //>>excludeEnd("ide");
  2770. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  2771. }),
  2772. $globals.SmalltalkImage);
  2773. $core.addMethod(
  2774. $core.method({
  2775. selector: "defaultAmdNamespace",
  2776. protocol: "accessing amd",
  2777. fn: function (){
  2778. var self=this,$self=this;
  2779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2780. return $core.withContext(function($ctx1) {
  2781. //>>excludeEnd("ctx");
  2782. return "transport.defaultAmdNamespace"._settingValue();
  2783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2784. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  2785. //>>excludeEnd("ctx");
  2786. },
  2787. //>>excludeStart("ide", pragmas.excludeIdeData);
  2788. args: [],
  2789. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  2790. referencedClasses: [],
  2791. //>>excludeEnd("ide");
  2792. messageSends: ["settingValue"]
  2793. }),
  2794. $globals.SmalltalkImage);
  2795. $core.addMethod(
  2796. $core.method({
  2797. selector: "defaultAmdNamespace:",
  2798. protocol: "accessing amd",
  2799. fn: function (aString){
  2800. var self=this,$self=this;
  2801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2802. return $core.withContext(function($ctx1) {
  2803. //>>excludeEnd("ctx");
  2804. "transport.defaultAmdNamespace"._settingValue_(aString);
  2805. return self;
  2806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2807. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  2808. //>>excludeEnd("ctx");
  2809. },
  2810. //>>excludeStart("ide", pragmas.excludeIdeData);
  2811. args: ["aString"],
  2812. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  2813. referencedClasses: [],
  2814. //>>excludeEnd("ide");
  2815. messageSends: ["settingValue:"]
  2816. }),
  2817. $globals.SmalltalkImage);
  2818. $core.addMethod(
  2819. $core.method({
  2820. selector: "deleteClass:",
  2821. protocol: "private",
  2822. fn: function (aClass){
  2823. var self=this,$self=this;
  2824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2825. return $core.withContext(function($ctx1) {
  2826. //>>excludeEnd("ctx");
  2827. $core.removeClass(aClass);
  2828. return self;
  2829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2830. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  2831. //>>excludeEnd("ctx");
  2832. },
  2833. //>>excludeStart("ide", pragmas.excludeIdeData);
  2834. args: ["aClass"],
  2835. 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)'>",
  2836. referencedClasses: [],
  2837. //>>excludeEnd("ide");
  2838. messageSends: []
  2839. }),
  2840. $globals.SmalltalkImage);
  2841. $core.addMethod(
  2842. $core.method({
  2843. selector: "deleteGlobalJsVariable:",
  2844. protocol: "globals",
  2845. fn: function (aString){
  2846. var self=this,$self=this;
  2847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2848. return $core.withContext(function($ctx1) {
  2849. //>>excludeEnd("ctx");
  2850. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  2851. }));
  2852. return self;
  2853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2854. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  2855. //>>excludeEnd("ctx");
  2856. },
  2857. //>>excludeStart("ide", pragmas.excludeIdeData);
  2858. args: ["aString"],
  2859. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  2860. referencedClasses: [],
  2861. //>>excludeEnd("ide");
  2862. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  2863. }),
  2864. $globals.SmalltalkImage);
  2865. $core.addMethod(
  2866. $core.method({
  2867. selector: "existsJsGlobal:",
  2868. protocol: "testing",
  2869. fn: function (aString){
  2870. var self=this,$self=this;
  2871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2872. return $core.withContext(function($ctx1) {
  2873. //>>excludeEnd("ctx");
  2874. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  2875. return true;
  2876. }),(function(){
  2877. return false;
  2878. }));
  2879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2880. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  2881. //>>excludeEnd("ctx");
  2882. },
  2883. //>>excludeStart("ide", pragmas.excludeIdeData);
  2884. args: ["aString"],
  2885. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  2886. referencedClasses: ["Platform"],
  2887. //>>excludeEnd("ide");
  2888. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  2889. }),
  2890. $globals.SmalltalkImage);
  2891. $core.addMethod(
  2892. $core.method({
  2893. selector: "globalJsVariables",
  2894. protocol: "globals",
  2895. fn: function (){
  2896. var self=this,$self=this;
  2897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2898. return $core.withContext(function($ctx1) {
  2899. //>>excludeEnd("ctx");
  2900. var $1,$receiver;
  2901. $1=$self["@globalJsVariables"];
  2902. if(($receiver = $1) == null || $receiver.a$nil){
  2903. $self["@globalJsVariables"]=["window", "document", "process", "global"].__comma($self._legacyGlobalJsVariables());
  2904. return $self["@globalJsVariables"];
  2905. } else {
  2906. return $1;
  2907. }
  2908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2909. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  2910. //>>excludeEnd("ctx");
  2911. },
  2912. //>>excludeStart("ide", pragmas.excludeIdeData);
  2913. args: [],
  2914. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global), self legacyGlobalJsVariables ]",
  2915. referencedClasses: [],
  2916. //>>excludeEnd("ide");
  2917. messageSends: ["ifNil:", ",", "legacyGlobalJsVariables"]
  2918. }),
  2919. $globals.SmalltalkImage);
  2920. $core.addMethod(
  2921. $core.method({
  2922. selector: "globals",
  2923. protocol: "accessing",
  2924. fn: function (){
  2925. var self=this,$self=this;
  2926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2927. return $core.withContext(function($ctx1) {
  2928. //>>excludeEnd("ctx");
  2929. return $globals;
  2930. return self;
  2931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2932. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  2933. //>>excludeEnd("ctx");
  2934. },
  2935. //>>excludeStart("ide", pragmas.excludeIdeData);
  2936. args: [],
  2937. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  2938. referencedClasses: [],
  2939. //>>excludeEnd("ide");
  2940. messageSends: []
  2941. }),
  2942. $globals.SmalltalkImage);
  2943. $core.addMethod(
  2944. $core.method({
  2945. selector: "includesKey:",
  2946. protocol: "accessing",
  2947. fn: function (aKey){
  2948. var self=this,$self=this;
  2949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2950. return $core.withContext(function($ctx1) {
  2951. //>>excludeEnd("ctx");
  2952. return $core.hasOwnProperty(aKey);
  2953. return self;
  2954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2955. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  2956. //>>excludeEnd("ctx");
  2957. },
  2958. //>>excludeStart("ide", pragmas.excludeIdeData);
  2959. args: ["aKey"],
  2960. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  2961. referencedClasses: [],
  2962. //>>excludeEnd("ide");
  2963. messageSends: []
  2964. }),
  2965. $globals.SmalltalkImage);
  2966. $core.addMethod(
  2967. $core.method({
  2968. selector: "isSmalltalkObject:",
  2969. protocol: "testing",
  2970. fn: function (anObject){
  2971. var self=this,$self=this;
  2972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2973. return $core.withContext(function($ctx1) {
  2974. //>>excludeEnd("ctx");
  2975. return anObject.a$cls != null;
  2976. return self;
  2977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2978. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  2979. //>>excludeEnd("ctx");
  2980. },
  2981. //>>excludeStart("ide", pragmas.excludeIdeData);
  2982. args: ["anObject"],
  2983. 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'>",
  2984. referencedClasses: [],
  2985. //>>excludeEnd("ide");
  2986. messageSends: []
  2987. }),
  2988. $globals.SmalltalkImage);
  2989. $core.addMethod(
  2990. $core.method({
  2991. selector: "legacyGlobalJsVariables",
  2992. protocol: "private",
  2993. fn: function (){
  2994. var self=this,$self=this;
  2995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2996. return $core.withContext(function($ctx1) {
  2997. //>>excludeEnd("ctx");
  2998. return $core.globalJsVariables;
  2999. return self;
  3000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3001. }, function($ctx1) {$ctx1.fill(self,"legacyGlobalJsVariables",{},$globals.SmalltalkImage)});
  3002. //>>excludeEnd("ctx");
  3003. },
  3004. //>>excludeStart("ide", pragmas.excludeIdeData);
  3005. args: [],
  3006. 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'>",
  3007. referencedClasses: [],
  3008. //>>excludeEnd("ide");
  3009. messageSends: []
  3010. }),
  3011. $globals.SmalltalkImage);
  3012. $core.addMethod(
  3013. $core.method({
  3014. selector: "optOut:",
  3015. protocol: "accessing",
  3016. fn: function (anObject){
  3017. var self=this,$self=this;
  3018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3019. return $core.withContext(function($ctx1) {
  3020. //>>excludeEnd("ctx");
  3021. anObject.klass = null; anObject.a$cls = null;
  3022. return self;
  3023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3024. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  3025. //>>excludeEnd("ctx");
  3026. },
  3027. //>>excludeStart("ide", pragmas.excludeIdeData);
  3028. args: ["anObject"],
  3029. 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'>",
  3030. referencedClasses: [],
  3031. //>>excludeEnd("ide");
  3032. messageSends: []
  3033. }),
  3034. $globals.SmalltalkImage);
  3035. $core.addMethod(
  3036. $core.method({
  3037. selector: "packageAt:",
  3038. protocol: "packages",
  3039. fn: function (packageName){
  3040. var self=this,$self=this;
  3041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3042. return $core.withContext(function($ctx1) {
  3043. //>>excludeEnd("ctx");
  3044. return $self._packageAt_ifAbsent_(packageName,(function(){
  3045. }));
  3046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3047. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  3048. //>>excludeEnd("ctx");
  3049. },
  3050. //>>excludeStart("ide", pragmas.excludeIdeData);
  3051. args: ["packageName"],
  3052. source: "packageAt: packageName\x0a\x09^ self packageAt: packageName ifAbsent: []",
  3053. referencedClasses: [],
  3054. //>>excludeEnd("ide");
  3055. messageSends: ["packageAt:ifAbsent:"]
  3056. }),
  3057. $globals.SmalltalkImage);
  3058. $core.addMethod(
  3059. $core.method({
  3060. selector: "packageAt:ifAbsent:",
  3061. protocol: "packages",
  3062. fn: function (packageName,aBlock){
  3063. var self=this,$self=this;
  3064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3065. return $core.withContext(function($ctx1) {
  3066. //>>excludeEnd("ctx");
  3067. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  3068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3069. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  3070. //>>excludeEnd("ctx");
  3071. },
  3072. //>>excludeStart("ide", pragmas.excludeIdeData);
  3073. args: ["packageName", "aBlock"],
  3074. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  3075. referencedClasses: [],
  3076. //>>excludeEnd("ide");
  3077. messageSends: ["at:ifAbsent:", "packageDictionary"]
  3078. }),
  3079. $globals.SmalltalkImage);
  3080. $core.addMethod(
  3081. $core.method({
  3082. selector: "packageDictionary",
  3083. protocol: "packages",
  3084. fn: function (){
  3085. var self=this,$self=this;
  3086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3087. return $core.withContext(function($ctx1) {
  3088. //>>excludeEnd("ctx");
  3089. return $core.packages;
  3090. return self;
  3091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3092. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  3093. //>>excludeEnd("ctx");
  3094. },
  3095. //>>excludeStart("ide", pragmas.excludeIdeData);
  3096. args: [],
  3097. source: "packageDictionary\x0a\x09<inlineJS: 'return $core.packages'>",
  3098. referencedClasses: [],
  3099. //>>excludeEnd("ide");
  3100. messageSends: []
  3101. }),
  3102. $globals.SmalltalkImage);
  3103. $core.addMethod(
  3104. $core.method({
  3105. selector: "packages",
  3106. protocol: "packages",
  3107. fn: function (){
  3108. var self=this,$self=this;
  3109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3110. return $core.withContext(function($ctx1) {
  3111. //>>excludeEnd("ctx");
  3112. return $recv($recv($self._packageDictionary())._values())._copy();
  3113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3114. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  3115. //>>excludeEnd("ctx");
  3116. },
  3117. //>>excludeStart("ide", pragmas.excludeIdeData);
  3118. args: [],
  3119. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  3120. referencedClasses: [],
  3121. //>>excludeEnd("ide");
  3122. messageSends: ["copy", "values", "packageDictionary"]
  3123. }),
  3124. $globals.SmalltalkImage);
  3125. $core.addMethod(
  3126. $core.method({
  3127. selector: "parse:",
  3128. protocol: "accessing",
  3129. fn: function (aString){
  3130. var self=this,$self=this;
  3131. var result;
  3132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3133. return $core.withContext(function($ctx1) {
  3134. //>>excludeEnd("ctx");
  3135. var $1;
  3136. $recv((function(){
  3137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3138. return $core.withContext(function($ctx2) {
  3139. //>>excludeEnd("ctx");
  3140. result=$self._basicParse_(aString);
  3141. return result;
  3142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3144. //>>excludeEnd("ctx");
  3145. }))._tryCatch_((function(ex){
  3146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3147. return $core.withContext(function($ctx2) {
  3148. //>>excludeEnd("ctx");
  3149. return $recv($self._parseError_parsing_(ex,aString))._signal();
  3150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3151. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  3152. //>>excludeEnd("ctx");
  3153. }));
  3154. $1=result;
  3155. $recv($1)._source_(aString);
  3156. return $recv($1)._yourself();
  3157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3158. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  3159. //>>excludeEnd("ctx");
  3160. },
  3161. //>>excludeStart("ide", pragmas.excludeIdeData);
  3162. args: ["aString"],
  3163. 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",
  3164. referencedClasses: [],
  3165. //>>excludeEnd("ide");
  3166. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  3167. }),
  3168. $globals.SmalltalkImage);
  3169. $core.addMethod(
  3170. $core.method({
  3171. selector: "parseError:parsing:",
  3172. protocol: "error handling",
  3173. fn: function (anException,aString){
  3174. var self=this,$self=this;
  3175. var pos;
  3176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3177. return $core.withContext(function($ctx1) {
  3178. //>>excludeEnd("ctx");
  3179. var $1,$2,$6,$5,$4,$3;
  3180. $1=$recv(anException)._basicAt_("location");
  3181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3182. $ctx1.sendIdx["basicAt:"]=1;
  3183. //>>excludeEnd("ctx");
  3184. pos=$recv($1)._start();
  3185. $2=$recv($globals.ParseError)._new();
  3186. $6=$recv("Parse error on line ".__comma($recv(pos)._line())).__comma(" column ");
  3187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3188. $ctx1.sendIdx[","]=4;
  3189. //>>excludeEnd("ctx");
  3190. $5=$recv($6).__comma($recv(pos)._column());
  3191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3192. $ctx1.sendIdx[","]=3;
  3193. //>>excludeEnd("ctx");
  3194. $4=$recv($5).__comma(" : Unexpected character ");
  3195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3196. $ctx1.sendIdx[","]=2;
  3197. //>>excludeEnd("ctx");
  3198. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  3199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3200. $ctx1.sendIdx[","]=1;
  3201. //>>excludeEnd("ctx");
  3202. return $recv($2)._messageText_($3);
  3203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3204. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString,pos:pos},$globals.SmalltalkImage)});
  3205. //>>excludeEnd("ctx");
  3206. },
  3207. //>>excludeStart("ide", pragmas.excludeIdeData);
  3208. args: ["anException", "aString"],
  3209. 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')",
  3210. referencedClasses: ["ParseError"],
  3211. //>>excludeEnd("ide");
  3212. messageSends: ["start", "basicAt:", "messageText:", "new", ",", "line", "column"]
  3213. }),
  3214. $globals.SmalltalkImage);
  3215. $core.addMethod(
  3216. $core.method({
  3217. selector: "pseudoVariableNames",
  3218. protocol: "accessing",
  3219. fn: function (){
  3220. var self=this,$self=this;
  3221. return ["self", "super", "nil", "true", "false", "thisContext"];
  3222. },
  3223. //>>excludeStart("ide", pragmas.excludeIdeData);
  3224. args: [],
  3225. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  3226. referencedClasses: [],
  3227. //>>excludeEnd("ide");
  3228. messageSends: []
  3229. }),
  3230. $globals.SmalltalkImage);
  3231. $core.addMethod(
  3232. $core.method({
  3233. selector: "readJSObject:",
  3234. protocol: "accessing",
  3235. fn: function (anObject){
  3236. var self=this,$self=this;
  3237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3238. return $core.withContext(function($ctx1) {
  3239. //>>excludeEnd("ctx");
  3240. return $core.readJSObject(anObject);
  3241. return self;
  3242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3243. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  3244. //>>excludeEnd("ctx");
  3245. },
  3246. //>>excludeStart("ide", pragmas.excludeIdeData);
  3247. args: ["anObject"],
  3248. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  3249. referencedClasses: [],
  3250. //>>excludeEnd("ide");
  3251. messageSends: []
  3252. }),
  3253. $globals.SmalltalkImage);
  3254. $core.addMethod(
  3255. $core.method({
  3256. selector: "removeClass:",
  3257. protocol: "classes",
  3258. fn: function (aClass){
  3259. var self=this,$self=this;
  3260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3261. return $core.withContext(function($ctx1) {
  3262. //>>excludeEnd("ctx");
  3263. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  3264. $1=$recv(aClass)._isMetaclass();
  3265. if($core.assert($1)){
  3266. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  3267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3268. $ctx1.sendIdx[","]=1;
  3269. //>>excludeEnd("ctx");
  3270. $self._error_($2);
  3271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3272. $ctx1.sendIdx["error:"]=1;
  3273. //>>excludeEnd("ctx");
  3274. }
  3275. $recv(aClass)._allSubclassesDo_((function(subclass){
  3276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3277. return $core.withContext(function($ctx2) {
  3278. //>>excludeEnd("ctx");
  3279. $5=$recv(aClass)._name();
  3280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3281. $ctx2.sendIdx["name"]=1;
  3282. //>>excludeEnd("ctx");
  3283. $4=$recv($5).__comma(" has a subclass: ");
  3284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3285. $ctx2.sendIdx[","]=3;
  3286. //>>excludeEnd("ctx");
  3287. $6=$recv(subclass)._name();
  3288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3289. $ctx2.sendIdx["name"]=2;
  3290. //>>excludeEnd("ctx");
  3291. $3=$recv($4).__comma($6);
  3292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3293. $ctx2.sendIdx[","]=2;
  3294. //>>excludeEnd("ctx");
  3295. return $self._error_($3);
  3296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3297. $ctx2.sendIdx["error:"]=2;
  3298. //>>excludeEnd("ctx");
  3299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3300. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  3301. //>>excludeEnd("ctx");
  3302. }));
  3303. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  3304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3305. return $core.withContext(function($ctx2) {
  3306. //>>excludeEnd("ctx");
  3307. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  3308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  3310. //>>excludeEnd("ctx");
  3311. }));
  3312. $self._deleteClass_(aClass);
  3313. $recv(aClass)._setTraitComposition_([]);
  3314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3315. $ctx1.sendIdx["setTraitComposition:"]=1;
  3316. //>>excludeEnd("ctx");
  3317. $7=$recv(aClass)._theMetaClass();
  3318. if(($receiver = $7) == null || $receiver.a$nil){
  3319. $7;
  3320. } else {
  3321. var meta;
  3322. meta=$receiver;
  3323. $recv(meta)._setTraitComposition_([]);
  3324. }
  3325. $8=$recv($globals.SystemAnnouncer)._current();
  3326. $10=$recv($globals.ClassRemoved)._new();
  3327. $recv($10)._theClass_(aClass);
  3328. $9=$recv($10)._yourself();
  3329. $recv($8)._announce_($9);
  3330. return self;
  3331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3332. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  3333. //>>excludeEnd("ctx");
  3334. },
  3335. //>>excludeStart("ide", pragmas.excludeIdeData);
  3336. args: ["aClass"],
  3337. 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)",
  3338. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  3339. //>>excludeEnd("ide");
  3340. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  3341. }),
  3342. $globals.SmalltalkImage);
  3343. $core.addMethod(
  3344. $core.method({
  3345. selector: "removePackage:",
  3346. protocol: "packages",
  3347. fn: function (packageName){
  3348. var self=this,$self=this;
  3349. var pkg;
  3350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3351. return $core.withContext(function($ctx1) {
  3352. //>>excludeEnd("ctx");
  3353. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  3354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3355. return $core.withContext(function($ctx2) {
  3356. //>>excludeEnd("ctx");
  3357. return $self._error_("Missing package: ".__comma(packageName));
  3358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3360. //>>excludeEnd("ctx");
  3361. }));
  3362. $recv($recv(pkg)._classes())._do_((function(each){
  3363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3364. return $core.withContext(function($ctx2) {
  3365. //>>excludeEnd("ctx");
  3366. return $self._removeClass_(each);
  3367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3368. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3369. //>>excludeEnd("ctx");
  3370. }));
  3371. $recv($self._packageDictionary())._removeKey_(packageName);
  3372. return self;
  3373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3374. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  3375. //>>excludeEnd("ctx");
  3376. },
  3377. //>>excludeStart("ide", pragmas.excludeIdeData);
  3378. args: ["packageName"],
  3379. 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",
  3380. referencedClasses: [],
  3381. //>>excludeEnd("ide");
  3382. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  3383. }),
  3384. $globals.SmalltalkImage);
  3385. $core.addMethod(
  3386. $core.method({
  3387. selector: "renamePackage:to:",
  3388. protocol: "packages",
  3389. fn: function (packageName,newName){
  3390. var self=this,$self=this;
  3391. var pkg;
  3392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3393. return $core.withContext(function($ctx1) {
  3394. //>>excludeEnd("ctx");
  3395. var $1,$2,$3,$receiver;
  3396. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  3397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3398. return $core.withContext(function($ctx2) {
  3399. //>>excludeEnd("ctx");
  3400. $1="Missing package: ".__comma(packageName);
  3401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3402. $ctx2.sendIdx[","]=1;
  3403. //>>excludeEnd("ctx");
  3404. return $self._error_($1);
  3405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3406. $ctx2.sendIdx["error:"]=1;
  3407. //>>excludeEnd("ctx");
  3408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3410. //>>excludeEnd("ctx");
  3411. }));
  3412. $2=$self._packageAt_(newName);
  3413. if(($receiver = $2) == null || $receiver.a$nil){
  3414. $2;
  3415. } else {
  3416. $self._error_("Already exists a package called: ".__comma(newName));
  3417. }
  3418. $recv(pkg)._name_(newName);
  3419. $3=$self._packageDictionary();
  3420. $recv($3)._at_put_(newName,pkg);
  3421. $recv($3)._removeKey_(packageName);
  3422. return self;
  3423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3424. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  3425. //>>excludeEnd("ctx");
  3426. },
  3427. //>>excludeStart("ide", pragmas.excludeIdeData);
  3428. args: ["packageName", "newName"],
  3429. 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\x09(self packageAt: newName) ifNotNil: [ self error: 'Already exists a package called: ', newName ].\x0a\x09pkg name: newName.\x0a\x09self packageDictionary\x0a\x09\x09at: newName put: pkg;\x0a\x09\x09removeKey: packageName",
  3430. referencedClasses: [],
  3431. //>>excludeEnd("ide");
  3432. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "at:put:", "packageDictionary", "removeKey:"]
  3433. }),
  3434. $globals.SmalltalkImage);
  3435. $core.addMethod(
  3436. $core.method({
  3437. selector: "reservedWords",
  3438. protocol: "accessing",
  3439. fn: function (){
  3440. var self=this,$self=this;
  3441. 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"];
  3442. },
  3443. //>>excludeStart("ide", pragmas.excludeIdeData);
  3444. args: [],
  3445. 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)",
  3446. referencedClasses: [],
  3447. //>>excludeEnd("ide");
  3448. messageSends: []
  3449. }),
  3450. $globals.SmalltalkImage);
  3451. $core.addMethod(
  3452. $core.method({
  3453. selector: "settings",
  3454. protocol: "accessing",
  3455. fn: function (){
  3456. var self=this,$self=this;
  3457. return $globals.SmalltalkSettings;
  3458. },
  3459. //>>excludeStart("ide", pragmas.excludeIdeData);
  3460. args: [],
  3461. source: "settings\x0a\x09^ SmalltalkSettings",
  3462. referencedClasses: ["SmalltalkSettings"],
  3463. //>>excludeEnd("ide");
  3464. messageSends: []
  3465. }),
  3466. $globals.SmalltalkImage);
  3467. $core.addMethod(
  3468. $core.method({
  3469. selector: "version",
  3470. protocol: "accessing",
  3471. fn: function (){
  3472. var self=this,$self=this;
  3473. return "0.20.0-pre";
  3474. },
  3475. //>>excludeStart("ide", pragmas.excludeIdeData);
  3476. args: [],
  3477. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.20.0-pre'",
  3478. referencedClasses: [],
  3479. //>>excludeEnd("ide");
  3480. messageSends: []
  3481. }),
  3482. $globals.SmalltalkImage);
  3483. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  3484. $core.addMethod(
  3485. $core.method({
  3486. selector: "current",
  3487. protocol: "instance creation",
  3488. fn: function (){
  3489. var self=this,$self=this;
  3490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3491. return $core.withContext(function($ctx1) {
  3492. //>>excludeEnd("ctx");
  3493. var $1,$receiver;
  3494. $1=$self["@current"];
  3495. if(($receiver = $1) == null || $receiver.a$nil){
  3496. $self["@current"]=(
  3497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3498. $ctx1.supercall = true,
  3499. //>>excludeEnd("ctx");
  3500. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  3501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3502. $ctx1.supercall = false;
  3503. //>>excludeEnd("ctx");;
  3504. return $self["@current"];
  3505. } else {
  3506. $self._deprecatedAPI();
  3507. return $self["@current"];
  3508. }
  3509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3510. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  3511. //>>excludeEnd("ctx");
  3512. },
  3513. //>>excludeStart("ide", pragmas.excludeIdeData);
  3514. args: [],
  3515. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  3516. referencedClasses: [],
  3517. //>>excludeEnd("ide");
  3518. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  3519. }),
  3520. $globals.SmalltalkImage.a$cls);
  3521. $core.addMethod(
  3522. $core.method({
  3523. selector: "initialize",
  3524. protocol: "initialization",
  3525. fn: function (){
  3526. var self=this,$self=this;
  3527. var st;
  3528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3529. return $core.withContext(function($ctx1) {
  3530. //>>excludeEnd("ctx");
  3531. st=$self._current();
  3532. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  3533. return self;
  3534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3535. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  3536. //>>excludeEnd("ctx");
  3537. },
  3538. //>>excludeStart("ide", pragmas.excludeIdeData);
  3539. args: [],
  3540. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  3541. referencedClasses: [],
  3542. //>>excludeEnd("ide");
  3543. messageSends: ["current", "at:put:", "globals"]
  3544. }),
  3545. $globals.SmalltalkImage.a$cls);
  3546. $core.addMethod(
  3547. $core.method({
  3548. selector: "new",
  3549. protocol: "instance creation",
  3550. fn: function (){
  3551. var self=this,$self=this;
  3552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3553. return $core.withContext(function($ctx1) {
  3554. //>>excludeEnd("ctx");
  3555. $self._shouldNotImplement();
  3556. return self;
  3557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3558. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  3559. //>>excludeEnd("ctx");
  3560. },
  3561. //>>excludeStart("ide", pragmas.excludeIdeData);
  3562. args: [],
  3563. source: "new\x0a\x09self shouldNotImplement",
  3564. referencedClasses: [],
  3565. //>>excludeEnd("ide");
  3566. messageSends: ["shouldNotImplement"]
  3567. }),
  3568. $globals.SmalltalkImage.a$cls);
  3569. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  3570. $core.addMethod(
  3571. $core.method({
  3572. selector: "nextPutJSObject:",
  3573. protocol: "*Kernel-Infrastructure",
  3574. fn: function (aJSObject){
  3575. var self=this,$self=this;
  3576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3577. return $core.withContext(function($ctx1) {
  3578. //>>excludeEnd("ctx");
  3579. $self._nextPut_(aJSObject);
  3580. return self;
  3581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3582. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  3583. //>>excludeEnd("ctx");
  3584. },
  3585. //>>excludeStart("ide", pragmas.excludeIdeData);
  3586. args: ["aJSObject"],
  3587. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  3588. referencedClasses: [],
  3589. //>>excludeEnd("ide");
  3590. messageSends: ["nextPut:"]
  3591. }),
  3592. $globals.ProtoStream);
  3593. $core.addMethod(
  3594. $core.method({
  3595. selector: "asJavaScriptPropertyName",
  3596. protocol: "*Kernel-Infrastructure",
  3597. fn: function (){
  3598. var self=this,$self=this;
  3599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3600. return $core.withContext(function($ctx1) {
  3601. //>>excludeEnd("ctx");
  3602. return $core.st2prop(self);
  3603. return self;
  3604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3605. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  3606. //>>excludeEnd("ctx");
  3607. },
  3608. //>>excludeStart("ide", pragmas.excludeIdeData);
  3609. args: [],
  3610. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  3611. referencedClasses: [],
  3612. //>>excludeEnd("ide");
  3613. messageSends: []
  3614. }),
  3615. $globals.String);
  3616. $core.addMethod(
  3617. $core.method({
  3618. selector: "asSetting",
  3619. protocol: "*Kernel-Infrastructure",
  3620. fn: function (){
  3621. var self=this,$self=this;
  3622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3623. return $core.withContext(function($ctx1) {
  3624. //>>excludeEnd("ctx");
  3625. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  3626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3627. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  3628. //>>excludeEnd("ctx");
  3629. },
  3630. //>>excludeStart("ide", pragmas.excludeIdeData);
  3631. args: [],
  3632. 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",
  3633. referencedClasses: ["Setting"],
  3634. //>>excludeEnd("ide");
  3635. messageSends: ["at:ifAbsent:"]
  3636. }),
  3637. $globals.String);
  3638. $core.addMethod(
  3639. $core.method({
  3640. selector: "asSettingIfAbsent:",
  3641. protocol: "*Kernel-Infrastructure",
  3642. fn: function (aDefaultValue){
  3643. var self=this,$self=this;
  3644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3645. return $core.withContext(function($ctx1) {
  3646. //>>excludeEnd("ctx");
  3647. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  3648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3649. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  3650. //>>excludeEnd("ctx");
  3651. },
  3652. //>>excludeStart("ide", pragmas.excludeIdeData);
  3653. args: ["aDefaultValue"],
  3654. 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",
  3655. referencedClasses: ["Setting"],
  3656. //>>excludeEnd("ide");
  3657. messageSends: ["at:ifAbsent:"]
  3658. }),
  3659. $globals.String);
  3660. $core.addMethod(
  3661. $core.method({
  3662. selector: "settingValue",
  3663. protocol: "*Kernel-Infrastructure",
  3664. fn: function (){
  3665. var self=this,$self=this;
  3666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3667. return $core.withContext(function($ctx1) {
  3668. //>>excludeEnd("ctx");
  3669. return $recv($self._asSetting())._value();
  3670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3671. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  3672. //>>excludeEnd("ctx");
  3673. },
  3674. //>>excludeStart("ide", pragmas.excludeIdeData);
  3675. args: [],
  3676. source: "settingValue\x0a\x09^ self asSetting value",
  3677. referencedClasses: [],
  3678. //>>excludeEnd("ide");
  3679. messageSends: ["value", "asSetting"]
  3680. }),
  3681. $globals.String);
  3682. $core.addMethod(
  3683. $core.method({
  3684. selector: "settingValue:",
  3685. protocol: "*Kernel-Infrastructure",
  3686. fn: function (aValue){
  3687. var self=this,$self=this;
  3688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3689. return $core.withContext(function($ctx1) {
  3690. //>>excludeEnd("ctx");
  3691. return $recv($self._asSetting())._value_(aValue);
  3692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3693. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  3694. //>>excludeEnd("ctx");
  3695. },
  3696. //>>excludeStart("ide", pragmas.excludeIdeData);
  3697. args: ["aValue"],
  3698. 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",
  3699. referencedClasses: [],
  3700. //>>excludeEnd("ide");
  3701. messageSends: ["value:", "asSetting"]
  3702. }),
  3703. $globals.String);
  3704. $core.addMethod(
  3705. $core.method({
  3706. selector: "settingValueIfAbsent:",
  3707. protocol: "*Kernel-Infrastructure",
  3708. fn: function (aDefaultValue){
  3709. var self=this,$self=this;
  3710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3711. return $core.withContext(function($ctx1) {
  3712. //>>excludeEnd("ctx");
  3713. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  3714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3715. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  3716. //>>excludeEnd("ctx");
  3717. },
  3718. //>>excludeStart("ide", pragmas.excludeIdeData);
  3719. args: ["aDefaultValue"],
  3720. 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",
  3721. referencedClasses: [],
  3722. //>>excludeEnd("ide");
  3723. messageSends: ["value", "asSettingIfAbsent:"]
  3724. }),
  3725. $globals.String);
  3726. });