Platform-ImportExport.js 177 KB

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