Browse Source

Moves `isKindOf:` to ProtoObject, fixes #948

Nicolas Petton 10 years ago
parent
commit
2e35591894
2 changed files with 31 additions and 29 deletions
  1. 23 23
      src/Kernel-Objects.js
  2. 8 6
      src/Kernel-Objects.st

+ 23 - 23
src/Kernel-Objects.js

@@ -215,6 +215,29 @@ referencedClasses: []
 }),
 globals.ProtoObject);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isKindOf:",
+protocol: 'testing',
+fn: function (aClass){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self._isMemberOf_(aClass);
+if(smalltalk.assert($2)){
+$1=true;
+} else {
+$1=_st(self._class())._inheritsFrom_(aClass);
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},globals.ProtoObject)})},
+args: ["aClass"],
+source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
+messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"],
+referencedClasses: []
+}),
+globals.ProtoObject);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "perform:",
@@ -875,29 +898,6 @@ referencedClasses: []
 }),
 globals.Object);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "isKindOf:",
-protocol: 'testing',
-fn: function (aClass){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-var $2,$1;
-$2=self._isMemberOf_(aClass);
-if(smalltalk.assert($2)){
-$1=true;
-} else {
-$1=_st(self._class())._inheritsFrom_(aClass);
-};
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},globals.Object)})},
-args: ["aClass"],
-source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
-messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"],
-referencedClasses: []
-}),
-globals.Object);
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "isMemberOf:",

+ 8 - 6
src/Kernel-Objects.st

@@ -112,6 +112,14 @@ printString
 		self printOn: str ]
 ! !
 
+!ProtoObject methodsFor: 'testing'!
+
+isKindOf: aClass
+	^ (self isMemberOf: aClass)
+		ifTrue: [ true ]
+		ifFalse: [ self class inheritsFrom: aClass ]
+! !
+
 !ProtoObject class methodsFor: 'accessing'!
 
 heliosClass
@@ -363,12 +371,6 @@ isImmutable
 	^ false
 !
 
-isKindOf: aClass
-	^ (self isMemberOf: aClass)
-		ifTrue: [ true ]
-		ifFalse: [ self class inheritsFrom: aClass ]
-!
-
 isMemberOf: aClass
 	^ self class = aClass
 !