public abstract class TypeTrackerBase extends java.lang.Object implements ITypeTracker
While this base class itself does not keep any state and is thread-safe, implementing classes may introduce such behavior.
ITypeTracker
Constructor and Description |
---|
TypeTrackerBase(ELanguage language)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addDefaultImports(ScopedTypeLookup variableLookup)
Adds default namespaces to the initial variable lookup.
|
ITypeResolution |
createTypeResolution(java.util.List<ShallowEntity> rootEntities)
Creates type information for all given shallow entities and their children.
|
ITypeResolution |
createTypeResolution(java.util.List<ShallowEntity> rootEntities,
ScopedTypeLookup variableLookup)
Creates type information for all given shallow entities and their children
and uses the given
ScopedTypeLookup as root lookup. |
protected java.util.Optional<ShallowEntity> |
getAdditionalParent(ShallowEntity entity)
Returns an additional shallowEntity whose type information scope should be
visible for the given entity.
|
protected abstract java.util.Set<java.lang.String> |
getSeparateScopeSubtypes()
Returns all statement sub-types that need a separate scope.
|
protected void |
initialize(java.util.List<ShallowEntity> rootEntities)
Performs initialization steps for the given set of root entities.
|
protected boolean |
needsOrderedScope(ShallowEntity entity)
Returns whether the given entity needs an ordered scope.
|
protected void |
processImport(ShallowEntity entity,
ScopedTypeLookup variableLookup)
Checks whether the given entity is an import of a namespace and adds the
namespace to the variable lookup.
|
public TypeTrackerBase(ELanguage language)
public ITypeResolution createTypeResolution(java.util.List<ShallowEntity> rootEntities)
createTypeResolution
in interface ITypeTracker
public ITypeResolution createTypeResolution(java.util.List<ShallowEntity> rootEntities, ScopedTypeLookup variableLookup)
ScopedTypeLookup
as root lookup. A type resolution
is returned.createTypeResolution
in interface ITypeTracker
protected void initialize(java.util.List<ShallowEntity> rootEntities)
protected java.util.Optional<ShallowEntity> getAdditionalParent(ShallowEntity entity)
protected void addDefaultImports(ScopedTypeLookup variableLookup)
protected void processImport(ShallowEntity entity, ScopedTypeLookup variableLookup)
protected boolean needsOrderedScope(ShallowEntity entity)
true
if the given entity's type is
contained in ORDERED_ENTITY_TYPES
. Subclasses may override this in
order to provide language-specific behavior.protected abstract java.util.Set<java.lang.String> getSeparateScopeSubtypes()