Class TypeContextCalculator


  • public class TypeContextCalculator
    extends java.lang.Object
    provides context information for an expression. first and foremost, whether the expression is within the context of a type (e.g., in a method)
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected de.monticore.symboltable.modifiers.AccessModifier _getAccessModifier​(TypeSymbol type, de.monticore.symboltable.IScope enclosingScope, boolean forceStatic)  
      protected java.util.Optional<TypeSymbol> _getEnclosingType​(de.monticore.symboltable.IScope enclosingScope)  
      static de.monticore.symboltable.modifiers.AccessModifier getAccessModifier​(TypeSymbol type, de.monticore.symboltable.IScope enclosingScope)  
      static de.monticore.symboltable.modifiers.AccessModifier getAccessModifier​(TypeSymbol type, de.monticore.symboltable.IScope enclosingScope, boolean forceStatic)
      given an expression's scope that accesses the type, return the appropriate AccessModifier e.g., an expression in a method can access private members, if the method is static, only static members can be accessed supported: visibility (private and protected), staticness, missing: package_local this function does NOT handle supertypes (WithinTypeBasicSymbolsResolver handles supertypes) for access via typeID, static access can be forced on (e.g., C.v)
      protected static TypeContextCalculator getDelegate()  
      static java.util.Optional<TypeSymbol> getEnclosingType​(de.monticore.symboltable.IScope enclosingScope)
      given an expression's enclosing scope, returns the enclosing type symbol
      protected IBasicSymbolsTypeDispatcher getTypeDispatcher()  
      static void init()  
      static void reset()  
      protected static void setDelegate​(TypeContextCalculator newDelegate)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TypeContextCalculator

        public TypeContextCalculator()
    • Method Detail

      • getEnclosingType

        public static java.util.Optional<TypeSymbol> getEnclosingType​(de.monticore.symboltable.IScope enclosingScope)
        given an expression's enclosing scope, returns the enclosing type symbol
      • _getEnclosingType

        protected java.util.Optional<TypeSymbol> _getEnclosingType​(de.monticore.symboltable.IScope enclosingScope)
      • getAccessModifier

        public static de.monticore.symboltable.modifiers.AccessModifier getAccessModifier​(TypeSymbol type,
                                                                                          de.monticore.symboltable.IScope enclosingScope,
                                                                                          boolean forceStatic)
        given an expression's scope that accesses the type, return the appropriate AccessModifier e.g., an expression in a method can access private members, if the method is static, only static members can be accessed supported: visibility (private and protected), staticness, missing: package_local this function does NOT handle supertypes (WithinTypeBasicSymbolsResolver handles supertypes) for access via typeID, static access can be forced on (e.g., C.v)
      • getAccessModifier

        public static de.monticore.symboltable.modifiers.AccessModifier getAccessModifier​(TypeSymbol type,
                                                                                          de.monticore.symboltable.IScope enclosingScope)
      • _getAccessModifier

        protected de.monticore.symboltable.modifiers.AccessModifier _getAccessModifier​(TypeSymbol type,
                                                                                       de.monticore.symboltable.IScope enclosingScope,
                                                                                       boolean forceStatic)
      • init

        public static void init()
      • reset

        public static void reset()