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 class
AbstractLinkingCandidate.ArgumentTypeComputationState
protected class
AbstractLinkingCandidate.ObservableTypeExpectation
-
Field Summary
Fields Modifier and Type Field Description protected IFeatureCallArguments
arguments
protected java.util.List<LightweightTypeReference>
typeArguments
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractLinkingCandidate(Expression expression, ITypeExpectation expectation, ExpressionTypeComputationState state)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
accept(AbstractLinkingCandidate.ObservableTypeExpectation expectation, LightweightTypeReference actual)
void
applyToComputationState()
Apply this candidate to the current computation state model.protected void
computeArgumentType(IFeatureCallArgumentSlot slot)
void
computeArgumentTypes()
protected void
computeFixedArityArgumentType(IFeatureCallArgumentSlot slot, TypeParameterSubstitutor<?> substitutor)
protected void
computeVarArgumentType(IFeatureCallArgumentSlot slot, TypeParameterSubstitutor<?> substitutor)
protected TypeParameterSubstitutor<?>
createArgumentTypeSubstitutor()
protected AbstractLinkingCandidate.ArgumentTypeComputationState
createLinkingTypeComputationState(LightweightTypeReference expectedType)
protected AbstractLinkingCandidate.ArgumentTypeComputationState
createVarArgTypeComputationState(LightweightTypeReference componentType)
protected LightweightTypeReference
deferredBindTypeArgument(ITypeExpectation expectation, LightweightTypeReference type)
protected void
discardRefinementTypeIfReassigned()
protected LightweightTypeReference
getActualType(org.eclipse.xtext.common.types.JvmIdentifiableElement element, boolean ignoreReassignedTypes)
Returns the actual type of the given element.protected LightweightTypeReference
getActualType(XExpression expression)
protected abstract java.util.List<XExpression>
getArguments()
protected java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument>
getDeclaratorParameterMapping()
protected LightweightTypeReference
getDeclaredType(org.eclipse.xtext.common.types.JvmIdentifiableElement feature)
protected java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter>
getDeclaredTypeParameters()
protected LightweightTypeReference
getExpectedType(XExpression expression)
Expression
getExpression()
The current expression that shall be linked.abstract org.eclipse.xtext.common.types.JvmIdentifiableElement
getFeature()
The currently considered feature (if any).protected abstract java.util.List<org.eclipse.xtext.common.types.JvmTypeReference>
getPlainSyntacticTypeArguments()
protected ExpressionTypeComputationState
getState()
protected LightweightTypeReference
getSubstitutedExpectedType(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 boolean
hasReceiver()
Returnstrue
if the argument at index 0 will be considered as the receiver.protected void
initializeArgumentTypeComputation()
protected void
initializeConstraintMapping(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter, UnboundTypeParameterPreservingSubstitutor substitutor, UnboundTypeReference typeReference)
protected void
initializeMapping(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 boolean
isBoundTypeArgumentSkipped(org.eclipse.xtext.common.types.JvmTypeParameter type, java.util.Map<org.eclipse.xtext.common.types.JvmTypeParameter,LightweightMergedBoundTypeArgument> mapping, ITypeReferenceOwner owner)
protected boolean
isRawTypeContext()
boolean
isTypeLiteral()
protected boolean
mustDiscardRefinement()
protected void
preApply()
protected void
resolveAgainstActualType(LightweightTypeReference declaredType, LightweightTypeReference actualType, AbstractTypeComputationState state)
protected void
resolveArgumentType(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:ILinkingCandidate
The resolved type arguments.- Specified by:
getTypeArguments
in 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:ILinkingCandidate
Apply 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:
applyToComputationState
in 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:ILinkingCandidate
The currently considered feature (if any). Otherwisenull
.- Specified by:
getFeature
in interfaceILinkingCandidate
-
getExpression
public Expression getExpression()
Description copied from interface:ILinkingCandidate
The current expression that shall be linked.- Specified by:
getExpression
in interfaceILinkingCandidate
-
hasReceiver
protected boolean hasReceiver()
Returnstrue
if 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()
-
-