Platform-ImportExport.js 182 KB

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