Platform-ImportExport.js 165 KB

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