--- a/Explainer.st Tue Jan 24 00:41:11 2017 +0100
+++ b/Explainer.st Thu Jan 26 09:31:42 2017 +0100
@@ -1433,11 +1433,27 @@
commonSuperClass isNil ifTrue:[
commonSuperClass := Behavior commonSuperclassOf:listOfImplementingClasses.
] .
- (listOfImplementingClasses includes:commonSuperClass) ifTrue:[
- (commonSuperClass implements:selector) ifTrue:[
- classProvidingComment := commonSuperClass
- ] ifFalse:[
+
+ ((listOfImplementingClasses includes:commonSuperClass)
+ and:[ (commonSuperClass implements:selector) ]
+ ) ifTrue:[
+ classProvidingComment := commonSuperClass
+ ] ifFalse:[
+ "/ avoid some obvious misleading pathes...
+ classProvidingComment := { Number . Collection . Stream . View }
+ detect:[:cls | (listOfImplementingClasses includes:cls)
+ or:[cls canUnderstand:selector] ]
+ ifNone:nil.
+ classProvidingComment notNil ifTrue:[
+ classProvidingComment := classProvidingComment whichClassImplements:selector.
+ ] ifFalse:[
classProvidingComment := firstImplementingClass.
+ [
+ classProvidingComment superclass notNil
+ and:[ classProvidingComment superclass implements:selector ]
+ ] whileTrue:[
+ classProvidingComment := classProvidingComment superclass
+ ].
].
].
].
@@ -1465,11 +1481,10 @@
cm := self fetchDescriptionOfMethod:(classProvidingComment compiledMethodAt:selector).
]
].
- cm notNil ifTrue:[
- cm := (' %1 says:\' withCRs bindWith:(self asClassLink:classProvidingComment name)),cm
- ].
].
cm notNil ifTrue:[
+ cm := (' %1 says:\' withCRs bindWith:(self asClassLink:classProvidingComment name)),cm.
+
"/ msg := msg,(msg last isSeparator ifTrue:[''] ifFalse:[' ']),cm
msg := msg,(Character cr),cm
].