io.sarl.lang.validation.subvalidators
Class SARLCastValidator
class SARLCastValidator
extends java.lang.Object
A specialized validator to deal with casting operations.

This validator is not a subtype of the Xtext validator API because it must be directly invoked from the overridden functions in the main SARLValidator.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
compiler
Since:
0.14
Constructor Summary
Constructor and description
new
Action Summary
Modifier and type Action and description
void checkCast(ISARLValidator,JvmTypeReference,LightweightTypeReference,LightweightTypeReference)
Check the type.
boolean checkCasts(ISARLValidator,XCastedExpression)
Check the overridable cast operators.
protected boolean checkOverrideableCasts(ISARLValidator,SarlCastedExpression)
Check if the given cast expression has an associated overriding function.
protected boolean isAmbiguousCastContext(JvmTypeReference,LightweightTypeReference,LightweightTypeReference)
Test if the enclosing cast expression is used in an context that make the casting operation mandatory in order to avoid ambiguity.
protected void reportCastWarnings(ISARLValidator,JvmTypeReference,LightweightTypeReference,LightweightTypeReference)
Report the warnings associated to the casted expressions.
Constructor Details
new
new
Action Details
checkCast(ISARLValidator,JvmTypeReference,LightweightTypeReference,LightweightTypeReference)
def checkCast(ISARLValidator,JvmTypeReference,LightweightTypeReference,LightweightTypeReference)
Check the type.
Parameters:
validator - the validator tool.
concreteSyntax - the concrete type from the SARL source code
toType - the real target type
fromType - the real from type (same as the concrete syntax type)
checkCasts(ISARLValidator,XCastedExpression)
def checkCasts(ISARLValidator,XCastedExpression) : boolean
Check the overridable cast operators.
Parameters:
validator - the validator tool.
cast - the operator.
Returns:
true if the cast was checked by this function; false if the function did not checked the cast operator.
checkOverrideableCasts(ISARLValidator,SarlCastedExpression)
protected def checkOverrideableCasts(ISARLValidator,SarlCastedExpression) : boolean
Check if the given cast expression has an associated overriding function.
Parameters:
validator - the validator tool.
cast - the SARL cast expression.
Returns:
true to avoid to do the "standard" cast test (because this function has already did it for example).
isAmbiguousCastContext(JvmTypeReference,LightweightTypeReference,LightweightTypeReference)
protected def isAmbiguousCastContext(JvmTypeReference,LightweightTypeReference,LightweightTypeReference) : boolean
Test if the enclosing cast expression is used in an context that make the casting operation mandatory in order to avoid ambiguity.
Parameters:
concreteSyntax - the concrete type from the SARL source code
toType - the real target type
fromType - the real from type (same as the concrete syntax type)
Returns:
true if the context of a casting operation is used for invoking a feature with some ambiguity.
reportCastWarnings(ISARLValidator,JvmTypeReference,LightweightTypeReference,LightweightTypeReference)
protected def reportCastWarnings(ISARLValidator,JvmTypeReference,LightweightTypeReference,LightweightTypeReference)
Report the warnings associated to the casted expressions.
Parameters:
validator - the validator tool.
concreteSyntax - the type specified into the casted expression.
toType - the type specified into the casted expression.
fromType - the type of the source expression.