define("amber/Importer-Exporter", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){ smalltalk.addPackage('Importer-Exporter'); smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter'); smalltalk.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a ChunkParser new\x0a stream: aStream;\x0a nextChunk"; smalltalk.addMethod( smalltalk.method({ selector: "nextChunk", category: 'reading', 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)})}, args: [], 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 metod returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a\x09\x09[char := stream next.\x0a\x09\x09char notNil] whileTrue: [\x0a\x09\x09\x09\x09char = '!' ifTrue: [\x0a\x09\x09\x09\x09\x09\x09stream peek = '!'\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifTrue: [stream next \x22skipping the escape double\x22]\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifFalse: [^result contents trimBoth \x22chunk end marker found\x22]].\x0a\x09\x09\x09\x09result nextPut: char].\x0a\x09^nil \x22a chunk needs to end with !\x22", messageSends: ["writeStream", "whileTrue:", "ifTrue:", "ifTrue:ifFalse:", "next", "trimBoth", "contents", "=", "peek", "nextPut:", "notNil"], referencedClasses: [] }), smalltalk.ChunkParser); smalltalk.addMethod( smalltalk.method({ selector: "stream:", category: 'accessing', 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)})}, args: ["aStream"], source: "stream: aStream\x0a\x09stream := aStream", messageSends: [], referencedClasses: [] }), smalltalk.ChunkParser); smalltalk.addMethod( smalltalk.method({ selector: "on:", category: 'not yet classified', 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)})}, args: ["aStream"], source: "on: aStream\x0a\x09^self new stream: aStream", messageSends: ["stream:", "new"], referencedClasses: [] }), smalltalk.ChunkParser.klass); smalltalk.addClass('Exporter', smalltalk.Object, [], 'Importer-Exporter'); smalltalk.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).\x0a\x0a## API\x0a\x0aUse `#exportAll`, `#exportClass:` or `#exportPackage:` methods."; smalltalk.addMethod( smalltalk.method({ selector: "classNameFor:", category: 'private', 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)})}, args: ["aClass"], source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09\x09ifTrue: [aClass instanceClass name, '.klass']\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: ['nil']\x0a\x09\x09\x09ifFalse: [aClass name]]", messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"], referencedClasses: [] }), smalltalk.Exporter); smalltalk.addMethod( smalltalk.method({ selector: "exportAll", category: 'fileOut', 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 _st(stream)._nextPutAll_(self._exportPackage_(_st(pkg)._name())); }, function($ctx3) {$ctx3.fillBlock({pkg:pkg},$ctx2)})})); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"exportAll",{},smalltalk.Exporter)})}, args: [], source: "exportAll\x0a\x09\x22Export all packages in the system.\x22\x0a\x0a\x09^String streamContents: [:stream |\x0a\x09\x09Smalltalk current packages do: [:pkg |\x0a\x09\x09stream nextPutAll: (self exportPackage: pkg name)]]", messageSends: ["streamContents:", "do:", "nextPutAll:", "exportPackage:", "name", "packages", "current"], referencedClasses: ["Smalltalk", "String"] }), smalltalk.Exporter); smalltalk.addMethod( smalltalk.method({ selector: "exportClass:", category: 'fileOut', fn: function (aClass){ var self=this; 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) { self._exportDefinitionOf_on_(aClass,stream); self._exportMethodsOf_on_(aClass,stream); self._exportMetaDefinitionOf_on_(aClass,stream); return self._exportMethodsOf_on_(_st(aClass)._class(),stream); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"exportClass:",{aClass:aClass},smalltalk.Exporter)})}, args: ["aClass"], source: "exportClass: aClass\x0a\x09\x22Export a single class. Subclasses override these methods.\x22\x0a\x0a\x09^String streamContents: [:stream |\x0a\x09\x09self exportDefinitionOf: aClass on: stream.\x0a\x09\x09self exportMethodsOf: aClass on: stream.\x0a\x09\x09self exportMetaDefinitionOf: aClass on: stream.\x0a\x09\x09self exportMethodsOf: aClass class on: stream]", messageSends: ["streamContents:", "exportDefinitionOf:on:", "exportMethodsOf:on:", "exportMetaDefinitionOf:on:", "class"], referencedClasses: ["String"] }), smalltalk.Exporter); smalltalk.addMethod( smalltalk.method({ selector: "exportDefinitionOf:on:", category: 'private', 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_("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)})}, args: ["aClass", "aStream"], source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.';\x0a\x09\x09nextPutAll: (self classNameFor: aClass);\x0a\x09\x09nextPutAll: '.comment=';\x0a\x09\x09nextPutAll: aClass comment asJavascript;\x0a\x09\x09nextPutAll: ';'].\x0a\x09aStream lf", messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "lf", "asJavascript", "comment", "notEmpty"], referencedClasses: [] }), smalltalk.Exporter); smalltalk.addMethod( smalltalk.method({ selector: "exportMetaDefinitionOf:on:", category: 'private', 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; $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)})}, args: ["aClass", "aStream"], source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ','].\x0a\x09\x09aStream nextPutAll: '];', String lf]", messageSends: ["ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"], referencedClasses: ["String"] }), smalltalk.Exporter); smalltalk.addMethod( smalltalk.method({ selector: "exportMethod:of:on:", category: 'private', fn: function (aMethod,aClass,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_(aClass))); _st($3)._nextPutAll_(");"); _st($3)._lf(); $4=_st($3)._lf(); return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:of:on:",{aMethod:aMethod,aClass:aClass,aStream:aStream},smalltalk.Exporter)})}, args: ["aMethod", "aClass", "aStream"], source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09\x22nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x22\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'category: ''', aMethod category, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ');';lf;lf", messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:"], referencedClasses: [] }), smalltalk.Exporter); smalltalk.addMethod( smalltalk.method({ selector: "exportMethodsOf:on:", category: 'private', fn: function (aClass,aStream){ var self=this; return smalltalk.withContext(function($ctx1) { var $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)})})))._do_((function(each){ return smalltalk.withContext(function($ctx2) { $1=_st(_st(each)._category())._match_("^\x5c*"); if(! smalltalk.assert($1)){ return self._exportMethod_of_on_(each,aClass,aStream); }; }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); _st(aStream)._lf(); return self}, function($ctx1) {$ctx1.fill(self,"exportMethodsOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})}, args: ["aClass", "aStream"], source: "exportMethodsOf: aClass on: aStream\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:each |\x0a\x09\x09(each category match: '^\x5c*') ifFalse: [\x0a\x09\x09\x09self exportMethod: each of: aClass on: aStream]].\x0a\x09aStream lf", messageSends: ["do:", "ifFalse:", "exportMethod:of:on:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "lf"], referencedClasses: [] }), smalltalk.Exporter); smalltalk.addMethod( smalltalk.method({ selector: "exportPackage:", category: 'fileOut', fn: function (packageName){ var self=this; var package_; 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) { package_=_st(_st($Smalltalk())._current())._packageAt_(packageName); package_; self._exportPackagePrologueOf_on_(package_,stream); return _st((function(){ return smalltalk.withContext(function($ctx3) { self._exportPackageDefinitionOf_on_(package_,stream); _st(_st(_st(package_)._sortedClasses())._asSet())._do_((function(each){ return smalltalk.withContext(function($ctx4) { return _st(stream)._nextPutAll_(self._exportClass_(each)); }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3)})})); return self._exportPackageExtensionsOf_on_(package_,stream); }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._ensure_((function(){ return smalltalk.withContext(function($ctx3) { return self._exportPackageEpilogueOn_(stream); }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})})); }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})); return $1; }, function($ctx1) {$ctx1.fill(self,"exportPackage:",{packageName:packageName,package_:package_},smalltalk.Exporter)})}, args: ["packageName"], source: "exportPackage: packageName\x0a\x09\x22Export a given package by name.\x22\x0a\x0a\x09| package |\x0a\x09^String streamContents: [:stream |\x0a\x09\x09package := Smalltalk current packageAt: packageName.\x0a\x09\x09self exportPackagePrologueOf: package on: stream.\x0a\x09\x09[\x0a\x09\x09\x09self exportPackageDefinitionOf: package on: stream.\x0a\x0a\x09\x09\x09\x22Export classes in dependency order.\x0a\x09\x09\x09Update (issue #171): Remove duplicates for export\x22\x0a\x09\x09\x09package sortedClasses asSet do: [:each |\x0a\x09\x09\x09\x09\x09\x09stream nextPutAll: (self exportClass: each)].\x0a\x09\x09\x09self exportPackageExtensionsOf: package on: stream\x0a\x09\x09] ensure: [\x0a\x09\x09\x09self exportPackageEpilogueOn: stream\x0a\x09\x09]]", messageSends: ["streamContents:", "packageAt:", "current", "exportPackagePrologueOf:on:", "ensure:", "exportPackageEpilogueOn:", "exportPackageDefinitionOf:on:", "do:", "nextPutAll:", "exportClass:", "asSet", "sortedClasses", "exportPackageExtensionsOf:on:"], referencedClasses: ["Smalltalk", "String"] }), smalltalk.Exporter); smalltalk.addMethod( smalltalk.method({ selector: "exportPackageDefinitionOf:on:", category: 'private', fn: function (package_,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(package_)._name())).__comma("');")); $2=_st($1)._lf(); return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.Exporter)})}, args: ["package", "aStream"], source: "exportPackageDefinitionOf: package on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addPackage(';\x0a\x09\x09nextPutAll: '''', package name, ''');';\x0a\x09\x09lf", messageSends: ["nextPutAll:", ",", "name", "lf"], referencedClasses: [] }), smalltalk.Exporter); smalltalk.addMethod( smalltalk.method({ selector: "exportPackageEpilogueOn:", category: 'private', fn: function (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,"exportPackageEpilogueOn:",{aStream:aStream},smalltalk.Exporter)})}, args: ["aStream"], source: "exportPackageEpilogueOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf", messageSends: ["nextPutAll:", "lf"], referencedClasses: [] }), smalltalk.Exporter); smalltalk.addMethod( smalltalk.method({ selector: "exportPackageExtensionsOf:on:", category: 'private', fn: function (package_,aStream){ var self=this; var name; 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(package_)._name(); _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(_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)})})))._do_((function(method){ return smalltalk.withContext(function($ctx4) { $1=_st(_st(method)._category())._match_("^\x5c*".__comma(name)); if(smalltalk.assert($1)){ return self._exportMethod_of_on_(method,aClass,aStream); }; }, function($ctx4) {$ctx4.fillBlock({method:method},$ctx3)})})); }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})})); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"exportPackageExtensionsOf:on:",{package_:package_,aStream:aStream,name:name},smalltalk.Exporter)})}, args: ["package", "aStream"], source: "exportPackageExtensionsOf: package on: aStream\x0a\x09\x22Issue #143: sort classes and methods alphabetically\x22\x0a\x0a\x09| name |\x0a\x09name := package name.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [:each |\x0a\x09\x09{each. each class} do: [:aClass |\x0a\x09\x09\x09((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:method |\x0a\x09\x09\x09\x09(method category match: '^\x5c*', name) ifTrue: [\x0a\x09\x09\x09\x09\x09self exportMethod: method of: aClass on: aStream ]]]]", messageSends: ["name", "do:", "ifTrue:", "exportMethod:of:on:", "match:", ",", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "class", "sortedClasses:", "classes", "current"], referencedClasses: ["Smalltalk", "Package"] }), smalltalk.Exporter); smalltalk.addMethod( smalltalk.method({ selector: "exportPackagePrologueOf:on:", category: 'private', fn: function (aPackage,aStream){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=aStream; _st($1)._nextPutAll_("define(\x22amber/"); _st($1)._nextPutAll_(_st(aPackage)._name()); _st($1)._nextPutAll_("\x22, [\x22amber_vm/smalltalk\x22,\x22amber_vm/nil\x22,\x22amber_vm/_st\x22], function(smalltalk,nil,_st){"); $2=_st($1)._lf(); return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})}, args: ["aPackage", "aStream"], source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22amber/';\x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, [\x22amber_vm/smalltalk\x22,\x22amber_vm/nil\x22,\x22amber_vm/_st\x22], function(smalltalk,nil,_st){';\x0a\x09\x09lf", messageSends: ["nextPutAll:", "name", "lf"], referencedClasses: [] }), smalltalk.Exporter); smalltalk.addClass('ChunkExporter', smalltalk.Exporter, [], 'Importer-Exporter'); smalltalk.ChunkExporter.comment="I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.\x0a\x0aI do not output any compiled code."; smalltalk.addMethod( smalltalk.method({ selector: "chunkEscape:", category: 'private', 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.ChunkExporter)})}, args: ["aString"], source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^(aString replace: '!' with: '!!') trimBoth", messageSends: ["trimBoth", "replace:with:"], referencedClasses: [] }), smalltalk.ChunkExporter); smalltalk.addMethod( smalltalk.method({ selector: "classNameFor:", category: 'private', 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.ChunkExporter)})}, args: ["aClass"], source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09\x09ifTrue: [aClass instanceClass name, ' class']\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: ['nil']\x0a\x09\x09\x09ifFalse: [aClass name]]", messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"], referencedClasses: [] }), smalltalk.ChunkExporter); smalltalk.addMethod( smalltalk.method({ selector: "exportDefinitionOf:on:", category: 'private', 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)})}, args: ["aClass", "aStream"], 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", messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"], referencedClasses: [] }), smalltalk.ChunkExporter); smalltalk.addMethod( smalltalk.method({ selector: "exportMetaDefinitionOf:on:", category: 'private', 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)})}, args: ["aClass", "aStream"], 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]", messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"], referencedClasses: [] }), smalltalk.ChunkExporter); smalltalk.addMethod( smalltalk.method({ selector: "exportMethod:of:on:", category: 'private', fn: function (aMethod,aClass,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:of:on:",{aMethod:aMethod,aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})}, args: ["aMethod", "aClass", "aStream"], source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'", messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"], referencedClasses: [] }), smalltalk.ChunkExporter); smalltalk.addMethod( smalltalk.method({ selector: "exportMethods:category:of:on:", category: 'private', fn: function (methods,category,aClass,aStream){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4; $1=aStream; _st($1)._nextPutAll_("!".__comma(self._classNameFor_(aClass))); $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(category)).__comma("'!")); _st(_st(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)})})))._do_((function(each){ return smalltalk.withContext(function($ctx2) { return self._exportMethod_of_on_(each,aClass,aStream); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); $3=aStream; _st($3)._nextPutAll_(" !"); _st($3)._lf(); $4=_st($3)._lf(); return self}, function($ctx1) {$ctx1.fill(self,"exportMethods:category:of:on:",{methods:methods,category:category,aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})}, args: ["methods", "category", "aClass", "aStream"], source: "exportMethods: methods category: category of: aClass on: aStream\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', category, '''!'.\x0a\x09\x09(methods sorted: [:a :b | a selector <= b selector]) do: [:each |\x0a\x09\x09\x09\x09self exportMethod: each of: aClass on: aStream].\x0a\x09aStream nextPutAll: ' !'; lf; lf", messageSends: ["nextPutAll:", ",", "classNameFor:", "do:", "exportMethod:of:on:", "sorted:", "<=", "selector", "lf"], referencedClasses: [] }), smalltalk.ChunkExporter); smalltalk.addMethod( smalltalk.method({ selector: "exportMethodsOf:on:", category: 'private', fn: function (aClass,aStream){ var self=this; var map; function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} return smalltalk.withContext(function($ctx1) { var $1; 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)})})); _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)})})))._do_((function(category){ var methods; return smalltalk.withContext(function($ctx2) { methods=_st(map)._at_(category); methods; return self._exportMethods_category_of_on_(methods,category,aClass,aStream); }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"exportMethodsOf:on:",{aClass:aClass,aStream:aStream,map:map},smalltalk.ChunkExporter)})}, args: ["aClass", "aStream"], source: "exportMethodsOf: aClass on: aStream\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [:category :methods |\x0a\x09\x09(category match: '^\x5c*') ifFalse: [ map at: category put: methods ]].\x0a\x09(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |\x0a\x09\x09methods := map at: category.\x0a\x09\x09self\x0a\x09\x09\x09exportMethods: methods\x0a\x09\x09\x09category: category\x0a\x09\x09\x09of: aClass\x0a\x09\x09\x09on: aStream ]", messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "do:", "at:", "exportMethods:category:of:on:", "sorted:", "<=", "keys"], referencedClasses: ["Dictionary"] }), smalltalk.ChunkExporter); smalltalk.addMethod( smalltalk.method({ selector: "exportPackageDefinitionOf:on:", category: 'private', fn: function (package_,aStream){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2; $1=aStream; _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(package_)._name())).__comma("'!")); $2=_st($1)._lf(); return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.ChunkExporter)})}, args: ["package", "aStream"], source: "exportPackageDefinitionOf: package on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk current createPackage: ''', package name, '''!';\x0a\x09\x09lf", messageSends: ["nextPutAll:", ",", "name", "lf"], referencedClasses: [] }), smalltalk.ChunkExporter); smalltalk.addMethod( smalltalk.method({ selector: "exportPackageEpilogueOn:", category: 'private', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOn:",{aStream:aStream},smalltalk.ChunkExporter)})}, args: ["aStream"], source: "exportPackageEpilogueOn: aStream", messageSends: [], referencedClasses: [] }), smalltalk.ChunkExporter); smalltalk.addMethod( smalltalk.method({ selector: "exportPackageExtensionsOf:on:", category: 'private', fn: function (package_,aStream){ var self=this; var name,map; function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)} 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(package_)._name(); _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)._match_("^\x5c*".__comma(name)); if(smalltalk.assert($1)){ return _st(map)._at_put_(category,methods); }; }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})})); return _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)})})))._do_((function(category){ var methods; return smalltalk.withContext(function($ctx4) { methods=_st(map)._at_(category); methods; return self._exportMethods_category_of_on_(methods,category,aClass,aStream); }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})})); }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})})); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})); return self}, function($ctx1) {$ctx1.fill(self,"exportPackageExtensionsOf:on:",{package_:package_,aStream:aStream,name:name,map:map},smalltalk.ChunkExporter)})}, args: ["package", "aStream"], source: "exportPackageExtensionsOf: package on: aStream\x0a\x09\x22We need to override this one too since we need to group\x0a\x09all methods in a given protocol under a leading methodsFor: chunk\x0a\x09for that class.\x22\x0a\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map |\x0a\x09name := package name.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [:each |\x0a\x09\x09{each. each class} do: [:aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [:category :methods |\x0a\x09\x09\x09\x09(category match: '^\x5c*', name) ifTrue: [ map at: category put: methods ]].\x0a\x09\x09\x09(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |\x0a\x09\x09\x09\x09methods := map at: category.\x0a\x09\x09\x09\x09self exportMethods: methods category: category of: aClass on: aStream ]]]", messageSends: ["name", "do:", "new", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "at:", "exportMethods:category:of:on:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"], referencedClasses: ["Dictionary", "Smalltalk", "Package"] }), smalltalk.ChunkExporter); smalltalk.addMethod( smalltalk.method({ selector: "exportPackagePrologueOn:", category: 'private', fn: function (aStream){ var self=this; return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOn:",{aStream:aStream},smalltalk.ChunkExporter)})}, args: ["aStream"], source: "exportPackagePrologueOn: aStream", messageSends: [], referencedClasses: [] }), smalltalk.ChunkExporter); smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter'); smalltalk.StrippedExporter.comment="I export Amber code into a JavaScript string, but without any optional associated data like the Amber source code."; smalltalk.addMethod( smalltalk.method({ selector: "exportDefinitionOf:on:", category: 'private', fn: function (aClass,aStream){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4; $1=aStream; _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)})}, args: ["aClass", "aStream"], source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aStream lf", messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "lf"], referencedClasses: [] }), smalltalk.StrippedExporter); smalltalk.addMethod( smalltalk.method({ selector: "exportMethod:of:on:", category: 'private', fn: function (aMethod,aClass,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_(aClass))); _st($1)._nextPutAll_(");"); _st($1)._lf(); $2=_st($1)._lf(); return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:of:on:",{aMethod:aMethod,aClass:aClass,aStream:aStream},smalltalk.StrippedExporter)})}, args: ["aMethod", "aClass", "aStream"], source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09\x22nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x22\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ');';lf;lf", messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "compiledSource", "fn", "messageSends", "classNameFor:"], referencedClasses: [] }), smalltalk.StrippedExporter); smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter'); smalltalk.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString"; smalltalk.addMethod( smalltalk.method({ selector: "import:", category: 'fileIn', 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)})}, args: ["aStream"], source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09[chunk := parser nextChunk.\x0a\x09chunk isNil] whileFalse: [\x0a\x09\x09chunk isEmpty\x0a\x09\x09\x09ifTrue: [lastEmpty := true]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser]]]", messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"], referencedClasses: ["ChunkParser", "Compiler"] }), smalltalk.Importer); smalltalk.addClass('PackageHandler', smalltalk.Object, [], 'Importer-Exporter'); smalltalk.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods."; smalltalk.addMethod( smalltalk.method({ selector: "ajaxPutAt:data:", category: 'private', fn: function (aURL,aString){ var self=this; return smalltalk.withContext(function($ctx1) { _st(jQuery)._ajax_options_(aURL,smalltalk.HashedCollection._from_(["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)})}, args: ["aURL", "aString"], source: "ajaxPutAt: aURL data: aString\x0a\x09jQuery\x0a\x09\x09ajax: aURL \x0a\x09\x09options: #{ \x0a\x09\x09\x09'type' -> 'PUT'.\x0a\x09\x09\x09'data' -> aString.\x0a\x09\x09\x09'contentType' -> 'text/plain;charset=UTF-8'.\x0a\x09\x09\x09'error' -> [ :xhr | self error: 'Commiting ' , aURL , ' failed with reason: \x22' , (xhr responseText) , '\x22'] }", messageSends: ["ajax:options:", "->", "error:", ",", "responseText"], referencedClasses: [] }), smalltalk.PackageHandler); smalltalk.addMethod( smalltalk.method({ selector: "commit:", category: 'committing', fn: function (aPackage){ var self=this; 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(_st(commitStrategy)._key())._exportPackage_(_st(aPackage)._name()); 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)})}, args: ["aPackage"], source: "commit: aPackage\x0a\x09self commitChannels\x0a\x09\x09do: [ :commitStrategyFactory || fileContents commitStrategy |\x0a\x09\x09\x09commitStrategy := commitStrategyFactory value: aPackage.\x0a\x09\x09\x09fileContents := (commitStrategy key exportPackage: aPackage name).\x0a\x09\x09\x09self ajaxPutAt: commitStrategy value data: fileContents ]\x0a\x09\x09displayingProgress: 'Committing package ', aPackage name", messageSends: ["do:displayingProgress:", "value:", "exportPackage:", "name", "key", "ajaxPutAt:data:", "value", ",", "commitChannels"], referencedClasses: [] }), smalltalk.PackageHandler); smalltalk.PackageHandler.klass.iVarNames = ['registry']; smalltalk.addMethod( smalltalk.method({ selector: "classRegisteredFor:", category: 'accessing', 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)})}, args: ["aString"], source: "classRegisteredFor: aString\x0a\x09^registry at: aString", messageSends: ["at:"], referencedClasses: [] }), smalltalk.PackageHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "for:", category: 'accessing', 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)})}, args: ["aString"], source: "for: aString\x0a\x09^(self classRegisteredFor: aString) new", messageSends: ["new", "classRegisteredFor:"], referencedClasses: [] }), smalltalk.PackageHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', 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)})}, args: [], source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}", messageSends: ["initialize"], referencedClasses: [] }), smalltalk.PackageHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "register:for:", category: 'registry', 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)})}, args: ["aClass", "aString"], source: "register: aClass for: aString\x0a\x09registry at: aString put: aClass", messageSends: ["at:put:"], referencedClasses: [] }), smalltalk.PackageHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "registerFor:", category: 'registry', 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)})}, args: ["aString"], source: "registerFor: aString\x0a\x09PackageHandler register: self for: aString", messageSends: ["register:for:"], referencedClasses: ["PackageHandler"] }), smalltalk.PackageHandler.klass); smalltalk.addClass('LegacyPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter'); smalltalk.LegacyPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods."; smalltalk.addMethod( smalltalk.method({ selector: "commitChannels", category: 'committing', 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($Exporter())._new()).__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($StrippedExporter())._new()).__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($ChunkExporter())._new()).__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)})}, args: [], source: "commitChannels\x0a\x09^{ \x0a\x09\x09[ :pkg | Exporter new -> (pkg commitPathJs, '/', pkg name, '.js') ].\x0a\x09\x09[ :pkg | StrippedExporter new -> (pkg commitPathJs, '/', pkg name, '.deploy.js') ].\x0a\x09\x09[ :pkg | ChunkExporter new -> (pkg commitPathSt, '/', pkg name, '.st') ]\x0a\x09}", messageSends: ["->", ",", "name", "commitPathJs", "new", "commitPathSt"], referencedClasses: ["Exporter", "StrippedExporter", "ChunkExporter"] }), smalltalk.LegacyPackageHandler); smalltalk.addMethod( smalltalk.method({ selector: "commitPathJsFor:", category: 'committing', 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)})}, args: ["aPackage"], source: "commitPathJsFor: aPackage\x0a\x09^self class defaultCommitPathJs", messageSends: ["defaultCommitPathJs", "class"], referencedClasses: [] }), smalltalk.LegacyPackageHandler); smalltalk.addMethod( smalltalk.method({ selector: "commitPathStFor:", category: 'committing', 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)})}, args: ["aPackage"], source: "commitPathStFor: aPackage\x0a\x09^self class defaultCommitPathSt", messageSends: ["defaultCommitPathSt", "class"], referencedClasses: [] }), smalltalk.LegacyPackageHandler); smalltalk.addMethod( smalltalk.method({ selector: "loadPackage:prefix:", category: 'loading', 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"); _st(jQuery)._ajax_options_(url,smalltalk.HashedCollection._from_(["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 _st(window)._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)})}, args: ["packageName", "aString"], source: "loadPackage: packageName prefix: aString\x0a\x09| url |\x0a\x09url := '/', aString, '/js/', packageName, '.js'.\x0a\x09jQuery\x0a\x09\x09ajax: url\x0a\x09\x09options: #{\x0a\x09\x09\x09'type' -> 'GET'.\x0a\x09\x09\x09'dataType' -> 'script'.\x0a\x09\x09\x09'complete' -> [ :jqXHR :textStatus |\x0a\x09\x09\x09\x09jqXHR readyState = 4\x0a\x09\x09\x09\x09\x09ifTrue: [ self setupPackageNamed: packageName prefix: aString ] ].\x0a\x09\x09\x09'error' -> [ window alert: 'Could not load package at: ', url ]\x0a\x09\x09}", messageSends: [",", "ajax:options:", "->", "ifTrue:", "setupPackageNamed:prefix:", "=", "readyState", "alert:"], referencedClasses: [] }), smalltalk.LegacyPackageHandler); smalltalk.addMethod( smalltalk.method({ selector: "loadPackages:prefix:", category: 'loading', 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)})}, args: ["aCollection", "aString"], source: "loadPackages: aCollection prefix: aString\x0a\x09aCollection do: [ :each |\x0a\x09\x09self loadPackage: each prefix: aString ]", messageSends: ["do:", "loadPackage:prefix:"], referencedClasses: [] }), smalltalk.LegacyPackageHandler); smalltalk.addMethod( smalltalk.method({ selector: "setupPackageNamed:prefix:", category: 'private', 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)})}, args: ["packageName", "aString"], source: "setupPackageNamed: packageName prefix: aString\x0a\x0a\x09(Package named: packageName)\x0a\x09\x09setupClasses;\x0a\x09\x09commitPathJs: '/', aString, '/js';\x0a\x09\x09commitPathSt: '/', aString, '/st'", messageSends: ["setupClasses", "named:", "commitPathJs:", ",", "commitPathSt:"], referencedClasses: ["Package"] }), smalltalk.LegacyPackageHandler); smalltalk.LegacyPackageHandler.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt']; smalltalk.addMethod( smalltalk.method({ selector: "commitPathsFromLoader", category: 'commit paths', 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)})}, args: [], source: "commitPathsFromLoader\x0a\x09<\x0a\x09\x09var commitPath = typeof amber !== 'undefined' && amber.commitPath;\x0a\x09\x09if (!commitPath) return;\x0a\x09\x09if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);\x0a\x09\x09if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);\x0a\x09>", messageSends: [], referencedClasses: [] }), smalltalk.LegacyPackageHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "defaultCommitPathJs", category: 'commit paths', 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)})}, args: [], source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']", messageSends: ["ifNil:"], referencedClasses: [] }), smalltalk.LegacyPackageHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "defaultCommitPathJs:", category: 'commit paths', 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)})}, args: ["aString"], source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString", messageSends: [], referencedClasses: [] }), smalltalk.LegacyPackageHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "defaultCommitPathSt", category: 'commit paths', 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)})}, args: [], source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']", messageSends: ["ifNil:"], referencedClasses: [] }), smalltalk.LegacyPackageHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "defaultCommitPathSt:", category: 'commit paths', 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)})}, args: ["aString"], source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString", messageSends: [], referencedClasses: [] }), smalltalk.LegacyPackageHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "initialize", category: 'initialization', 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)})}, args: [], source: "initialize\x0a\x09super initialize.\x0a\x09self registerFor: 'unknown'.\x0a\x09self commitPathsFromLoader", messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"], referencedClasses: [] }), smalltalk.LegacyPackageHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "loadPackages:prefix:", category: 'loading', 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)})}, args: ["aCollection", "aString"], source: "loadPackages: aCollection prefix: aString\x0a\x09^ self new loadPackages: aCollection prefix: aString", messageSends: ["loadPackages:prefix:", "new"], referencedClasses: [] }), smalltalk.LegacyPackageHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "resetCommitPaths", category: 'commit paths', 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)})}, args: [], source: "resetCommitPaths\x0a\x09defaultCommitPathJs := nil.\x0a\x09defaultCommitPathSt := nil", messageSends: [], referencedClasses: [] }), smalltalk.LegacyPackageHandler.klass); smalltalk.addMethod( smalltalk.method({ selector: "commit", category: '*Importer-Exporter', 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)})}, args: [], source: "commit\x0a\x09^ self transport commit: self", messageSends: ["commit:", "transport"], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "commitPathJs", category: '*Importer-Exporter', 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_ifAbsentPut_("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)})}, args: [], source: "commitPathJs\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs ifAbsentPut: [self transport commitPathJsFor: self]", messageSends: ["at:ifAbsentPut:", "commitPathJsFor:", "transport", "ifNil:"], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "commitPathJs:", category: '*Importer-Exporter', 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)})}, args: ["aString"], source: "commitPathJs: aString\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs put: aString", messageSends: ["at:put:", "ifNil:"], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "commitPathSt", category: '*Importer-Exporter', 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_ifAbsentPut_("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)})}, args: [], source: "commitPathSt\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt ifAbsentPut: [self transport commitPathStFor: self]", messageSends: ["at:ifAbsentPut:", "commitPathStFor:", "transport", "ifNil:"], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "commitPathSt:", category: '*Importer-Exporter', 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)})}, args: ["aString"], source: "commitPathSt: aString\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt put: aString", messageSends: ["at:put:", "ifNil:"], referencedClasses: [] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "transport", category: '*Importer-Exporter', 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)})}, args: [], source: "transport\x0a\x09^ PackageHandler for: self transportType", messageSends: ["for:", "transportType"], referencedClasses: ["PackageHandler"] }), smalltalk.Package); smalltalk.addMethod( smalltalk.method({ selector: "transportType", category: '*Importer-Exporter', 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)})}, args: [], source: "transportType\x0a\x09", messageSends: [], referencedClasses: [] }), smalltalk.Package); });