Module xl.compiler

Class Members

java.lang.Object
de.grogra.xl.compiler.scope.Members

public final class Members extends Object
This class is used to collect a set of Members, 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:
  1. The name of the members to collect is set by one of the resetName methods.
  2. 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.
  3. 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.
IMPORTANT: The numeric values of the masks up to 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

    Nested Classes
    Modifier and Type
    Class
    Description
    static 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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Bit mask for setContext methods indicating that constructors are to be included in the search.
    static final int
    Bit mask for setContext methods indicating that only declared members are to be included in the search.
    static final int
    This bit mask has to be set by Scope.findMembers(String, int, Members) before super.findMembers is invoked if the scope is related to another package than the package of the context.
    static final int
    Bit mask for setContext methods indicating that instance scopes have to be excluded from the search.
    static final int
    Bit mask for setContext methods indicating that interface are to be excluded from the search.
    static final int
    Bit mask for setContext methods indicating that types as members of packages are to be excluded from the search.
    static final int
    Bit mask for setContext methods indicating that fields are to be included in the search.
    static final int
     
    static final int
     
    static final int
    Bit mask for setContext methods indicating that only non-static members are to be included in the search.
    static final int
    Bit mask for setContext 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 for setContext 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 for setContext methods indicating that named predicates are to be included in the search.
    static final int
     
    static final int
    Bit mask for setContext methods indicating that only static members are to be included in the search.
    static final int
    Bit mask for setContext methods indicating that sub-packages of packages are to be included in the search.
    static final int
    Bit mask for setContext methods indicating that only members of the supertype of the context type are to be included in the search.
    static final int
    Bit mask for setContext methods indicating that top-level packages are to be included in the search.
    static final int
    Bit mask for setContext methods indicating that types are to be included in the search.
    static final int
    This bit mask is the union of FIELD and LOCAL, i.e., it represents variables.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Member m, Scope scope, int findFlags)
     
    void
    addMatches(Scope scope, int flags)
     
    void
    addMatches(Scope scope, Type qualifier, int flags)
     
     
     
     
    static String
    getMembersDescription(int types, boolean plural)
     
    static int
     
    static String
     
     
    antlr.collections.AST
     
     
     
    boolean
     
    void
     
    void
    resetName(antlr.collections.AST id)
     
    void
    resetName(String name, antlr.collections.AST pos)
     
     
    int
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • LOCAL

      public static final int LOCAL
      Bit mask for setContext methods indicating that local variables are to be included in the search.
      See Also:
    • FIELD

      public static final int FIELD
      Bit mask for setContext methods indicating that fields are to be included in the search.
      See Also:
    • PREDICATE

      public static final int PREDICATE
      Bit mask for setContext methods indicating that named predicates are to be included in the search.
      See Also:
    • METHOD

      public static final int METHOD
      Bit mask for setContext methods indicating that methods are to be included in the search.
      See Also:
    • CONSTRUCTOR

      public static final int CONSTRUCTOR
      Bit mask for setContext methods indicating that constructors are to be included in the search.
      See Also:
    • TYPE

      public static final int TYPE
      Bit mask for setContext methods indicating that types are to be included in the search.
      See Also:
    • SUB_PACKAGE

      public static final int SUB_PACKAGE
      Bit mask for setContext methods indicating that sub-packages of packages are to be included in the search.
      See Also:
    • MAX_MEMBER

      public static final int MAX_MEMBER
      Largest bit mask of the bit masks which select the type of members in question.
      See Also:
    • MEMBER_MASK

      public static final int MEMBER_MASK
      This constant can be used as mask to filter the bit masks which represent member types.
      See Also:
    • EXCLUDE_INTERFACES

      public static final int EXCLUDE_INTERFACES
      Bit mask for setContext methods indicating that interface are to be excluded from the search.
      See Also:
    • EXCLUDE_TYPES_IN_PACKAGES

      public static final int EXCLUDE_TYPES_IN_PACKAGES
      Bit mask for setContext methods indicating that types as members of packages are to be excluded from the search.
      See Also:
    • STATIC_ONLY

      public static final int STATIC_ONLY
      Bit mask for setContext methods indicating that only static members are to be included in the search.
      See Also:
    • INSTANCE_ONLY

      public static final int INSTANCE_ONLY
      Bit mask for setContext methods indicating that only non-static members are to be included in the search.
      See Also:
    • DECLARED_ONLY

      public static final int DECLARED_ONLY
      Bit mask for setContext 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_PACKAGE
      Bit mask for setContext methods indicating that top-level packages are to be included in the search.
      See Also:
    • SUPER

      public static final int SUPER
      Bit mask for setContext 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_SCOPES
      Bit mask for setContext 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_PACKAGE
      This bit mask has to be set by Scope.findMembers(String, int, Members) before super.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_UNUSED
      This is the minimal bit mask which is not defined by this class.
      See Also:
    • VARIABLE

      public static final int VARIABLE
      This bit mask is the union of FIELD and LOCAL, i.e., it represents variables.
      See Also:
  • Constructor Details

  • Method Details

    • resetName

      public void resetName(String name, antlr.collections.AST pos)
    • resetName

      public void resetName(antlr.collections.AST id)
    • reset

      public void reset()
    • addMatches

      public void addMatches(Scope scope, int flags)
    • addMatches

      public void addMatches(Scope scope, Type qualifier, int flags)
    • getPosition

      public antlr.collections.AST getPosition()
    • add

      public void add(Member m, Scope scope, int findFlags)
    • getMemberName

      public String getMemberName()
    • getPackage

      public String getPackage()
    • getQualifier

      public Type getQualifier()
    • getContextScope

      public Scope getContextScope()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • size

      public int size()
    • getApplicability

      public Members.Applicability getApplicability()
    • resolve

      public Member resolve(Members.Resolution res) throws RecognitionException
      Throws:
      RecognitionException
    • haveApplicable

      public boolean haveApplicable()
    • getScopeForResult

      public Scope getScopeForResult()
    • getMemberType

      public static int getMemberType(Member member)
    • getMemberTypeDescription

      public static String getMemberTypeDescription(Member m)
    • getMembersDescription

      public static String getMembersDescription(int types, boolean plural)