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 protectedClosureWithExpectationHelper(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 ITypeComputationStateassignParameters(ITypeAssigner typeAssigner)protected voidcomputeTypes()protected ITypeComputationStategetClosureBodyTypeComputationState(ITypeAssigner typeAssigner)FunctionTypeReferencegetExpectedClosureType()This method is only public for testing purpose.org.eclipse.xtext.common.types.JvmOperationgetOperation()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 FunctionTypeReferenceinitKnownClosureType(org.eclipse.xtext.common.types.JvmType type, org.eclipse.xtext.common.types.JvmOperation operation)protected booleanisImplicitReturn(ITypeComputationResult expressionResult)protected voidmarkCompatibleParameterList()protected voidmarkIncompatible()protected voidmarkIncompatibleParameterList()protected voidmarkRawCompatible()protected voidmarkUncheckedValid()protected voidmarkVoidCompatible()protected voidprepareComputation()protected voidprepareResultType()protected intprocessExpressionType(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:AbstractClosureTypeHelperThis method is only public for testing purpose.- Specified by:
getOperationin classAbstractClosureTypeHelper
-
getExpectedClosureType
public FunctionTypeReference getExpectedClosureType()
Description copied from class:AbstractClosureTypeHelperThis method is only public for testing purpose.- Specified by:
getExpectedClosureTypein classAbstractClosureTypeHelper
-
computeTypes
protected void computeTypes()
- Specified by:
computeTypesin 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:IClosureCandidateReturns the effective list of parameters. This may either be the declared parameter list or the synthetic parameter list.- Specified by:
getParametersin interfaceIClosureCandidate- Specified by:
getParametersin 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)
-
-