Platform-ImportExport.js 183 KB

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