[squeak-dev] The Trunk: ST80-nice.128.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun May 8 12:02:56 UTC 2011
Nicolas Cellier uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-nice.128.mcz
==================== Summary ====================
Name: ST80-nice.128
Author: nice
Time: 8 May 2011, 2:02:34.239 pm
UUID: bfa1b739-c121-4126-a2dd-3816b5c499e7
Ancestors: ST80-nice.127
minor refactorings: use #anySatisfy: #allSatisfy: #noneSatisfy: where it simplifies
=============== Diff against ST80-nice.127 ===============
Item was changed:
----- Method: ParagraphEditor>>explainGlobal: (in category 'explain') -----
explainGlobal: symbol
"Is symbol a global variable?"
| reply classes |
reply := Smalltalk at: symbol ifAbsent: [^nil].
(reply class == Dictionary or:[reply isKindOf: SharedPool class])
ifTrue:
[classes := Set new.
+ self systemNavigation allBehaviorsDo: [:each | (each sharedPools anySatisfy: [:pool | pool == reply])
+ ifTrue: [classes add: each]].
- self systemNavigation allBehaviorsDo: [:each | (each sharedPools detect: [:pool | pool == reply]
- ifNone: [])
- ~~ nil ifTrue: [classes add: each]].
classes := classes printString.
^'"is a global variable. It is a pool which is used by the following classes ' , (classes allButFirst: 5) , '"'].
(reply isKindOf: Behavior)
ifTrue: [^'"is a global variable. ' , symbol , ' is a class in category ', reply category,
'."', '\' withCRs, 'Browser newOnClass: ' , symbol , '.'].
symbol == #Smalltalk ifTrue: [^'"is a global. Smalltalk is the only instance of SystemDictionary and holds all global variables."'].
^'"is a global variable. ' , symbol , ' is ' , reply printString , '"'!
Item was changed:
----- Method: ParagraphEditor>>explainInst: (in category 'explain') -----
explainInst: string
"Is string an instance variable of this class?"
| classes cls |
(model respondsTo: #selectedClassOrMetaClass) ifTrue: [
cls := model selectedClassOrMetaClass].
cls ifNil: [^ nil]. "no class known"
classes := (Array with: cls)
, cls allSuperclasses.
+ classes := classes detect: [:each | each instVarNames
+ anySatisfy: [:name | name = string] ] ifNone: [^nil].
- classes := classes detect: [:each | (each instVarNames
- detect: [:name | name = string] ifNone: [])
- ~~ nil] ifNone: [^nil].
classes := classes printString.
^ '"is an instance variable of the receiver; defined in class ' , classes ,
'"\' withCRs , classes , ' systemNavigation browseAllAccessesTo: ''' , string , ''' from: ', classes, '.'!
Item was changed:
----- Method: ParagraphEditor>>explainMySel: (in category 'explain') -----
explainMySel: symbol
"Is symbol the selector of this method? Is it sent by this method? If
not, then expalin will call (explainPartSel:) to see if it is a fragment of a
selector sent here. If not, explain will call (explainAnySel:) to catch any
selector. "
| lits classes msg |
(model respondsTo: #selectedMessageName) ifFalse: [^ nil].
(msg := model selectedMessageName) ifNil: [^nil]. "not in a message"
classes := self systemNavigation allClassesImplementing: symbol.
classes size > 12
ifTrue: [classes := 'many classes']
ifFalse: [classes := 'these classes ' , classes printString].
msg = symbol
ifTrue: [^ '"' , symbol , ' is the selector of this very method!! It is defined in ',
classes , '. To see the other definitions, go to the message list pane, get the menu from the top of the scroll bar, and select ''implementors of...''."']
ifFalse:
[lits := (model selectedClassOrMetaClass compiledMethodAt:
msg) messages.
+ (lits anySatisfy: [:each | each == symbol])
+ ifFalse: [^nil].
- (lits detect: [:each | each == symbol]
- ifNone: [])
- == nil ifTrue: [^nil].
^ '"' , symbol , ' is a message selector which is defined in ', classes , '. To see the definitions, go to the message list pane, get the menu from the top of the scroll bar, and select ''implementors of...''."'].!
Item was changed:
----- Method: ParagraphEditor>>explainPartSel: (in category 'explain') -----
explainPartSel: string
"Is this a fragment of a multiple-argument selector sent in this method?"
| lits whole reply classes s msg |
(model respondsTo: #selectedMessageName) ifFalse: [^ nil].
(msg := model selectedMessageName) ifNil: [^ nil]. "not in a message"
string last == $: ifFalse: [^ nil].
"Name of this method"
lits := Array with: msg.
+ (whole := lits detect: [:each | each keywords anySatisfy: [:frag | frag = string] ]
- (whole := lits detect: [:each | (each keywords detect: [:frag | frag = string]
- ifNone: []) ~~ nil]
ifNone: []) ~~ nil
ifTrue: [reply := ', which is the selector of this very method!!'.
s := '. To see the other definitions, go to the message list pane, get the menu from the top of the scroll bar, and select ''implementors of...''."']
ifFalse:
["Selectors called from this method"
lits := (model selectedClassOrMetaClass compiledMethodAt:
msg) messages.
+ (whole := lits detect: [:each | each keywords anySatisfy: [:frag | frag = string] ]
- (whole := lits detect: [:each | (each keywords detect: [:frag | frag = string]
- ifNone: []) ~~ nil]
ifNone: []) ~~ nil
ifFalse: [string = 'primitive:'
ifTrue: [^self explainChar: '<']
ifFalse: [^nil]].
reply := '.'.
s := '. To see the definitions, go to the message list pane, get the menu from the top of the scroll bar, and select ''implementors of...''."'].
classes := self systemNavigation allClassesImplementing: whole.
classes size > 12
ifTrue: [classes := 'many classes']
ifFalse: [classes := 'these classes ' , classes printString].
^ '"' , string , ' is one part of the message selector ' , whole, reply , ' It is defined in ' , classes , s!
More information about the Squeak-dev
mailing list
|