#TUNING by cg
class: SystemBrowser class
changed: #searchBlockForCode:in:isMethod:
tuned search for methods with code if selector is known
--- a/SystemBrowser.st Mon Jul 15 15:35:34 2019 +0200
+++ b/SystemBrowser.st Mon Jul 15 15:54:49 2019 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -122,7 +120,7 @@
openInClass:aClass selector:aSelector
"launch a standard browser which immediately switches
- to aClass » aSelector. Returns the browser"
+ to aClass » aSelector. Returns the browser"
|brwsr classesName|
@@ -5667,7 +5665,9 @@
parseRewriteMethod:aCodeString
onError: errAction.
numMethodArgs := searchTree arguments size.
- methodSelector := searchTree selector.
+ (searchTree selectorParts contains:[:part | part isPatternVariable]) ifFalse:[
+ methodSelector := searchTree selector.
+ ].
] ifFalse:[
searchTree := RBParser
parseRewriteExpression:aCodeString
@@ -5729,14 +5729,18 @@
|isSTCCompiled allSelectorsInLiteralArray allMessagesSent
allGlobalsReferenced allUsedSymbolsInLiteralArray allStringsInLiteralArray
allSent src rslt parseTree
- literalsInMethod|
+ literalsInMethod skipMethod|
foundMatch := false.
- "/ can speedup the search, by filtering for number of message-args first...
- (isMethod not
- or:[ numMethodArgs isNil
- or:[ numMethodArgs == m numArgs ]]) ifTrue:[
+ "/ can speedup the search,
+ "/ by filtering for number of message-args or method selector first...
+ skipMethod := false.
+ isMethod ifTrue:[
+ (numMethodArgs notNil and:[ numMethodArgs ~= m numArgs ]) ifTrue:[ skipMethod := true ].
+ (methodSelector notNil and:[ methodSelector ~= sel ]) ifTrue:[ skipMethod := true ].
+ ].
+ skipMethod ifFalse:[
m isLazyMethod ifTrue:[
src := m source.
src notNil ifTrue:[
@@ -5811,7 +5815,7 @@
"Created: / 02-05-2011 / 13:25:01 / sr"
"Modified: / 20-07-2012 / 19:07:36 / cg"
- "Modified: / 10-07-2019 / 18:38:35 / Claus Gittinger"
+ "Modified: / 15-07-2019 / 15:27:48 / Claus Gittinger"
!
searchBlockForCode:aCodeString isMethod:isMethod
@@ -7351,8 +7355,8 @@
('*>>*' match:sel) ifTrue:[
sep := $>
] ifFalse:[
- ('*»*' match:sel) ifTrue:[
- sep := $»
+ ('*»*' match:sel) ifTrue:[
+ sep := $»
] ifFalse:[
('* *' match:sel) ifTrue:[
sep := Character space
@@ -7391,7 +7395,7 @@
aString isEmptyOrNil ifTrue:[^ nil].
- (idx := aString indexOf:$») ~~ 0 ifTrue:[
+ (idx := aString indexOf:$») ~~ 0 ifTrue:[
s := (aString copyFrom:idx+1) withoutSeparators.
s isEmpty ifTrue:[^ nil].
] ifFalse:[
@@ -7441,7 +7445,7 @@
self extractSelectorFrom:'self at:something put:someValue'
self extractSelectorFrom:'(self at:something put:someValue)'
self extractSelectorFrom:'[self at:something put:someValue] value'
- self extractSelectorFrom:'Array » at:put:'
+ self extractSelectorFrom:'Array » at:put:'
self extractSelectorFrom:'Array>>at:put:'
self extractSelectorFrom:'Array>>#at:put:'
self extractSelectorFrom:'Array>>#''at:put:'''
@@ -7615,7 +7619,7 @@
].
selector notNil ifTrue:[
aGCOrStream
- nextPutAll:' » ';
+ nextPutAll:' » ';
bold;
nextPutAll:selector;
normal.