Browse Source

Almost got rid of smalltalk.send()

Nicolas Petton 11 years ago
parent
commit
234cbadfd7

+ 93 - 24
js/Compiler-IR.deploy.js

@@ -1220,6 +1220,24 @@ return true;
 }),
 smalltalk.IRSend);
 
+smalltalk.addMethod(
+"_javascriptSelector",
+smalltalk.method({
+selector: "javascriptSelector",
+fn: function (){
+var self=this;
+var $2,$1;
+$2=smalltalk.send(self,"_classSend",[]);
+if(($receiver = $2) == nil || $receiver == undefined){
+$1=smalltalk.send(smalltalk.send(self,"_selector",[]),"_asSelector",[]);
+} else {
+$1=smalltalk.send(smalltalk.send(self,"_selector",[]),"_asSuperSelector",[]);
+};
+return $1;
+}
+}),
+smalltalk.IRSend);
+
 smalltalk.addMethod(
 "_selector",
 smalltalk.method({
@@ -1894,6 +1912,43 @@ smalltalk.method({
 selector: "visitIRSend:",
 fn: function (anIRSend){
 var self=this;
+var $1,$2,$3;
+$1=_st(anIRSend)._classSend();
+if(($receiver = $1) == nil || $receiver == undefined){
+_st(_st(self)._stream())._nextPutAll_("_st(");
+_st(self)._visit_(_st(_st(anIRSend)._instructions())._first());
+_st(_st(self)._stream())._nextPutAll_(_st(_st(").").__comma(_st(_st(anIRSend)._selector())._asSelector())).__comma("("));
+_st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
+return _st(self)._visit_(each);
+}),(function(){
+return _st(_st(self)._stream())._nextPutAll_(",");
+}));
+_st(_st(self)._stream())._nextPutAll_(")");
+} else {
+$2=_st(self)._stream();
+_st($2)._nextPutAll_(_st(_st(_st(anIRSend)._classSend())._asJavascript()).__comma(".fn.prototype."));
+_st($2)._nextPutAll_(_st(_st(_st(anIRSend)._selector())._asSelector()).__comma(".apply("));
+$3=_st($2)._nextPutAll_("_st(");
+$3;
+_st(self)._visit_(_st(_st(anIRSend)._instructions())._first());
+_st(_st(self)._stream())._nextPutAll_("), [");
+_st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
+return _st(self)._visit_(each);
+}),(function(){
+return _st(_st(self)._stream())._nextPutAll_(",");
+}));
+_st(_st(self)._stream())._nextPutAll_("])");
+};
+return self}
+}),
+smalltalk.IRJSTranslator);
+
+smalltalk.addMethod(
+"_visitIRSendOld_",
+smalltalk.method({
+selector: "visitIRSendOld:",
+fn: function (anIRSend){
+var self=this;
 var $1;
 smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.send("]);
 smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRSend,"_instructions",[]),"_first",[])]);
@@ -2075,6 +2130,23 @@ return self}
 }),
 smalltalk.JSStream);
 
+smalltalk.addMethod(
+"_nextPutContextFor_during_",
+smalltalk.method({
+selector: "nextPutContextFor:during:",
+fn: function (aMethod,aBlock){
+var self=this;
+var $1;
+_st(self)._nextPutAll_("return smalltalk.withContext(function() {");
+_st(aBlock)._value();
+_st(self)._nextPutAll_("}, self, ");
+_st(self)._nextPutAll_(_st(_st(_st(aMethod)._selector())._asJavascript()).__comma(", "));
+_st(self)._nextPutAll_(_st(_st(aMethod)._arguments())._asJavascript());
+$1=_st(self)._nextPutAll_(")");
+return self}
+}),
+smalltalk.JSStream);
+
 smalltalk.addMethod(
 "_nextPutFunctionWith_arguments_",
 smalltalk.method({
@@ -2142,31 +2214,28 @@ selector: "nextPutMethodDeclaration:with:",
 fn: function (aMethod,aBlock){
 var self=this;
 var $1,$2,$3;
-smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.method({"]);
-smalltalk.send(self["@stream"],"_lf",[]);
-smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("selector: \x22","__comma",[smalltalk.send(aMethod,"_selector",[])]),"__comma",["\x22,"])]);
-smalltalk.send(self["@stream"],"_lf",[]);
-smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("source: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_source",[]),"_asJavascript",[])]),"__comma",[","])]);
-$1=smalltalk.send(self["@stream"],"_lf",[]);
-smalltalk.send(aBlock,"_value",[]);
-smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(",","__comma",[smalltalk.send((smalltalk.String || String),"_lf",[])]),"__comma",["messageSends: "])]);
-smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_messageSends",[]),"_asArray",[]),"_asJavascript",[]),"__comma",[","])]);
-smalltalk.send(self["@stream"],"_lf",[]);
-smalltalk.send(self["@stream"],"_nextPutAll_",["superSends: "]);
-smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_superSends",[]),"_asArray",[]),"_asJavascript",[]),"__comma",[","])]);
-smalltalk.send(self["@stream"],"_lf",[]);
-smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("args: ","__comma",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_arguments",[]),"_collect_",[(function(each){
-return smalltalk.send(each,"_value",[]);
-})]),"_asArray",[]),"_asJavascript",[])]),"__comma",[","])]);
-smalltalk.send(self["@stream"],"_lf",[]);
-$2=smalltalk.send(self["@stream"],"_nextPutAll_",["referencedClasses: ["]);
-smalltalk.send(smalltalk.send(aMethod,"_classReferences",[]),"_do_separatedBy_",[(function(each){
-return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asJavascript",[])]);
+_st(self["@stream"])._nextPutAll_("smalltalk.method({");
+_st(self["@stream"])._lf();
+_st(self["@stream"])._nextPutAll_(_st(_st("selector: \x22").__comma(_st(aMethod)._selector())).__comma("\x22,"));
+_st(self["@stream"])._lf();
+_st(self["@stream"])._nextPutAll_(_st(_st("source: ").__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
+$1=_st(self["@stream"])._lf();
+_st(aBlock)._value();
+_st(self["@stream"])._nextPutAll_(_st(_st(",").__comma(_st((smalltalk.String || String))._lf())).__comma("messageSends: "));
+_st(self["@stream"])._nextPutAll_(_st(_st(_st(_st(aMethod)._messageSends())._asArray())._asJavascript()).__comma(","));
+_st(self["@stream"])._lf();
+_st(self["@stream"])._nextPutAll_(_st(_st("args: ").__comma(_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
+return _st(each)._value();
+})))._asArray())._asJavascript())).__comma(","));
+_st(self["@stream"])._lf();
+$2=_st(self["@stream"])._nextPutAll_("referencedClasses: [");
+_st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
+return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
 }),(function(){
-return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
-})]);
-smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
-$3=smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
+return _st(self["@stream"])._nextPutAll_(",");
+}));
+_st(self["@stream"])._nextPutAll_("]");
+$3=_st(self["@stream"])._nextPutAll_("})");
 return self}
 }),
 smalltalk.JSStream);

+ 111 - 27
js/Compiler-IR.js

@@ -1652,6 +1652,29 @@ referencedClasses: []
 }),
 smalltalk.IRSend);
 
+smalltalk.addMethod(
+"_javascriptSelector",
+smalltalk.method({
+selector: "javascriptSelector",
+category: 'accessing',
+fn: function (){
+var self=this;
+var $2,$1;
+$2=smalltalk.send(self,"_classSend",[]);
+if(($receiver = $2) == nil || $receiver == undefined){
+$1=smalltalk.send(smalltalk.send(self,"_selector",[]),"_asSelector",[]);
+} else {
+$1=smalltalk.send(smalltalk.send(self,"_selector",[]),"_asSuperSelector",[]);
+};
+return $1;
+},
+args: [],
+source: "javascriptSelector\x0a\x09^ self classSend \x0a    \x09ifNil: [ self selector asSelector ]\x0a      \x09ifNotNil: [ self selector asSuperSelector ]",
+messageSends: ["ifNil:ifNotNil:", "asSelector", "selector", "asSuperSelector", "classSend"],
+referencedClasses: []
+}),
+smalltalk.IRSend);
+
 smalltalk.addMethod(
 "_selector",
 smalltalk.method({
@@ -2580,6 +2603,48 @@ selector: "visitIRSend:",
 category: 'visiting',
 fn: function (anIRSend){
 var self=this;
+var $1,$2,$3;
+$1=_st(anIRSend)._classSend();
+if(($receiver = $1) == nil || $receiver == undefined){
+_st(_st(self)._stream())._nextPutAll_("_st(");
+_st(self)._visit_(_st(_st(anIRSend)._instructions())._first());
+_st(_st(self)._stream())._nextPutAll_(_st(_st(").").__comma(_st(_st(anIRSend)._selector())._asSelector())).__comma("("));
+_st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
+return _st(self)._visit_(each);
+}),(function(){
+return _st(_st(self)._stream())._nextPutAll_(",");
+}));
+_st(_st(self)._stream())._nextPutAll_(")");
+} else {
+$2=_st(self)._stream();
+_st($2)._nextPutAll_(_st(_st(_st(anIRSend)._classSend())._asJavascript()).__comma(".fn.prototype."));
+_st($2)._nextPutAll_(_st(_st(_st(anIRSend)._selector())._asSelector()).__comma(".apply("));
+$3=_st($2)._nextPutAll_("_st(");
+$3;
+_st(self)._visit_(_st(_st(anIRSend)._instructions())._first());
+_st(_st(self)._stream())._nextPutAll_("), [");
+_st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
+return _st(self)._visit_(each);
+}),(function(){
+return _st(_st(self)._stream())._nextPutAll_(",");
+}));
+_st(_st(self)._stream())._nextPutAll_("])");
+};
+return self},
+args: ["anIRSend"],
+source: "visitIRSend: anIRSend\x0a\x09anIRSend classSend \x0a    \x09ifNil: [\x0a\x09\x09\x09self stream nextPutAll: '_st('.\x0a\x09\x09\x09self visit: anIRSend instructions first.\x0a   \x09\x09 \x09self stream nextPutAll: ').', anIRSend selector asSelector, '('.\x0a\x09\x09\x09anIRSend instructions allButFirst\x0a\x09\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09ifNotNil: [ \x0a\x09\x09\x09self stream \x0a            \x09nextPutAll: anIRSend classSend asJavascript, '.fn.prototype.';\x0a\x09\x09\x09\x09nextPutAll: anIRSend selector asSelector, '.apply(';\x0a\x09\x09\x09\x09nextPutAll: '_st('.\x0a\x09\x09\x09self visit: anIRSend instructions first.\x0a\x09\x09\x09self stream nextPutAll: '), ['.\x0a\x09\x09\x09anIRSend instructions allButFirst\x0a\x09\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09\x09\x09self stream nextPutAll: '])' ]",
+messageSends: ["ifNil:ifNotNil:", "nextPutAll:", "stream", "visit:", "first", "instructions", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "asJavascript", "classSend"],
+referencedClasses: []
+}),
+smalltalk.IRJSTranslator);
+
+smalltalk.addMethod(
+"_visitIRSendOld_",
+smalltalk.method({
+selector: "visitIRSendOld:",
+category: 'visiting',
+fn: function (anIRSend){
+var self=this;
 var $1;
 smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.send("]);
 smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRSend,"_instructions",[]),"_first",[])]);
@@ -2599,7 +2664,7 @@ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(
 smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
 return self},
 args: ["anIRSend"],
-source: "visitIRSend: anIRSend\x0a\x09self stream nextPutAll: 'smalltalk.send('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll:  ',\x22', anIRSend selector asSelector, '\x22,['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ']'.\x0a\x09\x22anIRSend index > 1 \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09anIRSend classSend \x0a\x09\x09\x09\x09ifNil: [ self stream nextPutAll: ',undefined' ]\x0a\x09\x09\x09\x09ifNotNil: [ self stream nextPutAll: ',', anIRSend classSend asJavascript ].\x0a\x09\x09\x09self stream nextPutAll: ',', anIRSend index asString ]\x0a\x09\x09ifFalse: [\x22\x0a\x09\x09\x09anIRSend classSend ifNotNil: [  \x0a\x09\x09\x09\x09self stream nextPutAll: ',', anIRSend classSend asJavascript ]\x22]\x22.\x0a\x09self stream nextPutAll: ')'",
+source: "visitIRSendOld: anIRSend\x0a\x09self stream nextPutAll: 'smalltalk.send('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll:  ',\x22', anIRSend selector asSelector, '\x22,['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ']'.\x0a\x09\x22anIRSend index > 1 \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09anIRSend classSend \x0a\x09\x09\x09\x09ifNil: [ self stream nextPutAll: ',undefined' ]\x0a\x09\x09\x09\x09ifNotNil: [ self stream nextPutAll: ',', anIRSend classSend asJavascript ].\x0a\x09\x09\x09self stream nextPutAll: ',', anIRSend index asString ]\x0a\x09\x09ifFalse: [\x22\x0a\x09\x09\x09anIRSend classSend ifNotNil: [  \x0a\x09\x09\x09\x09self stream nextPutAll: ',', anIRSend classSend asJavascript ]\x22]\x22.\x0a\x09self stream nextPutAll: ')'",
 messageSends: ["nextPutAll:", "stream", "visit:", "first", "instructions", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "ifNotNil:", "asJavascript", "classSend"],
 referencedClasses: []
 }),
@@ -2825,6 +2890,28 @@ referencedClasses: []
 }),
 smalltalk.JSStream);
 
+smalltalk.addMethod(
+"_nextPutContextFor_during_",
+smalltalk.method({
+selector: "nextPutContextFor:during:",
+category: 'streaming',
+fn: function (aMethod,aBlock){
+var self=this;
+var $1;
+_st(self)._nextPutAll_("return smalltalk.withContext(function() {");
+_st(aBlock)._value();
+_st(self)._nextPutAll_("}, self, ");
+_st(self)._nextPutAll_(_st(_st(_st(aMethod)._selector())._asJavascript()).__comma(", "));
+_st(self)._nextPutAll_(_st(_st(aMethod)._arguments())._asJavascript());
+$1=_st(self)._nextPutAll_(")");
+return self},
+args: ["aMethod", "aBlock"],
+source: "nextPutContextFor: aMethod during: aBlock\x0a\x09self nextPutAll: 'return smalltalk.withContext(function() {'.\x0a    aBlock value.\x0a    self \x0a    \x09nextPutAll: '}, self, ';\x0a        nextPutAll: aMethod selector asJavascript, ', ';\x0a        nextPutAll: aMethod arguments asJavascript;\x0a        nextPutAll: ')'",
+messageSends: ["nextPutAll:", "value", ",", "asJavascript", "selector", "arguments"],
+referencedClasses: []
+}),
+smalltalk.JSStream);
+
 smalltalk.addMethod(
 "_nextPutFunctionWith_arguments_",
 smalltalk.method({
@@ -2908,35 +2995,32 @@ category: 'streaming',
 fn: function (aMethod,aBlock){
 var self=this;
 var $1,$2,$3;
-smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.method({"]);
-smalltalk.send(self["@stream"],"_lf",[]);
-smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("selector: \x22","__comma",[smalltalk.send(aMethod,"_selector",[])]),"__comma",["\x22,"])]);
-smalltalk.send(self["@stream"],"_lf",[]);
-smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("source: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_source",[]),"_asJavascript",[])]),"__comma",[","])]);
-$1=smalltalk.send(self["@stream"],"_lf",[]);
-smalltalk.send(aBlock,"_value",[]);
-smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(",","__comma",[smalltalk.send((smalltalk.String || String),"_lf",[])]),"__comma",["messageSends: "])]);
-smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_messageSends",[]),"_asArray",[]),"_asJavascript",[]),"__comma",[","])]);
-smalltalk.send(self["@stream"],"_lf",[]);
-smalltalk.send(self["@stream"],"_nextPutAll_",["superSends: "]);
-smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_superSends",[]),"_asArray",[]),"_asJavascript",[]),"__comma",[","])]);
-smalltalk.send(self["@stream"],"_lf",[]);
-smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("args: ","__comma",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_arguments",[]),"_collect_",[(function(each){
-return smalltalk.send(each,"_value",[]);
-})]),"_asArray",[]),"_asJavascript",[])]),"__comma",[","])]);
-smalltalk.send(self["@stream"],"_lf",[]);
-$2=smalltalk.send(self["@stream"],"_nextPutAll_",["referencedClasses: ["]);
-smalltalk.send(smalltalk.send(aMethod,"_classReferences",[]),"_do_separatedBy_",[(function(each){
-return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asJavascript",[])]);
+_st(self["@stream"])._nextPutAll_("smalltalk.method({");
+_st(self["@stream"])._lf();
+_st(self["@stream"])._nextPutAll_(_st(_st("selector: \x22").__comma(_st(aMethod)._selector())).__comma("\x22,"));
+_st(self["@stream"])._lf();
+_st(self["@stream"])._nextPutAll_(_st(_st("source: ").__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
+$1=_st(self["@stream"])._lf();
+_st(aBlock)._value();
+_st(self["@stream"])._nextPutAll_(_st(_st(",").__comma(_st((smalltalk.String || String))._lf())).__comma("messageSends: "));
+_st(self["@stream"])._nextPutAll_(_st(_st(_st(_st(aMethod)._messageSends())._asArray())._asJavascript()).__comma(","));
+_st(self["@stream"])._lf();
+_st(self["@stream"])._nextPutAll_(_st(_st("args: ").__comma(_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
+return _st(each)._value();
+})))._asArray())._asJavascript())).__comma(","));
+_st(self["@stream"])._lf();
+$2=_st(self["@stream"])._nextPutAll_("referencedClasses: [");
+_st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
+return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
 }),(function(){
-return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
-})]);
-smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
-$3=smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
+return _st(self["@stream"])._nextPutAll_(",");
+}));
+_st(self["@stream"])._nextPutAll_("]");
+$3=_st(self["@stream"])._nextPutAll_("})");
 return self},
 args: ["aMethod", "aBlock"],
-source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream \x0a\x09\x09nextPutAll: 'smalltalk.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: \x22', aMethod selector, '\x22,'; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream \x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'superSends: ';\x0a\x09\x09nextPutAll: aMethod superSends asArray asJavascript, ','; lf;\x0a        nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences \x0a\x09\x09do: [:each | stream nextPutAll: each asJavascript]\x0a\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09stream \x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
-messageSends: ["nextPutAll:", "lf", ",", "selector", "asJavascript", "source", "value", "asArray", "messageSends", "superSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
+source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream \x0a\x09\x09nextPutAll: 'smalltalk.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: \x22', aMethod selector, '\x22,'; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf. \x0a\x09aBlock value.\x0a\x09stream \x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a        nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences \x0a\x09\x09do: [:each | stream nextPutAll: each asJavascript]\x0a\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09stream \x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
+messageSends: ["nextPutAll:", "lf", ",", "selector", "asJavascript", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
 referencedClasses: ["String"]
 }),
 smalltalk.JSStream);

+ 5 - 4
js/Kernel-Classes.deploy.js

@@ -232,9 +232,10 @@ smalltalk.method({
 selector: "methodAt:",
 fn: function (aSymbol){
 var self=this;
-return smalltalk.methods(self)[aSymbol._asString()];
-;
-return self}
+var $1;
+$1=_st(_st(self)._methodDictionary())._at_(_st(aSymbol)._asString());
+return $1;
+}
 }),
 smalltalk.Behavior);
 
@@ -245,7 +246,7 @@ selector: "methodDictionary",
 fn: function (){
 var self=this;
 var dict = smalltalk.HashedCollection._new();
-	var methods = self.fn.prototype.methods;
+	var methods = self.methods;
 	for(var i in methods) {
 		if(methods[i].selector) {
 			dict._at_put_(methods[i].selector, methods[i]);

+ 6 - 5
js/Kernel-Classes.js

@@ -309,12 +309,13 @@ selector: "methodAt:",
 category: 'accessing',
 fn: function (aSymbol){
 var self=this;
-return smalltalk.methods(self)[aSymbol._asString()];
-;
-return self},
+var $1;
+$1=_st(_st(self)._methodDictionary())._at_(_st(aSymbol)._asString());
+return $1;
+},
 args: ["aSymbol"],
-source: "methodAt: aSymbol\x0a\x09<return smalltalk.methods(self)[aSymbol._asString()]>",
-messageSends: [],
+source: "methodAt: aSymbol\x0a\x09^ self methodDictionary at: aSymbol asString",
+messageSends: ["at:", "asString", "methodDictionary"],
 referencedClasses: []
 }),
 smalltalk.Behavior);

+ 1 - 13
js/Kernel-Collections.deploy.js

@@ -2312,7 +2312,7 @@ smalltalk.method({
 selector: "asSelector",
 fn: function (){
 var self=this;
-return smalltalk.selector(this);
+return smalltalk.selector(self);
 ;
 return self}
 }),
@@ -2329,18 +2329,6 @@ return self;
 }),
 smalltalk.String);
 
-smalltalk.addMethod(
-"_asSuperSelector",
-smalltalk.method({
-selector: "asSuperSelector",
-fn: function (){
-var self=this;
-return smalltalk.superSelector(self);
-;
-return self}
-}),
-smalltalk.String);
-
 smalltalk.addMethod(
 "_asSymbol",
 smalltalk.method({

+ 2 - 19
js/Kernel-Collections.js

@@ -3104,11 +3104,11 @@ selector: "asSelector",
 category: 'converting',
 fn: function (){
 var self=this;
-return smalltalk.selector(this);
+return smalltalk.selector(self);
 ;
 return self},
 args: [],
-source: "asSelector\x0a\x09<return smalltalk.selector(this)>",
+source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
 messageSends: [],
 referencedClasses: []
 }),
@@ -3130,23 +3130,6 @@ referencedClasses: []
 }),
 smalltalk.String);
 
-smalltalk.addMethod(
-"_asSuperSelector",
-smalltalk.method({
-selector: "asSuperSelector",
-category: 'converting',
-fn: function (){
-var self=this;
-return smalltalk.superSelector(self);
-;
-return self},
-args: [],
-source: "asSuperSelector\x0a\x09<return smalltalk.superSelector(self)>",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.String);
-
 smalltalk.addMethod(
 "_asSymbol",
 smalltalk.method({

+ 93 - 99
js/boot.js

@@ -13,23 +13,23 @@
    | Amber is released under the MIT license
    |
    | Permission is hereby granted, free of charge, to any person obtaining
-   | a copy of this software and associated documentation files (the 
-   | 'Software'), to deal in the Software without restriction, including 
-   | without limitation the rights to use, copy, modify, merge, publish, 
-   | distribute, sublicense, and/or sell copies of the Software, and to 
-   | permit persons to whom the Software is furnished to do so, subject to 
+   | a copy of this software and associated documentation files (the
+   | 'Software'), to deal in the Software without restriction, including
+   | without limitation the rights to use, copy, modify, merge, publish,
+   | distribute, sublicense, and/or sell copies of the Software, and to
+   | permit persons to whom the Software is furnished to do so, subject to
    | the following conditions:
    |
-   | The above copyright notice and this permission notice shall be 
+   | The above copyright notice and this permission notice shall be
    | included in all copies or substantial portions of the Software.
    |
-   | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 
-   | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
-   | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
-   | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
-   | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
-   | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
-   | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
+   | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+   | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+   | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+   | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+   | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+   | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    |
    ==================================================================== */
 
@@ -109,7 +109,7 @@ function Smalltalk(){
 	var st = this;
 
 	/* This is the current call context object. While it is publicly available,
-	   Use smalltalk.getThisContext() instead which will answer a safe copy of 
+	   Use smalltalk.getThisContext() instead which will answer a safe copy of
 	   the current context */
 
 	st.thisContext = undefined;
@@ -117,9 +117,9 @@ function Smalltalk(){
 	/* List of all reserved words in JavaScript. They may not be used as variables
 	   in Smalltalk. */
 
-	st.reservedWords = ['break', 'case', 'catch', 'char', 'class', 'continue', 'debugger', 
-		'default', 'delete', 'do', 'else', 'finally', 'for', 'function', 
-		'if', 'in', 'instanceof', 'native', 'new', 'private', 'protected', 
+	st.reservedWords = ['break', 'case', 'catch', 'char', 'class', 'continue', 'debugger',
+		'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
+		'if', 'in', 'instanceof', 'native', 'new', 'private', 'protected',
 		'public', 'return', 'static', 'switch', 'this', 'throw',
 		'try', 'typeof', 'var', 'void', 'while', 'with', 'yield'];
 
@@ -139,7 +139,7 @@ function Smalltalk(){
             dnuHandlers.push(string);
         }
     };
-    
+
     /* Dnu handler method */
 
     var dnu = function(selector) {
@@ -182,8 +182,8 @@ function Smalltalk(){
 		return that;
 	};
 
-	/* Smalltalk class creation. A class is an instance of an automatically 
-	   created metaclass object. Newly created classes (not their metaclass) 
+	/* Smalltalk class creation. A class is an instance of an automatically
+	   created metaclass object. Newly created classes (not their metaclass)
 	   should be added to the smalltalk object, see smalltalk.addClass().
 	   Superclass linking is *not* handled here, see smalltalk.init()  */
 
@@ -192,7 +192,7 @@ function Smalltalk(){
 		var meta = metaclass(spec);
 		var that = meta.instanceClass;
         setupClass(that, spec);
-		
+
         that.className = spec.className;
         that.wrapped   = spec.wrapped || false;
 		meta.className = spec.className + ' class';
@@ -203,7 +203,7 @@ function Smalltalk(){
 		}
 		return that;
 	}
-	
+
 	function metaclass(spec) {
         var superConstructor;
         spec = spec || {};
@@ -225,7 +225,7 @@ function Smalltalk(){
 		that.instanceClass = new that.fn();
 		return that;
 	}
-	
+
 	function setupClass(klass, spec) {
         spec = spec || {};
         if(!klass.fn) {
@@ -235,16 +235,26 @@ function Smalltalk(){
 		klass.pkg = spec.pkg;
 
         Object.defineProperty(klass, "toString", {
-			value: function() { return 'Smalltalk ' + this.className; }, 
+			value: function() { return 'Smalltalk ' + this.className; },
             configurable: true
 		});
-        
+
 		Object.defineProperties(klass, {
-			methods: { value: {}, enumerable: false, configurable: true, writable: true }
+			methods: { 
+                value: {}, 
+                enumerable: false, 
+                configurable: true, 
+                writable: true 
+            }
 		});
 
         Object.defineProperties(klass.fn.prototype, {
-			klass: { value: klass, enumerable: false, configurable: true, writable: true }
+			klass: { 
+                value: klass, 
+                enumerable: false, 
+                configurable: true, 
+                writable: true 
+            }
 		});
 	};
 
@@ -259,7 +269,6 @@ function Smalltalk(){
 		that.category          = spec.category;
 		that.source            = spec.source;
 		that.messageSends      = spec.messageSends || [];
-		that.superSends        = spec.superSends || [];
 		that.referencedClasses = spec.referencedClasses || [];
 		that.fn                = spec.fn;
 		return that;
@@ -267,7 +276,7 @@ function Smalltalk(){
 
 	/* Initialize a class in its class hierarchy. Handle both classes and
 	   metaclasses. */
-	   
+
 	st.init = function(klass) {
 		st.initClass(klass);
 		if(klass.klass && !klass.meta) {
@@ -278,7 +287,7 @@ function Smalltalk(){
     st.initClass = function(klass) {
         if(klass.wrapped) {
             copySuperclass(klass);
-        } 
+        }
         else {
             installSuperclass(klass);
         }
@@ -354,21 +363,6 @@ function Smalltalk(){
         }
     };
 
-    /* Super sends handling */
-
-    var installSuperSendHandler = function(string, klass) {
-        var selector = st.selector(string);
-        var superSelector = st.superSelector(string);
-        var fn = klass.superclass[selector];
-        if(!fn) {
-            fn = dnu(selector);
-        };
-
-        Object.defineProperty(klass.fn.prototype, superSelector, {
-            value: fn, configurable: true, writable: true
-        });
-    };
-
 	/* Answer all registered Packages as Array */
     // TODO: Remove this hack
 
@@ -382,7 +376,7 @@ function Smalltalk(){
 	};
 
 	/* Answer all registered Smalltalk classes */
-    //TODO: remove the function and make smalltalk.classes a simple property
+    //TODO: remove the function and make smalltalk.classes an array
 
 	st.classes = function() {
 		return classes;
@@ -414,7 +408,7 @@ function Smalltalk(){
 		return subclasses;
 	};
 
-	/* Create a new class wrapping a JavaScript constructor, and add it to the 
+	/* Create a new class wrapping a JavaScript constructor, and add it to the
 	   global smalltalk object. Package is lazily created if it does not exist with given name. */
 
 	st.wrapClassName = function(className, pkgName, fn, superclass, wrapped) {
@@ -423,9 +417,9 @@ function Smalltalk(){
         }
 		var pkg = st.addPackage(pkgName);
 		st[className] = klass({
-			className:  className, 
+			className:  className,
 			superclass: superclass,
-			pkg:        pkg, 
+			pkg:        pkg,
 			fn:         fn,
             wrapped:    wrapped
 		});
@@ -455,7 +449,7 @@ function Smalltalk(){
 		} else {
 			if(properties) {
 				st.packages[pkgName].properties = properties;
-			}	
+			}
 		}
 		return st.packages[pkgName];
 	};
@@ -474,7 +468,7 @@ function Smalltalk(){
                 st.removeClass(st[className]);
             };
 			st[className] = klass({
-				className: className, 
+				className: className,
 				superclass: superclass,
 				pkg: pkg,
 				iVarNames: iVarNames
@@ -497,18 +491,16 @@ function Smalltalk(){
 		Object.defineProperty(klass.fn.prototype, jsSelector, {
 			value: method.fn, configurable: true, writable: true
 		});
+
 		klass.methods[method.selector] = method;
 		method.methodClass = klass;
 		method.jsSelector = jsSelector;
 
         klass.organization.elements.addElement(method.category);
 
-        for(var i=0; i<method.superSends.length; i++) {
-            installSuperSendHandler(method.superSends[i], klass);
-        };
-
-        if(initialized) {
-            for(var i=0; i<method.messageSends.length; i++) {
+        for(var i=0; i<method.messageSends.length; i++) {
+            addDnuHandler(method.messageSends[i]);
+            if(initialized) {
                 installNewDnuHandler(method.messageSends[i]);
             };
         };
@@ -567,11 +559,11 @@ function Smalltalk(){
 		}
 	};
 
-	st.withContext = function(fn, receiver, selector, method, args) {
+	st.withContext = function(fn, receiver, selector, args) {
 		if(st.thisContext) {
-			return inContext(fn);
+			return inContext(fn, receiver, selector, args);
 		} else {
-			try {return inContext(fn)}
+			try {return inContext(fn, receiver, selector, args)}
 			catch(error) {
 				// Reset the context stack in any case
 				st.thisContext = undefined;
@@ -583,22 +575,22 @@ function Smalltalk(){
 			}
 		}
 	};
-    
-	function inContext(fn, receiver, selector, method, args) {
-		var context = pushContext(receiver, selector, method, args);
+
+	function inContext(fn, receiver, selector, args) {
+		var context = pushContext(receiver, selector, args);
 		var result = fn();
 		popContext(context);
 		return result;
 	};
 
 
-	/* Handles Smalltalk errors. Triggers the registered ErrorHandler 
+	/* Handles Smalltalk errors. Triggers the registered ErrorHandler
 	   (See the Smalltalk class ErrorHandler and its subclasses */
 
 	function handleError(error) {
         smalltalk.ErrorHandler._current()._handleError_(error);
 	};
-    
+
 	/* Handles #dnu: *and* JavaScript method calls.
 	   if the receiver has no klass, we consider it a JS object (outside of the
 	   Amber system). Else assume that the receiver understands #doesNotUnderstand: */
@@ -609,7 +601,7 @@ function Smalltalk(){
 			return callJavaScriptMethod(receiver, selector, args);
 		}
 
-		/* Handles not understood messages. Also see the Amber counter-part 
+		/* Handles not understood messages. Also see the Amber counter-part
 		   Object>>doesNotUnderstand: */
 
 		return receiver._doesNotUnderstand_(
@@ -623,7 +615,7 @@ function Smalltalk(){
 	   Else try wrapping a JSObjectProxy around the receiver.
 
        If the object property is a function, then call it, except if it starts with
-       an uppercase character (we probably want to answer the function itself in this 
+       an uppercase character (we probably want to answer the function itself in this
        case and send it #new from Amber).
 
 	   Converts keyword-based selectors by using the first
@@ -663,17 +655,16 @@ function Smalltalk(){
 		}
 	};
 
-	function pushContext(receiver, selector, method, temps) {
+	function pushContext(receiver, selector, temps) {
 		var c = st.oldContext, tc = st.thisContext;
 		if (!c) {
-			return st.thisContext = new SmalltalkMethodContext(receiver, selector, method, temps, tc);
+			return st.thisContext = new SmalltalkMethodContext(receiver, selector, temps, tc);
 		}
 		st.oldContext = null;
 		c.homeContext = tc;
         c.pc          = 1;
 		c.receiver    = receiver;
-        c.selector    = selector;
-		c.method      = method;
+        c.selector    = selector || "";
 		c.temps       = temps || {};
 		return st.thisContext = c;
 	};
@@ -689,10 +680,14 @@ function Smalltalk(){
     st.selector = function(string) {
         var selector = '_' + string;
 	    selector = selector.replace(/:/g, '_');
+	    selector = selector.replace(/[\&]/g, '_and');
+	    selector = selector.replace(/[\|]/g, '_or');
 	    selector = selector.replace(/[+]/g, '_plus');
 	    selector = selector.replace(/-/g, '_minus');
 	    selector = selector.replace(/[*]/g ,'_star');
 	    selector = selector.replace(/[\/]/g ,'_slash');
+	    selector = selector.replace(/[\\]/g ,'_backslash');
+	    selector = selector.replace(/[\~]/g ,'_tild');
 	    selector = selector.replace(/>/g ,'_gt');
 	    selector = selector.replace(/</g ,'_lt');
 	    selector = selector.replace(/=/g ,'_eq');
@@ -701,10 +696,6 @@ function Smalltalk(){
         return selector
     };
 
-    st.superSelector = function(string) {
-        return '$super' + st.selector(string);
-    };
-    
 	/* Convert a string to a valid smalltalk selector.
 	   if you modify the following functions, also change String>>asSelector
 	   accordingly */
@@ -724,15 +715,19 @@ function Smalltalk(){
 	function convertBinarySelector(selector) {
 		return selector
 			.replace(/^_/, '')
-			.replace(/_plus/, '+')
-			.replace(/_minus/, '-')
-			.replace(/_star/, '*')
-			.replace(/_slash/, '/')
-			.replace(/_gt/, '>')
-			.replace(/_lt/, '<')
-			.replace(/_eq/, '=')
-			.replace(/_comma/, ',')
-			.replace(/_at/, '@')
+			.replace(/_and/g, '&')
+			.replace(/_or/g, '|')
+			.replace(/_plus/g, '+')
+			.replace(/_minus/g, '-')
+			.replace(/_star/g, '*')
+			.replace(/_slash/g, '/')
+			.replace(/_backslash/g, '\\')
+			.replace(/_tild/g, '~')
+			.replace(/_gt/g, '>')
+			.replace(/_lt/g, '<')
+			.replace(/_eq/g, '=')
+			.replace(/_comma/g, ',')
+			.replace(/_at/g, '@')
 	};
 
 	/* Converts a JavaScript object to valid Smalltalk Object */
@@ -747,7 +742,7 @@ function Smalltalk(){
 		for(var i in js) {
 			if(readObject) {
 				object._at_put_(i, st.readJSObject(js[i]));
-			} 
+			}
 			if(readArray) {
 				object[i] = st.readJSObject(js[i]);
 			}
@@ -765,7 +760,7 @@ function Smalltalk(){
         }
     }
 
-    /* Smalltalk initilization. Called on page load */
+    /* Smalltalk initialization. Called on page load */
 
     st.initialize = function() {
         if(initialized) {return false};
@@ -784,18 +779,18 @@ function Smalltalk(){
 Smalltalk.prototype = new SmalltalkObject();
 Smalltalk.prototype.constructor = Smalltalk;
 
-function SmalltalkMethodContext(receiver, selector, method, temps, home) {
+function SmalltalkMethodContext(receiver, selector, temps, home) {
 	this.receiver    = receiver;
     this.selector    = selector;
-	this.method      = method;
 	this.temps       = temps || {};
 	this.homeContext = home;
 
-    this.resume = function() {
-        //Brutally set the receiver as thisContext, then re-enter the function
-        smalltalk.thisContext = this;
-        return this.method.apply(receiver, temps);
-    };
+    // TODO: adapt.
+    // this.resume = function() {
+    //     //Brutally set the receiver as thisContext, then re-enter the function
+    //     smalltalk.thisContext = this;
+    //     return this.method.apply(receiver, temps);
+    // };
 };
 
 SmalltalkMethodContext.prototype = new SmalltalkObject();
@@ -805,10 +800,9 @@ SmalltalkMethodContext.prototype.copy = function() {
 	var home = this.homeContext;
 	if(home) {home = home.copy()}
 	return new SmalltalkMethodContext(
-		this.receiver, 
+		this.receiver,
         this.selector,
-		this.method, 
-		this.temps, 
+		this.temps,
 		home
 	);
 };
@@ -822,8 +816,8 @@ if(this.jQuery) {
 var nil       = new SmalltalkNil();
 var smalltalk = new Smalltalk();
 
-/* 
- * Answer the smalltalk representation of o. 
+/*
+ * Answer the smalltalk representation of o.
  * Used in message sends
  */
 
@@ -831,7 +825,7 @@ var _st = function(o) {
     if(typeof o === 'undefined') {return nil};
     if(o.klass) {return o};
     return smalltalk.JSObjectProxy._on_(o);
-}; 
+};
 
 
 /***************************************** BOOTSTRAP ******************************************/

+ 40 - 3
st/Compiler-IR.st

@@ -576,6 +576,12 @@ index: anInteger
 	index := anInteger
 !
 
+javascriptSelector
+	^ self classSend 
+    	ifNil: [ self selector asSelector ]
+      	ifNotNil: [ self selector asSuperSelector ]
+!
+
 selector
 	^ selector
 !
@@ -887,6 +893,29 @@ visitIRReturn: anIRReturn
 !
 
 visitIRSend: anIRSend
+	anIRSend classSend 
+    	ifNil: [
+			self stream nextPutAll: '_st('.
+			self visit: anIRSend instructions first.
+   		 	self stream nextPutAll: ').', anIRSend selector asSelector, '('.
+			anIRSend instructions allButFirst
+				do: [ :each | self visit: each ]
+				separatedBy: [ self stream nextPutAll: ',' ].
+			self stream nextPutAll: ')' ]
+		ifNotNil: [ 
+			self stream 
+            	nextPutAll: anIRSend classSend asJavascript, '.fn.prototype.';
+				nextPutAll: anIRSend selector asSelector, '.apply(';
+				nextPutAll: '_st('.
+			self visit: anIRSend instructions first.
+			self stream nextPutAll: '), ['.
+			anIRSend instructions allButFirst
+				do: [ :each | self visit: each ]
+				separatedBy: [ self stream nextPutAll: ',' ].
+			self stream nextPutAll: '])' ]
+!
+
+visitIRSendOld: anIRSend
 	self stream nextPutAll: 'smalltalk.send('.
 	self visit: anIRSend instructions first.
 	self stream nextPutAll:  ',"', anIRSend selector asSelector, '",['.
@@ -976,6 +1005,16 @@ nextPutClosureWith: aBlock arguments: anArray
 	stream nextPutAll: '})'
 !
 
+nextPutContextFor: aMethod during: aBlock
+	self nextPutAll: 'return smalltalk.withContext(function() {'.
+    aBlock value.
+    self 
+    	nextPutAll: '}, self, ';
+        nextPutAll: aMethod selector asJavascript, ', ';
+        nextPutAll: aMethod arguments asJavascript;
+        nextPutAll: ')'
+!
+
 nextPutFunctionWith: aBlock arguments: anArray
 	stream nextPutAll: 'fn: function('.
 	anArray 
@@ -1009,13 +1048,11 @@ nextPutMethodDeclaration: aMethod with: aBlock
 	stream 
 		nextPutAll: 'smalltalk.method({'; lf;
 		nextPutAll: 'selector: "', aMethod selector, '",'; lf;
-		nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.
+		nextPutAll: 'source: ', aMethod source asJavascript, ',';lf. 
 	aBlock value.
 	stream 
 		nextPutAll: ',', String lf, 'messageSends: ';
 		nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;
-		nextPutAll: 'superSends: ';
-		nextPutAll: aMethod superSends asArray asJavascript, ','; lf;
         nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;
 		nextPutAll: 'referencedClasses: ['.
 	aMethod classReferences 

+ 2 - 2
st/Kernel-Classes.st

@@ -69,12 +69,12 @@ instanceVariableNames
 !
 
 methodAt: aSymbol
-	<return smalltalk.methods(self)[aSymbol._asString()]>
+	^ self methodDictionary at: aSymbol asString
 !
 
 methodDictionary
 	<var dict = smalltalk.HashedCollection._new();
-	var methods = self.fn.prototype.methods;
+	var methods = self.methods;
 	for(var i in methods) {
 		if(methods[i].selector) {
 			dict._at_put_(methods[i].selector, methods[i]);

+ 1 - 5
st/Kernel-Collections.st

@@ -1039,17 +1039,13 @@ asNumber
 !
 
 asSelector
-	<return smalltalk.selector(this)>
+	<return smalltalk.selector(self)>
 !
 
 asString
 	^self
 !
 
-asSuperSelector
-	<return smalltalk.superSelector(self)>
-!
-
 asSymbol
 	^Symbol lookup: self
 !