org.eclipse.xtext.xbase.scoping
Class XbaseScopeProvider
java.lang.Object
org.eclipse.xtext.scoping.impl.AbstractScopeProvider
org.eclipse.xtext.xbase.scoping.XtypeScopeProvider
org.eclipse.xtext.xbase.scoping.XbaseScopeProvider
- All Implemented Interfaces:
- IScopeProvider
- Direct Known Subclasses:
- PureXbaseScopeProvider, XbaseWithAnnotationsScopeProvider
public class XbaseScopeProvider
- extends XtypeScopeProvider
- Author:
- Sven Efftinge - Initial contribution and API
Method Summary |
protected IScope |
createConstructorCallScope(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference reference)
|
protected IScope |
createFeatureCallScope(XAbstractFeatureCall call,
org.eclipse.emf.ecore.EReference reference)
creates the feature scope for XAbstractFeatureCall , including the local variables in case it is a feature
call without receiver (XFeatureCall). |
IScope |
createFeatureCallScopeForReceiver(XExpression context,
XExpression receiver,
org.eclipse.emf.ecore.EReference reference)
This method serves as an entry point for the content assist scoping for features. |
protected JvmFeatureScope |
createFeatureScopeForTypeRef(JvmTypeReference receiverType,
org.eclipse.emf.ecore.EObject expression,
JvmDeclaredType currentContext,
XExpression implicitReceiver,
IScope parent)
|
protected IScope |
createImplicitFeatureCallScope(org.eclipse.emf.ecore.EObject call,
IScope localVariableScope)
override to add any other implicit feature calls. |
protected IScope |
createLocalScopeForParameter(JvmFormalParameter p,
IScope parentScope)
|
protected IValidatedEObjectDescription |
createLocalVarDescription(JvmFormalParameter p)
|
protected IValidatedEObjectDescription |
createLocalVarDescription(XVariableDeclaration varDecl)
|
protected LocalVariableScopeContext |
createLocalVariableScopeContext(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference reference,
boolean includeCurrentBlock,
int idx)
|
protected IScope |
createLocalVarScope(IScope parentScope,
LocalVariableScopeContext scopeContext)
|
protected IScope |
createLocalVarScopeForBlock(XBlockExpression block,
int indexOfContextExpressionInBlock,
boolean referredFromClosure,
IScope parentScope)
|
protected IScope |
createLocalVarScopeForCatchClause(XCatchClause catchClause,
int indexOfContextExpressionInBlock,
IScope parentScope)
|
protected IScope |
createLocalVarScopeForClosure(XClosure closure,
IScope parentScope)
|
protected IScope |
createLocalVarScopeForSwitchExpression(XSwitchExpression context,
IScope parentScope)
|
protected IScope |
createLocalVarScopeForTypeGuardedCase(XCasePart context,
IScope parentScope)
|
IScope |
createSimpleFeatureCallScope(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference reference,
org.eclipse.emf.ecore.resource.Resource resource,
boolean includeCurrentBlock,
int idx)
This method serves as an entry point for the content assist scoping for simple feature calls. |
protected IScope |
createStaticScope(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.resource.Resource resource,
IScope parent)
|
protected JvmDeclaredType |
getContextType(org.eclipse.emf.ecore.EObject call)
|
protected java.util.List<IJvmFeatureDescriptionProvider> |
getFeatureDescriptionProviders(JvmTypeReference type,
org.eclipse.emf.ecore.EObject expression,
JvmDeclaredType currentContext,
XExpression implicitReceiver)
|
protected java.util.List<IJvmFeatureDescriptionProvider> |
getFeatureDescriptionProvidersForAssignment(JvmTypeReference type,
XAssignment expression,
JvmDeclaredType currentContext,
XExpression implicitReceiver)
|
IScope |
getScope(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference reference)
Returns a scope for the given context. |
protected java.util.List<IJvmFeatureDescriptionProvider> |
getStaticFeatureDescriptionProviders(org.eclipse.emf.ecore.resource.Resource context,
JvmDeclaredType contextType)
|
protected XExpression |
getSyntacticalReceiver(XAbstractFeatureCall call)
|
protected ITypeProvider |
getTypeProvider()
|
protected boolean |
isConstructorCallScope(org.eclipse.emf.ecore.EReference reference)
|
boolean |
isFeatureCallScope(org.eclipse.emf.ecore.EReference reference)
|
protected DefaultJvmFeatureDescriptionProvider |
newDefaultFeatureDescProvider()
|
protected StaticMethodsFeatureForTypeProvider |
newImplicitStaticFeaturesProvider()
|
protected XFeatureCallSugarDescriptionProvider |
newSugarDescriptionProvider()
|
void |
setDefaultFeatureDescProvider(com.google.inject.Provider<DefaultJvmFeatureDescriptionProvider> defaultFeatureDescProvider)
|
void |
setFeatureNameProvider(IdentifiableSimpleNameProvider featureNameProvider)
|
void |
setSugarFeatureDescProvider(com.google.inject.Provider<XFeatureCallSugarDescriptionProvider> sugarFeatureDescProvider)
|
void |
setTypeProvider(ITypeProvider typeProvider)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
THIS
public static final QualifiedName THIS
jvmFeatureScopeProvider
@Inject
protected JvmFeatureScopeProvider jvmFeatureScopeProvider
XbaseScopeProvider
public XbaseScopeProvider()
setFeatureNameProvider
public void setFeatureNameProvider(IdentifiableSimpleNameProvider featureNameProvider)
setTypeProvider
public void setTypeProvider(ITypeProvider typeProvider)
getTypeProvider
protected ITypeProvider getTypeProvider()
setSugarFeatureDescProvider
public void setSugarFeatureDescProvider(com.google.inject.Provider<XFeatureCallSugarDescriptionProvider> sugarFeatureDescProvider)
setDefaultFeatureDescProvider
public void setDefaultFeatureDescProvider(com.google.inject.Provider<DefaultJvmFeatureDescriptionProvider> defaultFeatureDescProvider)
getScope
public IScope getScope(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference reference)
- Description copied from interface:
IScopeProvider
- Returns a scope for the given context. The scope provides access to the compatible
visible EObjects for a given reference.
- Specified by:
getScope
in interface IScopeProvider
- Overrides:
getScope
in class XtypeScopeProvider
- Parameters:
context
- the element from which an element shall be referenced. It doesn't need to be the element
containing the reference, it is just used to find the most inner scope for given EReference
.reference
- the reference for which to get the scope.
- Returns:
IScope
representing the inner most IScope
for the
passed context and reference. Note for implementors: The result may not be null
.
Return IScope.NULLSCOPE
instead.
createConstructorCallScope
protected IScope createConstructorCallScope(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference reference)
isConstructorCallScope
protected boolean isConstructorCallScope(org.eclipse.emf.ecore.EReference reference)
isFeatureCallScope
public boolean isFeatureCallScope(org.eclipse.emf.ecore.EReference reference)
createFeatureCallScope
protected IScope createFeatureCallScope(XAbstractFeatureCall call,
org.eclipse.emf.ecore.EReference reference)
- creates the feature scope for
XAbstractFeatureCall
, including the local variables in case it is a feature
call without receiver (XFeatureCall).
createSimpleFeatureCallScope
public IScope createSimpleFeatureCallScope(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference reference,
org.eclipse.emf.ecore.resource.Resource resource,
boolean includeCurrentBlock,
int idx)
- This method serves as an entry point for the content assist scoping for simple feature calls.
- Parameters:
context
- the context e.g. a for loop expression, a block or a catch clausereference
- the reference who's value shall be scoped. Not necessarily a feature of the context.includeCurrentBlock
- false
in the context of scoping but content assist will not have the
actual value holder of the reference at hand so it passes its container to this method and expects the
declared variables to be exposed in the scope.idx
- the index in an expression list of a block. Otherwise to be ignored.
createLocalVariableScopeContext
protected LocalVariableScopeContext createLocalVariableScopeContext(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference reference,
boolean includeCurrentBlock,
int idx)
createStaticScope
protected IScope createStaticScope(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.resource.Resource resource,
IScope parent)
createFeatureCallScopeForReceiver
public IScope createFeatureCallScopeForReceiver(XExpression context,
XExpression receiver,
org.eclipse.emf.ecore.EReference reference)
- This method serves as an entry point for the content assist scoping for features.
- Parameters:
context
- the context provides access to the resource set. If it is an assignment, it
will be used to restrict scoping.receiver
- the receiver of the feature call.
getSyntacticalReceiver
protected XExpression getSyntacticalReceiver(XAbstractFeatureCall call)
createImplicitFeatureCallScope
protected IScope createImplicitFeatureCallScope(org.eclipse.emf.ecore.EObject call,
IScope localVariableScope)
- override to add any other implicit feature calls.
getContextType
protected JvmDeclaredType getContextType(org.eclipse.emf.ecore.EObject call)
createLocalVarScope
protected IScope createLocalVarScope(IScope parentScope,
LocalVariableScopeContext scopeContext)
createLocalVarScopeForSwitchExpression
protected IScope createLocalVarScopeForSwitchExpression(XSwitchExpression context,
IScope parentScope)
createLocalVarScopeForTypeGuardedCase
protected IScope createLocalVarScopeForTypeGuardedCase(XCasePart context,
IScope parentScope)
createLocalVarScopeForCatchClause
protected IScope createLocalVarScopeForCatchClause(XCatchClause catchClause,
int indexOfContextExpressionInBlock,
IScope parentScope)
createLocalVarScopeForBlock
protected IScope createLocalVarScopeForBlock(XBlockExpression block,
int indexOfContextExpressionInBlock,
boolean referredFromClosure,
IScope parentScope)
createLocalVarScopeForClosure
protected IScope createLocalVarScopeForClosure(XClosure closure,
IScope parentScope)
createFeatureScopeForTypeRef
protected JvmFeatureScope createFeatureScopeForTypeRef(JvmTypeReference receiverType,
org.eclipse.emf.ecore.EObject expression,
JvmDeclaredType currentContext,
XExpression implicitReceiver,
IScope parent)
getStaticFeatureDescriptionProviders
protected java.util.List<IJvmFeatureDescriptionProvider> getStaticFeatureDescriptionProviders(org.eclipse.emf.ecore.resource.Resource context,
JvmDeclaredType contextType)
getFeatureDescriptionProviders
protected java.util.List<IJvmFeatureDescriptionProvider> getFeatureDescriptionProviders(JvmTypeReference type,
org.eclipse.emf.ecore.EObject expression,
JvmDeclaredType currentContext,
XExpression implicitReceiver)
newImplicitStaticFeaturesProvider
protected StaticMethodsFeatureForTypeProvider newImplicitStaticFeaturesProvider()
getFeatureDescriptionProvidersForAssignment
protected java.util.List<IJvmFeatureDescriptionProvider> getFeatureDescriptionProvidersForAssignment(JvmTypeReference type,
XAssignment expression,
JvmDeclaredType currentContext,
XExpression implicitReceiver)
createLocalScopeForParameter
protected IScope createLocalScopeForParameter(JvmFormalParameter p,
IScope parentScope)
createLocalVarDescription
protected IValidatedEObjectDescription createLocalVarDescription(JvmFormalParameter p)
createLocalVarDescription
protected IValidatedEObjectDescription createLocalVarDescription(XVariableDeclaration varDecl)
newDefaultFeatureDescProvider
protected DefaultJvmFeatureDescriptionProvider newDefaultFeatureDescProvider()
newSugarDescriptionProvider
protected XFeatureCallSugarDescriptionProvider newSugarDescriptionProvider()