"{ Package: 'stx:libtool' }"
"{ NameSpace: Tools }"
Toolbox subclass:#GenericToolbox
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Interface-Tools'
!
!GenericToolbox class methodsFor:'documentation'!
documentation
"
A generic toolbox for languages that compiles into Smalltalk/X bytecode.
Although it's a good idea to provide specialized toolbox each of those
languages, GenericToolbox is a good basis.
A GenericToolbox is also a default toolbox if ProgrammingLanguage does
not specify one.
[author:]
Jan Vrany <jan.vrany@fit.cvut.cz>
[instance variables:]
[class variables:]
[see also:]
Tools::Toolbox
Tools::SmalltalkToolbox
Tools::JavaToolbox
ProgrammingLanguage
"
! !
!GenericToolbox methodsFor:'accessing-methods'!
globalsReferencedByMethods: methods
"Returns a list of globals (classes) referenced by given methods"
| detector globals |
detector := [ :literal :method :recurse |
literal isSymbol ifTrue:[
| cls ns |
ns := method mclass nameSpace.
(ns notNil and:[ (cls := environment at: literal) notNil]) ifTrue:[
globals add: cls.
] ifFalse:[
(cls := environment at: literal) notNil ifTrue:[
globals add: cls.
].
].
] ifFalse:[
(recurse and:[ literal isArray ]) ifTrue:[
literal do:[:each | detector value: each value: method value: recurse ].
].
].
].
globals := Set new.
methods do:[:m |
| recurse |
"/ If the method is method spec, the do recurse into
"/ literal array when searching for globals, otherwise
"/ do not.
recurse := m resourceType == #canvas.
m literalsDo:[:each | detector value: each value: m value: recurse ].
].
^ globals.
"Created: / 24-02-2014 / 16:25:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GenericToolbox class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libtool/Tools__GenericToolbox.st,v 1.2 2014-02-25 10:41:28 vrany Exp $'
!
version_CVS
^ '$Header: /cvs/stx/stx/libtool/Tools__GenericToolbox.st,v 1.2 2014-02-25 10:41:28 vrany Exp $'
! !