ソースを参照

Add class knowledge to Protocol announcements and class organizer

Nicolas Petton 11 年 前
コミット
b1237d41a3

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

@@ -318,7 +318,7 @@ smalltalk.addClass('PackageAdded', smalltalk.PackageAnnouncement, [], 'Kernel-An
 smalltalk.addClass('PackageRemoved', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
 
 
-smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['protocol'], 'Kernel-Announcements');
+smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
 smalltalk.addMethod(
 "_protocol",
 smalltalk.method({
@@ -343,6 +343,30 @@ return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString}, sm
 messageSends: []}),
 smalltalk.ProtocolAnnouncement);
 
+smalltalk.addMethod(
+"_theClass",
+smalltalk.method({
+selector: "theClass",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=self["@theClass"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"theClass",{}, smalltalk.ProtocolAnnouncement)})},
+messageSends: []}),
+smalltalk.ProtocolAnnouncement);
+
+smalltalk.addMethod(
+"_theClass_",
+smalltalk.method({
+selector: "theClass:",
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
self["@theClass"]=aClass;
+return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass}, smalltalk.ProtocolAnnouncement)})},
+messageSends: []}),
+smalltalk.ProtocolAnnouncement);
+
 
 
 smalltalk.addClass('ProtocolAdded', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');

+ 35 - 1
js/Kernel-Announcements.js

@@ -432,7 +432,7 @@ smalltalk.addClass('PackageAdded', smalltalk.PackageAnnouncement, [], 'Kernel-An
 smalltalk.addClass('PackageRemoved', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
 
 
-smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['protocol'], 'Kernel-Announcements');
+smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
 smalltalk.addMethod(
 "_protocol",
 smalltalk.method({
@@ -467,6 +467,40 @@ referencedClasses: []
 }),
 smalltalk.ProtocolAnnouncement);
 
+smalltalk.addMethod(
+"_theClass",
+smalltalk.method({
+selector: "theClass",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=self["@theClass"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"theClass",{}, smalltalk.ProtocolAnnouncement)})},
+args: [],
+source: "theClass\x0a\x09^ theClass",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ProtocolAnnouncement);
+
+smalltalk.addMethod(
+"_theClass_",
+smalltalk.method({
+selector: "theClass:",
+category: 'accessing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
self["@theClass"]=aClass;
+return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass}, smalltalk.ProtocolAnnouncement)})},
+args: ["aClass"],
+source: "theClass: aClass\x0a\x09theClass := aClass",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ProtocolAnnouncement);
+
 
 
 smalltalk.addClass('ProtocolAdded', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');

+ 15 - 2
js/Kernel-Objects.deploy.js

@@ -2311,10 +2311,11 @@ return smalltalk.withContext(function($ctx1) { 
var $1,$2;
 smalltalk.Organizer.fn.prototype._addElement_.apply(_st(self), [aString]);
 $1=_st((smalltalk.ProtocolAdded || ProtocolAdded))._new();
 _st($1)._protocol_(aString);
+_st($1)._theClass_(_st(self)._theClass());
 $2=_st($1)._yourself();
 _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
 return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString}, smalltalk.ClassOrganizer)})},
-messageSends: ["addElement:", "announce:", "protocol:", "new", "yourself", "current"]}),
+messageSends: ["addElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"]}),
 smalltalk.ClassOrganizer);
 
 smalltalk.addMethod(
@@ -2327,10 +2328,22 @@ return smalltalk.withContext(function($ctx1) { 
var $1,$2;
 smalltalk.Organizer.fn.prototype._removeElement_.apply(_st(self), [aString]);
 $1=_st((smalltalk.ProtocolRemoved || ProtocolRemoved))._new();
 _st($1)._protocol_(aString);
+_st($1)._theClass_(_st(self)._theClass());
 $2=_st($1)._yourself();
 _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
 return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString}, smalltalk.ClassOrganizer)})},
-messageSends: ["removeElement:", "announce:", "protocol:", "new", "yourself", "current"]}),
+messageSends: ["removeElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"]}),
+smalltalk.ClassOrganizer);
+
+smalltalk.addMethod(
+"_theClass",
+smalltalk.method({
+selector: "theClass",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
 return self.theClass ;
+return self}, function($ctx1) {$ctx1.fill(self,"theClass",{}, smalltalk.ClassOrganizer)})},
+messageSends: []}),
 smalltalk.ClassOrganizer);
 
 

+ 22 - 4
js/Kernel-Objects.js

@@ -3197,12 +3197,13 @@ return smalltalk.withContext(function($ctx1) { 
var $1,$2;
 smalltalk.Organizer.fn.prototype._addElement_.apply(_st(self), [aString]);
 $1=_st((smalltalk.ProtocolAdded || ProtocolAdded))._new();
 _st($1)._protocol_(aString);
+_st($1)._theClass_(_st(self)._theClass());
 $2=_st($1)._yourself();
 _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
 return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString}, smalltalk.ClassOrganizer)})},
 args: ["aString"],
-source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a    \x09protocol: aString;\x0a        yourself)",
-messageSends: ["addElement:", "announce:", "protocol:", "new", "yourself", "current"],
+source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a    \x09protocol: aString;\x0a        theClass: self theClass;\x0a        yourself)",
+messageSends: ["addElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
 referencedClasses: ["ProtocolAdded", "SystemAnnouncer"]
 }),
 smalltalk.ClassOrganizer);
@@ -3218,16 +3219,33 @@ return smalltalk.withContext(function($ctx1) { 
var $1,$2;
 smalltalk.Organizer.fn.prototype._removeElement_.apply(_st(self), [aString]);
 $1=_st((smalltalk.ProtocolRemoved || ProtocolRemoved))._new();
 _st($1)._protocol_(aString);
+_st($1)._theClass_(_st(self)._theClass());
 $2=_st($1)._yourself();
 _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
 return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString}, smalltalk.ClassOrganizer)})},
 args: ["aString"],
-source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a    \x09protocol: aString;\x0a        yourself)",
-messageSends: ["removeElement:", "announce:", "protocol:", "new", "yourself", "current"],
+source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a    \x09protocol: aString;\x0a        theClass: self theClass;\x0a        yourself)",
+messageSends: ["removeElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
 referencedClasses: ["ProtocolRemoved", "SystemAnnouncer"]
 }),
 smalltalk.ClassOrganizer);
 
+smalltalk.addMethod(
+"_theClass",
+smalltalk.method({
+selector: "theClass",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
 return self.theClass ;
+return self}, function($ctx1) {$ctx1.fill(self,"theClass",{}, smalltalk.ClassOrganizer)})},
+args: [],
+source: "theClass\x0a\x09< return self.theClass >",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ClassOrganizer);
+
 
 
 smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');

+ 3 - 1
js/boot.js

@@ -242,7 +242,9 @@ function Smalltalk() {
             enumerable:false, configurable: true, writable: false
 		});
 
-		klass.organization = new SmalltalkClassOrganizer();
+		klass.organization          = new SmalltalkClassOrganizer();
+        klass.organization.theClass = klass;
+
 		Object.defineProperty(klass, "methods", {
 			value: {},
 			enumerable: false, configurable: true, writable: true

+ 9 - 1
st/Kernel-Announcements.st

@@ -210,7 +210,7 @@ PackageAnnouncement subclass: #PackageRemoved
 	package: 'Kernel-Announcements'!
 
 SystemAnnouncement subclass: #ProtocolAnnouncement
-	instanceVariableNames: 'protocol'
+	instanceVariableNames: 'theClass protocol'
 	package: 'Kernel-Announcements'!
 
 !ProtocolAnnouncement methodsFor: 'accessing'!
@@ -221,6 +221,14 @@ protocol
 
 protocol: aString
 	protocol := aString
+!
+
+theClass
+	^ theClass
+!
+
+theClass: aClass
+	theClass := aClass
 ! !
 
 ProtocolAnnouncement subclass: #ProtocolAdded

+ 6 - 0
st/Kernel-Objects.st

@@ -1073,6 +1073,7 @@ addElement: aString
 
 	SystemAnnouncer current announce: (ProtocolAdded new
     	protocol: aString;
+        theClass: self theClass;
         yourself)
 !
 
@@ -1081,7 +1082,12 @@ removeElement: aString
 
 	SystemAnnouncer current announce: (ProtocolRemoved new
     	protocol: aString;
+        theClass: self theClass;
         yourself)
+!
+
+theClass
+	< return self.theClass >
 ! !
 
 Organizer subclass: #PackageOrganizer