public class XbaseTypeComputer extends AbstractTypeComputer implements ITypeComputer
ITypeComputer. The interface contract
fully applies to this class.
This implementation handles all expression that are defined in Xbase.| Modifier and Type | Class and Description |
|---|---|
protected static class |
XbaseTypeComputer.BranchExpressionProcessor |
| Constructor and Description |
|---|
XbaseTypeComputer() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_computeTypes(XAbstractFeatureCall featureCall,
ITypeComputationState state) |
protected void |
_computeTypes(XAssignment assignment,
ITypeComputationState state) |
protected void |
_computeTypes(XBasicForLoopExpression object,
ITypeComputationState state) |
protected void |
_computeTypes(XBlockExpression object,
ITypeComputationState state) |
protected void |
_computeTypes(XBooleanLiteral object,
ITypeComputationState state) |
protected void |
_computeTypes(XCastedExpression object,
ITypeComputationState state) |
protected void |
_computeTypes(XClosure object,
ITypeComputationState state) |
protected void |
_computeTypes(XConstructorCall constructorCall,
ITypeComputationState state) |
protected void |
_computeTypes(XDoWhileExpression object,
ITypeComputationState state)
Since we are sure that the loop body is executed at least once, the early exit information
of the loop body expression can be used for the outer expression.
|
protected void |
_computeTypes(XForLoopExpression object,
ITypeComputationState state) |
protected void |
_computeTypes(XIfExpression object,
ITypeComputationState state) |
protected void |
_computeTypes(XInstanceOfExpression object,
ITypeComputationState state) |
protected void |
_computeTypes(XListLiteral literal,
ITypeComputationState state) |
protected void |
_computeTypes(XNullLiteral object,
ITypeComputationState state) |
protected void |
_computeTypes(XNumberLiteral object,
ITypeComputationState state) |
protected void |
_computeTypes(XReturnExpression object,
ITypeComputationState state) |
protected void |
_computeTypes(XSetLiteral literal,
ITypeComputationState state) |
protected void |
_computeTypes(XStringLiteral object,
ITypeComputationState state) |
protected void |
_computeTypes(XSwitchExpression object,
ITypeComputationState state) |
protected void |
_computeTypes(XSynchronizedExpression expr,
ITypeComputationState state) |
protected void |
_computeTypes(XThrowExpression object,
ITypeComputationState state) |
protected void |
_computeTypes(XTryCatchFinallyExpression object,
ITypeComputationState state) |
protected void |
_computeTypes(XTypeLiteral object,
ITypeComputationState state) |
protected void |
_computeTypes(XVariableDeclaration object,
ITypeComputationState state) |
protected void |
_computeTypes(XWhileExpression object,
ITypeComputationState state) |
protected void |
addLocalToCurrentScope(XExpression expression,
ITypeComputationState state)
If the expression is a variable declaration, then add it to the current scope;
DSLs introducing new containers for variable declarations should override this method
and explicitly add nested variable declarations.
|
protected void |
addLocalToCurrentScope(XVariableDeclaration localVariable,
ITypeComputationState state) |
protected ITypeComputationState |
assignType(org.eclipse.xtext.common.types.JvmFormalParameter param,
LightweightTypeReference type,
ITypeComputationState state) |
protected void |
checkValidReturn(XReturnExpression object,
ITypeComputationState state) |
protected void |
checkValidReturnExpression(XExpression returnValue,
ITypeComputationState expressionState) |
protected LightweightTypeReference |
computeForLoopParameterType(XForLoopExpression object,
ITypeComputationState state) |
void |
computeTypes(XExpression expression,
ITypeComputationState state)
Compute the type for the given expression in the context of the given computation state.
|
protected ITypeComputationResult |
computeWhileLoopBody(XAbstractWhileExpression object,
ITypeComputationState state,
boolean autocast) |
protected org.eclipse.xtext.common.types.JvmOperation |
findCloseMethod(LightweightTypeReference resourceType) |
protected LightweightTypeReference |
getAndEnhanceIterableOrArrayFromComponent(LightweightTypeReference parameterType,
org.eclipse.xtext.common.types.JvmGenericType iterableType,
CompoundTypeReference compoundResult) |
protected ILinkingCandidate |
getBestCandidate(java.util.List<? extends ILinkingCandidate> candidates) |
protected java.util.List<XCasePart> |
getCases(XSwitchExpression switchExpression)
Only for testing purpose.
|
protected LightweightTypeReference |
getDeclaredParameterType(org.eclipse.xtext.common.types.JvmFormalParameter declaredParam,
ITypeComputationState state) |
protected LightweightTypeReference |
getElementOrComponentType(LightweightTypeReference iterableOrArray,
ITypeReferenceOwner owner)
|
protected XExpression |
getElse(XIfExpression ifExpression)
Only for testing purpose.
|
protected org.eclipse.xtext.common.types.JvmIdentifiableElement |
getRefinableCandidate(XExpression object,
ITypeComputationState state) |
protected ITypeComputationState |
getSwitchExpressionState(XSwitchExpression expr,
ITypeComputationState state) |
protected XExpression |
getThen(XIfExpression ifExpression)
Only for testing purpose.
|
protected boolean |
hasThrowableExpectation(ITypeComputationState state) |
protected boolean |
isRefinableFeature(org.eclipse.xtext.common.types.JvmIdentifiableElement feature) |
protected LightweightTypeReference |
normalizedMultiType(ITypeReferenceOwner referenceOwner,
org.eclipse.xtext.common.types.JvmTypeReference ref) |
protected ITypeComputationState |
reassignCheckedType(XExpression condition,
XExpression guardedExpression,
ITypeComputationState state)
If the condition is a
type check, the checked expression
will be automatically casted in the returned state. |
protected void |
validateUnhandledException(LightweightTypeReference thrownException,
XExpression object,
org.eclipse.emf.ecore.EStructuralFeature feature,
ITypeComputationState state,
java.util.function.Function<? super org.eclipse.xtext.common.types.JvmType,? extends java.lang.String> message)
Checks if the given thrownexcpetion is handled (as in "taken care of by compiler").
|
deferredBindTypeArgument, findDeclaredType, findDeclaredType, findDeclaredType, findDeclaredType, getCommonSuperType, getCommonSuperType, getPrimitiveVoid, getRawTypeForName, getRawTypeForName, getRawTypeForName, getTypeForName, getTypeForNamepublic void computeTypes(XExpression expression, ITypeComputationState state)
ITypeComputercomputeTypes in interface ITypeComputerITypeComputationState.computeTypes(XExpression)protected void _computeTypes(XIfExpression object, ITypeComputationState state)
protected ITypeComputationState reassignCheckedType(XExpression condition, XExpression guardedExpression, ITypeComputationState state)
type check, the checked expression
will be automatically casted in the returned state.protected XExpression getElse(XIfExpression ifExpression)
protected XExpression getThen(XIfExpression ifExpression)
protected LightweightTypeReference normalizedMultiType(ITypeReferenceOwner referenceOwner, org.eclipse.xtext.common.types.JvmTypeReference ref)
protected void _computeTypes(XSwitchExpression object, ITypeComputationState state)
protected ITypeComputationState getSwitchExpressionState(XSwitchExpression expr, ITypeComputationState state)
protected java.util.List<XCasePart> getCases(XSwitchExpression switchExpression)
protected void _computeTypes(XBlockExpression object, ITypeComputationState state)
protected void addLocalToCurrentScope(XExpression expression, ITypeComputationState state)
protected void addLocalToCurrentScope(XVariableDeclaration localVariable, ITypeComputationState state)
protected void _computeTypes(XVariableDeclaration object, ITypeComputationState state)
protected org.eclipse.xtext.common.types.JvmOperation findCloseMethod(LightweightTypeReference resourceType)
protected void _computeTypes(XConstructorCall constructorCall, ITypeComputationState state)
protected void _computeTypes(XBooleanLiteral object, ITypeComputationState state)
object - used for dispatchingprotected void _computeTypes(XNullLiteral object, ITypeComputationState state)
object - used for dispatchingprotected void _computeTypes(XNumberLiteral object, ITypeComputationState state)
protected void _computeTypes(XStringLiteral object, ITypeComputationState state)
object - used for dispatchingprotected void _computeTypes(XListLiteral literal, ITypeComputationState state)
protected void _computeTypes(XSetLiteral literal, ITypeComputationState state)
protected void _computeTypes(XClosure object, ITypeComputationState state)
protected void _computeTypes(XCastedExpression object, ITypeComputationState state)
protected void _computeTypes(XBasicForLoopExpression object, ITypeComputationState state)
protected void _computeTypes(XForLoopExpression object, ITypeComputationState state)
protected ITypeComputationState assignType(org.eclipse.xtext.common.types.JvmFormalParameter param, LightweightTypeReference type, ITypeComputationState state)
protected LightweightTypeReference computeForLoopParameterType(XForLoopExpression object, ITypeComputationState state)
protected LightweightTypeReference getAndEnhanceIterableOrArrayFromComponent(LightweightTypeReference parameterType, org.eclipse.xtext.common.types.JvmGenericType iterableType, CompoundTypeReference compoundResult)
protected LightweightTypeReference getElementOrComponentType(LightweightTypeReference iterableOrArray, ITypeReferenceOwner owner)
ElementOrComponentTypeComputer.compute(LightweightTypeReference, ITypeReferenceOwner).
Clients may override.protected LightweightTypeReference getDeclaredParameterType(org.eclipse.xtext.common.types.JvmFormalParameter declaredParam, ITypeComputationState state)
protected void _computeTypes(XWhileExpression object, ITypeComputationState state)
protected ITypeComputationResult computeWhileLoopBody(XAbstractWhileExpression object, ITypeComputationState state, boolean autocast)
protected void _computeTypes(XDoWhileExpression object, ITypeComputationState state)
protected void _computeTypes(XTypeLiteral object, ITypeComputationState state)
protected void _computeTypes(XInstanceOfExpression object, ITypeComputationState state)
protected void _computeTypes(XThrowExpression object, ITypeComputationState state)
protected void validateUnhandledException(LightweightTypeReference thrownException, XExpression object, org.eclipse.emf.ecore.EStructuralFeature feature, ITypeComputationState state, java.util.function.Function<? super org.eclipse.xtext.common.types.JvmType,? extends java.lang.String> message)
thrownException - the exception to validateobject - the object in which context the exception should be validatedfeature - which causes the exceptionstate - bearing the expected exceptionsmessage - function to specify the exception messageprotected void _computeTypes(XReturnExpression object, ITypeComputationState state)
protected void checkValidReturn(XReturnExpression object, ITypeComputationState state)
protected boolean hasThrowableExpectation(ITypeComputationState state)
protected void checkValidReturnExpression(XExpression returnValue, ITypeComputationState expressionState)
protected void _computeTypes(XTryCatchFinallyExpression object, ITypeComputationState state)
protected void _computeTypes(XSynchronizedExpression expr, ITypeComputationState state)
protected void _computeTypes(XAssignment assignment, ITypeComputationState state)
protected void _computeTypes(XAbstractFeatureCall featureCall, ITypeComputationState state)
protected ILinkingCandidate getBestCandidate(java.util.List<? extends ILinkingCandidate> candidates)
protected org.eclipse.xtext.common.types.JvmIdentifiableElement getRefinableCandidate(XExpression object, ITypeComputationState state)
protected boolean isRefinableFeature(org.eclipse.xtext.common.types.JvmIdentifiableElement feature)