--- a/Explainer.st Sat May 14 07:05:46 2016 +0200
+++ b/Explainer.st Sun May 15 06:58:25 2016 +0200
@@ -454,7 +454,6 @@
node isMethod ifTrue:[
^ self explainMethodNode:node in:code forClass:cls short:short interval:intervalIfKnown
].
-
^ nil
!
@@ -853,7 +852,7 @@
"return an explanation or nil"
|template bindings
- sym stringText explanation val classCategory what pool valText doc|
+ sym explanation val classCategory pool valText doc|
"if not even known as key, it's definitely not a global"
sym := varName asSymbolIfInterned.
@@ -947,8 +946,11 @@
valText := self valueStringFor:val.
shortText ifTrue:[
- ^ stringText,' a global (',valText,')'.
+ ^ '%1: a global (%2)'
+ bindWith:varName
+ with:(self asLink:valText to:(self actionToBrowseClass:val class selector:nil))
].
+
explanation := explanation , '
Its current value is "%1".' bindWith:valText.
@@ -1194,11 +1196,11 @@
] ifFalse:[
tmp := ' is a selector implemented in '.
].
- s := string allBold.
+ "/ s := string allBold.
count > 1 ifTrue:[
- s := self asLink:s to:(self actionToOpenMethodFinderFor:selector).
+ s := self asLink:selector to:(self actionToOpenMethodFinderFor:selector).
] ifFalse:[
- s := self asLink:s to:(self actionToBrowseImplementorsOf:selector).
+ s := self asLink:selector to:(self actionToBrowseClass:listOfImplementingClassNames first selector:selector).
].
shortText ifTrue:[
@@ -1350,23 +1352,30 @@
^ msg
].
- "/ none implements it (type?);
+ "/ none implements it (typo?);
count := listOfSimilarSelectors size.
(count ~~ 0) ifTrue:[
listOfSimilarSelectors := listOfSimilarSelectors asOrderedCollection sort.
- shortText ifTrue:[
- tmp := ' is implemented in '.
- ] ifFalse:[
- tmp := ' is a selector implemented in '.
- ].
(count == 1) ifTrue:[
- msg := listOfSimilarSelectors first allBold , tmp , firstImplementingClassOfSimilar name , '.'.
+ |sel selLink clsLink implementors|
+
+ sel := listOfSimilarSelectors first.
+ selLink := self asLink:sel to:(self actionToOpenMethodFinderFor:sel).
+ "/ clsLink := self asLink:firstImplementingClassOfSimilar name to:(self actionToBrowseClass:firstImplementingClassOfSimilar selector:sel).
+ implementors := Smalltalk allImplementorsOf:sel.
+ clsLink := self typeDescriptionFor:implementors andSelector:sel.
+ msg := selLink , ' is implemented in ' , clsLink , '.'.
shortText ifFalse:[
msg := msg , s2.
]
] ifFalse:[
- msg := 'similar selectors: %1, %2' bindWith:listOfSimilarSelectors first allBold with:listOfSimilarSelectors second allBold.
+ |sel1 sel2|
+ sel1 := listOfSimilarSelectors first.
+ sel2 := listOfSimilarSelectors second.
+ msg := 'similar selectors: %1, %2'
+ bindWith:(self asLink:sel1 to:(self actionToOpenMethodFinderFor:sel1))
+ with:(self asLink:sel2 to:(self actionToOpenMethodFinderFor:sel1)).
count > 2 ifTrue:[
msg := msg,'...'.
].
@@ -1490,19 +1499,28 @@
"try syntax ...; return explanation or nil.
This is meant for beginners..."
+ |fullMsg|
+
((string = ':=') or:[string = '_']) ifTrue:[
- shortText ifTrue:[
- string = '_' ifTrue:[
- ^ '"_" - old style for assignment. Consider changing to ":=".'
- ].
- ^ '":=" - assign to variable on the left (syntax).'.
- ].
-
- ^ '<variable> := <expression>
+ fullMsg := '<variable> := <expression>
":=" and "_" (which is left-arrow in some fonts) mean assignment.
The variable is bound to (i.e. points to) the value of <expression>.
-The "_" form is historic and should not be used with new code.'
+The "_" form is historic and should not be used with new code.'.
+
+ shortText ifTrue:[
+ string = '_' ifTrue:[
+ ^ (self
+ asLink:'"_"'
+ info:fullMsg
+ to:nil),' - old style for assignment. Consider changing to ":=".'
+ ].
+ ^ (self
+ asLink:'":="'
+ info:fullMsg
+ to:nil),' - assign to variable on the left (syntax).'
+ ].
+ ^ fullMsg
].
(string = '^') ifTrue:[