Browse Source

BugFix: Message categories could not be changed

Marten Feldtmann 11 years ago
parent
commit
7d7affd231
3 changed files with 89 additions and 32 deletions
  1. 40 14
      js/Kernel-Methods.deploy.js
  2. 47 16
      js/Kernel-Methods.js
  3. 2 2
      st/Kernel-Methods.st

+ 40 - 14
js/Kernel-Methods.deploy.js

@@ -298,20 +298,24 @@ smalltalk.addMethod(
 "_category_",
 smalltalk.method({
 selector: "category:",
-fn: function (aString) {
-    var self = this;
-    var $1;
-    var oldCategory;
-    oldCategory = smalltalk.send(self, "_category", []);
-    smalltalk.send(self, "_basicAt_put_", ["category", aString]);
-    $1 = smalltalk.send(self, "_methodClass", []);
-    if (($receiver = $1) == nil || $receiver == undefined) {
-    } else {
-        smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodClass", []), "_organizer", []), "_addElement_", [aString]);
-        smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodClass", []), "_methods", []), "_select_", [function (each) {return smalltalk.send(smalltalk.send(each, "_category", []), "__eq", [oldCategory]);}]), "_ifEmpty_", [function () {return smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodClass", []), "_organizer", []), "_removeElement_", [oldCategory]);}]);
-    }
-    return self;
-}
+fn: function (aString){
+var self=this;
+var $1;
+var oldCategory;
+oldCategory=smalltalk.send(self,"_category",[]);
+smalltalk.send(self,"_basicAt_put_",["category",aString]);
+$1=smalltalk.send(self,"_methodClass",[]);
+if(($receiver = $1) == nil || $receiver == undefined){
+$1;
+} else {
+smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_addElement_",[aString]);
+smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_methods",[]),"_select_",[(function(each){
+return smalltalk.send(smalltalk.send(each,"_category",[]),"__eq",[oldCategory]);
+})]),"_ifEmpty_",[(function(){
+return smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_removeElement_",[oldCategory]);
+})]);
+};
+return self}
 }),
 smalltalk.CompiledMethod);
 
@@ -567,6 +571,28 @@ fn: function () {
 }),
 smalltalk.MethodContext);
 
+smalltalk.addMethod(
+"_inspectOn_",
+smalltalk.method({
+selector: "inspectOn:",
+fn: function (anInspector) {
+    var self = this;
+    var $1;
+    var variables;
+    variables = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
+    smalltalk.send(variables, "_at_put_", ["#self", self]);
+    smalltalk.send(variables, "_at_put_", ["#home", smalltalk.send(self, "_home", [])]);
+    smalltalk.send(variables, "_at_put_", ["#receiver", smalltalk.send(self, "_receiver", [])]);
+    smalltalk.send(variables, "_at_put_", ["#selector", smalltalk.send(self, "_selector", [])]);
+    smalltalk.send(variables, "_at_put_", ["#temps", smalltalk.send(self, "_temps", [])]);
+    smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_instanceVariableNames", []), "_do_", [function (each) {return smalltalk.send(variables, "_at_put_", [each, smalltalk.send(self, "_instVarAt_", [each])]);}]);
+    smalltalk.send(anInspector, "_setLabel_", [smalltalk.send(self, "_printString", [])]);
+    $1 = smalltalk.send(anInspector, "_setVariables_", [variables]);
+    return self;
+}
+}),
+smalltalk.MethodContext);
+
 smalltalk.addMethod(
 "_pc",
 smalltalk.method({

+ 47 - 16
js/Kernel-Methods.js

@@ -416,23 +416,27 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "category:",
 category: 'accessing',
-fn: function (aString) {
-    var self = this;
-    var $1;
-    var oldCategory;
-    oldCategory = smalltalk.send(self, "_category", []);
-    smalltalk.send(self, "_basicAt_put_", ["category", aString]);
-    $1 = smalltalk.send(self, "_methodClass", []);
-    if (($receiver = $1) == nil || $receiver == undefined) {
-    } else {
-        smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodClass", []), "_organizer", []), "_addElement_", [aString]);
-        smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodClass", []), "_methods", []), "_select_", [function (each) {return smalltalk.send(smalltalk.send(each, "_category", []), "__eq", [oldCategory]);}]), "_ifEmpty_", [function () {return smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodClass", []), "_organizer", []), "_removeElement_", [oldCategory]);}]);
-    }
-    return self;
-},
+fn: function (aString){
+var self=this;
+var $1;
+var oldCategory;
+oldCategory=smalltalk.send(self,"_category",[]);
+smalltalk.send(self,"_basicAt_put_",["category",aString]);
+$1=smalltalk.send(self,"_methodClass",[]);
+if(($receiver = $1) == nil || $receiver == undefined){
+$1;
+} else {
+smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_addElement_",[aString]);
+smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_methods",[]),"_select_",[(function(each){
+return smalltalk.send(smalltalk.send(each,"_category",[]),"__eq",[oldCategory]);
+})]),"_ifEmpty_",[(function(){
+return smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_removeElement_",[oldCategory]);
+})]);
+};
+return self},
 args: ["aString"],
-source: "category: aString\x0a\x09| oldCategory |\x0a    oldCategory := self category.\x0a\x09self basicAt: 'category' put: aString.\x0a    \x0a    self methodClass ifNotNil: [\x0a    \x09self methodClass organizer addElement: aString.\x0a    \x0a\x09\x09(self methodClass methods \x0a    \x09\x09select: [ :each | each category = oldCategory ])\x0a        \x09ifEmpty: [ self methodClass organizer removeElement: oldCategory ] ]",
-messageSends: ["category", "basicAt:put:", "ifNotNil:", "addElement:", "organizer", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
+source: "category: aString\x0a\x09| oldCategory |\x0a    oldCategory := self category.\x0a\x09self basicAt: 'category' put: aString.\x0a    \x0a    self methodClass ifNotNil: [\x0a    \x09self methodClass organization addElement: aString.\x0a    \x0a\x09\x09(self methodClass methods \x0a    \x09\x09select: [ :each | each category = oldCategory ])\x0a        \x09ifEmpty: [ self methodClass organization removeElement: oldCategory ] ]",
+messageSends: ["category", "basicAt:put:", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
 referencedClasses: []
 }),
 smalltalk.CompiledMethod);
@@ -786,6 +790,33 @@ referencedClasses: []
 }),
 smalltalk.MethodContext);
 
+smalltalk.addMethod(
+"_inspectOn_",
+smalltalk.method({
+selector: "inspectOn:",
+category: '',
+fn: function (anInspector) {
+    var self = this;
+    var $1;
+    var variables;
+    variables = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
+    smalltalk.send(variables, "_at_put_", ["#self", self]);
+    smalltalk.send(variables, "_at_put_", ["#home", smalltalk.send(self, "_home", [])]);
+    smalltalk.send(variables, "_at_put_", ["#receiver", smalltalk.send(self, "_receiver", [])]);
+    smalltalk.send(variables, "_at_put_", ["#selector", smalltalk.send(self, "_selector", [])]);
+    smalltalk.send(variables, "_at_put_", ["#temps", smalltalk.send(self, "_temps", [])]);
+    smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_instanceVariableNames", []), "_do_", [function (each) {return smalltalk.send(variables, "_at_put_", [each, smalltalk.send(self, "_instVarAt_", [each])]);}]);
+    smalltalk.send(anInspector, "_setLabel_", [smalltalk.send(self, "_printString", [])]);
+    $1 = smalltalk.send(anInspector, "_setVariables_", [variables]);
+    return self;
+},
+args: [object Object],
+source: "",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MethodContext);
+
 smalltalk.addMethod(
 "_pc",
 smalltalk.method({

+ 2 - 2
st/Kernel-Methods.st

@@ -167,11 +167,11 @@ category: aString
 	self basicAt: 'category' put: aString.
     
     self methodClass ifNotNil: [
-    	self methodClass organizer addElement: aString.
+    	self methodClass organization addElement: aString.
     
 		(self methodClass methods 
     		select: [ :each | each category = oldCategory ])
-        	ifEmpty: [ self methodClass organizer removeElement: oldCategory ] ]
+        	ifEmpty: [ self methodClass organization removeElement: oldCategory ] ]
 !
 
 fn