java.lang.Object
de.grogra.xl.compiler.scope.Scope
- Direct Known Subclasses:
BlockScope
,ClassPath
,CompilationUnitScope
,ImportOnDemandScope
,Package
,SingleStaticImport
,SingleTypeImport
,TypeScope
Scode
is the abstract base class for all scopes. As defined
by the Java language specification, scopes represent regions of
a programme in which Member
s can be identified
by their simple name. Scopes are nested.- Author:
- Ole Kniemeyer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dump()
boolean
Checks if this scope enclosess
directly or indirectly.void
findMembers
(String name, int flags, Members list) Finds all members which are declared in this scope or enclosing scopes.Returns the type of the innermost enclosing type declaration.Type<?>
Returns the enclosing scope of this scope.Type<?>
getOwnerOf
(Member m) Returns the type of the innermost type declaration of whichm
is a member.Returns the innermost enclosing scope of classPackage
, ornull
.getPropertyModel
(Type type, Compiler c, antlr.collections.AST pos) Returns the compile-time model to use in this scope.getQueryModel
(Compiler c, antlr.collections.AST pos) Returns the compile-time model to use in this scope.final Scope
getRoot()
Returns the outmost enclosing scope.void
Insertsenc
such that it becomes the new enclosing scope of this ecope.boolean
boolean
final boolean
Checks if declarations of this scope are shadowed by declarations ofs
.boolean
isStatic()
Checks if this scope appears in a static context.
-
Method Details
-
insert
Insertsenc
such that it becomes the new enclosing scope of this ecope. The enclosing scope of the outmost enclosing scope ofenc
is set to the previously enclosing scope of this scope.- Parameters:
enc
- the new enclosing scope of this. May benull
.
-
getEnclosingScope
Returns the enclosing scope of this scope.- Returns:
- enclosing scope, or
null
-
getRoot
Returns the outmost enclosing scope. This is the (directly or indirectly) enclosing scope of this scope which has no enclosing scope.- Returns:
- outmost enclosing scope
-
encloses
Checks if this scope enclosess
directly or indirectly. Returnsfalse
ifs
isnull
or this scope.- Parameters:
s
- a scope- Returns:
true
this scope enclosess
-
isShadowedBy
Checks if declarations of this scope are shadowed by declarations ofs
. This is defined by the Java language specification.- Parameters:
s
- a scope- Returns:
true
iff this scope is shadowed bys
-
getOwnerOf
Returns the type of the innermost type declaration of whichm
is a member.- Parameters:
m
- a member- Returns:
- innermost type of which
m
is a member
-
getDeclaredType
Returns the type of the innermost enclosing type declaration.- Returns:
- type of innermost enclosing type declaration
-
getDeclaredEntity
-
getQueryModel
Returns the compile-time model to use in this scope. This is the model of the innermost scope (potentiallythis
) for which a non-null
model has been set by#setModel(Model)
.- Returns:
- compile-time model for this scope
-
getPropertyModel
Returns the compile-time model to use in this scope. This is the model of the innermost scope (potentiallythis
) for which a non-null
model has been set by#setModel(Model)
.- Returns:
- compile-time model for this scope
-
getExtension
-
getPackage
Returns the innermost enclosing scope of classPackage
, ornull
. May bethis
.- Returns:
- innermost
Package
scope
-
isStatic
public boolean isStatic()Checks if this scope appears in a static context. This is defined by the Java Language Specification.- Returns:
true
iff this scope appears in a static context
-
findMembers
Finds all members which are declared in this scope or enclosing scopes. This method should be overwritten by subclasses; an invocation ofsuper.findMembers
has to be included in order to look for members in enclosing scopes. Theflags
are a combination of the bit masks defined inMembers
, they are used to restrict the range of possible members.- Parameters:
name
- simple name of the members to findflags
- combination of masks defined inMembers
list
- found members are added to this list
-
isD2FImplicit
public boolean isD2FImplicit() -
isEnabledConversion
-
getDefaultModuleSuperclass
-
getInstantiationProducerType
-
getCompiler
-
dump
public void dump()
-