Class ClosureWithExpectationHelper
- java.lang.Object
-
- org.eclipse.xtext.xbase.typesystem.computation.AbstractClosureTypeHelper
-
- org.eclipse.xtext.xbase.typesystem.computation.ClosureWithExpectationHelper
-
- All Implemented Interfaces:
IApplicableCandidate
,IClosureCandidate
public class ClosureWithExpectationHelper extends AbstractClosureTypeHelper
Strategy to compute types for lambda expression that do have an expected type.- See Also:
ClosureWithoutExpectationHelper
- Noinstantiate:
- This class is not intended to be instantiated by clients.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClosureWithExpectationHelper(XClosure closure, org.eclipse.xtext.common.types.JvmOperation operation, ITypeExpectation expectation, ITypeComputationState state)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ITypeComputationState
assignParameters(ITypeAssigner typeAssigner)
protected void
computeTypes()
protected ITypeComputationState
getClosureBodyTypeComputationState(ITypeAssigner typeAssigner)
FunctionTypeReference
getExpectedClosureType()
This method is only public for testing purpose.org.eclipse.xtext.common.types.JvmOperation
getOperation()
This method is only public for testing purpose.java.util.List<org.eclipse.xtext.common.types.JvmFormalParameter>
getParameters()
Returns the effective list of parameters.protected FunctionTypeReference
initKnownClosureType(org.eclipse.xtext.common.types.JvmType type, org.eclipse.xtext.common.types.JvmOperation operation)
protected boolean
isImplicitReturn(ITypeComputationResult expressionResult)
protected void
markCompatibleParameterList()
protected void
markIncompatible()
protected void
markIncompatibleParameterList()
protected void
markRawCompatible()
protected void
markUncheckedValid()
protected void
markVoidCompatible()
protected void
prepareComputation()
protected void
prepareResultType()
protected int
processExpressionType(ITypeComputationResult expressionResult)
Returns an indicator how compatible the expression type result is to the expected type.-
Methods inherited from class org.eclipse.xtext.xbase.typesystem.computation.AbstractClosureTypeHelper
applyToModel, deferredBindTypeArgument, getClosure, getExpectation, getServices, getState, validate
-
-
-
-
Constructor Detail
-
ClosureWithExpectationHelper
protected ClosureWithExpectationHelper(XClosure closure, org.eclipse.xtext.common.types.JvmOperation operation, ITypeExpectation expectation, ITypeComputationState state)
-
-
Method Detail
-
getOperation
public org.eclipse.xtext.common.types.JvmOperation getOperation()
Description copied from class:AbstractClosureTypeHelper
This method is only public for testing purpose.- Specified by:
getOperation
in classAbstractClosureTypeHelper
-
getExpectedClosureType
public FunctionTypeReference getExpectedClosureType()
Description copied from class:AbstractClosureTypeHelper
This method is only public for testing purpose.- Specified by:
getExpectedClosureType
in classAbstractClosureTypeHelper
-
computeTypes
protected void computeTypes()
- Specified by:
computeTypes
in classAbstractClosureTypeHelper
-
markUncheckedValid
protected void markUncheckedValid()
-
markIncompatibleParameterList
protected void markIncompatibleParameterList()
-
markCompatibleParameterList
protected void markCompatibleParameterList()
-
markIncompatible
protected void markIncompatible()
-
markRawCompatible
protected void markRawCompatible()
-
markVoidCompatible
protected void markVoidCompatible()
-
prepareComputation
protected void prepareComputation()
- Noreference:
- This method is not intended to be referenced by clients.
-
prepareResultType
protected void prepareResultType()
-
initKnownClosureType
protected FunctionTypeReference initKnownClosureType(org.eclipse.xtext.common.types.JvmType type, org.eclipse.xtext.common.types.JvmOperation operation)
-
getClosureBodyTypeComputationState
protected ITypeComputationState getClosureBodyTypeComputationState(ITypeAssigner typeAssigner)
-
getParameters
public java.util.List<org.eclipse.xtext.common.types.JvmFormalParameter> getParameters()
Description copied from interface:IClosureCandidate
Returns the effective list of parameters. This may either be the declared parameter list or the synthetic parameter list.- Specified by:
getParameters
in interfaceIClosureCandidate
- Specified by:
getParameters
in classAbstractClosureTypeHelper
-
assignParameters
protected ITypeComputationState assignParameters(ITypeAssigner typeAssigner)
-
processExpressionType
protected int processExpressionType(ITypeComputationResult expressionResult)
Returns an indicator how compatible the expression type result is to the expected type. Either
-
isImplicitReturn
protected boolean isImplicitReturn(ITypeComputationResult expressionResult)
-
-