Interface IFeatureScopeSession
-
- All Superinterfaces:
IVisibilityHelper
- All Known Implementing Classes:
AbstractFeatureScopeSession,AbstractNestedFeatureScopeSession,ConstructorFeatureScopeSession,FeatureScopeSessionWithCapturedLocalElements,FeatureScopeSessionWithContext,FeatureScopeSessionWithDynamicExtensions,FeatureScopeSessionWithLocalElements,FeatureScopeSessionWithNamedStaticTypes,FeatureScopeSessionWithNestedTypes,FeatureScopeSessionWithoutLocalElements,FeatureScopeSessionWithStaticTypes,InstanceFeatureScopeSession,RootFeatureScopeSession
public interface IFeatureScopeSession extends IVisibilityHelper
A feature scope session allows to successively enhance the reachable features by adding local variables, parameters from the context or the list of imports. Afterwards it's possible to ask for anIScopeby means ofgetScope(EObject, EReference, IResolvedTypes).
-
-
Field Summary
-
Fields inherited from interface org.eclipse.xtext.xbase.typesystem.util.IVisibilityHelper
ALL
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IFeatureScopeSessionaddImports(ITypeImporter.Client importer)Add types to the session that are either imported statically or as extension.IFeatureScopeSessionaddLocalElement(org.eclipse.xtext.naming.QualifiedName name, org.eclipse.xtext.common.types.JvmIdentifiableElement element, ITypeReferenceOwner owner)Add a locally defined identifiable to this scope.IFeatureScopeSessionaddLocalElements(java.util.Map<org.eclipse.xtext.naming.QualifiedName,org.eclipse.xtext.common.types.JvmIdentifiableElement> elements, ITypeReferenceOwner owner)Add locally defined identifiables to this scope.IFeatureScopeSessionaddNestedTypesToScope(org.eclipse.xtext.common.types.JvmDeclaredType type)Make inherited and declared nested classes oftypeavailable by their simple names.IFeatureScopeSessionaddToExtensionScope(java.util.Map<XExpression,LightweightTypeReference> extensionProviders)Add receivers to the session that contribute extensions.IFeatureScopeSessionaddTypesToStaticScope(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.IFeatureScopeSessioncaptureLocalElements()Allows to capture the available local elements as if they have been defined on thethistype as a member.IFeatureScopeSessiondropLocalElements()Allows to drop certain local elements from the current scope such as the enclosingthisfor static inner classes.java.util.List<org.eclipse.xtext.common.types.JvmDeclaredType>getEnclosingTypes()Returns a list of enclosing types that provide an instance in the current context.java.util.List<ExpressionBucket>getExtensionProviders()All extension providers as expression buckets.org.eclipse.xtext.resource.IEObjectDescriptiongetLocalElement(org.eclipse.xtext.naming.QualifiedName name)Find a local element with the given qualified name.java.util.List<org.eclipse.xtext.resource.IEObjectDescription>getLocalElements()Return all local elements that are known in this session.java.util.List<org.eclipse.xtext.common.types.JvmDeclaredType>getNestedTypeDeclarators()Returns enclosing types that declare available nested types.IFeatureScopeSessiongetNextCaptureLayer()Returns the next layer of the captured scopes.org.eclipse.xtext.scoping.IScopegetScope(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference, IResolvedTypes types)Return the scope for the givencontextandreferencebased on the known resolvedtypes.java.util.List<TypeBucket>getStaticallyImportedExtensionTypes()All statically imported extension types as type buckets.java.util.List<TypeBucket>getStaticallyImportedTypes()All statically imported types as type buckets.booleanisConstructorContext()Returnstrueif the current expression is used in a constructor body.booleanisInstanceContext()Returnstrueifthiscan be validly resolved in the current scope.booleanisVisible(org.eclipse.xtext.common.types.JvmMember member, LightweightTypeReference receiverType, org.eclipse.xtext.common.types.JvmIdentifiableElement receiverFeature)Returnstrueif the member is visible according to theJvmVisibilityand the local context when invoked on the given receiver feature which resolves to the given type.IFeatureScopeSessiontoConstructorContext()Forks this session with a constructor context.IFeatureScopeSessiontoInstanceContext()Forks this session with an instance context.-
Methods inherited from interface org.eclipse.xtext.xbase.typesystem.util.IVisibilityHelper
isVisible
-
-
-
-
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 givencontextandreferencebased on the known resolvedtypes.- Parameters:
context- the context object. May not benull.reference- the reference that holds the unresolved proxy. May not benull.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 benull.staticExtensionProviders- the static extension providers. May not benull.- 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 oftypeavailable 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.
-
toInstanceContext
IFeatureScopeSession toInstanceContext()
Forks this session with an instance context. References to 'this' are only valid in instance contexts.- See Also:
isInstanceContext()
-
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()
Returnstrueifthiscan be validly resolved in the current scope.- See Also:
toInstanceContext()
-
isConstructorContext
boolean isConstructorContext()
Returnstrueif 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 enclosingthisfor static inner classes.
-
captureLocalElements
IFeatureScopeSession captureLocalElements()
Allows to capture the available local elements as if they have been defined on thethistype 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:- The implicitly imported types as a single bucket.
- The explicitly imported types as a single bucket.
-
getStaticallyImportedExtensionTypes
java.util.List<TypeBucket> getStaticallyImportedExtensionTypes()
All statically imported extension types as type buckets. The list has usually two elements:- The implicitly available extensions as a single bucket.
- The explicitly imported extensions as a single bucket.
-
isVisible
boolean isVisible(org.eclipse.xtext.common.types.JvmMember member, LightweightTypeReference receiverType, org.eclipse.xtext.common.types.JvmIdentifiableElement receiverFeature)Returnstrueif the member is visible according to theJvmVisibilityand 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:
trueif the feature can be accessed.
-
-