123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758 |
- define("amber/Importer-Exporter", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber/Kernel-Objects", "amber/Kernel-Infrastructure"], function(smalltalk,nil,_st){
- smalltalk.addPackage('Importer-Exporter');
- smalltalk.packages["Importer-Exporter"].transport = {"type":"amd","amdNamespace":"amber"};
- smalltalk.addClass('AbstractExporter', smalltalk.Object, [], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "chunkEscape:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},smalltalk.AbstractExporter)})},
- messageSends: ["trimBoth", "replace:with:"]}),
- smalltalk.AbstractExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "classNameFor:",
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(aClass)._isMetaclass();
- if(smalltalk.assert($2)){
- $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
- } else {
- $3=_st(aClass)._isNil();
- if(smalltalk.assert($3)){
- $1="nil";
- } else {
- $1=_st(aClass)._name();
- };
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.AbstractExporter)})},
- messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
- smalltalk.AbstractExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "recipe",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.AbstractExporter)})},
- messageSends: ["subclassResponsibility"]}),
- smalltalk.AbstractExporter);
- smalltalk.AbstractExporter.klass.iVarNames = ['default'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "default",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@default"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@default"]=self._new();
- $1=self["@default"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.AbstractExporter.klass)})},
- messageSends: ["ifNil:", "new"]}),
- smalltalk.AbstractExporter.klass);
- smalltalk.addClass('ChunkExporter', smalltalk.AbstractExporter, [], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportCategoryEpilogueOf:on:",
- fn: function (aCategory,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aStream;
- _st($1)._nextPutAll_(" !");
- _st($1)._lf();
- $2=_st($1)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},smalltalk.ChunkExporter)})},
- messageSends: ["nextPutAll:", "lf"]}),
- smalltalk.ChunkExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportCategoryPrologueOf:on:",
- fn: function (aCategory,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aStream;
- _st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(aCategory)._theClass())));
- $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(aCategory)._name())).__comma("'!"));
- return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},smalltalk.ChunkExporter)})},
- messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]}),
- smalltalk.ChunkExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportDefinitionOf:on:",
- fn: function (aClass,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6,$7;
- $1=aStream;
- _st($1)._nextPutAll_(self._classNameFor_(_st(aClass)._superclass()));
- _st($1)._nextPutAll_(" subclass: #".__comma(self._classNameFor_(aClass)));
- _st($1)._lf();
- _st($1)._tab();
- $2=_st($1)._nextPutAll_("instanceVariableNames: '");
- _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(" ");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $3=aStream;
- _st($3)._nextPutAll_("'");
- _st($3)._lf();
- _st($3)._tab();
- _st($3)._nextPutAll_(_st("package: '".__comma(_st(aClass)._category())).__comma("'!"));
- $4=_st($3)._lf();
- $5=_st(_st(aClass)._comment())._notEmpty();
- if(smalltalk.assert($5)){
- $6=aStream;
- _st($6)._nextPutAll_(_st("!".__comma(self._classNameFor_(aClass))).__comma(" commentStamp!"));
- _st($6)._lf();
- _st($6)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
- $7=_st($6)._lf();
- $7;
- };
- _st(aStream)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
- messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"]}),
- smalltalk.ChunkExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportMetaDefinitionOf:on:",
- fn: function (aClass,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5;
- $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
- if(! smalltalk.assert($1)){
- $2=aStream;
- _st($2)._nextPutAll_(self._classNameFor_(_st(aClass)._class()));
- $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
- $3;
- _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(" ");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $4=aStream;
- _st($4)._nextPutAll_("'!");
- _st($4)._lf();
- $5=_st($4)._lf();
- $5;
- };
- return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
- messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"]}),
- smalltalk.ChunkExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportMethod:on:",
- fn: function (aMethod,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aStream;
- _st($1)._lf();
- _st($1)._lf();
- _st($1)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
- _st($1)._lf();
- $2=_st($1)._nextPutAll_("!");
- return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.ChunkExporter)})},
- messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]}),
- smalltalk.ChunkExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportPackageDefinitionOf:on:",
- fn: function (aPackage,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aStream;
- _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(aPackage)._name())).__comma("'!"));
- $2=_st($1)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.ChunkExporter)})},
- messageSends: ["nextPutAll:", ",", "name", "lf"]}),
- smalltalk.ChunkExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "extensionCategoriesOfPackage:",
- fn: function (aPackage){
- var self=this;
- var name,map,result;
- function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- name=_st(aPackage)._name();
- result=_st($OrderedCollection())._new();
- _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st([each,_st(each)._class()])._do_((function(aClass){
- return smalltalk.withContext(function($ctx3) {
- map=_st($Dictionary())._new();
- map;
- _st(aClass)._protocolsDo_((function(category,methods){
- return smalltalk.withContext(function($ctx4) {
- $1=_st(category).__eq("*".__comma(name));
- if(smalltalk.assert($1)){
- return _st(map)._at_put_(category,methods);
- };
- }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
- return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
- return smalltalk.withContext(function($ctx4) {
- return _st(a).__lt_eq(b);
- }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._collect_((function(category){
- return smalltalk.withContext(function($ctx4) {
- return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
- }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3)})})));
- }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $2=result;
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},smalltalk.ChunkExporter)})},
- messageSends: ["name", "new", "do:", "protocolsDo:", "ifTrue:", "at:put:", "=", ",", "addAll:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"]}),
- smalltalk.ChunkExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methodsOfCategory:",
- fn: function (aCategory){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(aCategory)._methods())._sorted_((function(a,b){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodsOfCategory:",{aCategory:aCategory},smalltalk.ChunkExporter)})},
- messageSends: ["sorted:", "<=", "selector", "methods"]}),
- smalltalk.ChunkExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ownCategoriesOfClass:",
- fn: function (aClass){
- var self=this;
- var map;
- function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- map=_st($Dictionary())._new();
- _st(aClass)._protocolsDo_((function(category,methods){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(category)._match_("^\x5c*");
- if(! smalltalk.assert($1)){
- return _st(map)._at_put_(category,methods);
- };
- }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
- $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
- return smalltalk.withContext(function($ctx2) {
- return _st(a).__lt_eq(b);
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._collect_((function(category){
- return smalltalk.withContext(function($ctx2) {
- return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
- }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
- return $2;
- }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},smalltalk.ChunkExporter)})},
- messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys"]}),
- smalltalk.ChunkExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ownCategoriesOfMetaClass:",
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self._ownCategoriesOfClass_(_st(aClass)._class());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},smalltalk.ChunkExporter)})},
- messageSends: ["ownCategoriesOfClass:", "class"]}),
- smalltalk.ChunkExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "recipe",
- fn: function (){
- var self=this;
- var exportCategoryRecipe;
- function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- exportCategoryRecipe=[self.__minus_gt("exportCategoryPrologueOf:on:"),[self.__minus_gt("methodsOfCategory:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportCategoryEpilogueOf:on:")];
- $1=[self.__minus_gt("exportPackageDefinitionOf:on:"),[_st($PluggableExporter()).__minus_gt("ownClassesOfPackage:"),self.__minus_gt("exportDefinitionOf:on:"),_st([self.__minus_gt("ownCategoriesOfClass:")]).__comma(exportCategoryRecipe),self.__minus_gt("exportMetaDefinitionOf:on:"),_st([self.__minus_gt("ownCategoriesOfMetaClass:")]).__comma(exportCategoryRecipe)],_st([self.__minus_gt("extensionCategoriesOfPackage:")]).__comma(exportCategoryRecipe)];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"recipe",{exportCategoryRecipe:exportCategoryRecipe},smalltalk.ChunkExporter)})},
- messageSends: ["->", ","]}),
- smalltalk.ChunkExporter);
- smalltalk.addClass('Exporter', smalltalk.AbstractExporter, [], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "amdRecipe",
- fn: function (){
- var self=this;
- var legacy,result;
- function $AmdExporter(){return smalltalk.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- legacy=self._recipe();
- result=_st(_st(_st(legacy)._copyFrom_to_((1),(2))).__comma([_st($AmdExporter()).__minus_gt("exportPackageTransportOf:on:")])).__comma(_st(legacy)._copyFrom_to_((3),_st(legacy)._size()));
- _st(_st(result)._first())._key_($AmdExporter());
- _st(_st(result)._last())._key_($AmdExporter());
- $1=result;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"amdRecipe",{legacy:legacy,result:result},smalltalk.Exporter)})},
- messageSends: ["recipe", ",", "copyFrom:to:", "size", "->", "key:", "first", "last"]}),
- smalltalk.Exporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "classNameFor:",
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(aClass)._isMetaclass();
- if(smalltalk.assert($2)){
- $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
- } else {
- $3=_st(aClass)._isNil();
- if(smalltalk.assert($3)){
- $1="nil";
- } else {
- $1=_st(aClass)._name();
- };
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.Exporter)})},
- messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
- smalltalk.Exporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportDefinitionOf:on:",
- fn: function (aClass,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4,$5,$6,$7;
- $1=aStream;
- _st($1)._lf();
- _st($1)._nextPutAll_("smalltalk.addClass(");
- _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
- _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
- $2=_st($1)._nextPutAll_(", [");
- _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(", ");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $3=aStream;
- _st($3)._nextPutAll_("], '");
- _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
- $4=_st($3)._nextPutAll_(");");
- $5=_st(_st(aClass)._comment())._notEmpty();
- if(smalltalk.assert($5)){
- $6=aStream;
- _st($6)._lf();
- _st($6)._nextPutAll_("smalltalk.");
- _st($6)._nextPutAll_(self._classNameFor_(aClass));
- _st($6)._nextPutAll_(".comment=");
- _st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
- $7=_st($6)._nextPutAll_(";");
- $7;
- };
- _st(aStream)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
- messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "asJavascript", "comment", "notEmpty"]}),
- smalltalk.Exporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportMetaDefinitionOf:on:",
- fn: function (aClass,aStream){
- var self=this;
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- _st(aStream)._lf();
- $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
- if(! smalltalk.assert($1)){
- $2=aStream;
- _st($2)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._class())));
- $3=_st($2)._nextPutAll_(".iVarNames = [");
- $3;
- _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(",");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
- };
- return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
- messageSends: ["lf", "ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "isEmpty"]}),
- smalltalk.Exporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportMethod:on:",
- fn: function (aMethod,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $1=aStream;
- _st($1)._nextPutAll_("smalltalk.addMethod(");
- _st($1)._lf();
- _st($1)._nextPutAll_("smalltalk.method({");
- _st($1)._lf();
- _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
- _st($1)._lf();
- _st($1)._nextPutAll_(_st("category: '".__comma(_st(aMethod)._category())).__comma("',"));
- _st($1)._lf();
- _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
- _st($1)._lf();
- _st($1)._nextPutAll_(_st("args: ".__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
- _st($1)._lf();
- _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
- _st($1)._lf();
- _st($1)._nextPutAll_(_st("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
- _st($1)._lf();
- $2=_st($1)._nextPutAll_("referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
- $3=aStream;
- _st($3)._lf();
- _st($3)._nextPutAll_("}),");
- _st($3)._lf();
- _st($3)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
- _st($3)._nextPutAll_(");");
- _st($3)._lf();
- $4=_st($3)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.Exporter)})},
- messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:", "methodClass"]}),
- smalltalk.Exporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportPackageDefinitionOf:on:",
- fn: function (aPackage,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aStream;
- _st($1)._nextPutAll_("smalltalk.addPackage(");
- _st($1)._nextPutAll_(_st("'".__comma(_st(aPackage)._name())).__comma("');"));
- $2=_st($1)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
- messageSends: ["nextPutAll:", ",", "name", "lf"]}),
- smalltalk.Exporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportPackageEpilogueOf:on:",
- fn: function (aPackage,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aStream;
- _st($1)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
- $2=_st($1)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
- messageSends: ["nextPutAll:", "lf"]}),
- smalltalk.Exporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportPackagePrologueOf:on:",
- fn: function (aPackage,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aStream;
- _st($1)._nextPutAll_("(function(smalltalk,nil,_st){");
- $2=_st($1)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
- messageSends: ["nextPutAll:", "lf"]}),
- smalltalk.Exporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "extensionMethodsOfPackage:",
- fn: function (aPackage){
- var self=this;
- var name,result;
- function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- name=_st(aPackage)._name();
- result=_st($OrderedCollection())._new();
- _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st([each,_st(each)._class()])._do_((function(aClass){
- return smalltalk.withContext(function($ctx3) {
- return _st(result)._addAll_(_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
- return smalltalk.withContext(function($ctx4) {
- return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
- }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._select_((function(method){
- return smalltalk.withContext(function($ctx4) {
- return _st(_st(method)._category()).__eq("*".__comma(name));
- }, function($ctx4) {$ctx4.fillBlock({method:method},$ctx3)})})));
- }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- $1=result;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,name:name,result:result},smalltalk.Exporter)})},
- messageSends: ["name", "new", "do:", "addAll:", "select:", "=", ",", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "class", "sortedClasses:", "classes", "current"]}),
- smalltalk.Exporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ownMethodsOfClass:",
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
- }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._reject_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(each)._category())._match_("^\x5c*");
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},smalltalk.Exporter)})},
- messageSends: ["reject:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary"]}),
- smalltalk.Exporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ownMethodsOfMetaClass:",
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self._ownMethodsOfClass_(_st(aClass)._class());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},smalltalk.Exporter)})},
- messageSends: ["ownMethodsOfClass:", "class"]}),
- smalltalk.Exporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "recipe",
- fn: function (){
- var self=this;
- function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=[self.__minus_gt("exportPackagePrologueOf:on:"),self.__minus_gt("exportPackageDefinitionOf:on:"),[_st($PluggableExporter()).__minus_gt("ownClassesOfPackage:"),self.__minus_gt("exportDefinitionOf:on:"),[self.__minus_gt("ownMethodsOfClass:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportMetaDefinitionOf:on:"),[self.__minus_gt("ownMethodsOfMetaClass:"),self.__minus_gt("exportMethod:on:")]],[self.__minus_gt("extensionMethodsOfPackage:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportPackageEpilogueOf:on:")];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.Exporter)})},
- messageSends: ["->"]}),
- smalltalk.Exporter);
- smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportDefinitionOf:on:",
- fn: function (aClass,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $1=aStream;
- _st($1)._lf();
- _st($1)._nextPutAll_("smalltalk.addClass(");
- _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
- _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
- $2=_st($1)._nextPutAll_(", [");
- _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(aStream)._nextPutAll_(", ");
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- $3=aStream;
- _st($3)._nextPutAll_("], '");
- _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
- $4=_st($3)._nextPutAll_(");");
- _st(aStream)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.StrippedExporter)})},
- messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category"]}),
- smalltalk.StrippedExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportMethod:on:",
- fn: function (aMethod,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aStream;
- _st($1)._nextPutAll_("smalltalk.addMethod(");
- _st($1)._lf();
- _st($1)._nextPutAll_("smalltalk.method({");
- _st($1)._lf();
- _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
- _st($1)._lf();
- _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
- _st($1)._lf();
- _st($1)._nextPutAll_("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript()));
- _st($1)._nextPutAll_("}),");
- _st($1)._lf();
- _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
- _st($1)._nextPutAll_(");");
- _st($1)._lf();
- $2=_st($1)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.StrippedExporter)})},
- messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "compiledSource", "fn", "messageSends", "classNameFor:", "methodClass"]}),
- smalltalk.StrippedExporter);
- smalltalk.addClass('AmdExporter', smalltalk.Object, [], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "amdNamesOfPackages:",
- fn: function (anArray){
- var self=this;
- var deps,depNames;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(anArray)._select_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(each)._amdNamespace())._notNil();
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._collect_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st(each)._amdNamespace()).__comma("/")).__comma(_st(each)._name());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray,deps:deps,depNames:depNames},smalltalk.AmdExporter.klass)})},
- messageSends: ["collect:", ",", "name", "amdNamespace", "select:", "notNil"]}),
- smalltalk.AmdExporter.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportPackageEpilogueOf:on:",
- fn: function (aPackage,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aStream;
- _st($1)._nextPutAll_("});");
- $2=_st($1)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
- messageSends: ["nextPutAll:", "lf"]}),
- smalltalk.AmdExporter.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportPackagePrologueOf:on:",
- fn: function (aPackage,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$4,$3,$5;
- $1=aStream;
- _st($1)._nextPutAll_("define(\x22");
- $2=$1;
- $4=_st(aPackage)._amdNamespace();
- if(($receiver = $4) == nil || $receiver == undefined){
- $3="amber";
- } else {
- $3=$4;
- };
- _st($2)._nextPutAll_($3);
- _st($1)._nextPutAll_("/");
- _st($1)._nextPutAll_(_st(aPackage)._name());
- _st($1)._nextPutAll_("\x22, ");
- _st($1)._nextPutAll_(_st(["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._asJavascript());
- _st($1)._nextPutAll_(", function(smalltalk,nil,_st){");
- $5=_st($1)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
- messageSends: ["nextPutAll:", "ifNil:", "amdNamespace", "name", "asJavascript", ",", "amdNamesOfPackages:", "loadDependencies", "lf"]}),
- smalltalk.AmdExporter.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportPackageTransportOf:on:",
- fn: function (aPackage,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=aStream;
- _st($1)._nextPutAll_("smalltalk.packages[");
- _st($1)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
- _st($1)._nextPutAll_("].transport = ");
- _st($1)._nextPutAll_(_st(aPackage)._transportJson());
- _st($1)._nextPutAll_(";");
- $2=_st($1)._lf();
- return self}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
- messageSends: ["nextPutAll:", "asJavascript", "name", "transportJson", "lf"]}),
- smalltalk.AmdExporter.klass);
- smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "nextChunk",
- fn: function (){
- var self=this;
- var char,result,chunk;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- var $early={};
- try {
- result=""._writeStream();
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- char=_st(self["@stream"])._next();
- char;
- return _st(char)._notNil();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(char).__eq("!");
- if(smalltalk.assert($1)){
- $2=_st(_st(self["@stream"])._peek()).__eq("!");
- if(smalltalk.assert($2)){
- _st(self["@stream"])._next();
- } else {
- $3=_st(_st(result)._contents())._trimBoth();
- throw $early=[$3];
- };
- };
- return _st(result)._nextPut_(char);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return nil;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},smalltalk.ChunkParser)})},
- messageSends: ["writeStream", "whileTrue:", "ifTrue:", "ifTrue:ifFalse:", "next", "trimBoth", "contents", "=", "peek", "nextPut:", "notNil"]}),
- smalltalk.ChunkParser);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "stream:",
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@stream"]=aStream;
- return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.ChunkParser)})},
- messageSends: []}),
- smalltalk.ChunkParser);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:",
- fn: function (aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self._new())._stream_(aStream);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},smalltalk.ChunkParser.klass)})},
- messageSends: ["stream:", "new"]}),
- smalltalk.ChunkParser.klass);
- smalltalk.addClass('ExportRecipeInterpreter', smalltalk.Object, [], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "interpret:for:on:",
- fn: function (aRecipe,anObject,aStream){
- var self=this;
- var recipeStream;
- return smalltalk.withContext(function($ctx1) {
- recipeStream=_st(aRecipe)._readStream();
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(recipeStream)._atEnd();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
- return smalltalk.withContext(function($ctx2) {
- return self._interpretStep_for_on_(_st(recipeStream)._next(),anObject,aStream);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"interpret:for:on:",{aRecipe:aRecipe,anObject:anObject,aStream:aStream,recipeStream:recipeStream},smalltalk.ExportRecipeInterpreter)})},
- messageSends: ["readStream", "whileFalse:", "interpretStep:for:on:", "next", "atEnd"]}),
- smalltalk.ExportRecipeInterpreter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "interpretStep:for:on:",
- fn: function (aRecipeStep,anObject,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st(_st(aRecipeStep)._value()).__eq_eq(aRecipeStep);
- if(smalltalk.assert($1)){
- $2=self._interpretSubRecipe_for_on_(aRecipeStep,anObject,aStream);
- return $2;
- };
- _st(_st(aRecipeStep)._key())._perform_withArguments_(_st(aRecipeStep)._value(),[anObject,aStream]);
- return self}, function($ctx1) {$ctx1.fill(self,"interpretStep:for:on:",{aRecipeStep:aRecipeStep,anObject:anObject,aStream:aStream},smalltalk.ExportRecipeInterpreter)})},
- messageSends: ["ifTrue:", "interpretSubRecipe:for:on:", "==", "value", "perform:withArguments:", "key"]}),
- smalltalk.ExportRecipeInterpreter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "interpretSubRecipe:for:on:",
- fn: function (aRecipe,anObject,aStream){
- var self=this;
- var selection;
- return smalltalk.withContext(function($ctx1) {
- selection=_st(_st(_st(aRecipe)._first())._key())._perform_withArguments_(_st(_st(aRecipe)._first())._value(),[anObject]);
- _st(selection)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return self._interpret_for_on_(_st(aRecipe)._allButFirst(),each,aStream);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"interpretSubRecipe:for:on:",{aRecipe:aRecipe,anObject:anObject,aStream:aStream,selection:selection},smalltalk.ExportRecipeInterpreter)})},
- messageSends: ["perform:withArguments:", "value", "first", "key", "do:", "interpret:for:on:", "allButFirst"]}),
- smalltalk.ExportRecipeInterpreter);
- smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "import:",
- fn: function (aStream){
- var self=this;
- var chunk,result,parser,lastEmpty;
- function $ChunkParser(){return smalltalk.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
- function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- parser=_st($ChunkParser())._on_(aStream);
- lastEmpty=false;
- _st((function(){
- return smalltalk.withContext(function($ctx2) {
- chunk=_st(parser)._nextChunk();
- chunk;
- return _st(chunk)._isNil();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(chunk)._isEmpty();
- if(smalltalk.assert($1)){
- lastEmpty=true;
- return lastEmpty;
- } else {
- result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
- result;
- $2=lastEmpty;
- if(smalltalk.assert($2)){
- lastEmpty=false;
- lastEmpty;
- return _st(result)._scanFrom_(parser);
- };
- };
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},smalltalk.Importer)})},
- messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"]}),
- smalltalk.Importer);
- smalltalk.addClass('MethodCategory', smalltalk.Object, ['methods', 'name', 'theClass'], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methods",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@methods"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.MethodCategory)})},
- messageSends: []}),
- smalltalk.MethodCategory);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methods:",
- fn: function (aCollection){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@methods"]=aCollection;
- return self}, function($ctx1) {$ctx1.fill(self,"methods:",{aCollection:aCollection},smalltalk.MethodCategory)})},
- messageSends: []}),
- smalltalk.MethodCategory);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "name",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@name"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.MethodCategory)})},
- messageSends: []}),
- smalltalk.MethodCategory);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "name:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@name"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.MethodCategory)})},
- messageSends: []}),
- smalltalk.MethodCategory);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@theClass"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.MethodCategory)})},
- messageSends: []}),
- smalltalk.MethodCategory);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass:",
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@theClass"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.MethodCategory)})},
- messageSends: []}),
- smalltalk.MethodCategory);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "name:theClass:methods:",
- fn: function (aString,aClass,anArray){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- _st($2)._name_(aString);
- _st($2)._theClass_(aClass);
- _st($2)._methods_(anArray);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"name:theClass:methods:",{aString:aString,aClass:aClass,anArray:anArray},smalltalk.MethodCategory.klass)})},
- messageSends: ["name:", "new", "theClass:", "methods:", "yourself"]}),
- smalltalk.MethodCategory.klass);
- smalltalk.addClass('PackageHandler', smalltalk.InterfacingObject, [], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ajaxPutAt:data:",
- fn: function (aURL,aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self._ajax_(smalltalk.HashedCollection._from_(["url".__minus_gt(aURL),"type".__minus_gt("PUT"),"data".__minus_gt(aString),"contentType".__minus_gt("text/plain;charset=UTF-8"),"error".__minus_gt((function(xhr){
- return smalltalk.withContext(function($ctx2) {
- return self._error_(_st(_st(_st("Commiting ".__comma(aURL)).__comma(" failed with reason: \x22")).__comma(_st(xhr)._responseText())).__comma("\x22"));
- }, function($ctx2) {$ctx2.fillBlock({xhr:xhr},$ctx1)})}))]));
- return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:",{aURL:aURL,aString:aString},smalltalk.PackageHandler)})},
- messageSends: ["ajax:", "->", "error:", ",", "responseText"]}),
- smalltalk.PackageHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commit:",
- fn: function (aPackage){
- var self=this;
- function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- _st(self._commitChannels())._do_displayingProgress_((function(commitStrategyFactory){
- var fileContents,commitStrategy;
- return smalltalk.withContext(function($ctx2) {
- commitStrategy=_st(commitStrategyFactory)._value_(aPackage);
- commitStrategy;
- fileContents=_st($String())._streamContents_((function(stream){
- return smalltalk.withContext(function($ctx3) {
- return _st(_st($PluggableExporter())._forRecipe_(_st(commitStrategy)._key()))._exportPackage_on_(aPackage,stream);
- }, function($ctx3) {$ctx3.fillBlock({stream:stream},$ctx2)})}));
- fileContents;
- return self._ajaxPutAt_data_(_st(commitStrategy)._value(),fileContents);
- }, function($ctx2) {$ctx2.fillBlock({commitStrategyFactory:commitStrategyFactory,fileContents:fileContents,commitStrategy:commitStrategy},$ctx1)})}),"Committing package ".__comma(_st(aPackage)._name()));
- return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
- messageSends: ["do:displayingProgress:", "value:", "streamContents:", "exportPackage:on:", "forRecipe:", "key", "ajaxPutAt:data:", "value", ",", "name", "commitChannels"]}),
- smalltalk.PackageHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitChannels",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self._subclassResponsibility();
- return self}, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.PackageHandler)})},
- messageSends: ["subclassResponsibility"]}),
- smalltalk.PackageHandler);
- smalltalk.PackageHandler.klass.iVarNames = ['registry'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "classRegisteredFor:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@registry"])._at_(aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
- messageSends: ["at:"]}),
- smalltalk.PackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "for:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self._classRegisteredFor_(aString))._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},smalltalk.PackageHandler.klass)})},
- messageSends: ["new", "classRegisteredFor:"]}),
- smalltalk.PackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.PackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
- self["@registry"]=smalltalk.HashedCollection._from_([]);
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.PackageHandler.klass)})},
- messageSends: ["initialize"]}),
- smalltalk.PackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "register:for:",
- fn: function (aClass,aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self["@registry"])._at_put_(aString,aClass);
- return self}, function($ctx1) {$ctx1.fill(self,"register:for:",{aClass:aClass,aString:aString},smalltalk.PackageHandler.klass)})},
- messageSends: ["at:put:"]}),
- smalltalk.PackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "registerFor:",
- fn: function (aString){
- var self=this;
- function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
- return smalltalk.withContext(function($ctx1) {
- _st($PackageHandler())._register_for_(self,aString);
- return self}, function($ctx1) {$ctx1.fill(self,"registerFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
- messageSends: ["register:for:"]}),
- smalltalk.PackageHandler.klass);
- smalltalk.addClass('AmdPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitChannels",
- fn: function (){
- var self=this;
- function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
- function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
- function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=[(function(pkg){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st($Exporter())._default())._amdRecipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
- }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st($StrippedExporter())._default())._amdRecipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
- }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st($ChunkExporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
- }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.AmdPackageHandler)})},
- messageSends: ["->", ",", "name", "commitPathJs", "amdRecipe", "default", "commitPathSt", "recipe"]}),
- smalltalk.AmdPackageHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathJsFor:",
- fn: function (aPackage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self._toUrl_(self._namespaceFor_(aPackage));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
- messageSends: ["toUrl:", "namespaceFor:"]}),
- smalltalk.AmdPackageHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathStFor:",
- fn: function (aPackage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self._toUrl_(_st(self._namespaceFor_(aPackage)).__comma("/_source"));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
- messageSends: ["toUrl:", ",", "namespaceFor:"]}),
- smalltalk.AmdPackageHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "namespaceFor:",
- fn: function (aPackage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$4,$1;
- $2=_st(aPackage)._amdNamespace();
- if(($receiver = $2) == nil || $receiver == undefined){
- $3=aPackage;
- _st($3)._amdNamespace_(_st(self._class())._defaultNamespace());
- $4=_st($3)._amdNamespace();
- $1=$4;
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
- messageSends: ["ifNil:", "amdNamespace:", "defaultNamespace", "class", "amdNamespace"]}),
- smalltalk.AmdPackageHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "toUrl:",
- fn: function (aString){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st(_st($Smalltalk())._current())._at_("_amd_require");
- if(($receiver = $1) == nil || $receiver == undefined){
- self._error_("AMD loader not present");
- } else {
- var require;
- require=$receiver;
- $2=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
- return $2;
- };
- return self}, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},smalltalk.AmdPackageHandler)})},
- messageSends: ["ifNil:ifNotNil:", "error:", "value:", "basicAt:", "at:", "current"]}),
- smalltalk.AmdPackageHandler);
- smalltalk.AmdPackageHandler.klass.iVarNames = ['defaultNamespace'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathsFromLoader",
- fn: function (){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st($Smalltalk())._current())._at_("_amd_defaultNamespace");
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- var namespace;
- namespace=$receiver;
- self._defaultNamespace_(namespace);
- };
- return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.AmdPackageHandler.klass)})},
- messageSends: ["ifNotNil:", "defaultNamespace:", "at:", "current"]}),
- smalltalk.AmdPackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultNamespace",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@defaultNamespace"];
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=self._error_("AMD default namespace not set.");
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageHandler.klass)})},
- messageSends: ["ifNil:", "error:"]}),
- smalltalk.AmdPackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultNamespace:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@defaultNamespace"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},smalltalk.AmdPackageHandler.klass)})},
- messageSends: []}),
- smalltalk.AmdPackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.AmdPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
- self._registerFor_("amd");
- self._commitPathsFromLoader();
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.AmdPackageHandler.klass)})},
- messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"]}),
- smalltalk.AmdPackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "resetCommitPaths",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@defaultNamespace"]=nil;
- return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.AmdPackageHandler.klass)})},
- messageSends: []}),
- smalltalk.AmdPackageHandler.klass);
- smalltalk.addClass('LegacyPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitChannels",
- fn: function (){
- var self=this;
- function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
- function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
- function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=[(function(pkg){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st($Exporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
- }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st($StrippedExporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
- }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st($ChunkExporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
- }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.LegacyPackageHandler)})},
- messageSends: ["->", ",", "name", "commitPathJs", "recipe", "default", "commitPathSt"]}),
- smalltalk.LegacyPackageHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathJsFor:",
- fn: function (aPackage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self._class())._defaultCommitPathJs();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
- messageSends: ["defaultCommitPathJs", "class"]}),
- smalltalk.LegacyPackageHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathStFor:",
- fn: function (aPackage){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self._class())._defaultCommitPathSt();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
- messageSends: ["defaultCommitPathSt", "class"]}),
- smalltalk.LegacyPackageHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "loadPackage:prefix:",
- fn: function (packageName,aString){
- var self=this;
- var url;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- url=_st(_st(_st("/".__comma(aString)).__comma("/js/")).__comma(packageName)).__comma(".js");
- self._ajax_(smalltalk.HashedCollection._from_(["url".__minus_gt(url),"type".__minus_gt("GET"),"dataType".__minus_gt("script"),"complete".__minus_gt((function(jqXHR,textStatus){
- return smalltalk.withContext(function($ctx2) {
- $1=_st(_st(jqXHR)._readyState()).__eq((4));
- if(smalltalk.assert($1)){
- return self._setupPackageNamed_prefix_(packageName,aString);
- };
- }, function($ctx2) {$ctx2.fillBlock({jqXHR:jqXHR,textStatus:textStatus},$ctx1)})})),"error".__minus_gt((function(){
- return smalltalk.withContext(function($ctx2) {
- return self._alert_("Could not load package at: ".__comma(url));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))]));
- return self}, function($ctx1) {$ctx1.fill(self,"loadPackage:prefix:",{packageName:packageName,aString:aString,url:url},smalltalk.LegacyPackageHandler)})},
- messageSends: [",", "ajax:", "->", "ifTrue:", "setupPackageNamed:prefix:", "=", "readyState", "alert:"]}),
- smalltalk.LegacyPackageHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "loadPackages:prefix:",
- fn: function (aCollection,aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aCollection)._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return self._loadPackage_prefix_(each,aString);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler)})},
- messageSends: ["do:", "loadPackage:prefix:"]}),
- smalltalk.LegacyPackageHandler);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "setupPackageNamed:prefix:",
- fn: function (packageName,aString){
- var self=this;
- function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st($Package())._named_(packageName);
- _st($1)._setupClasses();
- _st($1)._commitPathJs_(_st("/".__comma(aString)).__comma("/js"));
- $2=_st($1)._commitPathSt_(_st("/".__comma(aString)).__comma("/st"));
- return self}, function($ctx1) {$ctx1.fill(self,"setupPackageNamed:prefix:",{packageName:packageName,aString:aString},smalltalk.LegacyPackageHandler)})},
- messageSends: ["setupClasses", "named:", "commitPathJs:", ",", "commitPathSt:"]}),
- smalltalk.LegacyPackageHandler);
- smalltalk.LegacyPackageHandler.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathsFromLoader",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var commitPath = typeof amber !== 'undefined' && amber.commitPath;
- if (!commitPath) return;
- if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
- if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
- ;
- return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.LegacyPackageHandler.klass)})},
- messageSends: []}),
- smalltalk.LegacyPackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultCommitPathJs",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@defaultCommitPathJs"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@defaultCommitPathJs"]="js";
- $1=self["@defaultCommitPathJs"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.LegacyPackageHandler.klass)})},
- messageSends: ["ifNil:"]}),
- smalltalk.LegacyPackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultCommitPathJs:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@defaultCommitPathJs"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
- messageSends: []}),
- smalltalk.LegacyPackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultCommitPathSt",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@defaultCommitPathSt"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@defaultCommitPathSt"]="st";
- $1=self["@defaultCommitPathSt"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.LegacyPackageHandler.klass)})},
- messageSends: ["ifNil:"]}),
- smalltalk.LegacyPackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "defaultCommitPathSt:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@defaultCommitPathSt"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
- messageSends: []}),
- smalltalk.LegacyPackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "initialize",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.LegacyPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
- self._registerFor_("unknown");
- self._commitPathsFromLoader();
- return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.LegacyPackageHandler.klass)})},
- messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"]}),
- smalltalk.LegacyPackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "loadPackages:prefix:",
- fn: function (aCollection,aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self._new())._loadPackages_prefix_(aCollection,aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler.klass)})},
- messageSends: ["loadPackages:prefix:", "new"]}),
- smalltalk.LegacyPackageHandler.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "resetCommitPaths",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@defaultCommitPathJs"]=nil;
- self["@defaultCommitPathSt"]=nil;
- return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.LegacyPackageHandler.klass)})},
- messageSends: []}),
- smalltalk.LegacyPackageHandler.klass);
- smalltalk.addClass('PluggableExporter', smalltalk.Object, ['recipe'], 'Importer-Exporter');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportAllPackages",
- fn: function (){
- var self=this;
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($String())._streamContents_((function(stream){
- return smalltalk.withContext(function($ctx2) {
- return _st(_st(_st($Smalltalk())._current())._packages())._do_((function(pkg){
- return smalltalk.withContext(function($ctx3) {
- return self._exportPackage_on_(pkg,stream);
- }, function($ctx3) {$ctx3.fillBlock({pkg:pkg},$ctx2)})}));
- }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"exportAllPackages",{},smalltalk.PluggableExporter)})},
- messageSends: ["streamContents:", "do:", "exportPackage:on:", "packages", "current"]}),
- smalltalk.PluggableExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "exportPackage:on:",
- fn: function (aPackage,aStream){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self._interpreter())._interpret_for_on_(self._recipe(),aPackage,aStream);
- return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.PluggableExporter)})},
- messageSends: ["interpret:for:on:", "recipe", "interpreter"]}),
- smalltalk.PluggableExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "interpreter",
- fn: function (){
- var self=this;
- function $ExportRecipeInterpreter(){return smalltalk.ExportRecipeInterpreter||(typeof ExportRecipeInterpreter=="undefined"?nil:ExportRecipeInterpreter)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($ExportRecipeInterpreter())._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.PluggableExporter)})},
- messageSends: ["new"]}),
- smalltalk.PluggableExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "recipe",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@recipe"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.PluggableExporter)})},
- messageSends: []}),
- smalltalk.PluggableExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "recipe:",
- fn: function (anArray){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@recipe"]=anArray;
- return self}, function($ctx1) {$ctx1.fill(self,"recipe:",{anArray:anArray},smalltalk.PluggableExporter)})},
- messageSends: []}),
- smalltalk.PluggableExporter);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "forRecipe:",
- fn: function (aRecipe){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- _st($2)._recipe_(aRecipe);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"forRecipe:",{aRecipe:aRecipe},smalltalk.PluggableExporter.klass)})},
- messageSends: ["recipe:", "new", "yourself"]}),
- smalltalk.PluggableExporter.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "ownClassesOfPackage:",
- fn: function (package_){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(package_)._sortedClasses())._asSet();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"ownClassesOfPackage:",{package_:package_},smalltalk.PluggableExporter.klass)})},
- messageSends: ["asSet", "sortedClasses"]}),
- smalltalk.PluggableExporter.klass);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "amdNamespace",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return (self.transport && self.transport.amdNamespace) || nil;
- return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace",{},smalltalk.Package)})},
- messageSends: []}),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "amdNamespace:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- if (!self.transport) { self.transport = { type: 'amd' }; }
- if (self.transport.type !== 'amd') { throw new Error('Package '+self._name()+' has transport type '+self.transport.type+', not "amd".'); }
- self.transport.amdNamespace = aString;;
- return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace:",{aString:aString},smalltalk.Package)})},
- messageSends: []}),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commit",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self._transport())._commit_(self);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.Package)})},
- messageSends: ["commit:", "transport"]}),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathJs",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $3,$2,$1;
- $3=self["@extension"];
- if(($receiver = $3) == nil || $receiver == undefined){
- self["@extension"]=smalltalk.HashedCollection._from_([]);
- $2=self["@extension"];
- } else {
- $2=$3;
- };
- $1=_st($2)._at_ifAbsent_("commitPathJs",(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self._transport())._commitPathJsFor_(self);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
- messageSends: ["at:ifAbsent:", "commitPathJsFor:", "transport", "ifNil:"]}),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathJs:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $3,$2,$1;
- $3=self["@extension"];
- if(($receiver = $3) == nil || $receiver == undefined){
- self["@extension"]=smalltalk.HashedCollection._from_([]);
- $2=self["@extension"];
- } else {
- $2=$3;
- };
- $1=_st($2)._at_put_("commitPathJs",aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
- messageSends: ["at:put:", "ifNil:"]}),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathSt",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $3,$2,$1;
- $3=self["@extension"];
- if(($receiver = $3) == nil || $receiver == undefined){
- self["@extension"]=smalltalk.HashedCollection._from_([]);
- $2=self["@extension"];
- } else {
- $2=$3;
- };
- $1=_st($2)._at_ifAbsent_("commitPathSt",(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self._transport())._commitPathStFor_(self);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
- messageSends: ["at:ifAbsent:", "commitPathStFor:", "transport", "ifNil:"]}),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "commitPathSt:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $3,$2,$1;
- $3=self["@extension"];
- if(($receiver = $3) == nil || $receiver == undefined){
- self["@extension"]=smalltalk.HashedCollection._from_([]);
- $2=self["@extension"];
- } else {
- $2=$3;
- };
- $1=_st($2)._at_put_("commitPathSt",aString);
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
- messageSends: ["at:put:", "ifNil:"]}),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "transport",
- fn: function (){
- var self=this;
- function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st($PackageHandler())._for_(self._transportType());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"transport",{},smalltalk.Package)})},
- messageSends: ["for:", "transportType"]}),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "transportJson",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return JSON.stringify(self.transport || null);;
- return self}, function($ctx1) {$ctx1.fill(self,"transportJson",{},smalltalk.Package)})},
- messageSends: []}),
- smalltalk.Package);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "transportType",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return (self.transport && self.transport.type) || 'unknown';;
- return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
- messageSends: []}),
- smalltalk.Package);
- });
|