Browse Source

Merge branch 'master' into helios

Nicolas Petton 12 years ago
parent
commit
0b3f3fe9e9

+ 28 - 1
js/Kernel-Announcements.deploy.js

@@ -1,4 +1,4 @@
-smalltalk.addPackage('Kernel-Announcements', {});
+smalltalk.addPackage('Kernel-Announcements');
 smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['block', 'announcementClass'], 'Kernel-Announcements');
 smalltalk.addMethod(
 "_announcementClass",
@@ -228,6 +228,33 @@ smalltalk.MethodAnnouncement);
 smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
 
 
+smalltalk.addClass('MethodModified', smalltalk.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
+smalltalk.addMethod(
+"_oldMethod",
+smalltalk.method({
+selector: "oldMethod",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=self["@oldMethod"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"oldMethod",{}, smalltalk.MethodModified)})},
+messageSends: []}),
+smalltalk.MethodModified);
+
+smalltalk.addMethod(
+"_oldMethod_",
+smalltalk.method({
+selector: "oldMethod:",
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
self["@oldMethod"]=aMethod;
+return self}, function($ctx1) {$ctx1.fill(self,"oldMethod:",{aMethod:aMethod}, smalltalk.MethodModified)})},
+messageSends: []}),
+smalltalk.MethodModified);
+
+
+
 smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
 
 

+ 38 - 1
js/Kernel-Announcements.js

@@ -1,4 +1,4 @@
-smalltalk.addPackage('Kernel-Announcements', {});
+smalltalk.addPackage('Kernel-Announcements');
 smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['block', 'announcementClass'], 'Kernel-Announcements');
 smalltalk.AnnouncementSubscription.comment="The subscription is a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible."
 smalltalk.addMethod(
@@ -312,6 +312,43 @@ smalltalk.MethodAnnouncement);
 smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
 
 
+smalltalk.addClass('MethodModified', smalltalk.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
+smalltalk.addMethod(
+"_oldMethod",
+smalltalk.method({
+selector: "oldMethod",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=self["@oldMethod"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"oldMethod",{}, smalltalk.MethodModified)})},
+args: [],
+source: "oldMethod\x0a\x09^ oldMethod",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MethodModified);
+
+smalltalk.addMethod(
+"_oldMethod_",
+smalltalk.method({
+selector: "oldMethod:",
+category: 'accessing',
+fn: function (aMethod){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
self["@oldMethod"]=aMethod;
+return self}, function($ctx1) {$ctx1.fill(self,"oldMethod:",{aMethod:aMethod}, smalltalk.MethodModified)})},
+args: ["aMethod"],
+source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MethodModified);
+
+
+
 smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
 
 

+ 23 - 8
js/Kernel-Classes.deploy.js

@@ -6,15 +6,30 @@ smalltalk.method({
 selector: "addCompiledMethod:",
 fn: function (aMethod){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1,$2;
+var oldMethod,announcement;
+return smalltalk.withContext(function($ctx1) { 
var $1,$2,$3,$4,$5;
+oldMethod=_st(_st(self)._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
+return smalltalk.withContext(function($ctx2) {
return nil;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
 _st(self)._basicAddCompiledMethod_(aMethod);
-$1=_st((smalltalk.MethodAdded || MethodAdded))._new();
-_st($1)._theClass_(self);
-_st($1)._method_(aMethod);
-$2=_st($1)._yourself();
-_st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
-return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod}, smalltalk.Behavior)})},
-messageSends: ["basicAddCompiledMethod:", "announce:", "theClass:", "new", "method:", "yourself", "current"]}),
+$1=oldMethod;
+if(($receiver = $1) == nil || $receiver == undefined){
+$2=_st((smalltalk.MethodAdded || MethodAdded))._new();
+_st($2)._theClass_(self);
+_st($2)._method_(aMethod);
+$3=_st($2)._yourself();
+announcement=$3;
+} else {
+$4=_st((smalltalk.MethodModified || MethodModified))._new();
+_st($4)._theClass_(self);
+_st($4)._oldMethod_(oldMethod);
+_st($4)._method_(aMethod);
+$5=_st($4)._yourself();
+announcement=$5;
+};
+_st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_(announcement);
+return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement}, smalltalk.Behavior)})},
+messageSends: ["at:ifAbsent:", "selector", "methodDictionary", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "theClass:", "new", "method:", "yourself", "oldMethod:", "announce:", "current"]}),
 smalltalk.Behavior);
 
 smalltalk.addMethod(

+ 25 - 10
js/Kernel-Classes.js

@@ -8,18 +8,33 @@ selector: "addCompiledMethod:",
 category: 'compiling',
 fn: function (aMethod){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1,$2;
+var oldMethod,announcement;
+return smalltalk.withContext(function($ctx1) { 
var $1,$2,$3,$4,$5;
+oldMethod=_st(_st(self)._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
+return smalltalk.withContext(function($ctx2) {
return nil;
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
 _st(self)._basicAddCompiledMethod_(aMethod);
-$1=_st((smalltalk.MethodAdded || MethodAdded))._new();
-_st($1)._theClass_(self);
-_st($1)._method_(aMethod);
-$2=_st($1)._yourself();
-_st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
-return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod}, smalltalk.Behavior)})},
+$1=oldMethod;
+if(($receiver = $1) == nil || $receiver == undefined){
+$2=_st((smalltalk.MethodAdded || MethodAdded))._new();
+_st($2)._theClass_(self);
+_st($2)._method_(aMethod);
+$3=_st($2)._yourself();
+announcement=$3;
+} else {
+$4=_st((smalltalk.MethodModified || MethodModified))._new();
+_st($4)._theClass_(self);
+_st($4)._oldMethod_(oldMethod);
+_st($4)._method_(aMethod);
+$5=_st($4)._yourself();
+announcement=$5;
+};
+_st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_(announcement);
+return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement}, smalltalk.Behavior)})},
 args: ["aMethod"],
-source: "addCompiledMethod: aMethod\x0a\x09self basicAddCompiledMethod: aMethod.\x0a    \x0a    SystemAnnouncer current\x0a   \x09\x09announce: (MethodAdded new\x0a        \x09theClass: self;\x0a            method: aMethod;\x0a            yourself)",
-messageSends: ["basicAddCompiledMethod:", "announce:", "theClass:", "new", "method:", "yourself", "current"],
-referencedClasses: ["MethodAdded", "SystemAnnouncer"]
+source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a    \x0a\x09oldMethod := self methodDictionary \x0a    \x09at: aMethod selector \x0a        ifAbsent: [ nil ].\x0a    \x0a\x09self basicAddCompiledMethod: aMethod.\x0a    \x0a    announcement := oldMethod \x0a    \x09ifNil: [\x0a\x09\x09    MethodAdded new\x0a       \x09\x09\x09 \x09theClass: self;\x0a\x09\x09            method: aMethod;\x0a       \x09\x09\x09    yourself ]\x0a    \x09ifNotNil: [\x0a          \x09MethodModified new\x0a       \x09\x09\x09 \x09theClass: self;\x0a                    oldMethod: oldMethod; \x0a\x09\x09            method: aMethod;\x0a       \x09\x09\x09    yourself ].\x0a                    \x0a\x09SystemAnnouncer current\x0a\x09\x09   \x09\x09announce: announcement",
+messageSends: ["at:ifAbsent:", "selector", "methodDictionary", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "theClass:", "new", "method:", "yourself", "oldMethod:", "announce:", "current"],
+referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"]
 }),
 smalltalk.Behavior);
 

+ 14 - 0
st/Kernel-Announcements.st

@@ -155,6 +155,20 @@ MethodAnnouncement subclass: #MethodAdded
 	instanceVariableNames: ''
 	package: 'Kernel-Announcements'!
 
+MethodAnnouncement subclass: #MethodModified
+	instanceVariableNames: 'oldMethod'
+	package: 'Kernel-Announcements'!
+
+!MethodModified methodsFor: 'accessing'!
+
+oldMethod
+	^ oldMethod
+!
+
+oldMethod: aMethod
+	oldMethod := aMethod
+! !
+
 MethodAnnouncement subclass: #MethodRemoved
 	instanceVariableNames: ''
 	package: 'Kernel-Announcements'!

+ 21 - 5
st/Kernel-Classes.st

@@ -161,13 +161,29 @@ withAllSubclasses
 !Behavior methodsFor: 'compiling'!
 
 addCompiledMethod: aMethod
+	| oldMethod announcement |
+    
+	oldMethod := self methodDictionary 
+    	at: aMethod selector 
+        ifAbsent: [ nil ].
+    
 	self basicAddCompiledMethod: aMethod.
     
-    SystemAnnouncer current
-   		announce: (MethodAdded new
-        	theClass: self;
-            method: aMethod;
-            yourself)
+    announcement := oldMethod 
+    	ifNil: [
+		    MethodAdded new
+       			 	theClass: self;
+		            method: aMethod;
+       			    yourself ]
+    	ifNotNil: [
+          	MethodModified new
+       			 	theClass: self;
+                    oldMethod: oldMethod; 
+		            method: aMethod;
+       			    yourself ].
+                    
+	SystemAnnouncer current
+		   		announce: announcement
 !
 
 compile: aString