Importer-Exporter.js 117 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863
  1. define("amber/Importer-Exporter", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber/Kernel-Objects", "amber/Kernel-Infrastructure"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Importer-Exporter');
  3. smalltalk.packages["Importer-Exporter"].transport = {"type":"amd","amdNamespace":"amber"};
  4. smalltalk.addClass('AbstractExporter', smalltalk.Object, [], 'Importer-Exporter');
  5. smalltalk.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.";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "chunkEscape:",
  9. category: 'convenience',
  10. fn: function (aString){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. var $1;
  14. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  15. return $1;
  16. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},smalltalk.AbstractExporter)})},
  17. args: ["aString"],
  18. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^(aString replace: '!' with: '!!') trimBoth",
  19. messageSends: ["trimBoth", "replace:with:"],
  20. referencedClasses: []
  21. }),
  22. smalltalk.AbstractExporter);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "classNameFor:",
  26. category: 'convenience',
  27. fn: function (aClass){
  28. var self=this;
  29. return smalltalk.withContext(function($ctx1) {
  30. var $2,$3,$1;
  31. $2=_st(aClass)._isMetaclass();
  32. if(smalltalk.assert($2)){
  33. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
  34. } else {
  35. $3=_st(aClass)._isNil();
  36. if(smalltalk.assert($3)){
  37. $1="nil";
  38. } else {
  39. $1=_st(aClass)._name();
  40. };
  41. };
  42. return $1;
  43. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.AbstractExporter)})},
  44. args: ["aClass"],
  45. 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 ] ]",
  46. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
  47. referencedClasses: []
  48. }),
  49. smalltalk.AbstractExporter);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "exportPackage:on:",
  53. category: 'output',
  54. fn: function (aPackage,aStream){
  55. var self=this;
  56. return smalltalk.withContext(function($ctx1) {
  57. self._subclassResponsibility();
  58. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AbstractExporter)})},
  59. args: ["aPackage", "aStream"],
  60. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  61. messageSends: ["subclassResponsibility"],
  62. referencedClasses: []
  63. }),
  64. smalltalk.AbstractExporter);
  65. smalltalk.addMethod(
  66. smalltalk.method({
  67. selector: "extensionMethodsOfPackage:",
  68. category: 'accessing',
  69. fn: function (aPackage){
  70. var self=this;
  71. var result;
  72. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  73. return smalltalk.withContext(function($ctx1) {
  74. var $1;
  75. result=_st($OrderedCollection())._new();
  76. _st(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  77. return smalltalk.withContext(function($ctx2) {
  78. return _st(result)._addAll_(_st(each)._methods());
  79. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  80. $1=result;
  81. return $1;
  82. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},smalltalk.AbstractExporter)})},
  83. args: ["aPackage"],
  84. 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",
  85. messageSends: ["new", "do:", "addAll:", "methods", "extensionProtocolsOfPackage:"],
  86. referencedClasses: ["OrderedCollection"]
  87. }),
  88. smalltalk.AbstractExporter);
  89. smalltalk.addMethod(
  90. smalltalk.method({
  91. selector: "extensionProtocolsOfPackage:",
  92. category: 'accessing',
  93. fn: function (aPackage){
  94. var self=this;
  95. var extensionName,result;
  96. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  97. function $ExportMethodProtocol(){return smalltalk.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  98. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  99. return smalltalk.withContext(function($ctx1) {
  100. var $1,$2;
  101. extensionName="*".__comma(_st(aPackage)._name());
  102. result=_st($OrderedCollection())._new();
  103. _st(_st(_st($Smalltalk())._current())._classes())._do_((function(each){
  104. return smalltalk.withContext(function($ctx2) {
  105. return _st([each,_st(each)._class()])._do_((function(behavior){
  106. return smalltalk.withContext(function($ctx3) {
  107. $1=_st(_st(behavior)._protocols())._includes_(extensionName);
  108. if(smalltalk.assert($1)){
  109. return _st(result)._add_(_st($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  110. };
  111. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2)})}));
  112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  113. $2=result;
  114. return $2;
  115. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},smalltalk.AbstractExporter)})},
  116. args: ["aPackage"],
  117. 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 sorting (dependency resolution) does not matter here.\x0a\x09Not sorting improves the speed by a number of magnitude.\x22\x0a\x09\x0a\x09Smalltalk current classes 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",
  118. messageSends: [",", "name", "new", "do:", "ifTrue:", "add:", "name:theClass:", "includes:", "protocols", "class", "classes", "current"],
  119. referencedClasses: ["OrderedCollection", "ExportMethodProtocol", "Smalltalk"]
  120. }),
  121. smalltalk.AbstractExporter);
  122. smalltalk.addClass('ChunkExporter', smalltalk.AbstractExporter, [], 'Importer-Exporter');
  123. smalltalk.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.";
  124. smalltalk.addMethod(
  125. smalltalk.method({
  126. selector: "exportCategoryEpilogueOf:on:",
  127. category: 'output',
  128. fn: function (aCategory,aStream){
  129. var self=this;
  130. return smalltalk.withContext(function($ctx1) {
  131. var $1,$2;
  132. $1=aStream;
  133. _st($1)._nextPutAll_(" !");
  134. _st($1)._lf();
  135. $2=_st($1)._lf();
  136. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},smalltalk.ChunkExporter)})},
  137. args: ["aCategory", "aStream"],
  138. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  139. messageSends: ["nextPutAll:", "lf"],
  140. referencedClasses: []
  141. }),
  142. smalltalk.ChunkExporter);
  143. smalltalk.addMethod(
  144. smalltalk.method({
  145. selector: "exportCategoryPrologueOf:on:",
  146. category: 'output',
  147. fn: function (aCategory,aStream){
  148. var self=this;
  149. return smalltalk.withContext(function($ctx1) {
  150. var $1,$2;
  151. $1=aStream;
  152. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(aCategory)._theClass())));
  153. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(aCategory)._name())).__comma("'!"));
  154. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},smalltalk.ChunkExporter)})},
  155. args: ["aCategory", "aStream"],
  156. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  157. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
  158. referencedClasses: []
  159. }),
  160. smalltalk.ChunkExporter);
  161. smalltalk.addMethod(
  162. smalltalk.method({
  163. selector: "exportDefinitionOf:on:",
  164. category: 'output',
  165. fn: function (aClass,aStream){
  166. var self=this;
  167. return smalltalk.withContext(function($ctx1) {
  168. var $1,$2,$3,$4,$5,$6,$7;
  169. $1=aStream;
  170. _st($1)._nextPutAll_(self._classNameFor_(_st(aClass)._superclass()));
  171. _st($1)._nextPutAll_(" subclass: #".__comma(self._classNameFor_(aClass)));
  172. _st($1)._lf();
  173. _st($1)._tab();
  174. $2=_st($1)._nextPutAll_("instanceVariableNames: '");
  175. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  176. return smalltalk.withContext(function($ctx2) {
  177. return _st(aStream)._nextPutAll_(each);
  178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  179. return smalltalk.withContext(function($ctx2) {
  180. return _st(aStream)._nextPutAll_(" ");
  181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  182. $3=aStream;
  183. _st($3)._nextPutAll_("'");
  184. _st($3)._lf();
  185. _st($3)._tab();
  186. _st($3)._nextPutAll_(_st("package: '".__comma(_st(aClass)._category())).__comma("'!"));
  187. $4=_st($3)._lf();
  188. $5=_st(_st(aClass)._comment())._notEmpty();
  189. if(smalltalk.assert($5)){
  190. $6=aStream;
  191. _st($6)._nextPutAll_(_st("!".__comma(self._classNameFor_(aClass))).__comma(" commentStamp!"));
  192. _st($6)._lf();
  193. _st($6)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  194. $7=_st($6)._lf();
  195. $7;
  196. };
  197. _st(aStream)._lf();
  198. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  199. args: ["aClass", "aStream"],
  200. 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",
  201. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"],
  202. referencedClasses: []
  203. }),
  204. smalltalk.ChunkExporter);
  205. smalltalk.addMethod(
  206. smalltalk.method({
  207. selector: "exportMetaDefinitionOf:on:",
  208. category: 'output',
  209. fn: function (aClass,aStream){
  210. var self=this;
  211. return smalltalk.withContext(function($ctx1) {
  212. var $1,$2,$3,$4,$5;
  213. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  214. if(! smalltalk.assert($1)){
  215. $2=aStream;
  216. _st($2)._nextPutAll_(self._classNameFor_(_st(aClass)._class()));
  217. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  218. $3;
  219. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  220. return smalltalk.withContext(function($ctx2) {
  221. return _st(aStream)._nextPutAll_(each);
  222. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  223. return smalltalk.withContext(function($ctx2) {
  224. return _st(aStream)._nextPutAll_(" ");
  225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  226. $4=aStream;
  227. _st($4)._nextPutAll_("'!");
  228. _st($4)._lf();
  229. $5=_st($4)._lf();
  230. $5;
  231. };
  232. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  233. args: ["aClass", "aStream"],
  234. 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]",
  235. messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"],
  236. referencedClasses: []
  237. }),
  238. smalltalk.ChunkExporter);
  239. smalltalk.addMethod(
  240. smalltalk.method({
  241. selector: "exportMethod:on:",
  242. category: 'output',
  243. fn: function (aMethod,aStream){
  244. var self=this;
  245. return smalltalk.withContext(function($ctx1) {
  246. var $1,$2;
  247. $1=aStream;
  248. _st($1)._lf();
  249. _st($1)._lf();
  250. _st($1)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  251. _st($1)._lf();
  252. $2=_st($1)._nextPutAll_("!");
  253. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.ChunkExporter)})},
  254. args: ["aMethod", "aStream"],
  255. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  256. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"],
  257. referencedClasses: []
  258. }),
  259. smalltalk.ChunkExporter);
  260. smalltalk.addMethod(
  261. smalltalk.method({
  262. selector: "exportPackage:on:",
  263. category: 'output',
  264. fn: function (aPackage,aStream){
  265. var self=this;
  266. return smalltalk.withContext(function($ctx1) {
  267. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  268. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  269. return smalltalk.withContext(function($ctx2) {
  270. self._exportDefinitionOf_on_(each,aStream);
  271. self._exportProtocols_on_(self._ownMethodProtocolsOfClass_(each),aStream);
  272. self._exportMetaDefinitionOf_on_(each,aStream);
  273. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_(_st(each)._class()),aStream);
  274. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  275. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  276. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.ChunkExporter)})},
  277. args: ["aPackage", "aStream"],
  278. source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self exportPackageDefinitionOf: 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",
  279. messageSends: ["exportPackageDefinitionOf:on:", "do:", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "sortedClasses", "extensionProtocolsOfPackage:"],
  280. referencedClasses: []
  281. }),
  282. smalltalk.ChunkExporter);
  283. smalltalk.addMethod(
  284. smalltalk.method({
  285. selector: "exportPackageDefinitionOf:on:",
  286. category: 'output',
  287. fn: function (aPackage,aStream){
  288. var self=this;
  289. return smalltalk.withContext(function($ctx1) {
  290. var $1,$2;
  291. $1=aStream;
  292. _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(aPackage)._name())).__comma("'!"));
  293. $2=_st($1)._lf();
  294. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.ChunkExporter)})},
  295. args: ["aPackage", "aStream"],
  296. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk current createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  297. messageSends: ["nextPutAll:", ",", "name", "lf"],
  298. referencedClasses: []
  299. }),
  300. smalltalk.ChunkExporter);
  301. smalltalk.addMethod(
  302. smalltalk.method({
  303. selector: "exportProtocol:on:",
  304. category: 'output',
  305. fn: function (aProtocol,aStream){
  306. var self=this;
  307. return smalltalk.withContext(function($ctx1) {
  308. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  309. _st(_st(aProtocol)._methods())._do_((function(method){
  310. return smalltalk.withContext(function($ctx2) {
  311. return self._exportMethod_on_(method,aStream);
  312. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1)})}));
  313. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  314. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},smalltalk.ChunkExporter)})},
  315. args: ["aProtocol", "aStream"],
  316. 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",
  317. messageSends: ["exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "methods", "exportProtocolEpilogueOf:on:"],
  318. referencedClasses: []
  319. }),
  320. smalltalk.ChunkExporter);
  321. smalltalk.addMethod(
  322. smalltalk.method({
  323. selector: "exportProtocolEpilogueOf:on:",
  324. category: 'output',
  325. fn: function (aProtocol,aStream){
  326. var self=this;
  327. return smalltalk.withContext(function($ctx1) {
  328. var $1,$2;
  329. $1=aStream;
  330. _st($1)._nextPutAll_(" !");
  331. _st($1)._lf();
  332. $2=_st($1)._lf();
  333. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},smalltalk.ChunkExporter)})},
  334. args: ["aProtocol", "aStream"],
  335. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  336. messageSends: ["nextPutAll:", "lf"],
  337. referencedClasses: []
  338. }),
  339. smalltalk.ChunkExporter);
  340. smalltalk.addMethod(
  341. smalltalk.method({
  342. selector: "exportProtocolPrologueOf:on:",
  343. category: 'output',
  344. fn: function (aProtocol,aStream){
  345. var self=this;
  346. return smalltalk.withContext(function($ctx1) {
  347. var $1,$2;
  348. $1=aStream;
  349. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(aProtocol)._theClass())));
  350. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(aProtocol)._name())).__comma("'!"));
  351. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},smalltalk.ChunkExporter)})},
  352. args: ["aProtocol", "aStream"],
  353. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  354. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
  355. referencedClasses: []
  356. }),
  357. smalltalk.ChunkExporter);
  358. smalltalk.addMethod(
  359. smalltalk.method({
  360. selector: "exportProtocols:on:",
  361. category: 'output',
  362. fn: function (aCollection,aStream){
  363. var self=this;
  364. return smalltalk.withContext(function($ctx1) {
  365. _st(aCollection)._do_((function(each){
  366. return smalltalk.withContext(function($ctx2) {
  367. return self._exportProtocol_on_(each,aStream);
  368. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  369. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},smalltalk.ChunkExporter)})},
  370. args: ["aCollection", "aStream"],
  371. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  372. messageSends: ["do:", "exportProtocol:on:"],
  373. referencedClasses: []
  374. }),
  375. smalltalk.ChunkExporter);
  376. smalltalk.addMethod(
  377. smalltalk.method({
  378. selector: "extensionCategoriesOfPackage:",
  379. category: 'accessing',
  380. fn: function (aPackage){
  381. var self=this;
  382. var name,map,result;
  383. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  384. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  385. function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  386. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  387. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  388. return smalltalk.withContext(function($ctx1) {
  389. var $1,$2;
  390. name=_st(aPackage)._name();
  391. result=_st($OrderedCollection())._new();
  392. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  393. return smalltalk.withContext(function($ctx2) {
  394. return _st([each,_st(each)._class()])._do_((function(aClass){
  395. return smalltalk.withContext(function($ctx3) {
  396. map=_st($Dictionary())._new();
  397. map;
  398. _st(aClass)._protocolsDo_((function(category,methods){
  399. return smalltalk.withContext(function($ctx4) {
  400. $1=_st(category).__eq("*".__comma(name));
  401. if(smalltalk.assert($1)){
  402. return _st(map)._at_put_(category,methods);
  403. };
  404. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  405. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  406. return smalltalk.withContext(function($ctx4) {
  407. return _st(a).__lt_eq(b);
  408. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._collect_((function(category){
  409. return smalltalk.withContext(function($ctx4) {
  410. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  411. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3)})})));
  412. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  413. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  414. $2=result;
  415. return $2;
  416. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},smalltalk.ChunkExporter)})},
  417. args: ["aPackage"],
  418. 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 current 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",
  419. messageSends: ["name", "new", "do:", "protocolsDo:", "ifTrue:", "at:put:", "=", ",", "addAll:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"],
  420. referencedClasses: ["OrderedCollection", "Dictionary", "MethodCategory", "Smalltalk", "Package"]
  421. }),
  422. smalltalk.ChunkExporter);
  423. smalltalk.addMethod(
  424. smalltalk.method({
  425. selector: "methodsOfCategory:",
  426. category: 'accessing',
  427. fn: function (aCategory){
  428. var self=this;
  429. return smalltalk.withContext(function($ctx1) {
  430. var $1;
  431. $1=_st(_st(aCategory)._methods())._sorted_((function(a,b){
  432. return smalltalk.withContext(function($ctx2) {
  433. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  434. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  435. return $1;
  436. }, function($ctx1) {$ctx1.fill(self,"methodsOfCategory:",{aCategory:aCategory},smalltalk.ChunkExporter)})},
  437. args: ["aCategory"],
  438. source: "methodsOfCategory: aCategory\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^(aCategory methods) sorted: [ :a :b | a selector <= b selector ]",
  439. messageSends: ["sorted:", "<=", "selector", "methods"],
  440. referencedClasses: []
  441. }),
  442. smalltalk.ChunkExporter);
  443. smalltalk.addMethod(
  444. smalltalk.method({
  445. selector: "ownCategoriesOfClass:",
  446. category: 'accessing',
  447. fn: function (aClass){
  448. var self=this;
  449. var map;
  450. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  451. function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  452. return smalltalk.withContext(function($ctx1) {
  453. var $1,$2;
  454. map=_st($Dictionary())._new();
  455. _st(aClass)._protocolsDo_((function(each,methods){
  456. return smalltalk.withContext(function($ctx2) {
  457. $1=_st(each)._match_("^\x5c*");
  458. if(! smalltalk.assert($1)){
  459. return _st(map)._at_put_(each,methods);
  460. };
  461. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1)})}));
  462. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  463. return smalltalk.withContext(function($ctx2) {
  464. return _st(a).__lt_eq(b);
  465. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._collect_((function(each){
  466. return smalltalk.withContext(function($ctx2) {
  467. return _st($MethodCategory())._name_theClass_methods_(each,aClass,_st(map)._at_(each));
  468. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  469. return $2;
  470. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},smalltalk.ChunkExporter)})},
  471. args: ["aClass"],
  472. 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) ]",
  473. messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys"],
  474. referencedClasses: ["Dictionary", "MethodCategory"]
  475. }),
  476. smalltalk.ChunkExporter);
  477. smalltalk.addMethod(
  478. smalltalk.method({
  479. selector: "ownCategoriesOfMetaClass:",
  480. category: 'accessing',
  481. fn: function (aClass){
  482. var self=this;
  483. return smalltalk.withContext(function($ctx1) {
  484. var $1;
  485. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  486. return $1;
  487. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},smalltalk.ChunkExporter)})},
  488. args: ["aClass"],
  489. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^self ownCategoriesOfClass: aClass class",
  490. messageSends: ["ownCategoriesOfClass:", "class"],
  491. referencedClasses: []
  492. }),
  493. smalltalk.ChunkExporter);
  494. smalltalk.addMethod(
  495. smalltalk.method({
  496. selector: "ownMethodProtocolsOfClass:",
  497. category: 'accessing',
  498. fn: function (aClass){
  499. var self=this;
  500. function $ExportMethodProtocol(){return smalltalk.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  501. return smalltalk.withContext(function($ctx1) {
  502. var $1;
  503. $1=_st(_st(aClass)._ownProtocols())._collect_((function(each){
  504. return smalltalk.withContext(function($ctx2) {
  505. return _st($ExportMethodProtocol())._name_theClass_(each,aClass);
  506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  507. return $1;
  508. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},smalltalk.ChunkExporter)})},
  509. args: ["aClass"],
  510. 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 ]",
  511. messageSends: ["collect:", "name:theClass:", "ownProtocols"],
  512. referencedClasses: ["ExportMethodProtocol"]
  513. }),
  514. smalltalk.ChunkExporter);
  515. smalltalk.addMethod(
  516. smalltalk.method({
  517. selector: "recipe",
  518. category: 'fileOut',
  519. fn: function (){
  520. var self=this;
  521. var exportCategoryRecipe;
  522. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  523. return smalltalk.withContext(function($ctx1) {
  524. var $1;
  525. exportCategoryRecipe=[self.__minus_gt("exportCategoryPrologueOf:on:"),[self.__minus_gt("methodsOfCategory:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportCategoryEpilogueOf:on:")];
  526. $1=[self.__minus_gt("exportPackageDefinitionOf:on:"),[_st($PluggableExporter()).__minus_gt("ownClassesOfPackage:"),self.__minus_gt("exportDefinitionOf:on:"),_st([self.__minus_gt("ownCategoriesOfClass:")]).__comma(exportCategoryRecipe),self.__minus_gt("exportMetaDefinitionOf:on:"),_st([self.__minus_gt("ownCategoriesOfMetaClass:")]).__comma(exportCategoryRecipe)],_st([self.__minus_gt("extensionCategoriesOfPackage:")]).__comma(exportCategoryRecipe)];
  527. return $1;
  528. }, function($ctx1) {$ctx1.fill(self,"recipe",{exportCategoryRecipe:exportCategoryRecipe},smalltalk.ChunkExporter)})},
  529. args: [],
  530. source: "recipe\x0a\x09\x22Export a given package.\x22\x0a\x0a\x09| exportCategoryRecipe |\x0a\x09exportCategoryRecipe := {\x0a\x09\x09self -> #exportCategoryPrologueOf:on:.\x0a\x09\x09{\x0a\x09\x09\x09self -> #methodsOfCategory:.\x0a\x09\x09\x09self -> #exportMethod:on: }.\x0a\x09\x09self -> #exportCategoryEpilogueOf:on: }.\x0a\x0a\x09^{\x0a\x09\x09self -> #exportPackageDefinitionOf:on:.\x0a\x09\x09{\x0a\x09\x09\x09PluggableExporter -> #ownClassesOfPackage:.\x0a\x09\x09\x09self -> #exportDefinitionOf:on:.\x0a\x09\x09\x09{ self -> #ownCategoriesOfClass: }, exportCategoryRecipe.\x0a\x09\x09\x09self -> #exportMetaDefinitionOf:on:.\x0a\x09\x09\x09{ self -> #ownCategoriesOfMetaClass: }, exportCategoryRecipe }.\x0a\x09\x09{ self -> #extensionCategoriesOfPackage: }, exportCategoryRecipe\x0a\x09}",
  531. messageSends: ["->", ","],
  532. referencedClasses: ["PluggableExporter"]
  533. }),
  534. smalltalk.ChunkExporter);
  535. smalltalk.addClass('Exporter', smalltalk.AbstractExporter, [], 'Importer-Exporter');
  536. smalltalk.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.).";
  537. smalltalk.addMethod(
  538. smalltalk.method({
  539. selector: "amdRecipe",
  540. category: 'fileOut',
  541. fn: function (){
  542. var self=this;
  543. var result;
  544. function $AmdExporter(){return smalltalk.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  545. return smalltalk.withContext(function($ctx1) {
  546. var $1;
  547. result=self._recipe();
  548. _st(_st(result)._first())._key_($AmdExporter());
  549. _st(_st(result)._last())._key_($AmdExporter());
  550. $1=result;
  551. return $1;
  552. }, function($ctx1) {$ctx1.fill(self,"amdRecipe",{result:result},smalltalk.Exporter)})},
  553. args: [],
  554. source: "amdRecipe\x0a\x09\x22Export a given package with amd transport type.\x22\x0a\x0a\x09| result |\x0a\x09result := self recipe.\x0a\x09result first key: AmdExporter.\x0a\x09result last key: AmdExporter.\x0a\x09^result",
  555. messageSends: ["recipe", "key:", "first", "last"],
  556. referencedClasses: ["AmdExporter"]
  557. }),
  558. smalltalk.Exporter);
  559. smalltalk.addMethod(
  560. smalltalk.method({
  561. selector: "classNameFor:",
  562. category: 'convenience',
  563. fn: function (aClass){
  564. var self=this;
  565. return smalltalk.withContext(function($ctx1) {
  566. var $2,$3,$1;
  567. $2=_st(aClass)._isMetaclass();
  568. if(smalltalk.assert($2)){
  569. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  570. } else {
  571. $3=_st(aClass)._isNil();
  572. if(smalltalk.assert($3)){
  573. $1="nil";
  574. } else {
  575. $1=_st(aClass)._name();
  576. };
  577. };
  578. return $1;
  579. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.Exporter)})},
  580. args: ["aClass"],
  581. source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]",
  582. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
  583. referencedClasses: []
  584. }),
  585. smalltalk.Exporter);
  586. smalltalk.addMethod(
  587. smalltalk.method({
  588. selector: "exportDefinitionOf:on:",
  589. category: 'output',
  590. fn: function (aClass,aStream){
  591. var self=this;
  592. return smalltalk.withContext(function($ctx1) {
  593. var $1,$2,$3,$4,$5,$6,$7;
  594. $1=aStream;
  595. _st($1)._lf();
  596. _st($1)._nextPutAll_("smalltalk.addClass(");
  597. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  598. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  599. $2=_st($1)._nextPutAll_(", [");
  600. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  601. return smalltalk.withContext(function($ctx2) {
  602. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  603. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  604. return smalltalk.withContext(function($ctx2) {
  605. return _st(aStream)._nextPutAll_(", ");
  606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  607. $3=aStream;
  608. _st($3)._nextPutAll_("], '");
  609. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  610. $4=_st($3)._nextPutAll_(");");
  611. $5=_st(_st(aClass)._comment())._notEmpty();
  612. if(smalltalk.assert($5)){
  613. $6=aStream;
  614. _st($6)._lf();
  615. _st($6)._nextPutAll_("smalltalk.");
  616. _st($6)._nextPutAll_(self._classNameFor_(aClass));
  617. _st($6)._nextPutAll_(".comment=");
  618. _st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  619. $7=_st($6)._nextPutAll_(";");
  620. $7;
  621. };
  622. _st(aStream)._lf();
  623. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  624. args: ["aClass", "aStream"],
  625. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: 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\x09nextPutAll: 'smalltalk.';\x0a\x09\x09nextPutAll: (self classNameFor: aClass);\x0a\x09\x09nextPutAll: '.comment=';\x0a\x09\x09nextPutAll: aClass comment asJavascript;\x0a\x09\x09nextPutAll: ';'].\x0a\x09aStream lf",
  626. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "asJavascript", "comment", "notEmpty"],
  627. referencedClasses: []
  628. }),
  629. smalltalk.Exporter);
  630. smalltalk.addMethod(
  631. smalltalk.method({
  632. selector: "exportMetaDefinitionOf:on:",
  633. category: 'output',
  634. fn: function (aClass,aStream){
  635. var self=this;
  636. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  637. return smalltalk.withContext(function($ctx1) {
  638. var $1,$2,$3;
  639. _st(aStream)._lf();
  640. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  641. if(! smalltalk.assert($1)){
  642. $2=aStream;
  643. _st($2)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._class())));
  644. $3=_st($2)._nextPutAll_(".iVarNames = [");
  645. $3;
  646. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  647. return smalltalk.withContext(function($ctx2) {
  648. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  649. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  650. return smalltalk.withContext(function($ctx2) {
  651. return _st(aStream)._nextPutAll_(",");
  652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  653. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  654. };
  655. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  656. args: ["aClass", "aStream"],
  657. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: 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]",
  658. messageSends: ["lf", "ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "isEmpty"],
  659. referencedClasses: ["String"]
  660. }),
  661. smalltalk.Exporter);
  662. smalltalk.addMethod(
  663. smalltalk.method({
  664. selector: "exportMethod:on:",
  665. category: 'output',
  666. fn: function (aMethod,aStream){
  667. var self=this;
  668. return smalltalk.withContext(function($ctx1) {
  669. var $1,$2,$3,$4;
  670. $1=aStream;
  671. _st($1)._nextPutAll_("smalltalk.addMethod(");
  672. _st($1)._lf();
  673. _st($1)._nextPutAll_("smalltalk.method({");
  674. _st($1)._lf();
  675. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  676. _st($1)._lf();
  677. _st($1)._nextPutAll_(_st("category: '".__comma(_st(aMethod)._category())).__comma("',"));
  678. _st($1)._lf();
  679. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  680. _st($1)._lf();
  681. _st($1)._nextPutAll_(_st("args: ".__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
  682. _st($1)._lf();
  683. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  684. _st($1)._lf();
  685. _st($1)._nextPutAll_(_st("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
  686. _st($1)._lf();
  687. $2=_st($1)._nextPutAll_("referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
  688. $3=aStream;
  689. _st($3)._lf();
  690. _st($3)._nextPutAll_("}),");
  691. _st($3)._lf();
  692. _st($3)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  693. _st($3)._nextPutAll_(");");
  694. _st($3)._lf();
  695. $4=_st($3)._lf();
  696. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.Exporter)})},
  697. args: ["aMethod", "aStream"],
  698. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09\x22nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x22\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'category: ''', aMethod category, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  699. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:", "methodClass"],
  700. referencedClasses: []
  701. }),
  702. smalltalk.Exporter);
  703. smalltalk.addMethod(
  704. smalltalk.method({
  705. selector: "exportPackage:on:",
  706. category: 'output',
  707. fn: function (aPackage,aStream){
  708. var self=this;
  709. return smalltalk.withContext(function($ctx1) {
  710. var $1,$2;
  711. $1=self;
  712. _st($1)._exportPackagePrologueOf_on_(aPackage,aStream);
  713. _st($1)._exportPackageDefinitionOf_on_(aPackage,aStream);
  714. $2=_st($1)._exportPackageTransportOf_on_(aPackage,aStream);
  715. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  716. return smalltalk.withContext(function($ctx2) {
  717. self._exportDefinitionOf_on_(each,aStream);
  718. _st(_st(each)._ownMethods())._do_((function(method){
  719. return smalltalk.withContext(function($ctx3) {
  720. return self._exportMethod_on_(method,aStream);
  721. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2)})}));
  722. self._exportMetaDefinitionOf_on_(each,aStream);
  723. return _st(_st(_st(each)._class())._ownMethods())._do_((function(method){
  724. return smalltalk.withContext(function($ctx3) {
  725. return self._exportMethod_on_(method,aStream);
  726. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2)})}));
  727. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  728. _st(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  729. return smalltalk.withContext(function($ctx2) {
  730. return self._exportMethod_on_(each,aStream);
  731. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  732. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  733. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  734. args: ["aPackage", "aStream"],
  735. source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: 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",
  736. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageTransportOf:on:", "do:", "exportDefinitionOf:on:", "exportMethod:on:", "ownMethods", "exportMetaDefinitionOf:on:", "class", "sortedClasses", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"],
  737. referencedClasses: []
  738. }),
  739. smalltalk.Exporter);
  740. smalltalk.addMethod(
  741. smalltalk.method({
  742. selector: "exportPackageDefinitionOf:on:",
  743. category: 'output',
  744. fn: function (aPackage,aStream){
  745. var self=this;
  746. return smalltalk.withContext(function($ctx1) {
  747. var $1,$2;
  748. $1=aStream;
  749. _st($1)._nextPutAll_("smalltalk.addPackage(");
  750. _st($1)._nextPutAll_(_st("'".__comma(_st(aPackage)._name())).__comma("');"));
  751. $2=_st($1)._lf();
  752. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  753. args: ["aPackage", "aStream"],
  754. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  755. messageSends: ["nextPutAll:", ",", "name", "lf"],
  756. referencedClasses: []
  757. }),
  758. smalltalk.Exporter);
  759. smalltalk.addMethod(
  760. smalltalk.method({
  761. selector: "exportPackageEpilogueOf:on:",
  762. category: 'output',
  763. fn: function (aPackage,aStream){
  764. var self=this;
  765. return smalltalk.withContext(function($ctx1) {
  766. var $1,$2;
  767. $1=aStream;
  768. _st($1)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  769. $2=_st($1)._lf();
  770. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  771. args: ["aPackage", "aStream"],
  772. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '})(global_smalltalk,global_nil,global__st);';\x0a\x09\x09lf",
  773. messageSends: ["nextPutAll:", "lf"],
  774. referencedClasses: []
  775. }),
  776. smalltalk.Exporter);
  777. smalltalk.addMethod(
  778. smalltalk.method({
  779. selector: "exportPackagePrologueOf:on:",
  780. category: 'output',
  781. fn: function (aPackage,aStream){
  782. var self=this;
  783. return smalltalk.withContext(function($ctx1) {
  784. var $1,$2;
  785. $1=aStream;
  786. _st($1)._nextPutAll_("(function(smalltalk,nil,_st){");
  787. $2=_st($1)._lf();
  788. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  789. args: ["aPackage", "aStream"],
  790. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '(function(smalltalk,nil,_st){';\x0a\x09\x09lf",
  791. messageSends: ["nextPutAll:", "lf"],
  792. referencedClasses: []
  793. }),
  794. smalltalk.Exporter);
  795. smalltalk.addMethod(
  796. smalltalk.method({
  797. selector: "exportPackageTransportOf:on:",
  798. category: 'output',
  799. fn: function (aPackage,aStream){
  800. var self=this;
  801. var json;
  802. return smalltalk.withContext(function($ctx1) {
  803. var $1,$2,$3;
  804. json=_st(aPackage)._transportJson();
  805. $1=_st(json).__eq("null");
  806. if(! smalltalk.assert($1)){
  807. $2=aStream;
  808. _st($2)._nextPutAll_("smalltalk.packages[");
  809. _st($2)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
  810. _st($2)._nextPutAll_("].transport = ");
  811. _st($2)._nextPutAll_(json);
  812. _st($2)._nextPutAll_(";");
  813. $3=_st($2)._lf();
  814. $3;
  815. };
  816. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream,json:json},smalltalk.Exporter)})},
  817. args: ["aPackage", "aStream"],
  818. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09| json |\x0a\x09json := aPackage transportJson.\x0a\x09json = 'null' ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: 'smalltalk.packages[';\x0a\x09\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09\x09nextPutAll: '].transport = ';\x0a\x09\x09\x09nextPutAll: json;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf ]",
  819. messageSends: ["transportJson", "ifFalse:", "nextPutAll:", "asJavascript", "name", "lf", "="],
  820. referencedClasses: []
  821. }),
  822. smalltalk.Exporter);
  823. smalltalk.addMethod(
  824. smalltalk.method({
  825. selector: "ownMethodsOfClass:",
  826. category: 'accessing',
  827. fn: function (aClass){
  828. var self=this;
  829. return smalltalk.withContext(function($ctx1) {
  830. var $1;
  831. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  832. return smalltalk.withContext(function($ctx2) {
  833. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  834. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._reject_((function(each){
  835. return smalltalk.withContext(function($ctx2) {
  836. return _st(_st(each)._category())._match_("^\x5c*");
  837. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  838. return $1;
  839. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},smalltalk.Exporter)})},
  840. args: ["aClass"],
  841. 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 category match: '^\x5c*')]",
  842. messageSends: ["reject:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary"],
  843. referencedClasses: []
  844. }),
  845. smalltalk.Exporter);
  846. smalltalk.addMethod(
  847. smalltalk.method({
  848. selector: "ownMethodsOfMetaClass:",
  849. category: 'accessing',
  850. fn: function (aClass){
  851. var self=this;
  852. return smalltalk.withContext(function($ctx1) {
  853. var $1;
  854. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  855. return $1;
  856. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},smalltalk.Exporter)})},
  857. args: ["aClass"],
  858. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^self ownMethodsOfClass: aClass class",
  859. messageSends: ["ownMethodsOfClass:", "class"],
  860. referencedClasses: []
  861. }),
  862. smalltalk.Exporter);
  863. smalltalk.addMethod(
  864. smalltalk.method({
  865. selector: "recipe",
  866. category: 'fileOut',
  867. fn: function (){
  868. var self=this;
  869. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  870. return smalltalk.withContext(function($ctx1) {
  871. var $1;
  872. $1=[self.__minus_gt("exportPackagePrologueOf:on:"),self.__minus_gt("exportPackageDefinitionOf:on:"),self.__minus_gt("exportPackageTransportOf:on:"),[_st($PluggableExporter()).__minus_gt("ownClassesOfPackage:"),self.__minus_gt("exportDefinitionOf:on:"),[self.__minus_gt("ownMethodsOfClass:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportMetaDefinitionOf:on:"),[self.__minus_gt("ownMethodsOfMetaClass:"),self.__minus_gt("exportMethod:on:")]],[self.__minus_gt("extensionMethodsOfPackage:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportPackageEpilogueOf:on:")];
  873. return $1;
  874. }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.Exporter)})},
  875. args: [],
  876. source: "recipe\x0a\x09\x22Export a given package.\x22\x0a\x0a\x09^{\x0a\x09\x09self -> #exportPackagePrologueOf:on:.\x0a\x09\x09self -> #exportPackageDefinitionOf:on:.\x0a\x09\x09self -> #exportPackageTransportOf:on:.\x0a\x09\x09{\x0a\x09\x09\x09PluggableExporter -> #ownClassesOfPackage:.\x0a\x09\x09\x09self -> #exportDefinitionOf:on:.\x0a\x09\x09\x09{\x0a\x09\x09\x09\x09self -> #ownMethodsOfClass:.\x0a\x09\x09\x09\x09self -> #exportMethod:on: }.\x0a\x09\x09\x09self -> #exportMetaDefinitionOf:on:.\x0a\x09\x09\x09{\x0a\x09\x09\x09\x09self -> #ownMethodsOfMetaClass:.\x0a\x09\x09\x09\x09self -> #exportMethod:on: } }.\x0a\x09\x09{\x0a\x09\x09\x09self -> #extensionMethodsOfPackage:.\x0a\x09\x09\x09self -> #exportMethod:on: }.\x0a\x09\x09self -> #exportPackageEpilogueOf:on:\x0a\x09}",
  877. messageSends: ["->"],
  878. referencedClasses: ["PluggableExporter"]
  879. }),
  880. smalltalk.Exporter);
  881. smalltalk.addClass('AmdExporter', smalltalk.Exporter, ['namespace'], 'Importer-Exporter');
  882. smalltalk.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  883. smalltalk.addMethod(
  884. smalltalk.method({
  885. selector: "amdNamesOfPackages:",
  886. category: 'private',
  887. fn: function (anArray){
  888. var self=this;
  889. return smalltalk.withContext(function($ctx1) {
  890. var $1;
  891. $1=_st(_st(anArray)._select_((function(each){
  892. return smalltalk.withContext(function($ctx2) {
  893. return _st(self._amdNamespaceOfPackage_(each))._notNil();
  894. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._collect_((function(each){
  895. return smalltalk.withContext(function($ctx2) {
  896. return _st(_st(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma(_st(each)._name());
  897. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  898. return $1;
  899. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},smalltalk.AmdExporter)})},
  900. args: ["anArray"],
  901. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  902. messageSends: ["collect:", ",", "name", "amdNamespaceOfPackage:", "select:", "notNil"],
  903. referencedClasses: []
  904. }),
  905. smalltalk.AmdExporter);
  906. smalltalk.addMethod(
  907. smalltalk.method({
  908. selector: "amdNamespaceOfPackage:",
  909. category: 'private',
  910. fn: function (aPackage){
  911. var self=this;
  912. return smalltalk.withContext(function($ctx1) {
  913. var $2,$1;
  914. $2=_st(_st(_st(aPackage)._transport())._type()).__eq("amd");
  915. if(smalltalk.assert($2)){
  916. $1=_st(_st(aPackage)._transport())._namespace();
  917. } else {
  918. $1=nil;
  919. };
  920. return $1;
  921. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},smalltalk.AmdExporter)})},
  922. args: ["aPackage"],
  923. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  924. messageSends: ["ifTrue:ifFalse:", "namespace", "transport", "=", "type"],
  925. referencedClasses: []
  926. }),
  927. smalltalk.AmdExporter);
  928. smalltalk.addMethod(
  929. smalltalk.method({
  930. selector: "exportPackageEpilogueOf:on:",
  931. category: 'output',
  932. fn: function (aPackage,aStream){
  933. var self=this;
  934. return smalltalk.withContext(function($ctx1) {
  935. var $1,$2;
  936. $1=aStream;
  937. _st($1)._nextPutAll_("});");
  938. $2=_st($1)._lf();
  939. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter)})},
  940. args: ["aPackage", "aStream"],
  941. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  942. messageSends: ["nextPutAll:", "lf"],
  943. referencedClasses: []
  944. }),
  945. smalltalk.AmdExporter);
  946. smalltalk.addMethod(
  947. smalltalk.method({
  948. selector: "exportPackagePrologueOf:on:",
  949. category: 'output',
  950. fn: function (aPackage,aStream){
  951. var self=this;
  952. return smalltalk.withContext(function($ctx1) {
  953. var $1,$2;
  954. $1=aStream;
  955. _st($1)._nextPutAll_("define(\x22");
  956. _st($1)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  957. _st($1)._nextPutAll_("/");
  958. _st($1)._nextPutAll_(_st(aPackage)._name());
  959. _st($1)._nextPutAll_("\x22, ");
  960. _st($1)._nextPutAll_(_st(["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._asJavascript());
  961. _st($1)._nextPutAll_(", function(smalltalk,nil,_st){");
  962. $2=_st($1)._lf();
  963. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter)})},
  964. args: ["aPackage", "aStream"],
  965. source: "exportPackagePrologueOf: aPackage on: aStream\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: (#('amber_vm/smalltalk' 'amber_vm/nil' 'amber_vm/_st'), (self amdNamesOfPackages: aPackage loadDependencies)) asJavascript;\x0a\x09\x09nextPutAll: ', function(smalltalk,nil,_st){';\x0a\x09\x09lf",
  966. messageSends: ["nextPutAll:", "amdNamespaceOfPackage:", "name", "asJavascript", ",", "amdNamesOfPackages:", "loadDependencies", "lf"],
  967. referencedClasses: []
  968. }),
  969. smalltalk.AmdExporter);
  970. smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
  971. smalltalk.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";
  972. smalltalk.addMethod(
  973. smalltalk.method({
  974. selector: "nextChunk",
  975. category: 'reading',
  976. fn: function (){
  977. var self=this;
  978. var char,result,chunk;
  979. return smalltalk.withContext(function($ctx1) {
  980. var $1,$2,$3;
  981. var $early={};
  982. try {
  983. result=""._writeStream();
  984. _st((function(){
  985. return smalltalk.withContext(function($ctx2) {
  986. char=_st(self["@stream"])._next();
  987. char;
  988. return _st(char)._notNil();
  989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  990. return smalltalk.withContext(function($ctx2) {
  991. $1=_st(char).__eq("!");
  992. if(smalltalk.assert($1)){
  993. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  994. if(smalltalk.assert($2)){
  995. _st(self["@stream"])._next();
  996. } else {
  997. $3=_st(_st(result)._contents())._trimBoth();
  998. throw $early=[$3];
  999. };
  1000. };
  1001. return _st(result)._nextPut_(char);
  1002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1003. return nil;
  1004. }
  1005. catch(e) {if(e===$early)return e[0]; throw e}
  1006. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},smalltalk.ChunkParser)})},
  1007. args: [],
  1008. 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: [^result contents trimBoth \x22chunk end marker found\x22]].\x0a\x09\x09\x09\x09result nextPut: char].\x0a\x09^nil \x22a chunk needs to end with !\x22",
  1009. messageSends: ["writeStream", "whileTrue:", "ifTrue:", "ifTrue:ifFalse:", "next", "trimBoth", "contents", "=", "peek", "nextPut:", "notNil"],
  1010. referencedClasses: []
  1011. }),
  1012. smalltalk.ChunkParser);
  1013. smalltalk.addMethod(
  1014. smalltalk.method({
  1015. selector: "stream:",
  1016. category: 'accessing',
  1017. fn: function (aStream){
  1018. var self=this;
  1019. return smalltalk.withContext(function($ctx1) {
  1020. self["@stream"]=aStream;
  1021. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.ChunkParser)})},
  1022. args: ["aStream"],
  1023. source: "stream: aStream\x0a\x09stream := aStream",
  1024. messageSends: [],
  1025. referencedClasses: []
  1026. }),
  1027. smalltalk.ChunkParser);
  1028. smalltalk.addMethod(
  1029. smalltalk.method({
  1030. selector: "on:",
  1031. category: 'instance creation',
  1032. fn: function (aStream){
  1033. var self=this;
  1034. return smalltalk.withContext(function($ctx1) {
  1035. var $1;
  1036. $1=_st(self._new())._stream_(aStream);
  1037. return $1;
  1038. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},smalltalk.ChunkParser.klass)})},
  1039. args: ["aStream"],
  1040. source: "on: aStream\x0a\x09^self new stream: aStream",
  1041. messageSends: ["stream:", "new"],
  1042. referencedClasses: []
  1043. }),
  1044. smalltalk.ChunkParser.klass);
  1045. smalltalk.addClass('ExportMethodProtocol', smalltalk.Object, ['name', 'theClass'], 'Importer-Exporter');
  1046. smalltalk.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.";
  1047. smalltalk.addMethod(
  1048. smalltalk.method({
  1049. selector: "methods",
  1050. category: 'accessing',
  1051. fn: function (){
  1052. var self=this;
  1053. return smalltalk.withContext(function($ctx1) {
  1054. var $1;
  1055. $1=_st(self._theClass())._methodsInProtocol_(self._name());
  1056. return $1;
  1057. }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.ExportMethodProtocol)})},
  1058. args: [],
  1059. source: "methods\x0a\x09^ self theClass methodsInProtocol: self name",
  1060. messageSends: ["methodsInProtocol:", "name", "theClass"],
  1061. referencedClasses: []
  1062. }),
  1063. smalltalk.ExportMethodProtocol);
  1064. smalltalk.addMethod(
  1065. smalltalk.method({
  1066. selector: "name",
  1067. category: 'accessing',
  1068. fn: function (){
  1069. var self=this;
  1070. return smalltalk.withContext(function($ctx1) {
  1071. var $1;
  1072. $1=self["@name"];
  1073. return $1;
  1074. }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.ExportMethodProtocol)})},
  1075. args: [],
  1076. source: "name\x0a\x09^name",
  1077. messageSends: [],
  1078. referencedClasses: []
  1079. }),
  1080. smalltalk.ExportMethodProtocol);
  1081. smalltalk.addMethod(
  1082. smalltalk.method({
  1083. selector: "name:",
  1084. category: 'accessing',
  1085. fn: function (aString){
  1086. var self=this;
  1087. return smalltalk.withContext(function($ctx1) {
  1088. self["@name"]=aString;
  1089. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.ExportMethodProtocol)})},
  1090. args: ["aString"],
  1091. source: "name: aString\x0a\x09name := aString",
  1092. messageSends: [],
  1093. referencedClasses: []
  1094. }),
  1095. smalltalk.ExportMethodProtocol);
  1096. smalltalk.addMethod(
  1097. smalltalk.method({
  1098. selector: "sortedMethods",
  1099. category: 'accessing',
  1100. fn: function (){
  1101. var self=this;
  1102. return smalltalk.withContext(function($ctx1) {
  1103. var $1;
  1104. $1=_st(self._methods())._sorted_((function(a,b){
  1105. return smalltalk.withContext(function($ctx2) {
  1106. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  1107. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  1108. return $1;
  1109. }, function($ctx1) {$ctx1.fill(self,"sortedMethods",{},smalltalk.ExportMethodProtocol)})},
  1110. args: [],
  1111. source: "sortedMethods\x0a\x09^ self methods sorted: [ :a :b | a selector <= b selector ]",
  1112. messageSends: ["sorted:", "<=", "selector", "methods"],
  1113. referencedClasses: []
  1114. }),
  1115. smalltalk.ExportMethodProtocol);
  1116. smalltalk.addMethod(
  1117. smalltalk.method({
  1118. selector: "theClass",
  1119. category: 'accessing',
  1120. fn: function (){
  1121. var self=this;
  1122. return smalltalk.withContext(function($ctx1) {
  1123. var $1;
  1124. $1=self["@theClass"];
  1125. return $1;
  1126. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ExportMethodProtocol)})},
  1127. args: [],
  1128. source: "theClass\x0a\x09^theClass",
  1129. messageSends: [],
  1130. referencedClasses: []
  1131. }),
  1132. smalltalk.ExportMethodProtocol);
  1133. smalltalk.addMethod(
  1134. smalltalk.method({
  1135. selector: "theClass:",
  1136. category: 'accessing',
  1137. fn: function (aClass){
  1138. var self=this;
  1139. return smalltalk.withContext(function($ctx1) {
  1140. self["@theClass"]=aClass;
  1141. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ExportMethodProtocol)})},
  1142. args: ["aClass"],
  1143. source: "theClass: aClass\x0a\x09theClass := aClass",
  1144. messageSends: [],
  1145. referencedClasses: []
  1146. }),
  1147. smalltalk.ExportMethodProtocol);
  1148. smalltalk.addMethod(
  1149. smalltalk.method({
  1150. selector: "name:theClass:",
  1151. category: 'instance creation',
  1152. fn: function (aString,aClass){
  1153. var self=this;
  1154. return smalltalk.withContext(function($ctx1) {
  1155. var $2,$3,$1;
  1156. $2=self._new();
  1157. _st($2)._name_(aString);
  1158. _st($2)._theClass_(aClass);
  1159. $3=_st($2)._yourself();
  1160. $1=$3;
  1161. return $1;
  1162. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},smalltalk.ExportMethodProtocol.klass)})},
  1163. args: ["aString", "aClass"],
  1164. source: "name: aString theClass: aClass\x0a\x09^self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  1165. messageSends: ["name:", "new", "theClass:", "yourself"],
  1166. referencedClasses: []
  1167. }),
  1168. smalltalk.ExportMethodProtocol.klass);
  1169. smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
  1170. smalltalk.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "import:",
  1174. category: 'fileIn',
  1175. fn: function (aStream){
  1176. var self=this;
  1177. var chunk,result,parser,lastEmpty;
  1178. function $ChunkParser(){return smalltalk.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  1179. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1180. return smalltalk.withContext(function($ctx1) {
  1181. var $1,$2;
  1182. parser=_st($ChunkParser())._on_(aStream);
  1183. lastEmpty=false;
  1184. _st((function(){
  1185. return smalltalk.withContext(function($ctx2) {
  1186. chunk=_st(parser)._nextChunk();
  1187. chunk;
  1188. return _st(chunk)._isNil();
  1189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  1190. return smalltalk.withContext(function($ctx2) {
  1191. $1=_st(chunk)._isEmpty();
  1192. if(smalltalk.assert($1)){
  1193. lastEmpty=true;
  1194. return lastEmpty;
  1195. } else {
  1196. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  1197. result;
  1198. $2=lastEmpty;
  1199. if(smalltalk.assert($2)){
  1200. lastEmpty=false;
  1201. lastEmpty;
  1202. return _st(result)._scanFrom_(parser);
  1203. };
  1204. };
  1205. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1206. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},smalltalk.Importer)})},
  1207. args: ["aStream"],
  1208. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\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\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]]]",
  1209. messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"],
  1210. referencedClasses: ["ChunkParser", "Compiler"]
  1211. }),
  1212. smalltalk.Importer);
  1213. smalltalk.addClass('MethodCategory', smalltalk.Object, ['methods', 'name', 'theClass'], 'Importer-Exporter');
  1214. smalltalk.MethodCategory.comment="I am an abstraction for a method category in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package.";
  1215. smalltalk.addMethod(
  1216. smalltalk.method({
  1217. selector: "methods",
  1218. category: 'accessing',
  1219. fn: function (){
  1220. var self=this;
  1221. return smalltalk.withContext(function($ctx1) {
  1222. var $1;
  1223. $1=self["@methods"];
  1224. return $1;
  1225. }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.MethodCategory)})},
  1226. args: [],
  1227. source: "methods\x0a\x09^methods",
  1228. messageSends: [],
  1229. referencedClasses: []
  1230. }),
  1231. smalltalk.MethodCategory);
  1232. smalltalk.addMethod(
  1233. smalltalk.method({
  1234. selector: "methods:",
  1235. category: 'accessing',
  1236. fn: function (aCollection){
  1237. var self=this;
  1238. return smalltalk.withContext(function($ctx1) {
  1239. self["@methods"]=aCollection;
  1240. return self}, function($ctx1) {$ctx1.fill(self,"methods:",{aCollection:aCollection},smalltalk.MethodCategory)})},
  1241. args: ["aCollection"],
  1242. source: "methods: aCollection\x0a\x09methods := aCollection",
  1243. messageSends: [],
  1244. referencedClasses: []
  1245. }),
  1246. smalltalk.MethodCategory);
  1247. smalltalk.addMethod(
  1248. smalltalk.method({
  1249. selector: "name",
  1250. category: 'accessing',
  1251. fn: function (){
  1252. var self=this;
  1253. return smalltalk.withContext(function($ctx1) {
  1254. var $1;
  1255. $1=self["@name"];
  1256. return $1;
  1257. }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.MethodCategory)})},
  1258. args: [],
  1259. source: "name\x0a\x09^name",
  1260. messageSends: [],
  1261. referencedClasses: []
  1262. }),
  1263. smalltalk.MethodCategory);
  1264. smalltalk.addMethod(
  1265. smalltalk.method({
  1266. selector: "name:",
  1267. category: 'accessing',
  1268. fn: function (aString){
  1269. var self=this;
  1270. return smalltalk.withContext(function($ctx1) {
  1271. self["@name"]=aString;
  1272. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.MethodCategory)})},
  1273. args: ["aString"],
  1274. source: "name: aString\x0a\x09name := aString",
  1275. messageSends: [],
  1276. referencedClasses: []
  1277. }),
  1278. smalltalk.MethodCategory);
  1279. smalltalk.addMethod(
  1280. smalltalk.method({
  1281. selector: "theClass",
  1282. category: 'accessing',
  1283. fn: function (){
  1284. var self=this;
  1285. return smalltalk.withContext(function($ctx1) {
  1286. var $1;
  1287. $1=self["@theClass"];
  1288. return $1;
  1289. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.MethodCategory)})},
  1290. args: [],
  1291. source: "theClass\x0a\x09^theClass",
  1292. messageSends: [],
  1293. referencedClasses: []
  1294. }),
  1295. smalltalk.MethodCategory);
  1296. smalltalk.addMethod(
  1297. smalltalk.method({
  1298. selector: "theClass:",
  1299. category: 'accessing',
  1300. fn: function (aClass){
  1301. var self=this;
  1302. return smalltalk.withContext(function($ctx1) {
  1303. self["@theClass"]=aClass;
  1304. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.MethodCategory)})},
  1305. args: ["aClass"],
  1306. source: "theClass: aClass\x0a\x09theClass := aClass",
  1307. messageSends: [],
  1308. referencedClasses: []
  1309. }),
  1310. smalltalk.MethodCategory);
  1311. smalltalk.addMethod(
  1312. smalltalk.method({
  1313. selector: "name:theClass:methods:",
  1314. category: 'not yet classified',
  1315. fn: function (aString,aClass,anArray){
  1316. var self=this;
  1317. return smalltalk.withContext(function($ctx1) {
  1318. var $2,$3,$1;
  1319. $2=self._new();
  1320. _st($2)._name_(aString);
  1321. _st($2)._theClass_(aClass);
  1322. _st($2)._methods_(anArray);
  1323. $3=_st($2)._yourself();
  1324. $1=$3;
  1325. return $1;
  1326. }, function($ctx1) {$ctx1.fill(self,"name:theClass:methods:",{aString:aString,aClass:aClass,anArray:anArray},smalltalk.MethodCategory.klass)})},
  1327. args: ["aString", "aClass", "anArray"],
  1328. source: "name: aString theClass: aClass methods: anArray\x0a\x09^self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09methods: anArray;\x0a\x09\x09yourself",
  1329. messageSends: ["name:", "new", "theClass:", "methods:", "yourself"],
  1330. referencedClasses: []
  1331. }),
  1332. smalltalk.MethodCategory.klass);
  1333. smalltalk.addClass('PackageHandler', smalltalk.InterfacingObject, [], 'Importer-Exporter');
  1334. smalltalk.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  1335. smalltalk.addMethod(
  1336. smalltalk.method({
  1337. selector: "ajaxPutAt:data:",
  1338. category: 'private',
  1339. fn: function (aURL,aString){
  1340. var self=this;
  1341. return smalltalk.withContext(function($ctx1) {
  1342. self._ajax_(smalltalk.HashedCollection._from_(["url".__minus_gt(aURL),"type".__minus_gt("PUT"),"data".__minus_gt(aString),"contentType".__minus_gt("text/plain;charset=UTF-8"),"error".__minus_gt((function(xhr){
  1343. return smalltalk.withContext(function($ctx2) {
  1344. return self._error_(_st(_st(_st("Commiting ".__comma(aURL)).__comma(" failed with reason: \x22")).__comma(_st(xhr)._responseText())).__comma("\x22"));
  1345. }, function($ctx2) {$ctx2.fillBlock({xhr:xhr},$ctx1)})}))]));
  1346. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:",{aURL:aURL,aString:aString},smalltalk.PackageHandler)})},
  1347. args: ["aURL", "aString"],
  1348. source: "ajaxPutAt: aURL data: aString\x0a\x09self\x0a\x09\x09ajax: #{\x0a\x09\x09\x09'url' -> aURL.\x0a\x09\x09\x09'type' -> 'PUT'.\x0a\x09\x09\x09'data' -> aString.\x0a\x09\x09\x09'contentType' -> 'text/plain;charset=UTF-8'.\x0a\x09\x09\x09'error' -> [ :xhr | self error: 'Commiting ' , aURL , ' failed with reason: \x22' , (xhr responseText) , '\x22'] }",
  1349. messageSends: ["ajax:", "->", "error:", ",", "responseText"],
  1350. referencedClasses: []
  1351. }),
  1352. smalltalk.PackageHandler);
  1353. smalltalk.addMethod(
  1354. smalltalk.method({
  1355. selector: "chunkContentsFor:",
  1356. category: 'accessing',
  1357. fn: function (aPackage){
  1358. var self=this;
  1359. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1360. return smalltalk.withContext(function($ctx1) {
  1361. var $1;
  1362. $1=_st($String())._streamContents_((function(str){
  1363. return smalltalk.withContext(function($ctx2) {
  1364. return _st(self._chunkExporter())._exportPackage_on_(aPackage,str);
  1365. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1)})}));
  1366. return $1;
  1367. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1368. args: ["aPackage"],
  1369. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  1370. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"],
  1371. referencedClasses: ["String"]
  1372. }),
  1373. smalltalk.PackageHandler);
  1374. smalltalk.addMethod(
  1375. smalltalk.method({
  1376. selector: "chunkExporter",
  1377. category: 'factory',
  1378. fn: function (){
  1379. var self=this;
  1380. return smalltalk.withContext(function($ctx1) {
  1381. var $1;
  1382. $1=_st(self._chunkExporterClass())._new();
  1383. return $1;
  1384. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},smalltalk.PackageHandler)})},
  1385. args: [],
  1386. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  1387. messageSends: ["new", "chunkExporterClass"],
  1388. referencedClasses: []
  1389. }),
  1390. smalltalk.PackageHandler);
  1391. smalltalk.addMethod(
  1392. smalltalk.method({
  1393. selector: "chunkExporterClass",
  1394. category: 'accessing',
  1395. fn: function (){
  1396. var self=this;
  1397. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  1398. return smalltalk.withContext(function($ctx1) {
  1399. var $1;
  1400. $1=$ChunkExporter();
  1401. return $1;
  1402. }, function($ctx1) {$ctx1.fill(self,"chunkExporterClass",{},smalltalk.PackageHandler)})},
  1403. args: [],
  1404. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  1405. messageSends: [],
  1406. referencedClasses: ["ChunkExporter"]
  1407. }),
  1408. smalltalk.PackageHandler);
  1409. smalltalk.addMethod(
  1410. smalltalk.method({
  1411. selector: "commit:",
  1412. category: 'committing',
  1413. fn: function (aPackage){
  1414. var self=this;
  1415. return smalltalk.withContext(function($ctx1) {
  1416. _st([(function(){
  1417. return smalltalk.withContext(function($ctx2) {
  1418. return self._commitStFileFor_(aPackage);
  1419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  1420. return smalltalk.withContext(function($ctx2) {
  1421. return self._commitJsFileFor_(aPackage);
  1422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})])._do_displayingProgress_((function(each){
  1423. return smalltalk.withContext(function($ctx2) {
  1424. return _st(each)._value();
  1425. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),"Committing package ".__comma(_st(aPackage)._name()));
  1426. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1427. args: ["aPackage"],
  1428. source: "commit: aPackage\x0a\x09{\x0a\x09\x09[ self commitStFileFor: aPackage ].\x0a\x09\x09[ self commitJsFileFor: aPackage ]\x0a\x09}\x0a\x09\x09do: [ :each | each value ]\x0a\x09\x09displayingProgress: 'Committing package ', aPackage name",
  1429. messageSends: ["do:displayingProgress:", "value", ",", "name", "commitStFileFor:", "commitJsFileFor:"],
  1430. referencedClasses: []
  1431. }),
  1432. smalltalk.PackageHandler);
  1433. smalltalk.addMethod(
  1434. smalltalk.method({
  1435. selector: "commitJsFileFor:",
  1436. category: 'committing',
  1437. fn: function (aPackage){
  1438. var self=this;
  1439. return smalltalk.withContext(function($ctx1) {
  1440. self._ajaxPutAt_data_(_st(_st(_st(self._commitPathJsFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name())).__comma(".js"),self._contentsFor_(aPackage));
  1441. return self}, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1442. args: ["aPackage"],
  1443. source: "commitJsFileFor: aPackage\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'\x0a\x09\x09data: (self contentsFor: aPackage)",
  1444. messageSends: ["ajaxPutAt:data:", ",", "name", "commitPathJsFor:", "contentsFor:"],
  1445. referencedClasses: []
  1446. }),
  1447. smalltalk.PackageHandler);
  1448. smalltalk.addMethod(
  1449. smalltalk.method({
  1450. selector: "commitPathJsFor:",
  1451. category: 'accessing',
  1452. fn: function (aPackage){
  1453. var self=this;
  1454. return smalltalk.withContext(function($ctx1) {
  1455. self._subclassResponsibility();
  1456. return self}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1457. args: ["aPackage"],
  1458. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  1459. messageSends: ["subclassResponsibility"],
  1460. referencedClasses: []
  1461. }),
  1462. smalltalk.PackageHandler);
  1463. smalltalk.addMethod(
  1464. smalltalk.method({
  1465. selector: "commitPathStFor:",
  1466. category: 'accessing',
  1467. fn: function (aPackage){
  1468. var self=this;
  1469. return smalltalk.withContext(function($ctx1) {
  1470. self._subclassResponsibility();
  1471. return self}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1472. args: ["aPackage"],
  1473. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  1474. messageSends: ["subclassResponsibility"],
  1475. referencedClasses: []
  1476. }),
  1477. smalltalk.PackageHandler);
  1478. smalltalk.addMethod(
  1479. smalltalk.method({
  1480. selector: "commitStFileFor:",
  1481. category: 'committing',
  1482. fn: function (aPackage){
  1483. var self=this;
  1484. return smalltalk.withContext(function($ctx1) {
  1485. self._ajaxPutAt_data_(_st(_st(_st(self._commitPathStFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name())).__comma(".st"),self._chunkContentsFor_(aPackage));
  1486. return self}, function($ctx1) {$ctx1.fill(self,"commitStFileFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1487. args: ["aPackage"],
  1488. source: "commitStFileFor: aPackage\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'\x0a\x09\x09data: (self chunkContentsFor: aPackage)",
  1489. messageSends: ["ajaxPutAt:data:", ",", "name", "commitPathStFor:", "chunkContentsFor:"],
  1490. referencedClasses: []
  1491. }),
  1492. smalltalk.PackageHandler);
  1493. smalltalk.addMethod(
  1494. smalltalk.method({
  1495. selector: "contentsFor:",
  1496. category: 'accessing',
  1497. fn: function (aPackage){
  1498. var self=this;
  1499. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1500. return smalltalk.withContext(function($ctx1) {
  1501. var $1;
  1502. $1=_st($String())._streamContents_((function(str){
  1503. return smalltalk.withContext(function($ctx2) {
  1504. return _st(self._exporter())._exportPackage_on_(aPackage,str);
  1505. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1)})}));
  1506. return $1;
  1507. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1508. args: ["aPackage"],
  1509. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  1510. messageSends: ["streamContents:", "exportPackage:on:", "exporter"],
  1511. referencedClasses: ["String"]
  1512. }),
  1513. smalltalk.PackageHandler);
  1514. smalltalk.addMethod(
  1515. smalltalk.method({
  1516. selector: "exporter",
  1517. category: 'factory',
  1518. fn: function (){
  1519. var self=this;
  1520. return smalltalk.withContext(function($ctx1) {
  1521. var $1;
  1522. $1=_st(self._exporterClass())._new();
  1523. return $1;
  1524. }, function($ctx1) {$ctx1.fill(self,"exporter",{},smalltalk.PackageHandler)})},
  1525. args: [],
  1526. source: "exporter\x0a\x09^ self exporterClass new",
  1527. messageSends: ["new", "exporterClass"],
  1528. referencedClasses: []
  1529. }),
  1530. smalltalk.PackageHandler);
  1531. smalltalk.addMethod(
  1532. smalltalk.method({
  1533. selector: "exporterClass",
  1534. category: 'accessing',
  1535. fn: function (){
  1536. var self=this;
  1537. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  1538. return smalltalk.withContext(function($ctx1) {
  1539. var $1;
  1540. $1=$Exporter();
  1541. return $1;
  1542. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},smalltalk.PackageHandler)})},
  1543. args: [],
  1544. source: "exporterClass\x0a\x09^ Exporter",
  1545. messageSends: [],
  1546. referencedClasses: ["Exporter"]
  1547. }),
  1548. smalltalk.PackageHandler);
  1549. smalltalk.addMethod(
  1550. smalltalk.method({
  1551. selector: "oldCommit:",
  1552. category: 'committing',
  1553. fn: function (aPackage){
  1554. var self=this;
  1555. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  1556. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1557. return smalltalk.withContext(function($ctx1) {
  1558. _st(self._commitChannels())._do_displayingProgress_((function(commitStrategyFactory){
  1559. var fileContents,commitStrategy;
  1560. return smalltalk.withContext(function($ctx2) {
  1561. commitStrategy=_st(commitStrategyFactory)._value_(aPackage);
  1562. commitStrategy;
  1563. fileContents=_st($String())._streamContents_((function(stream){
  1564. return smalltalk.withContext(function($ctx3) {
  1565. return _st(_st($PluggableExporter())._forRecipe_(_st(commitStrategy)._key()))._exportPackage_on_(aPackage,stream);
  1566. }, function($ctx3) {$ctx3.fillBlock({stream:stream},$ctx2)})}));
  1567. fileContents;
  1568. return self._ajaxPutAt_data_(_st(commitStrategy)._value(),fileContents);
  1569. }, function($ctx2) {$ctx2.fillBlock({commitStrategyFactory:commitStrategyFactory,fileContents:fileContents,commitStrategy:commitStrategy},$ctx1)})}),"Committing package ".__comma(_st(aPackage)._name()));
  1570. return self}, function($ctx1) {$ctx1.fill(self,"oldCommit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1571. args: ["aPackage"],
  1572. source: "oldCommit: aPackage\x0a\x09\x0a\x09self commitChannels\x0a\x09\x09do: [ :commitStrategyFactory || fileContents commitStrategy |\x0a\x09\x09\x09commitStrategy := commitStrategyFactory value: aPackage.\x0a\x09\x09\x09fileContents := String streamContents: [ :stream |\x0a\x09\x09\x09\x09(PluggableExporter forRecipe: commitStrategy key) exportPackage: aPackage on: stream ].\x0a\x09\x09\x09self ajaxPutAt: commitStrategy value data: fileContents ]\x0a\x09\x09displayingProgress: 'Committing package ', aPackage name",
  1573. messageSends: ["do:displayingProgress:", "value:", "streamContents:", "exportPackage:on:", "forRecipe:", "key", "ajaxPutAt:data:", "value", ",", "name", "commitChannels"],
  1574. referencedClasses: ["PluggableExporter", "String"]
  1575. }),
  1576. smalltalk.PackageHandler);
  1577. smalltalk.addClass('AmdPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  1578. smalltalk.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  1579. smalltalk.addMethod(
  1580. smalltalk.method({
  1581. selector: "commitPathJsFor:",
  1582. category: 'accessing',
  1583. fn: function (aPackage){
  1584. var self=this;
  1585. return smalltalk.withContext(function($ctx1) {
  1586. var $1;
  1587. $1=self._toUrl_(self._namespaceFor_(aPackage));
  1588. return $1;
  1589. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1590. args: ["aPackage"],
  1591. source: "commitPathJsFor: aPackage\x0a\x09^self toUrl: (self namespaceFor: aPackage)",
  1592. messageSends: ["toUrl:", "namespaceFor:"],
  1593. referencedClasses: []
  1594. }),
  1595. smalltalk.AmdPackageHandler);
  1596. smalltalk.addMethod(
  1597. smalltalk.method({
  1598. selector: "commitPathStFor:",
  1599. category: 'accessing',
  1600. fn: function (aPackage){
  1601. var self=this;
  1602. return smalltalk.withContext(function($ctx1) {
  1603. var $1;
  1604. $1=self._toUrl_(_st(self._namespaceFor_(aPackage)).__comma("/_source"));
  1605. return $1;
  1606. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1607. args: ["aPackage"],
  1608. source: "commitPathStFor: aPackage\x0a\x09\x22if _source is not mapped, .st commit will likely fail\x22\x0a\x09^self toUrl: (self namespaceFor: aPackage), '/_source'.",
  1609. messageSends: ["toUrl:", ",", "namespaceFor:"],
  1610. referencedClasses: []
  1611. }),
  1612. smalltalk.AmdPackageHandler);
  1613. smalltalk.addMethod(
  1614. smalltalk.method({
  1615. selector: "exporterClass",
  1616. category: 'accessing',
  1617. fn: function (){
  1618. var self=this;
  1619. function $AmdExporter(){return smalltalk.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  1620. return smalltalk.withContext(function($ctx1) {
  1621. var $1;
  1622. $1=$AmdExporter();
  1623. return $1;
  1624. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},smalltalk.AmdPackageHandler)})},
  1625. args: [],
  1626. source: "exporterClass\x0a\x09^ AmdExporter",
  1627. messageSends: [],
  1628. referencedClasses: ["AmdExporter"]
  1629. }),
  1630. smalltalk.AmdPackageHandler);
  1631. smalltalk.addMethod(
  1632. smalltalk.method({
  1633. selector: "namespaceFor:",
  1634. category: 'committing',
  1635. fn: function (aPackage){
  1636. var self=this;
  1637. return smalltalk.withContext(function($ctx1) {
  1638. var $1;
  1639. $1=_st(_st(aPackage)._transport())._namespace();
  1640. return $1;
  1641. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1642. args: ["aPackage"],
  1643. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  1644. messageSends: ["namespace", "transport"],
  1645. referencedClasses: []
  1646. }),
  1647. smalltalk.AmdPackageHandler);
  1648. smalltalk.addMethod(
  1649. smalltalk.method({
  1650. selector: "toUrl:",
  1651. category: 'private',
  1652. fn: function (aString){
  1653. var self=this;
  1654. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1655. return smalltalk.withContext(function($ctx1) {
  1656. var $2,$1;
  1657. $2=_st(_st($Smalltalk())._current())._amdRequire();
  1658. if(($receiver = $2) == nil || $receiver == undefined){
  1659. $1=self._error_("AMD loader not present");
  1660. } else {
  1661. var require;
  1662. require=$receiver;
  1663. $1=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
  1664. };
  1665. return $1;
  1666. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},smalltalk.AmdPackageHandler)})},
  1667. args: ["aString"],
  1668. source: "toUrl: aString\x0a\x09^ Smalltalk current amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  1669. messageSends: ["ifNil:ifNotNil:", "error:", "value:", "basicAt:", "amdRequire", "current"],
  1670. referencedClasses: ["Smalltalk"]
  1671. }),
  1672. smalltalk.AmdPackageHandler);
  1673. smalltalk.addMethod(
  1674. smalltalk.method({
  1675. selector: "defaultNamespace",
  1676. category: 'commit paths',
  1677. fn: function (){
  1678. var self=this;
  1679. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1680. return smalltalk.withContext(function($ctx1) {
  1681. var $1;
  1682. $1=_st(_st($Smalltalk())._current())._defaultAmdNamespace();
  1683. return $1;
  1684. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageHandler.klass)})},
  1685. args: [],
  1686. source: "defaultNamespace\x0a\x09^ Smalltalk current defaultAmdNamespace",
  1687. messageSends: ["defaultAmdNamespace", "current"],
  1688. referencedClasses: ["Smalltalk"]
  1689. }),
  1690. smalltalk.AmdPackageHandler.klass);
  1691. smalltalk.addMethod(
  1692. smalltalk.method({
  1693. selector: "defaultNamespace:",
  1694. category: 'commit paths',
  1695. fn: function (aString){
  1696. var self=this;
  1697. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1698. return smalltalk.withContext(function($ctx1) {
  1699. _st(_st($Smalltalk())._current())._defaultAMDNamespace_(aString);
  1700. return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},smalltalk.AmdPackageHandler.klass)})},
  1701. args: ["aString"],
  1702. source: "defaultNamespace: aString\x0a\x09Smalltalk current defaultAMDNamespace: aString",
  1703. messageSends: ["defaultAMDNamespace:", "current"],
  1704. referencedClasses: ["Smalltalk"]
  1705. }),
  1706. smalltalk.AmdPackageHandler.klass);
  1707. smalltalk.addMethod(
  1708. smalltalk.method({
  1709. selector: "initialize",
  1710. category: 'initialization',
  1711. fn: function (){
  1712. var self=this;
  1713. function $AMDPackageTransport(){return smalltalk.AMDPackageTransport||(typeof AMDPackageTransport=="undefined"?nil:AMDPackageTransport)}
  1714. return smalltalk.withContext(function($ctx1) {
  1715. smalltalk.AmdPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1716. self._registerFor_(_st($AMDPackageTransport())._type());
  1717. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.AmdPackageHandler.klass)})},
  1718. args: [],
  1719. source: "initialize\x0a\x09super initialize.\x0a\x09self registerFor: AMDPackageTransport type",
  1720. messageSends: ["initialize", "registerFor:", "type"],
  1721. referencedClasses: ["AMDPackageTransport"]
  1722. }),
  1723. smalltalk.AmdPackageHandler.klass);
  1724. smalltalk.addMethod(
  1725. smalltalk.method({
  1726. selector: "resetCommitPaths",
  1727. category: 'commit paths',
  1728. fn: function (){
  1729. var self=this;
  1730. return smalltalk.withContext(function($ctx1) {
  1731. self["@defaultNamespace"]=nil;
  1732. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.AmdPackageHandler.klass)})},
  1733. args: [],
  1734. source: "resetCommitPaths\x0a\x09defaultNamespace := nil",
  1735. messageSends: [],
  1736. referencedClasses: []
  1737. }),
  1738. smalltalk.AmdPackageHandler.klass);
  1739. smalltalk.addClass('LegacyPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  1740. smalltalk.LegacyPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  1741. smalltalk.addMethod(
  1742. smalltalk.method({
  1743. selector: "commitChannels",
  1744. category: 'committing',
  1745. fn: function (){
  1746. var self=this;
  1747. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  1748. function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
  1749. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  1750. return smalltalk.withContext(function($ctx1) {
  1751. var $1;
  1752. $1=[(function(pkg){
  1753. return smalltalk.withContext(function($ctx2) {
  1754. return _st(_st(_st($Exporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
  1755. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  1756. return smalltalk.withContext(function($ctx2) {
  1757. return _st(_st(_st($StrippedExporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
  1758. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  1759. return smalltalk.withContext(function($ctx2) {
  1760. return _st(_st(_st($ChunkExporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
  1761. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
  1762. return $1;
  1763. }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.LegacyPackageHandler)})},
  1764. args: [],
  1765. source: "commitChannels\x0a\x09^{ \x0a\x09\x09[ :pkg | Exporter default recipe -> (pkg commitPathJs, '/', pkg name, '.js') ].\x0a\x09\x09[ :pkg | StrippedExporter default recipe -> (pkg commitPathJs, '/', pkg name, '.deploy.js') ].\x0a\x09\x09[ :pkg | ChunkExporter default recipe -> (pkg commitPathSt, '/', pkg name, '.st') ]\x0a\x09}",
  1766. messageSends: ["->", ",", "name", "commitPathJs", "recipe", "default", "commitPathSt"],
  1767. referencedClasses: ["Exporter", "StrippedExporter", "ChunkExporter"]
  1768. }),
  1769. smalltalk.LegacyPackageHandler);
  1770. smalltalk.addMethod(
  1771. smalltalk.method({
  1772. selector: "commitPathJsFor:",
  1773. category: 'committing',
  1774. fn: function (aPackage){
  1775. var self=this;
  1776. return smalltalk.withContext(function($ctx1) {
  1777. var $1;
  1778. $1=_st(self._class())._defaultCommitPathJs();
  1779. return $1;
  1780. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  1781. args: ["aPackage"],
  1782. source: "commitPathJsFor: aPackage\x0a\x09^self class defaultCommitPathJs",
  1783. messageSends: ["defaultCommitPathJs", "class"],
  1784. referencedClasses: []
  1785. }),
  1786. smalltalk.LegacyPackageHandler);
  1787. smalltalk.addMethod(
  1788. smalltalk.method({
  1789. selector: "commitPathStFor:",
  1790. category: 'committing',
  1791. fn: function (aPackage){
  1792. var self=this;
  1793. return smalltalk.withContext(function($ctx1) {
  1794. var $1;
  1795. $1=_st(self._class())._defaultCommitPathSt();
  1796. return $1;
  1797. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  1798. args: ["aPackage"],
  1799. source: "commitPathStFor: aPackage\x0a\x09^self class defaultCommitPathSt",
  1800. messageSends: ["defaultCommitPathSt", "class"],
  1801. referencedClasses: []
  1802. }),
  1803. smalltalk.LegacyPackageHandler);
  1804. smalltalk.addMethod(
  1805. smalltalk.method({
  1806. selector: "loadPackage:prefix:",
  1807. category: 'loading',
  1808. fn: function (packageName,aString){
  1809. var self=this;
  1810. var url;
  1811. return smalltalk.withContext(function($ctx1) {
  1812. var $1;
  1813. url=_st(_st(_st("/".__comma(aString)).__comma("/js/")).__comma(packageName)).__comma(".js");
  1814. self._ajax_(smalltalk.HashedCollection._from_(["url".__minus_gt(url),"type".__minus_gt("GET"),"dataType".__minus_gt("script"),"complete".__minus_gt((function(jqXHR,textStatus){
  1815. return smalltalk.withContext(function($ctx2) {
  1816. $1=_st(_st(jqXHR)._readyState()).__eq((4));
  1817. if(smalltalk.assert($1)){
  1818. return self._setupPackageNamed_prefix_(packageName,aString);
  1819. };
  1820. }, function($ctx2) {$ctx2.fillBlock({jqXHR:jqXHR,textStatus:textStatus},$ctx1)})})),"error".__minus_gt((function(){
  1821. return smalltalk.withContext(function($ctx2) {
  1822. return self._alert_("Could not load package at: ".__comma(url));
  1823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))]));
  1824. return self}, function($ctx1) {$ctx1.fill(self,"loadPackage:prefix:",{packageName:packageName,aString:aString,url:url},smalltalk.LegacyPackageHandler)})},
  1825. args: ["packageName", "aString"],
  1826. source: "loadPackage: packageName prefix: aString\x0a\x09| url |\x0a\x09url := '/', aString, '/js/', packageName, '.js'.\x0a\x09self\x0a\x09\x09ajax: #{\x0a\x09\x09\x09'url' -> url.\x0a\x09\x09\x09'type' -> 'GET'.\x0a\x09\x09\x09'dataType' -> 'script'.\x0a\x09\x09\x09'complete' -> [ :jqXHR :textStatus |\x0a\x09\x09\x09\x09jqXHR readyState = 4\x0a\x09\x09\x09\x09\x09ifTrue: [ self setupPackageNamed: packageName prefix: aString ] ].\x0a\x09\x09\x09'error' -> [ self alert: 'Could not load package at: ', url ]\x0a\x09\x09}",
  1827. messageSends: [",", "ajax:", "->", "ifTrue:", "setupPackageNamed:prefix:", "=", "readyState", "alert:"],
  1828. referencedClasses: []
  1829. }),
  1830. smalltalk.LegacyPackageHandler);
  1831. smalltalk.addMethod(
  1832. smalltalk.method({
  1833. selector: "loadPackages:prefix:",
  1834. category: 'loading',
  1835. fn: function (aCollection,aString){
  1836. var self=this;
  1837. return smalltalk.withContext(function($ctx1) {
  1838. _st(aCollection)._do_((function(each){
  1839. return smalltalk.withContext(function($ctx2) {
  1840. return self._loadPackage_prefix_(each,aString);
  1841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1842. return self}, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler)})},
  1843. args: ["aCollection", "aString"],
  1844. source: "loadPackages: aCollection prefix: aString\x0a\x09aCollection do: [ :each |\x0a\x09\x09self loadPackage: each prefix: aString ]",
  1845. messageSends: ["do:", "loadPackage:prefix:"],
  1846. referencedClasses: []
  1847. }),
  1848. smalltalk.LegacyPackageHandler);
  1849. smalltalk.addMethod(
  1850. smalltalk.method({
  1851. selector: "setupPackageNamed:prefix:",
  1852. category: 'private',
  1853. fn: function (packageName,aString){
  1854. var self=this;
  1855. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  1856. return smalltalk.withContext(function($ctx1) {
  1857. var $1,$2;
  1858. $1=_st($Package())._named_(packageName);
  1859. _st($1)._setupClasses();
  1860. _st($1)._commitPathJs_(_st("/".__comma(aString)).__comma("/js"));
  1861. $2=_st($1)._commitPathSt_(_st("/".__comma(aString)).__comma("/st"));
  1862. return self}, function($ctx1) {$ctx1.fill(self,"setupPackageNamed:prefix:",{packageName:packageName,aString:aString},smalltalk.LegacyPackageHandler)})},
  1863. args: ["packageName", "aString"],
  1864. source: "setupPackageNamed: packageName prefix: aString\x0a\x0a\x09(Package named: packageName)\x0a\x09\x09setupClasses;\x0a\x09\x09commitPathJs: '/', aString, '/js';\x0a\x09\x09commitPathSt: '/', aString, '/st'",
  1865. messageSends: ["setupClasses", "named:", "commitPathJs:", ",", "commitPathSt:"],
  1866. referencedClasses: ["Package"]
  1867. }),
  1868. smalltalk.LegacyPackageHandler);
  1869. smalltalk.LegacyPackageHandler.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  1870. smalltalk.addMethod(
  1871. smalltalk.method({
  1872. selector: "commitPathsFromLoader",
  1873. category: 'commit paths',
  1874. fn: function (){
  1875. var self=this;
  1876. return smalltalk.withContext(function($ctx1) {
  1877. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  1878. if (!commitPath) return;
  1879. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  1880. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  1881. ;
  1882. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.LegacyPackageHandler.klass)})},
  1883. args: [],
  1884. source: "commitPathsFromLoader\x0a\x09<\x0a\x09\x09var commitPath = typeof amber !== 'undefined' && amber.commitPath;\x0a\x09\x09if (!commitPath) return;\x0a\x09\x09if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);\x0a\x09\x09if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);\x0a\x09>",
  1885. messageSends: [],
  1886. referencedClasses: []
  1887. }),
  1888. smalltalk.LegacyPackageHandler.klass);
  1889. smalltalk.addMethod(
  1890. smalltalk.method({
  1891. selector: "defaultCommitPathJs",
  1892. category: 'commit paths',
  1893. fn: function (){
  1894. var self=this;
  1895. return smalltalk.withContext(function($ctx1) {
  1896. var $2,$1;
  1897. $2=self["@defaultCommitPathJs"];
  1898. if(($receiver = $2) == nil || $receiver == undefined){
  1899. self["@defaultCommitPathJs"]="js";
  1900. $1=self["@defaultCommitPathJs"];
  1901. } else {
  1902. $1=$2;
  1903. };
  1904. return $1;
  1905. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.LegacyPackageHandler.klass)})},
  1906. args: [],
  1907. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  1908. messageSends: ["ifNil:"],
  1909. referencedClasses: []
  1910. }),
  1911. smalltalk.LegacyPackageHandler.klass);
  1912. smalltalk.addMethod(
  1913. smalltalk.method({
  1914. selector: "defaultCommitPathJs:",
  1915. category: 'commit paths',
  1916. fn: function (aString){
  1917. var self=this;
  1918. return smalltalk.withContext(function($ctx1) {
  1919. self["@defaultCommitPathJs"]=aString;
  1920. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1921. args: ["aString"],
  1922. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  1923. messageSends: [],
  1924. referencedClasses: []
  1925. }),
  1926. smalltalk.LegacyPackageHandler.klass);
  1927. smalltalk.addMethod(
  1928. smalltalk.method({
  1929. selector: "defaultCommitPathSt",
  1930. category: 'commit paths',
  1931. fn: function (){
  1932. var self=this;
  1933. return smalltalk.withContext(function($ctx1) {
  1934. var $2,$1;
  1935. $2=self["@defaultCommitPathSt"];
  1936. if(($receiver = $2) == nil || $receiver == undefined){
  1937. self["@defaultCommitPathSt"]="st";
  1938. $1=self["@defaultCommitPathSt"];
  1939. } else {
  1940. $1=$2;
  1941. };
  1942. return $1;
  1943. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.LegacyPackageHandler.klass)})},
  1944. args: [],
  1945. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  1946. messageSends: ["ifNil:"],
  1947. referencedClasses: []
  1948. }),
  1949. smalltalk.LegacyPackageHandler.klass);
  1950. smalltalk.addMethod(
  1951. smalltalk.method({
  1952. selector: "defaultCommitPathSt:",
  1953. category: 'commit paths',
  1954. fn: function (aString){
  1955. var self=this;
  1956. return smalltalk.withContext(function($ctx1) {
  1957. self["@defaultCommitPathSt"]=aString;
  1958. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1959. args: ["aString"],
  1960. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  1961. messageSends: [],
  1962. referencedClasses: []
  1963. }),
  1964. smalltalk.LegacyPackageHandler.klass);
  1965. smalltalk.addMethod(
  1966. smalltalk.method({
  1967. selector: "initialize",
  1968. category: 'initialization',
  1969. fn: function (){
  1970. var self=this;
  1971. return smalltalk.withContext(function($ctx1) {
  1972. smalltalk.LegacyPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1973. self._registerFor_("unknown");
  1974. self._commitPathsFromLoader();
  1975. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.LegacyPackageHandler.klass)})},
  1976. args: [],
  1977. source: "initialize\x0a\x09super initialize.\x0a\x09self registerFor: 'unknown'.\x0a\x09self commitPathsFromLoader",
  1978. messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"],
  1979. referencedClasses: []
  1980. }),
  1981. smalltalk.LegacyPackageHandler.klass);
  1982. smalltalk.addMethod(
  1983. smalltalk.method({
  1984. selector: "loadPackages:prefix:",
  1985. category: 'loading',
  1986. fn: function (aCollection,aString){
  1987. var self=this;
  1988. return smalltalk.withContext(function($ctx1) {
  1989. var $1;
  1990. $1=_st(self._new())._loadPackages_prefix_(aCollection,aString);
  1991. return $1;
  1992. }, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1993. args: ["aCollection", "aString"],
  1994. source: "loadPackages: aCollection prefix: aString\x0a\x09^ self new loadPackages: aCollection prefix: aString",
  1995. messageSends: ["loadPackages:prefix:", "new"],
  1996. referencedClasses: []
  1997. }),
  1998. smalltalk.LegacyPackageHandler.klass);
  1999. smalltalk.addMethod(
  2000. smalltalk.method({
  2001. selector: "resetCommitPaths",
  2002. category: 'commit paths',
  2003. fn: function (){
  2004. var self=this;
  2005. return smalltalk.withContext(function($ctx1) {
  2006. self["@defaultCommitPathJs"]=nil;
  2007. self["@defaultCommitPathSt"]=nil;
  2008. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.LegacyPackageHandler.klass)})},
  2009. args: [],
  2010. source: "resetCommitPaths\x0a\x09defaultCommitPathJs := nil.\x0a\x09defaultCommitPathSt := nil",
  2011. messageSends: [],
  2012. referencedClasses: []
  2013. }),
  2014. smalltalk.LegacyPackageHandler.klass);
  2015. smalltalk.addClass('PackageTransport', smalltalk.Object, ['package'], 'Importer-Exporter');
  2016. smalltalk.addMethod(
  2017. smalltalk.method({
  2018. selector: "commit",
  2019. category: 'committing',
  2020. fn: function (){
  2021. var self=this;
  2022. return smalltalk.withContext(function($ctx1) {
  2023. _st(self._commitHandler())._commit_(self._package());
  2024. return self}, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.PackageTransport)})},
  2025. args: [],
  2026. source: "commit\x0a\x09self commitHandler commit: self package",
  2027. messageSends: ["commit:", "package", "commitHandler"],
  2028. referencedClasses: []
  2029. }),
  2030. smalltalk.PackageTransport);
  2031. smalltalk.addMethod(
  2032. smalltalk.method({
  2033. selector: "commitHandler",
  2034. category: 'factory',
  2035. fn: function (){
  2036. var self=this;
  2037. return smalltalk.withContext(function($ctx1) {
  2038. var $1;
  2039. $1=_st(self._commitHandlerClass())._new();
  2040. return $1;
  2041. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},smalltalk.PackageTransport)})},
  2042. args: [],
  2043. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  2044. messageSends: ["new", "commitHandlerClass"],
  2045. referencedClasses: []
  2046. }),
  2047. smalltalk.PackageTransport);
  2048. smalltalk.addMethod(
  2049. smalltalk.method({
  2050. selector: "commitHandlerClass",
  2051. category: 'accessing',
  2052. fn: function (){
  2053. var self=this;
  2054. return smalltalk.withContext(function($ctx1) {
  2055. self._subclassResponsibility();
  2056. return self}, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},smalltalk.PackageTransport)})},
  2057. args: [],
  2058. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  2059. messageSends: ["subclassResponsibility"],
  2060. referencedClasses: []
  2061. }),
  2062. smalltalk.PackageTransport);
  2063. smalltalk.addMethod(
  2064. smalltalk.method({
  2065. selector: "package",
  2066. category: 'accessing',
  2067. fn: function (){
  2068. var self=this;
  2069. return smalltalk.withContext(function($ctx1) {
  2070. var $1;
  2071. $1=self["@package"];
  2072. return $1;
  2073. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.PackageTransport)})},
  2074. args: [],
  2075. source: "package\x0a\x09^ package",
  2076. messageSends: [],
  2077. referencedClasses: []
  2078. }),
  2079. smalltalk.PackageTransport);
  2080. smalltalk.addMethod(
  2081. smalltalk.method({
  2082. selector: "package:",
  2083. category: 'accessing',
  2084. fn: function (aPackage){
  2085. var self=this;
  2086. return smalltalk.withContext(function($ctx1) {
  2087. self["@package"]=aPackage;
  2088. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage},smalltalk.PackageTransport)})},
  2089. args: ["aPackage"],
  2090. source: "package: aPackage\x0a\x09package := aPackage",
  2091. messageSends: [],
  2092. referencedClasses: []
  2093. }),
  2094. smalltalk.PackageTransport);
  2095. smalltalk.addMethod(
  2096. smalltalk.method({
  2097. selector: "setupFromJson:",
  2098. category: 'initialization',
  2099. fn: function (anObject){
  2100. var self=this;
  2101. return smalltalk.withContext(function($ctx1) {
  2102. return self}, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},smalltalk.PackageTransport)})},
  2103. args: ["anObject"],
  2104. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  2105. messageSends: [],
  2106. referencedClasses: []
  2107. }),
  2108. smalltalk.PackageTransport);
  2109. smalltalk.addMethod(
  2110. smalltalk.method({
  2111. selector: "type",
  2112. category: 'accessing',
  2113. fn: function (){
  2114. var self=this;
  2115. return smalltalk.withContext(function($ctx1) {
  2116. var $1;
  2117. $1=_st(self._class())._type();
  2118. return $1;
  2119. }, function($ctx1) {$ctx1.fill(self,"type",{},smalltalk.PackageTransport)})},
  2120. args: [],
  2121. source: "type\x0a\x09^ self class type",
  2122. messageSends: ["type", "class"],
  2123. referencedClasses: []
  2124. }),
  2125. smalltalk.PackageTransport);
  2126. smalltalk.PackageTransport.klass.iVarNames = ['registry'];
  2127. smalltalk.addMethod(
  2128. smalltalk.method({
  2129. selector: "classRegisteredFor:",
  2130. category: 'accessing',
  2131. fn: function (aString){
  2132. var self=this;
  2133. return smalltalk.withContext(function($ctx1) {
  2134. var $1;
  2135. $1=_st(self["@registry"])._at_(aString);
  2136. return $1;
  2137. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},smalltalk.PackageTransport.klass)})},
  2138. args: ["aString"],
  2139. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  2140. messageSends: ["at:"],
  2141. referencedClasses: []
  2142. }),
  2143. smalltalk.PackageTransport.klass);
  2144. smalltalk.addMethod(
  2145. smalltalk.method({
  2146. selector: "for:",
  2147. category: 'accessing',
  2148. fn: function (aString){
  2149. var self=this;
  2150. return smalltalk.withContext(function($ctx1) {
  2151. var $1;
  2152. $1=_st(self._classRegisteredFor_(aString))._new();
  2153. return $1;
  2154. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},smalltalk.PackageTransport.klass)})},
  2155. args: ["aString"],
  2156. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  2157. messageSends: ["new", "classRegisteredFor:"],
  2158. referencedClasses: []
  2159. }),
  2160. smalltalk.PackageTransport.klass);
  2161. smalltalk.addMethod(
  2162. smalltalk.method({
  2163. selector: "initialize",
  2164. category: 'initialization',
  2165. fn: function (){
  2166. var self=this;
  2167. return smalltalk.withContext(function($ctx1) {
  2168. smalltalk.PackageTransport.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  2169. self["@registry"]=smalltalk.HashedCollection._from_([]);
  2170. self._register();
  2171. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.PackageTransport.klass)})},
  2172. args: [],
  2173. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.\x0a\x09self register",
  2174. messageSends: ["initialize", "register"],
  2175. referencedClasses: []
  2176. }),
  2177. smalltalk.PackageTransport.klass);
  2178. smalltalk.addMethod(
  2179. smalltalk.method({
  2180. selector: "register",
  2181. category: 'registration',
  2182. fn: function (){
  2183. var self=this;
  2184. function $PackageTransport(){return smalltalk.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  2185. return smalltalk.withContext(function($ctx1) {
  2186. _st($PackageTransport())._register_(self);
  2187. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.PackageTransport.klass)})},
  2188. args: [],
  2189. source: "register\x0a\x09PackageTransport register: self",
  2190. messageSends: ["register:"],
  2191. referencedClasses: ["PackageTransport"]
  2192. }),
  2193. smalltalk.PackageTransport.klass);
  2194. smalltalk.addMethod(
  2195. smalltalk.method({
  2196. selector: "register:",
  2197. category: 'registration',
  2198. fn: function (aClass){
  2199. var self=this;
  2200. return smalltalk.withContext(function($ctx1) {
  2201. var $1;
  2202. $1=_st(aClass)._type();
  2203. if(($receiver = $1) == nil || $receiver == undefined){
  2204. $1;
  2205. } else {
  2206. _st(self["@registry"])._at_put_(_st(aClass)._type(),aClass);
  2207. };
  2208. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},smalltalk.PackageTransport.klass)})},
  2209. args: ["aClass"],
  2210. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  2211. messageSends: ["ifNotNil:", "at:put:", "type"],
  2212. referencedClasses: []
  2213. }),
  2214. smalltalk.PackageTransport.klass);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: "type",
  2218. category: 'accessing',
  2219. fn: function (){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. return nil;
  2223. }, function($ctx1) {$ctx1.fill(self,"type",{},smalltalk.PackageTransport.klass)})},
  2224. args: [],
  2225. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  2226. messageSends: [],
  2227. referencedClasses: []
  2228. }),
  2229. smalltalk.PackageTransport.klass);
  2230. smalltalk.addClass('AmdPackageTransport', smalltalk.PackageTransport, ['namespace'], 'Importer-Exporter');
  2231. smalltalk.addMethod(
  2232. smalltalk.method({
  2233. selector: "commitHandlerClass",
  2234. category: 'accessing',
  2235. fn: function (){
  2236. var self=this;
  2237. function $AmdPackageHandler(){return smalltalk.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  2238. return smalltalk.withContext(function($ctx1) {
  2239. var $1;
  2240. $1=$AmdPackageHandler();
  2241. return $1;
  2242. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},smalltalk.AmdPackageTransport)})},
  2243. args: [],
  2244. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  2245. messageSends: [],
  2246. referencedClasses: ["AmdPackageHandler"]
  2247. }),
  2248. smalltalk.AmdPackageTransport);
  2249. smalltalk.addMethod(
  2250. smalltalk.method({
  2251. selector: "defaultNamespace",
  2252. category: 'defaults',
  2253. fn: function (){
  2254. var self=this;
  2255. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2256. return smalltalk.withContext(function($ctx1) {
  2257. var $1;
  2258. $1=_st(_st($Smalltalk())._current())._defaultAmdNamespace();
  2259. return $1;
  2260. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageTransport)})},
  2261. args: [],
  2262. source: "defaultNamespace\x0a\x09^ Smalltalk current defaultAmdNamespace",
  2263. messageSends: ["defaultAmdNamespace", "current"],
  2264. referencedClasses: ["Smalltalk"]
  2265. }),
  2266. smalltalk.AmdPackageTransport);
  2267. smalltalk.addMethod(
  2268. smalltalk.method({
  2269. selector: "namespace",
  2270. category: 'accessing',
  2271. fn: function (){
  2272. var self=this;
  2273. return smalltalk.withContext(function($ctx1) {
  2274. var $2,$1;
  2275. $2=self["@namespace"];
  2276. if(($receiver = $2) == nil || $receiver == undefined){
  2277. $1=self._defaultNamespace();
  2278. } else {
  2279. $1=$2;
  2280. };
  2281. return $1;
  2282. }, function($ctx1) {$ctx1.fill(self,"namespace",{},smalltalk.AmdPackageTransport)})},
  2283. args: [],
  2284. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  2285. messageSends: ["ifNil:", "defaultNamespace"],
  2286. referencedClasses: []
  2287. }),
  2288. smalltalk.AmdPackageTransport);
  2289. smalltalk.addMethod(
  2290. smalltalk.method({
  2291. selector: "namespace:",
  2292. category: 'accessing',
  2293. fn: function (aString){
  2294. var self=this;
  2295. return smalltalk.withContext(function($ctx1) {
  2296. self["@namespace"]=aString;
  2297. return self}, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},smalltalk.AmdPackageTransport)})},
  2298. args: ["aString"],
  2299. source: "namespace: aString\x0a\x09namespace := aString",
  2300. messageSends: [],
  2301. referencedClasses: []
  2302. }),
  2303. smalltalk.AmdPackageTransport);
  2304. smalltalk.addMethod(
  2305. smalltalk.method({
  2306. selector: "setupFromJson:",
  2307. category: 'initialization',
  2308. fn: function (anObject){
  2309. var self=this;
  2310. return smalltalk.withContext(function($ctx1) {
  2311. self._namespace_(_st(anObject)._at_("amdNamespace"));
  2312. return self}, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},smalltalk.AmdPackageTransport)})},
  2313. args: ["anObject"],
  2314. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  2315. messageSends: ["namespace:", "at:"],
  2316. referencedClasses: []
  2317. }),
  2318. smalltalk.AmdPackageTransport);
  2319. smalltalk.addMethod(
  2320. smalltalk.method({
  2321. selector: "namespace:",
  2322. category: 'instance creation',
  2323. fn: function (aString){
  2324. var self=this;
  2325. return smalltalk.withContext(function($ctx1) {
  2326. var $2,$3,$1;
  2327. $2=self._new();
  2328. _st($2)._namespace_(aString);
  2329. $3=_st($2)._yourself();
  2330. $1=$3;
  2331. return $1;
  2332. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},smalltalk.AmdPackageTransport.klass)})},
  2333. args: ["aString"],
  2334. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  2335. messageSends: ["namespace:", "new", "yourself"],
  2336. referencedClasses: []
  2337. }),
  2338. smalltalk.AmdPackageTransport.klass);
  2339. smalltalk.addMethod(
  2340. smalltalk.method({
  2341. selector: "type",
  2342. category: 'accessing',
  2343. fn: function (){
  2344. var self=this;
  2345. return smalltalk.withContext(function($ctx1) {
  2346. return "amd";
  2347. }, function($ctx1) {$ctx1.fill(self,"type",{},smalltalk.AmdPackageTransport.klass)})},
  2348. args: [],
  2349. source: "type\x0a\x09^ 'amd'",
  2350. messageSends: [],
  2351. referencedClasses: []
  2352. }),
  2353. smalltalk.AmdPackageTransport.klass);
  2354. smalltalk.addClass('PluggableExporter', smalltalk.Object, ['recipe'], 'Importer-Exporter');
  2355. smalltalk.PluggableExporter.comment="I am an engine for exporting structured data on a Stream.\x0a\x0aMy instances are created using\x0a PluggableExporter forRecipe: aRecipe,\x0awhere recipe is structured description of the exporting algorithm (see `ExportRecipeInterpreter`).\x0a\x0aThe actual exporting is done by interpreting the recipe using a `RecipeInterpreter`.\x0a\x0a\x0aI am used to export amber packages, so I have a convenience method\x0a`exportPackage: aPackage on: aStream`\x0awhich exports `aPackage` using the `recipe`\x0a(it is otherwise no special, so it may be renamed to export:on:)";
  2356. smalltalk.addMethod(
  2357. smalltalk.method({
  2358. selector: "exportAllPackages",
  2359. category: 'fileOut',
  2360. fn: function (){
  2361. var self=this;
  2362. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2363. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2364. return smalltalk.withContext(function($ctx1) {
  2365. var $1;
  2366. $1=_st($String())._streamContents_((function(stream){
  2367. return smalltalk.withContext(function($ctx2) {
  2368. return _st(_st(_st($Smalltalk())._current())._packages())._do_((function(pkg){
  2369. return smalltalk.withContext(function($ctx3) {
  2370. return self._exportPackage_on_(pkg,stream);
  2371. }, function($ctx3) {$ctx3.fillBlock({pkg:pkg},$ctx2)})}));
  2372. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  2373. return $1;
  2374. }, function($ctx1) {$ctx1.fill(self,"exportAllPackages",{},smalltalk.PluggableExporter)})},
  2375. args: [],
  2376. source: "exportAllPackages\x0a\x09\x22Export all packages in the system.\x22\x0a\x0a\x09^String streamContents: [:stream |\x0a\x09\x09Smalltalk current packages do: [:pkg |\x0a\x09\x09self exportPackage: pkg on: stream]]",
  2377. messageSends: ["streamContents:", "do:", "exportPackage:on:", "packages", "current"],
  2378. referencedClasses: ["Smalltalk", "String"]
  2379. }),
  2380. smalltalk.PluggableExporter);
  2381. smalltalk.addMethod(
  2382. smalltalk.method({
  2383. selector: "exportPackage:on:",
  2384. category: 'fileOut',
  2385. fn: function (aPackage,aStream){
  2386. var self=this;
  2387. return smalltalk.withContext(function($ctx1) {
  2388. _st(self._interpreter())._interpret_for_on_(self._recipe(),aPackage,aStream);
  2389. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.PluggableExporter)})},
  2390. args: ["aPackage", "aStream"],
  2391. source: "exportPackage: aPackage on: aStream\x0a\x09self interpreter interpret: self recipe for: aPackage on: aStream",
  2392. messageSends: ["interpret:for:on:", "recipe", "interpreter"],
  2393. referencedClasses: []
  2394. }),
  2395. smalltalk.PluggableExporter);
  2396. smalltalk.addMethod(
  2397. smalltalk.method({
  2398. selector: "interpreter",
  2399. category: 'accessing',
  2400. fn: function (){
  2401. var self=this;
  2402. function $ExportRecipeInterpreter(){return smalltalk.ExportRecipeInterpreter||(typeof ExportRecipeInterpreter=="undefined"?nil:ExportRecipeInterpreter)}
  2403. return smalltalk.withContext(function($ctx1) {
  2404. var $1;
  2405. $1=_st($ExportRecipeInterpreter())._new();
  2406. return $1;
  2407. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.PluggableExporter)})},
  2408. args: [],
  2409. source: "interpreter\x0a\x09^ ExportRecipeInterpreter new",
  2410. messageSends: ["new"],
  2411. referencedClasses: ["ExportRecipeInterpreter"]
  2412. }),
  2413. smalltalk.PluggableExporter);
  2414. smalltalk.addMethod(
  2415. smalltalk.method({
  2416. selector: "recipe",
  2417. category: 'accessing',
  2418. fn: function (){
  2419. var self=this;
  2420. return smalltalk.withContext(function($ctx1) {
  2421. var $1;
  2422. $1=self["@recipe"];
  2423. return $1;
  2424. }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.PluggableExporter)})},
  2425. args: [],
  2426. source: "recipe\x0a\x09^recipe",
  2427. messageSends: [],
  2428. referencedClasses: []
  2429. }),
  2430. smalltalk.PluggableExporter);
  2431. smalltalk.addMethod(
  2432. smalltalk.method({
  2433. selector: "recipe:",
  2434. category: 'accessing',
  2435. fn: function (anArray){
  2436. var self=this;
  2437. return smalltalk.withContext(function($ctx1) {
  2438. self["@recipe"]=anArray;
  2439. return self}, function($ctx1) {$ctx1.fill(self,"recipe:",{anArray:anArray},smalltalk.PluggableExporter)})},
  2440. args: ["anArray"],
  2441. source: "recipe: anArray\x0a\x09recipe := anArray",
  2442. messageSends: [],
  2443. referencedClasses: []
  2444. }),
  2445. smalltalk.PluggableExporter);
  2446. smalltalk.addMethod(
  2447. smalltalk.method({
  2448. selector: "forRecipe:",
  2449. category: 'instance creation',
  2450. fn: function (aRecipe){
  2451. var self=this;
  2452. return smalltalk.withContext(function($ctx1) {
  2453. var $2,$3,$1;
  2454. $2=self._new();
  2455. _st($2)._recipe_(aRecipe);
  2456. $3=_st($2)._yourself();
  2457. $1=$3;
  2458. return $1;
  2459. }, function($ctx1) {$ctx1.fill(self,"forRecipe:",{aRecipe:aRecipe},smalltalk.PluggableExporter.klass)})},
  2460. args: ["aRecipe"],
  2461. source: "forRecipe: aRecipe\x0a\x09^self new recipe: aRecipe; yourself",
  2462. messageSends: ["recipe:", "new", "yourself"],
  2463. referencedClasses: []
  2464. }),
  2465. smalltalk.PluggableExporter.klass);
  2466. smalltalk.addMethod(
  2467. smalltalk.method({
  2468. selector: "ownClassesOfPackage:",
  2469. category: 'convenience',
  2470. fn: function (package_){
  2471. var self=this;
  2472. return smalltalk.withContext(function($ctx1) {
  2473. var $1;
  2474. $1=_st(_st(package_)._sortedClasses())._asSet();
  2475. return $1;
  2476. }, function($ctx1) {$ctx1.fill(self,"ownClassesOfPackage:",{package_:package_},smalltalk.PluggableExporter.klass)})},
  2477. args: ["package"],
  2478. source: "ownClassesOfPackage: package\x0a\x09\x22Export classes in dependency order.\x0a\x09Update (issue #171): Remove duplicates for export\x22\x0a\x09^package sortedClasses asSet",
  2479. messageSends: ["asSet", "sortedClasses"],
  2480. referencedClasses: []
  2481. }),
  2482. smalltalk.PluggableExporter.klass);
  2483. smalltalk.addMethod(
  2484. smalltalk.method({
  2485. selector: "amdNamespace",
  2486. category: '*Importer-Exporter',
  2487. fn: function (){
  2488. var self=this;
  2489. return smalltalk.withContext(function($ctx1) {
  2490. return (self.transport && self.transport.amdNamespace) || nil;
  2491. return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace",{},smalltalk.Package)})},
  2492. args: [],
  2493. source: "amdNamespace\x0a\x09<return (self.transport && self.transport.amdNamespace) || nil>",
  2494. messageSends: [],
  2495. referencedClasses: []
  2496. }),
  2497. smalltalk.Package);
  2498. smalltalk.addMethod(
  2499. smalltalk.method({
  2500. selector: "amdNamespace:",
  2501. category: '*Importer-Exporter',
  2502. fn: function (aString){
  2503. var self=this;
  2504. return smalltalk.withContext(function($ctx1) {
  2505. if (!self.transport) { self.transport = { type: 'amd' }; }
  2506. if (self.transport.type !== 'amd') { throw new Error('Package '+self._name()+' has transport type '+self.transport.type+', not "amd".'); }
  2507. self.transport.amdNamespace = aString;
  2508. ;
  2509. return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace:",{aString:aString},smalltalk.Package)})},
  2510. args: ["aString"],
  2511. source: "amdNamespace: aString\x0a\x09<\x0a\x09\x09if (!self.transport) { self.transport = { type: 'amd' }; }\x0a\x09\x09if (self.transport.type !== 'amd') { throw new Error('Package '+self._name()+' has transport type '+self.transport.type+', not \x22amd\x22.'); }\x0a\x09\x09self.transport.amdNamespace = aString;\x0a\x09>",
  2512. messageSends: [],
  2513. referencedClasses: []
  2514. }),
  2515. smalltalk.Package);
  2516. smalltalk.addMethod(
  2517. smalltalk.method({
  2518. selector: "commit",
  2519. category: '*Importer-Exporter',
  2520. fn: function (){
  2521. var self=this;
  2522. return smalltalk.withContext(function($ctx1) {
  2523. var $1;
  2524. $1=_st(self._transport())._commit();
  2525. return $1;
  2526. }, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.Package)})},
  2527. args: [],
  2528. source: "commit\x0a\x09^ self transport commit",
  2529. messageSends: ["commit", "transport"],
  2530. referencedClasses: []
  2531. }),
  2532. smalltalk.Package);
  2533. smalltalk.addMethod(
  2534. smalltalk.method({
  2535. selector: "commitPathJs",
  2536. category: '*Importer-Exporter',
  2537. fn: function (){
  2538. var self=this;
  2539. return smalltalk.withContext(function($ctx1) {
  2540. var $3,$2,$1;
  2541. $3=self["@extension"];
  2542. if(($receiver = $3) == nil || $receiver == undefined){
  2543. self["@extension"]=smalltalk.HashedCollection._from_([]);
  2544. $2=self["@extension"];
  2545. } else {
  2546. $2=$3;
  2547. };
  2548. $1=_st($2)._at_ifAbsent_("commitPathJs",(function(){
  2549. return smalltalk.withContext(function($ctx2) {
  2550. return _st(self._handler())._commitPathJsFor_(self);
  2551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2552. return $1;
  2553. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  2554. args: [],
  2555. source: "commitPathJs\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs ifAbsent: [ self handler commitPathJsFor: self ]",
  2556. messageSends: ["at:ifAbsent:", "commitPathJsFor:", "handler", "ifNil:"],
  2557. referencedClasses: []
  2558. }),
  2559. smalltalk.Package);
  2560. smalltalk.addMethod(
  2561. smalltalk.method({
  2562. selector: "commitPathJs:",
  2563. category: '*Importer-Exporter',
  2564. fn: function (aString){
  2565. var self=this;
  2566. return smalltalk.withContext(function($ctx1) {
  2567. var $3,$2,$1;
  2568. $3=self["@extension"];
  2569. if(($receiver = $3) == nil || $receiver == undefined){
  2570. self["@extension"]=smalltalk.HashedCollection._from_([]);
  2571. $2=self["@extension"];
  2572. } else {
  2573. $2=$3;
  2574. };
  2575. $1=_st($2)._at_put_("commitPathJs",aString);
  2576. return $1;
  2577. }, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  2578. args: ["aString"],
  2579. source: "commitPathJs: aString\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs put: aString",
  2580. messageSends: ["at:put:", "ifNil:"],
  2581. referencedClasses: []
  2582. }),
  2583. smalltalk.Package);
  2584. smalltalk.addMethod(
  2585. smalltalk.method({
  2586. selector: "commitPathSt",
  2587. category: '*Importer-Exporter',
  2588. fn: function (){
  2589. var self=this;
  2590. return smalltalk.withContext(function($ctx1) {
  2591. var $3,$2,$1;
  2592. $3=self["@extension"];
  2593. if(($receiver = $3) == nil || $receiver == undefined){
  2594. self["@extension"]=smalltalk.HashedCollection._from_([]);
  2595. $2=self["@extension"];
  2596. } else {
  2597. $2=$3;
  2598. };
  2599. $1=_st($2)._at_ifAbsent_("commitPathSt",(function(){
  2600. return smalltalk.withContext(function($ctx2) {
  2601. return _st(self._handler())._commitPathStFor_(self);
  2602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2603. return $1;
  2604. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  2605. args: [],
  2606. source: "commitPathSt\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt ifAbsent: [ self handler commitPathStFor: self ]",
  2607. messageSends: ["at:ifAbsent:", "commitPathStFor:", "handler", "ifNil:"],
  2608. referencedClasses: []
  2609. }),
  2610. smalltalk.Package);
  2611. smalltalk.addMethod(
  2612. smalltalk.method({
  2613. selector: "commitPathSt:",
  2614. category: '*Importer-Exporter',
  2615. fn: function (aString){
  2616. var self=this;
  2617. return smalltalk.withContext(function($ctx1) {
  2618. var $3,$2,$1;
  2619. $3=self["@extension"];
  2620. if(($receiver = $3) == nil || $receiver == undefined){
  2621. self["@extension"]=smalltalk.HashedCollection._from_([]);
  2622. $2=self["@extension"];
  2623. } else {
  2624. $2=$3;
  2625. };
  2626. $1=_st($2)._at_put_("commitPathSt",aString);
  2627. return $1;
  2628. }, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  2629. args: ["aString"],
  2630. source: "commitPathSt: aString\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt put: aString",
  2631. messageSends: ["at:put:", "ifNil:"],
  2632. referencedClasses: []
  2633. }),
  2634. smalltalk.Package);
  2635. smalltalk.addMethod(
  2636. smalltalk.method({
  2637. selector: "transportJson",
  2638. category: '*Importer-Exporter',
  2639. fn: function (){
  2640. var self=this;
  2641. return smalltalk.withContext(function($ctx1) {
  2642. return JSON.stringify(self.transport || null);;
  2643. return self}, function($ctx1) {$ctx1.fill(self,"transportJson",{},smalltalk.Package)})},
  2644. args: [],
  2645. source: "transportJson\x0a\x09<return JSON.stringify(self.transport || null);>",
  2646. messageSends: [],
  2647. referencedClasses: []
  2648. }),
  2649. smalltalk.Package);
  2650. smalltalk.addMethod(
  2651. smalltalk.method({
  2652. selector: "transportType",
  2653. category: '*Importer-Exporter',
  2654. fn: function (){
  2655. var self=this;
  2656. return smalltalk.withContext(function($ctx1) {
  2657. return (self.transport && self.transport.type) || 'unknown';;
  2658. return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
  2659. args: [],
  2660. source: "transportType\x0a\x09<return (self.transport && self.transport.type) || 'unknown';>",
  2661. messageSends: [],
  2662. referencedClasses: []
  2663. }),
  2664. smalltalk.Package);
  2665. smalltalk.addMethod(
  2666. smalltalk.method({
  2667. selector: "transport",
  2668. category: '*Importer-Exporter',
  2669. fn: function (){
  2670. var self=this;
  2671. function $PackageTransport(){return smalltalk.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  2672. return smalltalk.withContext(function($ctx1) {
  2673. var $2,$3,$1;
  2674. $2=_st($PackageTransport())._for_(self._transportType());
  2675. _st($2)._setupFromJson_(self._basicTransport());
  2676. _st($2)._package_(self);
  2677. $3=_st($2)._yourself();
  2678. $1=$3;
  2679. return $1;
  2680. }, function($ctx1) {$ctx1.fill(self,"transport",{},smalltalk.Package)})},
  2681. args: [],
  2682. source: "transport\x0a\x09^ (PackageTransport for: self transportType)\x0a\x09\x09setupFromJson: self basicTransport;\x0a\x09\x09package: self;\x0a\x09\x09yourself",
  2683. messageSends: ["setupFromJson:", "basicTransport", "for:", "transportType", "package:", "yourself"],
  2684. referencedClasses: ["PackageTransport"]
  2685. }),
  2686. smalltalk.Package);
  2687. smalltalk.addMethod(
  2688. smalltalk.method({
  2689. selector: "basicTransport",
  2690. category: '*Importer-Exporter',
  2691. fn: function (){
  2692. var self=this;
  2693. return smalltalk.withContext(function($ctx1) {
  2694. return self.transport;
  2695. return self}, function($ctx1) {$ctx1.fill(self,"basicTransport",{},smalltalk.Package)})},
  2696. args: [],
  2697. source: "basicTransport\x0a\x09<return self.transport>",
  2698. messageSends: [],
  2699. referencedClasses: []
  2700. }),
  2701. smalltalk.Package);
  2702. });