Module xl.compiler

Class Scope

java.lang.Object
de.grogra.xl.compiler.scope.Scope
Direct Known Subclasses:
BlockScope, ClassPath, CompilationUnitScope, ImportOnDemandScope, Package, SingleStaticImport, SingleTypeImport, TypeScope

public abstract class Scope extends Object
Scode is the abstract base class for all scopes. As defined by the Java language specification, scopes represent regions of a programme in which Members can be identified by their simple name. Scopes are nested.
Author:
Ole Kniemeyer
  • Method Details

    • insert

      public void insert(Scope enc)
      Inserts enc such that it becomes the new enclosing scope of this ecope. The enclosing scope of the outmost enclosing scope of enc is set to the previously enclosing scope of this scope.
      Parameters:
      enc - the new enclosing scope of this. May be null.
    • getEnclosingScope

      public Scope getEnclosingScope()
      Returns the enclosing scope of this scope.
      Returns:
      enclosing scope, or null
    • getRoot

      public final Scope 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

      public boolean encloses(Scope s)
      Checks if this scope encloses s directly or indirectly. Returns false if s is null or this scope.
      Parameters:
      s - a scope
      Returns:
      true this scope encloses s
    • isShadowedBy

      public final boolean isShadowedBy(Scope s)
      Checks if declarations of this scope are shadowed by declarations of s. This is defined by the Java language specification.
      Parameters:
      s - a scope
      Returns:
      true iff this scope is shadowed by s
    • getOwnerOf

      public Type getOwnerOf(Member m)
      Returns the type of the innermost type declaration of which m is a member.
      Parameters:
      m - a member
      Returns:
      innermost type of which m is a member
    • getDeclaredType

      public CClass getDeclaredType()
      Returns the type of the innermost enclosing type declaration.
      Returns:
      type of innermost enclosing type declaration
    • getDeclaredEntity

      public Member getDeclaredEntity()
    • getQueryModel

      public CompiletimeModel getQueryModel(Compiler c, antlr.collections.AST pos)
      Returns the compile-time model to use in this scope. This is the model of the innermost scope (potentially this) for which a non-null model has been set by #setModel(Model).
      Returns:
      compile-time model for this scope
    • getPropertyModel

      public CompiletimeModel getPropertyModel(Type type, Compiler c, antlr.collections.AST pos)
      Returns the compile-time model to use in this scope. This is the model of the innermost scope (potentially this) for which a non-null model has been set by #setModel(Model).
      Returns:
      compile-time model for this scope
    • getExtension

      public Extension getExtension()
    • getPackage

      public Package getPackage()
      Returns the innermost enclosing scope of class Package, or null. May be this.
      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

      public void findMembers(String name, int flags, Members list)
      Finds all members which are declared in this scope or enclosing scopes. This method should be overwritten by subclasses; an invocation of super.findMembers has to be included in order to look for members in enclosing scopes. The flags are a combination of the bit masks defined in Members, they are used to restrict the range of possible members.
      Parameters:
      name - simple name of the members to find
      flags - combination of masks defined in Members
      list - found members are added to this list
    • isD2FImplicit

      public boolean isD2FImplicit()
    • isEnabledConversion

      public boolean isEnabledConversion(ConversionType type)
    • getDefaultModuleSuperclass

      public Type<?> getDefaultModuleSuperclass()
    • getInstantiationProducerType

      public Type<?> getInstantiationProducerType()
    • getCompiler

      public Compiler getCompiler()
    • dump

      public void dump()