Platform-ImportExport.js 181 KB

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