Interface RelatedExpression<N,T,B,TB extends B,S,QI,R extends RelatedExpression<N,T,B,TB,S,QI,R>>
- Type Parameters:
N- The node type in the ASTT- The type typeB- The binding typeTB- The type binding typeS- The scope type (optional)QI- The type used to represent qualified identifiersR- The sub-type of related expression to use
- All Known Implementing Classes:
DefaultRelatedExpression
public interface RelatedExpression<N,T,B,TB extends B,S,QI,R extends RelatedExpression<N,T,B,TB,S,QI,R>>
Represents the function of an expression, or statement as related expression.
-
Method Summary
Modifier and Type Method Description booleancanBeUsedInsteadOf(R other)Used to resolve referential ambiguity between related expressions.List<QI>getAssociateNames()intgetColumn()List<QI>getContainedNamesFromSurface()StringgetDescription()intgetLengthOfTypeForTempVar(S scope)intgetLine()QIgetName()Return the name used as identifier in the related expression, if the related expression declares a name.List<QI>getPartNames()NgetRelatedExpression()RelatedExpressionStrategy<N,T,B,TB,S,QI,R>getStrategy()TgetTypeForTempVar(S scope, Function<TB,T> importRewrite)Deprecated.default booleanhasName()Whether or not this related expression declares a name.booleanisEffectivelyFinal()If the related expression is effectively final, its value is identical at run-time, regardless of whether the related expression occurs in its original position, or would be moved or copied to the position of the anaphor.List<TB>resolveAssociateTypes(S scope)List<TB>resolveContainedTypesFromSurface(S scope)BresolveNameBinding(S scope)Resolves the binding of the name declared in the related expression.List<TB>resolvePartTypes(S scope)TBresolveType(S scope)Resolve the type of the related expressionvoidsetRelatedExpression(N relatedExpression)Deprecated.default booleanshouldResolutionReplaceRelatedExpressionWithTempDeclaration()
-
Method Details
-
isEffectivelyFinal
boolean isEffectivelyFinal()If the related expression is effectively final, its value is identical at run-time, regardless of whether the related expression occurs in its original position, or would be moved or copied to the position of the anaphor.- Returns:
- true, if the related expression is effectively final.
-
shouldResolutionReplaceRelatedExpressionWithTempDeclaration
- Returns:
- true, if anaphor resolution should replace the related expression with a declaration of a temporary local variable. This is required whenever the related expression is not effectively final and is not already used to initialize an effectively final local variable that can be re-used.
- See Also:
isEffectivelyFinal()
-
getRelatedExpression
-
setRelatedExpression
Deprecated.Replaces the current related expression with the given one.- Parameters:
relatedExpression- The new related expression- See Also:
getRelatedExpression(),getStrategy()
-
getStrategy
RelatedExpressionStrategy<N,T,B,TB,S,QI,R> getStrategy() -
canBeUsedInsteadOf
Used to resolve referential ambiguity between related expressions.- Parameters:
other- Another related expression.- Returns:
- True, if this related expression refers to the same referent as
otherand this related expression should be used instead ofotherin order to eliminate the ambiguity between the two. False is returned otherwise.
-
hasName
Whether or not this related expression declares a name.- Returns:
- True, if a name is declared, false otherwise.
-
getName
Return the name used as identifier in the related expression, if the related expression declares a name. Null is returned, ifhasName()returns false. -
getPartNames
List<QI> getPartNames() -
getAssociateNames
-
getContainedNamesFromSurface
-
resolveNameBinding
Resolves the binding of the name declared in the related expression. Returns null, ifhasName()returns false.- Parameters:
scope- The scope containing the related expression if used by the compiler-specific implementation. Implementations of this method must not access the scope but merely pass it on to SPI's they invoke.- Returns:
- The resolved binding.
-
getLengthOfTypeForTempVar
-
getTypeForTempVar
Deprecated.Returns the type of the related expression for use in declaring a local temporary variable. This method needs to add import declarations if necessary to make the type useable for the temp var.- Parameters:
importRewrite- To turn a type binding into a type that can be used in the AST
-
resolveType
Resolve the type of the related expression- Parameters:
scope- The scope containing the related expression if used by the compiler-specific implementation. Implementations of this method must not access the scope but merely pass it on to SPI's they invoke.- Returns:
- The resolved type.
-
resolvePartTypes
-
resolveAssociateTypes
-
resolveContainedTypesFromSurface
-
getDescription
-
getLine
int getLine() -
getColumn
int getColumn()
-