class: Method
authorClaus Gittinger <cg@exept.de>
Wed, 25 Feb 2015 23:21:05 +0100
changeset 17562 ee6d827bd625
parent 17561 2226a8f6e76c
child 17563 4affe2d5112a
class: Method changed: #shadowedMethod
Method.st
--- a/Method.st	Wed Feb 25 15:18:11 2015 +0100
+++ b/Method.st	Wed Feb 25 23:21:05 2015 +0100
@@ -1000,7 +1000,6 @@
     "Modified (format): / 18-11-2011 / 14:47:06 / cg"
 ! !
 
-
 !Method methodsFor:'accessing-visibility'!
 
 isIgnored
@@ -3400,20 +3399,28 @@
 !
 
 shadowedMethod
-    "Return shadowed method if this method is an extension (i.e. package ~= classes' package)
-     which shadows an existing method from method's class.
+    "Return the shadowed method if this method is an extension (i.e. package ~= classes' package)
+     AND it shadows (redefines) an existing method from the method's class.
      If this method does not shadow any other method, return nil."
 
-    | myClass myProjectDefinition |
+    | myClass nonMetaClass myProjectDefinition originalMethod|
 
     myClass := self mclass.
     myClass isNil ifTrue:[^ nil].
-    myClass := myClass theNonMetaclass.
-    (myClass notNil
-        and:[ package ~= myClass package
+    nonMetaClass := myClass theNonMetaclass.
+
+    (package ~= nonMetaClass package
         and:[ package ~= PackageId noProjectID
-        and:[ (myProjectDefinition := myClass projectDefinitionClass) notNil ]]])
-        ifTrue:[ ^ (myProjectDefinition savedOverwrittenMethodForClass:self mclass selector:self selector) ].
+        and:[ (myProjectDefinition := nonMetaClass projectDefinitionClass) notNil ]])
+    ifTrue:[ 
+        originalMethod := myProjectDefinition savedOverwrittenMethodForClass:myClass selector:self selector.
+
+        "/ mhm - what if it does no make a difference?
+        "/ (originalMethod notNil and:[originalMethod source = self source]) ifTrue:[
+        "/    "/ self halt. ^ nil
+        "/ ].
+        ^ originalMethod
+    ].
     ^ nil
 
     "Created: / 03-10-2014 / 15:16:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -3624,7 +3631,6 @@
     "Created: / 23-07-2012 / 11:16:36 / cg"
 ! !
 
-
 !Method methodsFor:'source management'!
 
 revisionInfo
@@ -3872,11 +3878,11 @@
 !Method class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.456 2015-02-24 13:29:07 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.457 2015-02-25 22:21:05 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.456 2015-02-24 13:29:07 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.457 2015-02-25 22:21:05 cg Exp $'
 !
 
 version_SVN