Kernel-Infrastructure.js 137 KB

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