Hi All,
the "find method with string literals containing..." command, command-E
does /not/ look inside Symbol literals. Here's a case where I specifically
wanted it to, I wanted to find the reference to CogSimStackEntry in
instVarNamesAndTypesForTranslationDo: aBinaryBlock
"enumerate aBinaryBlock with the names and C type strings for the inst vars
to include in a CogSSOptStatus struct."
self instVarNames do:
[:ivn|
aBinaryBlock
value: ivn
value: (ivn = 'ssEntry'
ifTrue: [#'CogSimStackEntry *']
ifFalse: [#sqInt])]
The method in question is
SystemNavigation>>browseMethodsWithString: aString matchCase: caseSensitive
"Launch a browser on all methods that contain string literals with aString
as a substring. Make the search case-sensitive or insensitive as dictated
by the caseSensitive boolean parameter"
self browseAllSelect:
[:method |
method hasLiteralSuchThat: [:lit |
(lit isString and: [lit isSymbol not]) and:
[lit includesSubstring: aString caseSensitive: caseSensitive]]]
name: 'Methods with string ', aString printString, (caseSensitive ifTrue:
[' (case-sensitive)'] ifFalse: [' (case-insensitive)'])
autoSelect: aString
Would people object if I changed this? One way to change it is to exclude
Symbol literals that are also messages in the receiver. So, e.g...
browseMethodsWithString: aString matchCase: caseSensitive
"Launch a browser on all methods that contain string literals with aString
as a substring. Make the search case-sensitive or insensitive as dictated
by the caseSensitive boolean parameter"
self browseAllSelect:
[:method |
method hasLiteralSuchThat:
[:lit |
lit isString
and: [(lit includesSubstring: aString caseSensitive: caseSensitive)
and: [lit isSymbol
ifTrue: [(method messages includes: lit) not]
ifFalse: [true]]]]]
name: 'Methods with string ', aString printString, (caseSensitive ifTrue:
[' (case-sensitive)'] ifFalse: [' (case-insensitive)'])
autoSelect: aString
Would anyone object to me committing this definition?
_,,,^..^,,,_
best, Eliot