Class AbstractLinkingCandidate<Expression extends XExpression>
- java.lang.Object
-
- org.eclipse.xtext.xbase.typesystem.internal.AbstractLinkingCandidate<Expression>
-
- All Implemented Interfaces:
IApplicableCandidate,ILinkingCandidate
- Direct Known Subclasses:
AbstractPendingLinkingCandidate,AbstractResolvedReference
public abstract class AbstractLinkingCandidate<Expression extends XExpression> extends java.lang.Object implements ILinkingCandidate
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAbstractLinkingCandidate.ArgumentTypeComputationStateprotected classAbstractLinkingCandidate.ObservableTypeExpectation
-
Field Summary
Fields Modifier and Type Field Description protected IFeatureCallArgumentsargumentsprotected java.util.List<LightweightTypeReference>typeArguments
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractLinkingCandidate(Expression expression, ITypeExpectation expectation, ExpressionTypeComputationState state)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaccept(AbstractLinkingCandidate.ObservableTypeExpectation expectation, LightweightTypeReference actual)voidapplyToComputationState()Apply this candidate to the current computation state model.protected voidcomputeArgumentType(IFeatureCallArgumentSlot slot)voidcomputeArgumentTypes()protected voidcomputeFixedArityArgumentType(IFeatureCallArgumentSlot slot, TypeParameterSubstitutor<?> substitutor)protected voidcomputeVarArgumentType(IFeatureCallArgumentSlot slot, TypeParameterSubstitutor<?> substitutor)protected TypeParameterSubstitutor<?>createArgumentTypeSubstitutor()protected AbstractLinkingCandidate.ArgumentTypeComputationStatecreateLinkingTypeComputationState(LightweightTypeReference expectedType)protected AbstractLinkingCandidate.ArgumentTypeComputationStatecreateVarArgTypeComputationState(LightweightTypeReference componentType)protected LightweightTypeReferencedeferredBindTypeArgument(ITypeExpectation expectation, LightweightTypeReference type)protected voiddiscardRefinementTypeIfReassigned()protected LightweightTypeReferencegetActualType(org.eclipse.xtext.common.types.JvmIdentifiableElement element, boolean ignoreReassignedTypes)Returns the actual type of the given element.protected LightweightTypeReferencegetActualType(XExpression expression)protected abstract java.util.List<XExpression>getArguments()protected java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument>getDeclaratorParameterMapping()protected LightweightTypeReferencegetDeclaredType(org.eclipse.xtext.common.types.JvmIdentifiableElement feature)protected java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter>getDeclaredTypeParameters()protected LightweightTypeReferencegetExpectedType(XExpression expression)ExpressiongetExpression()The current expression that shall be linked.abstract org.eclipse.xtext.common.types.JvmIdentifiableElementgetFeature()The currently considered feature (if any).protected abstract java.util.List<org.eclipse.xtext.common.types.JvmTypeReference>getPlainSyntacticTypeArguments()protected ExpressionTypeComputationStategetState()protected LightweightTypeReferencegetSubstitutedExpectedType(int argumentIndex)Returns the substituted expected type for the argument atargumentIndex.protected java.util.List<LightweightTypeReference>getSyntacticTypeArguments()java.util.List<LightweightTypeReference>getTypeArguments()The resolved type arguments.protected abstract java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument>getTypeParameterMapping()protected booleanhasReceiver()Returnstrueif the argument at index 0 will be considered as the receiver.protected voidinitializeArgumentTypeComputation()protected voidinitializeConstraintMapping(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter, UnboundTypeParameterPreservingSubstitutor substitutor, UnboundTypeReference typeReference)protected voidinitializeMapping(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter, java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> result)protected java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument>initializeTypeParameterMapping()protected java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument>initializeTypeParameterMapping(java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter> declaredTypeParameters)protected booleanisBoundTypeArgumentSkipped(org.eclipse.xtext.common.types.JvmTypeParameter type, java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> mapping, ITypeReferenceOwner owner)protected booleanisRawTypeContext()booleanisTypeLiteral()protected booleanmustDiscardRefinement()protected voidpreApply()protected voidresolveAgainstActualType(LightweightTypeReference declaredType, LightweightTypeReference actualType, AbstractTypeComputationState state)protected voidresolveArgumentType(XExpression argument, LightweightTypeReference declaredType, ITypeComputationState argumentState)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.xtext.xbase.typesystem.computation.IApplicableCandidate
validate
-
Methods inherited from interface org.eclipse.xtext.xbase.typesystem.computation.ILinkingCandidate
applyToModel, getPreferredCandidate
-
-
-
-
Field Detail
-
typeArguments
protected java.util.List<LightweightTypeReference> typeArguments
-
arguments
protected IFeatureCallArguments arguments
-
-
Constructor Detail
-
AbstractLinkingCandidate
protected AbstractLinkingCandidate(Expression expression, ITypeExpectation expectation, ExpressionTypeComputationState state)
-
-
Method Detail
-
initializeTypeParameterMapping
protected java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> initializeTypeParameterMapping()
-
initializeTypeParameterMapping
protected java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> initializeTypeParameterMapping(java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter> declaredTypeParameters)
-
initializeMapping
protected void initializeMapping(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter, java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> result)
-
initializeConstraintMapping
protected void initializeConstraintMapping(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter, UnboundTypeParameterPreservingSubstitutor substitutor, UnboundTypeReference typeReference)
-
accept
protected void accept(AbstractLinkingCandidate.ObservableTypeExpectation expectation, LightweightTypeReference actual)
-
getTypeArguments
public java.util.List<LightweightTypeReference> getTypeArguments()
Description copied from interface:ILinkingCandidateThe resolved type arguments.- Specified by:
getTypeArgumentsin interfaceILinkingCandidate
-
getTypeParameterMapping
protected abstract java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> getTypeParameterMapping()
-
getDeclaredTypeParameters
protected java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter> getDeclaredTypeParameters()
-
applyToComputationState
public void applyToComputationState()
Description copied from interface:ILinkingCandidateApply this candidate to the current computation state model. This propagates the type information about arguments and child expressions to the currently active resolution state.- Specified by:
applyToComputationStatein interfaceILinkingCandidate
-
preApply
protected void preApply()
-
deferredBindTypeArgument
protected LightweightTypeReference deferredBindTypeArgument(ITypeExpectation expectation, LightweightTypeReference type)
-
computeArgumentTypes
public void computeArgumentTypes()
-
initializeArgumentTypeComputation
protected void initializeArgumentTypeComputation()
-
computeArgumentType
protected void computeArgumentType(IFeatureCallArgumentSlot slot)
-
computeVarArgumentType
protected void computeVarArgumentType(IFeatureCallArgumentSlot slot, TypeParameterSubstitutor<?> substitutor)
-
createArgumentTypeSubstitutor
protected TypeParameterSubstitutor<?> createArgumentTypeSubstitutor()
-
isBoundTypeArgumentSkipped
protected boolean isBoundTypeArgumentSkipped(org.eclipse.xtext.common.types.JvmTypeParameter type, java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> mapping, ITypeReferenceOwner owner)
-
isRawTypeContext
protected boolean isRawTypeContext()
-
computeFixedArityArgumentType
protected void computeFixedArityArgumentType(IFeatureCallArgumentSlot slot, TypeParameterSubstitutor<?> substitutor)
-
createLinkingTypeComputationState
protected AbstractLinkingCandidate.ArgumentTypeComputationState createLinkingTypeComputationState(LightweightTypeReference expectedType)
-
createVarArgTypeComputationState
protected AbstractLinkingCandidate.ArgumentTypeComputationState createVarArgTypeComputationState(LightweightTypeReference componentType)
-
resolveAgainstActualType
protected void resolveAgainstActualType(LightweightTypeReference declaredType, LightweightTypeReference actualType, AbstractTypeComputationState state)
-
getDeclaredType
protected LightweightTypeReference getDeclaredType(org.eclipse.xtext.common.types.JvmIdentifiableElement feature)
-
getDeclaratorParameterMapping
protected java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> getDeclaratorParameterMapping()
-
resolveArgumentType
protected void resolveArgumentType(XExpression argument, LightweightTypeReference declaredType, ITypeComputationState argumentState)
- Parameters:
argument- the expression that should be processed.declaredType- the declared (expected) type for the given expression.argumentState- the to-be-used state to compute the actual type of the argument. It is already configured with the expectation.
-
getArguments
protected abstract java.util.List<XExpression> getArguments()
-
getExpectedType
protected LightweightTypeReference getExpectedType(XExpression expression)
-
getActualType
protected LightweightTypeReference getActualType(org.eclipse.xtext.common.types.JvmIdentifiableElement element, boolean ignoreReassignedTypes)
Returns the actual type of the given element. Does not consider reassigned types.
-
getActualType
protected LightweightTypeReference getActualType(XExpression expression)
-
getSubstitutedExpectedType
protected LightweightTypeReference getSubstitutedExpectedType(int argumentIndex)
Returns the substituted expected type for the argument atargumentIndex. If the expected type is an unbound type parameter, a reference to the type parameter itself is returned.
-
getSyntacticTypeArguments
protected java.util.List<LightweightTypeReference> getSyntacticTypeArguments()
-
getPlainSyntacticTypeArguments
protected abstract java.util.List<org.eclipse.xtext.common.types.JvmTypeReference> getPlainSyntacticTypeArguments()
-
getFeature
public abstract org.eclipse.xtext.common.types.JvmIdentifiableElement getFeature()
Description copied from interface:ILinkingCandidateThe currently considered feature (if any). Otherwisenull.- Specified by:
getFeaturein interfaceILinkingCandidate
-
getExpression
public Expression getExpression()
Description copied from interface:ILinkingCandidateThe current expression that shall be linked.- Specified by:
getExpressionin interfaceILinkingCandidate
-
hasReceiver
protected boolean hasReceiver()
Returnstrueif the argument at index 0 will be considered as the receiver.
-
isTypeLiteral
public boolean isTypeLiteral()
-
getState
protected ExpressionTypeComputationState getState()
-
mustDiscardRefinement
protected boolean mustDiscardRefinement()
-
discardRefinementTypeIfReassigned
protected void discardRefinementTypeIfReassigned()
-
-