diff -r 8086dadff648 -r de8b73b42e1e SystemBrowser.st --- a/SystemBrowser.st Wed Nov 06 10:45:46 2002 +0100 +++ b/SystemBrowser.st Wed Nov 06 10:46:47 2002 +0100 @@ -3125,6 +3125,63 @@ "Modified: / 31.10.1997 / 15:42:05 / cg" ! +browseReferendsOfUnboundGlobalsWithTitle:title ifNone:actionIfNone + "launch a browser for all methods referencing an unbound global. + " + + |globalsPlainName searchBlock browser| + + searchBlock := [:cls :mthd :sel | + + |mSource globals potentialNames| + + "/ kludge: Lazy methods do not include symbols in the literal array - sigh + mthd isLazyMethod ifTrue:[ + mSource := mthd source. + mSource notNil ifTrue:[ + globals := mthd usedGlobals. + ]. + ] ifFalse:[ + "/ try hard to avoid the usedGlobals - its expensive + potentialNames := mthd literals select:[:lit | lit isSymbol and:[lit size > 0 and:[lit first isUppercase]]]. + potentialNames notEmpty ifTrue:[ + potentialNames := potentialNames select:[:lit | (Smalltalk at:lit) isNil]. + potentialNames notEmpty ifTrue:[ + globals := mthd usedGlobals. + ] + ] + ]. + globals notNil ifTrue:[ + globals contains:[:aGlobalKey | (Smalltalk at:aGlobalKey asSymbol) isNil]. + ] ifFalse:[ + false + ] + ]. + + browser := self browseMethodsWhere:searchBlock title:title ifNone:[actionIfNone value. ^ nil]. + browser isNil ifTrue:[ + actionIfNone value + ] ifFalse:[ + browser autoSearch:globalsPlainName + ]. + ^ browser +! + +browseReferendsOfUnboundGlobalsWithTitle:title warnIfNone:doWarn + "launch a browser for all methods referencing an unbound global. + " + + |b| + + doWarn ifTrue: [ + b := [self showNoneFound:title] + ]. + + ^ self + browseReferendsOfUnboundGlobalsWithTitle:title + ifNone:b +! + browseRefsTo:aString classVars:classVars in:aCollectionOfClasses modificationsOnly:modsOnly "launch a browser for all methods in aClass where the instVar/classVar named aString is referenced; if modsOnly is true, browse only methods where the @@ -4790,7 +4847,7 @@ !SystemBrowser class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.172 2002-11-04 21:29:18 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.173 2002-11-06 09:46:47 cg Exp $' ! ! SystemBrowser initialize!