1
0

Importer-Exporter.js 116 KB

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