--- a/SystemBrowser.st Wed Oct 08 17:15:22 2003 +0200
+++ b/SystemBrowser.st Wed Oct 08 17:32:28 2003 +0200
@@ -4150,7 +4150,7 @@
searchBlockForCode:aCodeString isMethod:isMethod
"return a block to search for a pice of code (intelligent search)."
- |errAction searchTree searcher messages searchBlock foundMatch|
+ |errAction searchTree searcher variables messages searchBlock foundMatch|
errAction := [:str :pos |
Dialog warn:'Error during parse: ' , str , ' (position ' , pos printString , ')'.
@@ -4170,6 +4170,12 @@
searchTree isMessage ifTrue:[
messages := searchTree sentMessages
].
+ variables := searchTree referencedVariables
+ select:[:node |
+ node isPatternNode not
+ and:[ Smalltalk includesKey: node name asSymbol ]
+ ]
+ thenCollect:[:node | node name asSymbol].
searcher := ParseTreeSearcher new.
searcher
@@ -4180,7 +4186,7 @@
"/ can speedup the search, by filtering for sent messages first...
searchBlock := [:c :m :sel |
- |allSent src rslt parseTree|
+ |allGlobalsReferenced allSent src rslt parseTree|
m isLazyMethod ifTrue:[
src := m source.
@@ -4188,20 +4194,24 @@
m makeRealMethod.
].
].
- allSent := (messages contains:[:sel | (m sends:sel) not]) not.
- allSent ifTrue:[
- src := m source.
- src isNil ifTrue:[
- ('Browser [info]: no source for ' , m printString) infoPrintCR.
- false
- ] ifFalse:[
- parseTree := RBParser
- parseSearchMethod:src
- onError: [:str :pos | Transcript showCR:str. Transcript showCR:pos. nil].
-
- foundMatch := false.
- rslt := searcher executeTree:parseTree.
- foundMatch.
+sel == #numArgs ifTrue:[self halt].
+ allGlobalsReferenced := variables conform:[:varName | m referencesGlobal:varName].
+ allGlobalsReferenced ifTrue:[
+ allSent := messages conform:[:sel | (m sends:sel)].
+ allSent ifTrue:[
+ src := m source.
+ src isNil ifTrue:[
+ ('Browser [info]: no source for ' , m printString) infoPrintCR.
+ false
+ ] ifFalse:[
+ parseTree := RBParser
+ parseSearchMethod:src
+ onError: [:str :pos | Transcript showCR:str. Transcript showCR:pos. nil].
+
+ foundMatch := false.
+ rslt := searcher executeTree:parseTree.
+ foundMatch.
+ ]
]
]
].
@@ -5126,7 +5136,7 @@
!SystemBrowser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.198 2003-10-07 19:15:38 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.199 2003-10-08 15:32:28 cg Exp $'
! !
SystemBrowser initialize!