diff -r db726b209298 -r ae69dc905971 SystemBrowser.st --- a/SystemBrowser.st Mon Feb 20 10:50:02 2006 +0100 +++ b/SystemBrowser.st Mon Feb 20 10:50:53 2006 +0100 @@ -4243,7 +4243,8 @@ searchBlockForCode:aCodeString isMethod:isMethod "return a block to search for a pice of code (intelligent search)." - |errAction searchTree searcher globalVariablesUsed sentMessages searchBlock foundMatch| + |errAction searchTree searcher globalVariablesUsed usedSymbols + sentMessages searchBlock foundMatch| "/self halt. "/rule := ParseTreeLintRule @@ -4280,6 +4281,7 @@ ] do:[ sentMessages := searchTree sentMessages. ]. + globalVariablesUsed := searchTree referencedVariables select:[:node | node isPatternNode not @@ -4287,6 +4289,8 @@ ] thenCollect:[:node | node name asSymbol]. + usedSymbols := searchTree usedSymbols. + searcher := ParseTreeSearcher new. isMethod ifTrue:[ searcher @@ -4298,24 +4302,25 @@ do:[:aNode :answer | foundMatch := true]. ]. - sentMessages notEmptyOrNil ifTrue:[ - "/ can speedup the search, by filtering for sent messages first... - - searchBlock := [:c :m :sel | - |allSelectorsInLiteralArray allMessagesSent - allGlobalsReferenced allSent src rslt parseTree| - - foundMatch := false. - - m isLazyMethod ifTrue:[ - src := m source. - src notNil ifTrue:[ - m makeRealMethod. - ]. + + searchBlock := [:c :m :sel | + |allSelectorsInLiteralArray allMessagesSent + allGlobalsReferenced allUsedSymbolsInLiteralArray allSent src rslt parseTree| + + foundMatch := false. + + m isLazyMethod ifTrue:[ + src := m source. + src notNil ifTrue:[ + m makeRealMethod. ]. - allSelectorsInLiteralArray := m literals includesAll:sentMessages. - allSelectorsInLiteralArray ifTrue:[ - allMessagesSent := m messages includesAll:sentMessages. + ]. + "/ can speedup the search, by filtering for sent messages first... + allSelectorsInLiteralArray := sentMessages isEmptyOrNil or:[ m literals includesAll:sentMessages ]. + allSelectorsInLiteralArray ifTrue:[ + allUsedSymbolsInLiteralArray := usedSymbols isEmptyOrNil or:[ m literals includesAll:usedSymbols ]. + allUsedSymbolsInLiteralArray ifTrue:[ + allMessagesSent := sentMessages isEmptyOrNil or:[ m messages includesAll:sentMessages ]. allMessagesSent ifTrue:[ allGlobalsReferenced := globalVariablesUsed conform:[:varName | m referencesGlobal:varName]. allGlobalsReferenced ifTrue:[ @@ -4345,37 +4350,10 @@ ] ] ] - ]. - foundMatch. - ]. - ] ifFalse:[ - searchBlock := [:c :m :sel | - |src rslt parseTree| - - foundMatch := false. - - 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]. - - parseTree isNil ifTrue:[ - Transcript showCR:('ParseError in ' , m whoString , ' - please verify.'). - ] ifFalse:[ - false "isMethod" ifTrue:[ - rslt := searcher executeMethod:parseTree. - ] ifFalse:[ - rslt := searcher executeTree:parseTree. - ]. - ]. - ]. - foundMatch. - ]. - ]. + ] + ]. + foundMatch. + ]. ^ searchBlock. ! @@ -5382,7 +5360,7 @@ !SystemBrowser class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.226 2006-02-15 16:31:49 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.227 2006-02-20 09:50:53 cg Exp $' ! ! SystemBrowser initialize!