Interface IFeatureScopeSession

    • Method Detail

      • getScope

        org.eclipse.xtext.scoping.IScope getScope​(org.eclipse.emf.ecore.EObject context,
                                                  org.eclipse.emf.ecore.EReference reference,
                                                  IResolvedTypes types)
        Return the scope for the given context and reference based on the known resolved types.
        Parameters:
        context - the context object. May not be null.
        reference - the reference that holds the unresolved proxy. May not be null.
        types - the already computed types.
        See Also:
        IScopeProvider.getScope(EObject, EReference)
      • addTypesToStaticScope

        IFeatureScopeSession addTypesToStaticScope​(java.util.List<? extends org.eclipse.xtext.common.types.JvmType> staticFeatureProviders,
                                                   java.util.List<? extends org.eclipse.xtext.common.types.JvmType> staticExtensionProviders)
        Add types to the session that are imported statically either as plain static imports or with an extension semantic.
        Parameters:
        staticFeatureProviders - the static feature providers. May not be null.
        staticExtensionProviders - the static extension providers. May not be null.
        Returns:
        a configured session.
      • addImports

        IFeatureScopeSession addImports​(ITypeImporter.Client importer)
        Add types to the session that are either imported statically or as extension.
        Parameters:
        importer - the description of the imported types.
        Returns:
        a configured session.
      • addToExtensionScope

        IFeatureScopeSession addToExtensionScope​(java.util.Map<XExpression,​LightweightTypeReference> extensionProviders)
        Add receivers to the session that contribute extensions. The expressions in the map will be cloned on demand prior to adding them to the model. They are prototypes.
        Parameters:
        extensionProviders - the expressions that yield extension receivers.
        Returns:
        a configured session.
      • addNestedTypesToScope

        IFeatureScopeSession addNestedTypesToScope​(org.eclipse.xtext.common.types.JvmDeclaredType type)
        Make inherited and declared nested classes of type available by their simple names.
      • getEnclosingTypes

        java.util.List<org.eclipse.xtext.common.types.JvmDeclaredType> getEnclosingTypes()
        Returns a list of enclosing types that provide an instance in the current context. The first element in the list is the innermost type.
      • getNestedTypeDeclarators

        java.util.List<org.eclipse.xtext.common.types.JvmDeclaredType> getNestedTypeDeclarators()
        Returns enclosing types that declare available nested types. The first element in the list is the innermost type.
      • toConstructorContext

        IFeatureScopeSession toConstructorContext()
        Forks this session with a constructor context. References to delegation constructors are only valid within this context.
        See Also:
        isInstanceContext()
      • isInstanceContext

        boolean isInstanceContext()
        Returns true if this can be validly resolved in the current scope.
        See Also:
        toInstanceContext()
      • isConstructorContext

        boolean isConstructorContext()
        Returns true if the current expression is used in a constructor body.
        See Also:
        toConstructorContext()
      • getExtensionProviders

        java.util.List<ExpressionBucket> getExtensionProviders()
        All extension providers as expression buckets.
        Returns:
        the list of extension providers.
      • addLocalElement

        IFeatureScopeSession addLocalElement​(org.eclipse.xtext.naming.QualifiedName name,
                                             org.eclipse.xtext.common.types.JvmIdentifiableElement element,
                                             ITypeReferenceOwner owner)
        Add a locally defined identifiable to this scope. It will shadow previously registered locals. No validation of the given name is performed.
        Parameters:
        name - the qualified name of the identifiable.
        element - the element itself.
        Returns:
        a configured session.
      • addLocalElements

        IFeatureScopeSession addLocalElements​(java.util.Map<org.eclipse.xtext.naming.QualifiedName,​org.eclipse.xtext.common.types.JvmIdentifiableElement> elements,
                                              ITypeReferenceOwner owner)
        Add locally defined identifiables to this scope. Since the elements have unique names, they cannot shadow each other. However, they will shadow previously added local elements.
        Parameters:
        elements - the local elements.
        Returns:
        a configured session.
      • dropLocalElements

        IFeatureScopeSession dropLocalElements()
        Allows to drop certain local elements from the current scope such as the enclosing this for static inner classes.
      • captureLocalElements

        IFeatureScopeSession captureLocalElements()
        Allows to capture the available local elements as if they have been defined on the this type as a member. This will provide a proper scope for non static nested or local classes.
      • getNextCaptureLayer

        IFeatureScopeSession getNextCaptureLayer()
        Returns the next layer of the captured scopes.
      • getLocalElement

        org.eclipse.xtext.resource.IEObjectDescription getLocalElement​(org.eclipse.xtext.naming.QualifiedName name)
        Find a local element with the given qualified name.
        Returns:
        the known element or null.
      • getLocalElements

        java.util.List<org.eclipse.xtext.resource.IEObjectDescription> getLocalElements()
        Return all local elements that are known in this session.
        Returns:
        all local elements. Never null.
      • getStaticallyImportedTypes

        java.util.List<TypeBucket> getStaticallyImportedTypes()
        All statically imported types as type buckets. The list has usually two elements:
        1. The implicitly imported types as a single bucket.
        2. The explicitly imported types as a single bucket.
        Scenarios with more than two buckets are especially nested structures with multiple import sections or ordered imports.
      • getStaticallyImportedExtensionTypes

        java.util.List<TypeBucket> getStaticallyImportedExtensionTypes()
        All statically imported extension types as type buckets. The list has usually two elements:
        1. The implicitly available extensions as a single bucket.
        2. The explicitly imported extensions as a single bucket.
        Scenarios with more than two buckets are especially nested structures with multiple import sections or ordered imports.
      • isVisible

        boolean isVisible​(org.eclipse.xtext.common.types.JvmMember member,
                          LightweightTypeReference receiverType,
                          org.eclipse.xtext.common.types.JvmIdentifiableElement receiverFeature)
        Returns true if the member is visible according to the JvmVisibility and the local context when invoked on the given receiver feature which resolves to the given type.
        Parameters:
        member - the member that shall be accessed.
        receiverType - the type of the receiver. May be unknown.
        receiverFeature - the links the receiver of the feature call to the given member. May be unknown.
        Returns:
        true if the feature can be accessed.