Interface IResolvedTypes
-
- All Known Implementing Classes:
CachingBatchTypeResolver.LazyResolvedTypes,CapturedLocalElementsAwareStackedResolvedTypes,CompoundReentrantTypeResolver,EmptyResolvedTypes,ExpectedExceptionsStackedResolvedTypes,ExpressionAwareStackedResolvedTypes,ForwardingResolvedTypes,IResolvedTypes.NullResolvedTypes,ReassigningStackedResolvedTypes,ResolvedTypes,RootResolvedTypes,StackedResolvedTypes
public interface IResolvedTypesResolved types represent the result of the type resolution. They offer a means to query for actual types, expectations, the type arguments for a feature call or the diagnostics that were produced during the type resolution. TODO JavaDoc - better describe actual type, return type and expected types.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classIResolvedTypes.NullResolvedTypes
-
Field Summary
Fields Modifier and Type Field Description static IResolvedTypesNULL
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description LightweightTypeReferencegetActualType(org.eclipse.xtext.common.types.JvmIdentifiableElement identifiable)Returns the actually inferred or declared type for the given identifiable ornullif none.LightweightTypeReferencegetActualType(XExpression expression)Returns the actually inferred type for the given expression ornullif none.java.util.List<LightweightTypeReference>getActualTypeArguments(XExpression expression)Returns the resolved type arguments.java.util.Collection<IAmbiguousLinkingCandidate>getAmbiguousLinkingCandidates()Returns all ambiguous linking candidates that have been encountered.LightweightTypeReferencegetExpectedReturnType(XExpression expression)Returns the expected return type for the given expression ornullif none.LightweightTypeReferencegetExpectedType(XExpression expression)Returns the actually expected type for the given expression ornullif none.IExpressionScopegetExpressionScope(org.eclipse.emf.ecore.EObject context, IExpressionScope.Anchor anchor)Returns the scope the given expression is contained in.java.util.Collection<ILinkingCandidate>getFollowUpErrors()Returns the linking candidates that could not be resolved but are not exposed to the users because they are follow up errors.org.eclipse.xtext.common.types.JvmIdentifiableElementgetLinkedFeature(XAbstractFeatureCall featureCall)Returns the intermediate linking result for the given feature call, if any.org.eclipse.xtext.common.types.JvmIdentifiableElementgetLinkedFeature(XConstructorCall constructorCall)Returns the intermediate linking result for the given constructor call, if any.IFeatureLinkingCandidategetLinkingCandidate(XAbstractFeatureCall featureCall)Returns the intermediate linking candidate for the given feature call, if any.IConstructorLinkingCandidategetLinkingCandidate(XConstructorCall constructorCall)Returns the intermediate linking candidate for the given constructor call, if any.java.util.Collection<org.eclipse.xtext.diagnostics.AbstractDiagnostic>getQueuedDiagnostics()Provides access to all diagnostics that have been added during the type computation so far.LightweightTypeReferencegetReturnType(XExpression expression)Returns the actually inferred return type for the given expression ornullif none.LightweightTypeReferencegetReturnType(XExpression expression, boolean onlyExplicitReturns)Returns the actually inferred return type for the given expression ornullif none.java.util.List<LightweightTypeReference>getThrownExceptions(XExpression obj)booleanhasExpressionScope(org.eclipse.emf.ecore.EObject context, IExpressionScope.Anchor anchor)booleanisRefinedType(XExpression expression)Returnstrueif the expression's type is based on a type refinement, e.g.booleanisVoidTypeAllowed(XExpression expression)Returnstrueif the given expression may have the typevoid.
-
-
-
Field Detail
-
NULL
static final IResolvedTypes NULL
-
-
Method Detail
-
getQueuedDiagnostics
java.util.Collection<org.eclipse.xtext.diagnostics.AbstractDiagnostic> getQueuedDiagnostics()
Provides access to all diagnostics that have been added during the type computation so far.
-
getFollowUpErrors
java.util.Collection<ILinkingCandidate> getFollowUpErrors()
Returns the linking candidates that could not be resolved but are not exposed to the users because they are follow up errors.
-
getAmbiguousLinkingCandidates
java.util.Collection<IAmbiguousLinkingCandidate> getAmbiguousLinkingCandidates()
Returns all ambiguous linking candidates that have been encountered.
-
getActualType
LightweightTypeReference getActualType(XExpression expression)
Returns the actually inferred type for the given expression ornullif none.- Parameters:
expression- expression whose type is queried.
-
getReturnType
LightweightTypeReference getReturnType(XExpression expression)
Returns the actually inferred return type for the given expression ornullif none. Returns the actual expression type, if no explicit return type exists. Shorthand forgetReturnType(expression, false)- Parameters:
expression- expression whose return type is queried.
-
getReturnType
LightweightTypeReference getReturnType(XExpression expression, boolean onlyExplicitReturns)
Returns the actually inferred return type for the given expression ornullif none.- Parameters:
expression- expression whose return type is queried.
-
getActualType
LightweightTypeReference getActualType(org.eclipse.xtext.common.types.JvmIdentifiableElement identifiable)
Returns the actually inferred or declared type for the given identifiable ornullif none.- Parameters:
identifiable- identifiable whose type is queried.
-
getThrownExceptions
java.util.List<LightweightTypeReference> getThrownExceptions(XExpression obj)
-
getExpectedType
LightweightTypeReference getExpectedType(XExpression expression)
Returns the actually expected type for the given expression ornullif none.- Parameters:
expression- expression whose expected type is queried.
-
isVoidTypeAllowed
boolean isVoidTypeAllowed(XExpression expression)
Returnstrueif the given expression may have the typevoid.- Parameters:
expression- expression whose expected type is queried.
-
getExpectedReturnType
LightweightTypeReference getExpectedReturnType(XExpression expression)
Returns the expected return type for the given expression ornullif none.- Parameters:
expression- expression whose expected return type is queried.
-
getActualTypeArguments
java.util.List<LightweightTypeReference> getActualTypeArguments(XExpression expression)
Returns the resolved type arguments. If the expression refers to a constructor and the constructor itself defines type parameters, their resolved representation is prepended to the list of type arguments. Consider the following type:class C<T, V> { public <PLgt; C(P p) {} }An invocation of the constructorCwill return three type arguments, the bound values of forP,TandV.- Parameters:
expression- may either be anXAbstractFeatureCallorXConstructorCall. May not benull.
-
getLinkedFeature
org.eclipse.xtext.common.types.JvmIdentifiableElement getLinkedFeature(XAbstractFeatureCall featureCall)
Returns the intermediate linking result for the given feature call, if any. If the feature call isnull, the result isnull.- Parameters:
featureCall- the feature call that is queried for the current linking state.- Returns:
- the potentially intermediate linking state or
nullif none.
-
getLinkedFeature
org.eclipse.xtext.common.types.JvmIdentifiableElement getLinkedFeature(XConstructorCall constructorCall)
Returns the intermediate linking result for the given constructor call, if any. If the constructor call isnull, the result isnull. If the constructor call is broken, it may return aJvmTypeinstead of aJvmConstructor.- Parameters:
constructorCall- the constructor call that is queried for the current linking state.- Returns:
- the potentially intermediate linking state or
nullif none.
-
getLinkingCandidate
IFeatureLinkingCandidate getLinkingCandidate(XAbstractFeatureCall featureCall)
Returns the intermediate linking candidate for the given feature call, if any. If the feature call isnull, the result isnull.- Parameters:
featureCall- the feature call that is queried for the current linking state.- Returns:
- the potentially intermediate linking state or
nullif none.
-
getLinkingCandidate
IConstructorLinkingCandidate getLinkingCandidate(XConstructorCall constructorCall)
Returns the intermediate linking candidate for the given constructor call, if any. If the constructor call isnull, the result isnull. If the constructor call is broken, it may return aJvmTypeinstead of aJvmConstructor.- Parameters:
constructorCall- the constructor call that is queried for the current linking state.- Returns:
- the potentially intermediate linking state or
nullif none.
-
isRefinedType
boolean isRefinedType(XExpression expression)
Returnstrueif the expression's type is based on a type refinement, e.g. an instanceof guard my specialize the type of the checked reference. Any feature call to that reference is considered to be based on a refined type.- Parameters:
expression- the expression that may have been typed based on a refinement.- Returns:
trueif the type was refined,falseotherwise.
-
getExpressionScope
IExpressionScope getExpressionScope(org.eclipse.emf.ecore.EObject context, IExpressionScope.Anchor anchor)
Returns the scope the given expression is contained in. This considers all decision paths that were taken while computing the type of the expression. The returned scope carries some meta data such as whether there was an attempt to resolve the given expression as a type.
-
hasExpressionScope
boolean hasExpressionScope(org.eclipse.emf.ecore.EObject context, IExpressionScope.Anchor anchor)
-
-