2
0

Platform-ImportExport.js 167 KB

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