SystemBrowser.st
changeset 4198 de8b73b42e1e
parent 4167 588e05d2124d
child 4200 3859a6fee797
equal deleted inserted replaced
4197:8086dadff648 4198:de8b73b42e1e
  3123         warnIfNone:doWarn
  3123         warnIfNone:doWarn
  3124 
  3124 
  3125     "Modified: / 31.10.1997 / 15:42:05 / cg"
  3125     "Modified: / 31.10.1997 / 15:42:05 / cg"
  3126 !
  3126 !
  3127 
  3127 
       
  3128 browseReferendsOfUnboundGlobalsWithTitle:title ifNone:actionIfNone
       
  3129     "launch a browser for all methods referencing an unbound global.
       
  3130     "
       
  3131 
       
  3132     |globalsPlainName searchBlock browser|
       
  3133 
       
  3134     searchBlock := [:cls :mthd :sel | 
       
  3135 
       
  3136                     |mSource globals potentialNames|
       
  3137 
       
  3138                     "/ kludge: Lazy methods do not include symbols in the literal array - sigh
       
  3139                     mthd isLazyMethod ifTrue:[
       
  3140                         mSource := mthd source.
       
  3141                         mSource notNil ifTrue:[
       
  3142                             globals := mthd usedGlobals.
       
  3143                         ].
       
  3144                     ] ifFalse:[
       
  3145                         "/ try hard to avoid the usedGlobals - its expensive
       
  3146                         potentialNames := mthd literals select:[:lit | lit isSymbol and:[lit size > 0 and:[lit first isUppercase]]].
       
  3147                         potentialNames notEmpty ifTrue:[
       
  3148                             potentialNames := potentialNames select:[:lit | (Smalltalk at:lit) isNil].
       
  3149                             potentialNames notEmpty ifTrue:[
       
  3150                                 globals := mthd usedGlobals.
       
  3151                             ]
       
  3152                         ]
       
  3153                     ].
       
  3154                     globals notNil ifTrue:[
       
  3155                         globals contains:[:aGlobalKey | (Smalltalk at:aGlobalKey asSymbol) isNil].
       
  3156                     ] ifFalse:[
       
  3157                         false
       
  3158                     ]
       
  3159                   ].
       
  3160 
       
  3161     browser := self browseMethodsWhere:searchBlock title:title ifNone:[actionIfNone value. ^ nil].
       
  3162     browser isNil ifTrue:[
       
  3163         actionIfNone value
       
  3164     ] ifFalse:[
       
  3165         browser autoSearch:globalsPlainName
       
  3166     ].
       
  3167     ^ browser
       
  3168 !
       
  3169 
       
  3170 browseReferendsOfUnboundGlobalsWithTitle:title warnIfNone:doWarn
       
  3171     "launch a browser for all methods referencing an unbound global.
       
  3172     "
       
  3173 
       
  3174     |b|
       
  3175 
       
  3176     doWarn ifTrue: [
       
  3177         b := [self showNoneFound:title]
       
  3178     ].
       
  3179 
       
  3180     ^ self
       
  3181         browseReferendsOfUnboundGlobalsWithTitle:title 
       
  3182         ifNone:b
       
  3183 !
       
  3184 
  3128 browseRefsTo:aString classVars:classVars in:aCollectionOfClasses modificationsOnly:modsOnly
  3185 browseRefsTo:aString classVars:classVars in:aCollectionOfClasses modificationsOnly:modsOnly
  3129     "launch a browser for all methods in aClass where the instVar/classVar named
  3186     "launch a browser for all methods in aClass where the instVar/classVar named
  3130      aString is referenced; if modsOnly is true, browse only methods where the
  3187      aString is referenced; if modsOnly is true, browse only methods where the
  3131      instvar is modified"
  3188      instvar is modified"
  3132 
  3189 
  4788 ! !
  4845 ! !
  4789 
  4846 
  4790 !SystemBrowser class methodsFor:'documentation'!
  4847 !SystemBrowser class methodsFor:'documentation'!
  4791 
  4848 
  4792 version
  4849 version
  4793     ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.172 2002-11-04 21:29:18 cg Exp $'
  4850     ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.173 2002-11-06 09:46:47 cg Exp $'
  4794 ! !
  4851 ! !
  4795 
  4852 
  4796 SystemBrowser initialize!
  4853 SystemBrowser initialize!