java.lang.Object
de.grogra.xl.compiler.scope.Members
This class is used to collect a set of
Member
s,
and to determine the applicable, accessible, and most specific, member
thereof. In the context of this class, members are local variables, fields,
named predicates, methods, constructors, types, and packages.
The usage is as follows:
- The name of the members to collect is set by one of the
resetName
methods. - The context in which members of the given name are to be searched
is defined by one of the
setContext
methods. This also includes a set of flags (a union of constants defined in this class) which restrict the possible set of members. - The method
#find(Resolution)
is invoked in order to collect the members which can be found in the context, have the given name, and match the restrictions imposed by the flags. This method either returns a member or throws an exception.
MAX_MEMBER
are chosen to reflect the obscuring relations
of the XL programming language. Do not change the values!- Author:
- Ole Kniemeyer
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
This class stores information about the quality of applicability of a member in a context.static interface
Resolution
defines a strategy how applicable members for explicitly given arguments are determined and how the most specific member of these is chosen. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Bit mask forsetContext
methods indicating that constructors are to be included in the search.static final int
Bit mask forsetContext
methods indicating that only declared members are to be included in the search.static final int
This bit mask has to be set byScope.findMembers(String, int, Members)
beforesuper.findMembers
is invoked if the scope is related to another package than the package of the context.static final int
Bit mask forsetContext
methods indicating that instance scopes have to be excluded from the search.static final int
Bit mask forsetContext
methods indicating that interface are to be excluded from the search.static final int
Bit mask forsetContext
methods indicating that types as members of packages are to be excluded from the search.static final int
Bit mask forsetContext
methods indicating that fields are to be included in the search.static final int
static final int
static final int
Bit mask forsetContext
methods indicating that only non-static members are to be included in the search.static final int
Bit mask forsetContext
methods indicating that local variables are to be included in the search.static final int
Largest bit mask of the bit masks which select the type of members in question.static final int
This constant can be used as mask to filter the bit masks which represent member types.static final int
Bit mask forsetContext
methods indicating that methods are to be included in the search.static final int
This is the minimal bit mask which is not defined by this class.static final int
static final int
Bit mask forsetContext
methods indicating that named predicates are to be included in the search.static final int
static final int
Bit mask forsetContext
methods indicating that only static members are to be included in the search.static final int
Bit mask forsetContext
methods indicating that sub-packages of packages are to be included in the search.static final int
Bit mask forsetContext
methods indicating that only members of the supertype of the context type are to be included in the search.static final int
Bit mask forsetContext
methods indicating that top-level packages are to be included in the search.static final int
Bit mask forsetContext
methods indicating that types are to be included in the search.static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addMatches
(Scope scope, int flags) void
addMatches
(Scope scope, Type qualifier, int flags) static String
getMembersDescription
(int types, boolean plural) static int
getMemberType
(Member member) static String
antlr.collections.AST
boolean
void
reset()
void
resetName
(antlr.collections.AST id) void
int
size()
toString()
-
Field Details
-
LOCAL
public static final int LOCALBit mask forsetContext
methods indicating that local variables are to be included in the search.- See Also:
-
FIELD
public static final int FIELDBit mask forsetContext
methods indicating that fields are to be included in the search.- See Also:
-
PREDICATE
public static final int PREDICATEBit mask forsetContext
methods indicating that named predicates are to be included in the search.- See Also:
-
METHOD
public static final int METHODBit mask forsetContext
methods indicating that methods are to be included in the search.- See Also:
-
CONSTRUCTOR
public static final int CONSTRUCTORBit mask forsetContext
methods indicating that constructors are to be included in the search.- See Also:
-
TYPE
public static final int TYPEBit mask forsetContext
methods indicating that types are to be included in the search.- See Also:
-
SUB_PACKAGE
public static final int SUB_PACKAGEBit mask forsetContext
methods indicating that sub-packages of packages are to be included in the search.- See Also:
-
MAX_MEMBER
public static final int MAX_MEMBERLargest bit mask of the bit masks which select the type of members in question.- See Also:
-
MEMBER_MASK
public static final int MEMBER_MASKThis constant can be used as mask to filter the bit masks which represent member types.- See Also:
-
EXCLUDE_INTERFACES
public static final int EXCLUDE_INTERFACESBit mask forsetContext
methods indicating that interface are to be excluded from the search.- See Also:
-
EXCLUDE_TYPES_IN_PACKAGES
public static final int EXCLUDE_TYPES_IN_PACKAGESBit mask forsetContext
methods indicating that types as members of packages are to be excluded from the search.- See Also:
-
STATIC_ONLY
public static final int STATIC_ONLYBit mask forsetContext
methods indicating that only static members are to be included in the search.- See Also:
-
INSTANCE_ONLY
public static final int INSTANCE_ONLYBit mask forsetContext
methods indicating that only non-static members are to be included in the search.- See Also:
-
DECLARED_ONLY
public static final int DECLARED_ONLYBit mask forsetContext
methods indicating that only declared members are to be included in the search. This excludes members declared in supertypes and members imported by import-on-demand statements.- See Also:
-
TOP_LEVEL_PACKAGE
public static final int TOP_LEVEL_PACKAGEBit mask forsetContext
methods indicating that top-level packages are to be included in the search.- See Also:
-
SUPER
public static final int SUPERBit mask forsetContext
methods indicating that only members of the supertype of the context type are to be included in the search.- See Also:
-
FULLY_QUALIFIED
public static final int FULLY_QUALIFIED- See Also:
-
EXCLUDE_INSTANCE_SCOPES
public static final int EXCLUDE_INSTANCE_SCOPESBit mask forsetContext
methods indicating that instance scopes have to be excluded from the search.- See Also:
-
INCLUDE_FIRST_INSTANCE_SCOPE
public static final int INCLUDE_FIRST_INSTANCE_SCOPE- See Also:
-
OPERATOR_METHODS
public static final int OPERATOR_METHODS- See Also:
-
SHIFT_METHODS
public static final int SHIFT_METHODS- See Also:
-
DIFFERENT_PACKAGE
public static final int DIFFERENT_PACKAGEThis bit mask has to be set byScope.findMembers(String, int, Members)
beforesuper.findMembers
is invoked if the scope is related to another package than the package of the context.- See Also:
-
MIN_UNUSED
public static final int MIN_UNUSEDThis is the minimal bit mask which is not defined by this class.- See Also:
-
VARIABLE
public static final int VARIABLE- See Also:
-
-
Constructor Details
-
Members
-
-
Method Details
-
resetName
-
resetName
public void resetName(antlr.collections.AST id) -
reset
public void reset() -
addMatches
-
addMatches
-
getPosition
public antlr.collections.AST getPosition() -
add
-
getMemberName
-
getPackage
-
getQualifier
-
getContextScope
-
toString
-
size
public int size() -
getApplicability
-
resolve
- Throws:
RecognitionException
-
haveApplicable
public boolean haveApplicable() -
getScopeForResult
-
getMemberType
-
getMemberTypeDescription
-
getMembersDescription
-