Platform-ImportExport.js 174 KB

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