org.eclipse.xtext.xbase.typing
Class XbaseTypeProvider
java.lang.Object
org.eclipse.xtext.xbase.typing.AbstractTypeProvider
org.eclipse.xtext.xbase.typing.XbaseTypeProvider
- All Implemented Interfaces:
- ITypeArgumentContextHelper, ITypeProvider
- Direct Known Subclasses:
- XbaseWithAnnotationsTypeProvider
public class XbaseTypeProvider
- extends AbstractTypeProvider
- implements ITypeArgumentContextHelper
- Author:
- Sven Efftinge, Sebastian Zarnekow
Method Summary |
protected void |
_earlyExits(XAbstractFeatureCall expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
|
protected void |
_earlyExits(XClosure expr,
AbstractTypeProvider.EarlyExitAcceptor a)
|
protected void |
_earlyExits(XConstructorCall expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
|
protected void |
_earlyExits(XReturnExpression expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
|
protected void |
_earlyExits(XThrowExpression expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
|
protected void |
_earlyExits(XTryCatchFinallyExpression expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
|
protected JvmTypeReference |
_expectedType(org.eclipse.emf.ecore.EObject obj,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XAbstractFeatureCall featureCall,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XAbstractWhileExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XAssignment assignment,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XBinaryOperation expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XBlockExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XCasePart expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XCastedExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XCatchClause expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XClosure closure,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XConstructorCall expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XForLoopExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XIfExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XReturnExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XSwitchExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XThrowExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XTryCatchFinallyExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_expectedType(XVariableDeclaration expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference |
_type(XAbstractFeatureCall featureCall,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XAbstractWhileExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XBlockExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XBooleanLiteral object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XCastedExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XClosure object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XConstructorCall constructorCall,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XForLoopExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XIfExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XInstanceOfExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XIntLiteral object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XNullLiteral object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XReturnExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XStringLiteral object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XSwitchExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XThrowExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XTryCatchFinallyExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XTypeLiteral object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_type(XVariableDeclaration object,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
_typeForIdentifiable(JvmConstructor constructor,
boolean rawType)
|
protected JvmTypeReference |
_typeForIdentifiable(JvmField field,
boolean rawType)
|
protected JvmTypeReference |
_typeForIdentifiable(JvmFormalParameter parameter,
boolean rawType)
|
protected JvmTypeReference |
_typeForIdentifiable(JvmGenericType thisOrSuper,
boolean rawType)
|
protected JvmTypeReference |
_typeForIdentifiable(JvmOperation operation,
boolean rawType)
|
protected JvmTypeReference |
_typeForIdentifiable(JvmType type,
boolean rawType)
|
protected JvmTypeReference |
_typeForIdentifiable(XCasePart object,
boolean rawType)
|
protected JvmTypeReference |
_typeForIdentifiable(XSwitchExpression object,
boolean rawType)
|
protected JvmTypeReference |
_typeForIdentifiable(XVariableDeclaration object,
boolean rawType)
|
protected JvmTypeReference |
expectedType(org.eclipse.emf.ecore.EObject container,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
|
protected JvmTypeReference[] |
getArgumentTypes(JvmExecutable executable,
java.util.List<XExpression> actualArguments,
boolean rawType)
|
protected JvmTypeReference[] |
getArgumentTypes(XAbstractFeatureCall expr,
boolean rawType)
|
protected JvmTypeReference |
getCommonType(java.util.List<JvmTypeReference> types)
Returns the common type of the given types. |
JvmTypeReference |
getExpectedReturnType(XExpression expr,
boolean rawType)
Return the expected return type of the given expression. |
protected JvmTypeReference |
getExpectedVarArgType(JvmExecutable feature,
ITypeArgumentContext typeArgumentContext,
boolean rawType,
boolean forceComponentType)
|
protected XExpression |
getExpression(org.eclipse.emf.ecore.EObject object,
org.eclipse.emf.ecore.EReference reference,
int index)
|
protected ITypeArgumentContext |
getFeatureCallTypeArgContext(XAbstractFeatureCall expr,
boolean rawType)
|
protected JvmFormalParameter |
getParam(JvmExecutable executable,
int i)
|
protected JvmTypeReference |
getPrimitiveVoid(XExpression object)
|
protected JvmTypeReference |
getReceiverType(XAbstractFeatureCall expr,
boolean rawType)
|
java.lang.Iterable<JvmTypeReference> |
getThrownExceptionForIdentifiable(JvmIdentifiableElement identifiable)
returns the exception types, declared to be thrown by referencing / executing the passed JvmIdentifiableElement . |
ITypeArgumentContext |
getTypeArgumentContext(XAbstractFeatureCall featureCall,
java.util.List<XExpression> actualArguments,
com.google.inject.Provider<JvmTypeReference> receiverTypeProvider,
JvmIdentifiableElement feature)
|
ITypeArgumentContext |
getTypeArgumentContext(XConstructorCall constructorCall,
JvmConstructor constructor)
|
protected TypesFactory |
getTypesFactory()
|
protected JvmTypeReference |
handleCycleGetExpectedType(XExpression expression,
boolean rawType)
|
protected JvmTypeReference |
handleCycleGetTypeForIdentifiable(JvmIdentifiableElement identifiableElement,
boolean rawType)
|
protected boolean |
isFilteredFromCommonTypesList(JvmTypeReference reference)
|
protected JvmTypeReference |
type(XExpression expression,
JvmTypeReference rawExpectation,
boolean rawType)
|
protected JvmTypeReference |
typeForIdentifiable(JvmIdentifiableElement identifiable,
boolean rawType)
|
Methods inherited from class org.eclipse.xtext.xbase.typing.AbstractTypeProvider |
_earlyExits, _earlyExits, _earlyExits, _type, _typeForIdentifiable, checkIsSingelton, doGetType, getCommonReturnType, getConstructor, getConstructor, getContainingInfo, getDebugIndentation, getExpectedType, getExpectedType, getFeature, getFeature, getLogicalOrRealContainer, getLogicalOrRealContainer, getNearestTypeParameterDeclarator, getThrownExceptionTypes, getType, getType, getType, getTypeArgumentContextProvider, getTypeConformanceComputer, getTypeForIdentifiable, getTypeForIdentifiable, getTypeReferences, handleCyclicGetType, internalCollectEarlyExits, isDeclaratorOf, isResolved, isResolved |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XbaseTypeProvider
public XbaseTypeProvider()
_expectedType
protected JvmTypeReference _expectedType(org.eclipse.emf.ecore.EObject obj,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
- Overrides:
_expectedType
in class AbstractTypeProvider
typeForIdentifiable
protected JvmTypeReference typeForIdentifiable(JvmIdentifiableElement identifiable,
boolean rawType)
- Overrides:
typeForIdentifiable
in class AbstractTypeProvider
type
protected JvmTypeReference type(XExpression expression,
JvmTypeReference rawExpectation,
boolean rawType)
- Overrides:
type
in class AbstractTypeProvider
expectedType
protected JvmTypeReference expectedType(org.eclipse.emf.ecore.EObject container,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
- Overrides:
expectedType
in class AbstractTypeProvider
_expectedType
protected JvmTypeReference _expectedType(XAssignment assignment,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
getExpression
protected XExpression getExpression(org.eclipse.emf.ecore.EObject object,
org.eclipse.emf.ecore.EReference reference,
int index)
_expectedType
protected JvmTypeReference _expectedType(XAbstractFeatureCall featureCall,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XClosure closure,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
handleCycleGetExpectedType
protected JvmTypeReference handleCycleGetExpectedType(XExpression expression,
boolean rawType)
- Overrides:
handleCycleGetExpectedType
in class AbstractTypeProvider
getFeatureCallTypeArgContext
protected ITypeArgumentContext getFeatureCallTypeArgContext(XAbstractFeatureCall expr,
boolean rawType)
getArgumentTypes
protected JvmTypeReference[] getArgumentTypes(XAbstractFeatureCall expr,
boolean rawType)
getArgumentTypes
protected JvmTypeReference[] getArgumentTypes(JvmExecutable executable,
java.util.List<XExpression> actualArguments,
boolean rawType)
getParam
protected JvmFormalParameter getParam(JvmExecutable executable,
int i)
getReceiverType
protected JvmTypeReference getReceiverType(XAbstractFeatureCall expr,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XBinaryOperation expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XVariableDeclaration expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XConstructorCall expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
getExpectedVarArgType
protected JvmTypeReference getExpectedVarArgType(JvmExecutable feature,
ITypeArgumentContext typeArgumentContext,
boolean rawType,
boolean forceComponentType)
_expectedType
protected JvmTypeReference _expectedType(XBlockExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XIfExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XForLoopExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XAbstractWhileExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XTryCatchFinallyExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XCatchClause expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XCastedExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XThrowExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XReturnExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XSwitchExpression expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_expectedType
protected JvmTypeReference _expectedType(XCasePart expr,
org.eclipse.emf.ecore.EReference reference,
int index,
boolean rawType)
_type
protected JvmTypeReference _type(XIfExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
getCommonType
protected JvmTypeReference getCommonType(java.util.List<JvmTypeReference> types)
- Returns the common type of the given types.
Filters
for primitive voids
and unresolved types prior to asking the
TypeConformanceComputer
.
isFilteredFromCommonTypesList
protected boolean isFilteredFromCommonTypesList(JvmTypeReference reference)
_type
protected JvmTypeReference _type(XSwitchExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XBlockExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XVariableDeclaration object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XConstructorCall constructorCall,
JvmTypeReference rawExpectation,
boolean rawType)
getTypeArgumentContext
public ITypeArgumentContext getTypeArgumentContext(XConstructorCall constructorCall,
JvmConstructor constructor)
- Specified by:
getTypeArgumentContext
in interface ITypeArgumentContextHelper
_type
protected JvmTypeReference _type(XBooleanLiteral object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XNullLiteral object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XIntLiteral object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XStringLiteral object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XClosure object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XCastedExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XForLoopExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XAbstractWhileExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XTypeLiteral object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XInstanceOfExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XThrowExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XReturnExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
getPrimitiveVoid
protected JvmTypeReference getPrimitiveVoid(XExpression object)
_type
protected JvmTypeReference _type(XTryCatchFinallyExpression object,
JvmTypeReference rawExpectation,
boolean rawType)
_type
protected JvmTypeReference _type(XAbstractFeatureCall featureCall,
JvmTypeReference rawExpectation,
boolean rawType)
getTypeArgumentContext
public ITypeArgumentContext getTypeArgumentContext(XAbstractFeatureCall featureCall,
java.util.List<XExpression> actualArguments,
com.google.inject.Provider<JvmTypeReference> receiverTypeProvider,
JvmIdentifiableElement feature)
- Specified by:
getTypeArgumentContext
in interface ITypeArgumentContextHelper
_typeForIdentifiable
protected JvmTypeReference _typeForIdentifiable(XSwitchExpression object,
boolean rawType)
_typeForIdentifiable
protected JvmTypeReference _typeForIdentifiable(XCasePart object,
boolean rawType)
_typeForIdentifiable
protected JvmTypeReference _typeForIdentifiable(XVariableDeclaration object,
boolean rawType)
_typeForIdentifiable
protected JvmTypeReference _typeForIdentifiable(JvmFormalParameter parameter,
boolean rawType)
handleCycleGetTypeForIdentifiable
protected JvmTypeReference handleCycleGetTypeForIdentifiable(JvmIdentifiableElement identifiableElement,
boolean rawType)
- Overrides:
handleCycleGetTypeForIdentifiable
in class AbstractTypeProvider
_typeForIdentifiable
protected JvmTypeReference _typeForIdentifiable(JvmGenericType thisOrSuper,
boolean rawType)
_typeForIdentifiable
protected JvmTypeReference _typeForIdentifiable(JvmConstructor constructor,
boolean rawType)
_typeForIdentifiable
protected JvmTypeReference _typeForIdentifiable(JvmField field,
boolean rawType)
_typeForIdentifiable
protected JvmTypeReference _typeForIdentifiable(JvmOperation operation,
boolean rawType)
_typeForIdentifiable
protected JvmTypeReference _typeForIdentifiable(JvmType type,
boolean rawType)
_earlyExits
protected void _earlyExits(XClosure expr,
AbstractTypeProvider.EarlyExitAcceptor a)
_earlyExits
protected void _earlyExits(XReturnExpression expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
_earlyExits
protected void _earlyExits(XThrowExpression expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
_earlyExits
protected void _earlyExits(XConstructorCall expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
_earlyExits
protected void _earlyExits(XAbstractFeatureCall expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
_earlyExits
protected void _earlyExits(XTryCatchFinallyExpression expr,
AbstractTypeProvider.EarlyExitAcceptor acceptor)
getTypesFactory
protected TypesFactory getTypesFactory()
getThrownExceptionForIdentifiable
public java.lang.Iterable<JvmTypeReference> getThrownExceptionForIdentifiable(JvmIdentifiableElement identifiable)
- Description copied from interface:
ITypeProvider
- returns the exception types, declared to be thrown by referencing / executing the passed
JvmIdentifiableElement
.
This includes explicitly declared RuntimeException
s as well.
- Specified by:
getThrownExceptionForIdentifiable
in interface ITypeProvider
- Parameters:
identifiable
- May not be null
.
- Returns:
- the iterable of fully-resolved exception types, if a correct, fully-linkable model is
given.
null
indicates a problem during computation, an empty iterable means no thrown exceptions were found.
getExpectedReturnType
public JvmTypeReference getExpectedReturnType(XExpression expr,
boolean rawType)
- Description copied from interface:
ITypeProvider
- Return the expected return type of the given expression.
- Specified by:
getExpectedReturnType
in interface ITypeProvider
- Parameters:
expr
- the expression. May not be null
.rawType
- true
if the raw type is sufficient.
- Returns:
- the expected return type of the given expression, if a correct, fully-linkable model is given.
Returns
null
if no special return type is expected