Kernel-ImportExport.js 98 KB

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