1
0

Kernel-ImportExport.js 151 KB

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