io.sarl.lang.validation.subvalidators
Class SARLFeatureCallsValidator
All Superinterfaces:
org.eclipse.emf.ecore.EValidator, org.eclipse.xtext.validation.ValidationMessageAcceptor
class SARLFeatureCallsValidator
extends AbstractSARLSubValidator
A specialized validator to deal with feature calls.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
compiler
Since:
0.14
Property Summary
Constructor Summary
Constructor and description
new
Action Summary
Modifier and type Action and description
void checkAmbiguousInterpretationMinusUnaryOperator(XUnaryOperation)
Check if the call to an unary minus operator may be ambiguous interpretation for the SARL developer.
void checkAssertKeywordUse(SarlAssertExpression)
Check for usage of assert keyword.
void checkAssumeKeywordUse(SarlAssertExpression)
Check for usage of assert keyword.
void checkBreakKeywordUse(SarlBreakExpression)
Check for usage of break inside loops.
void checkContinueKeywordUse(SarlContinueExpression)
Check for usage of continue inside loops.
void checkDiscouragedCalls(XAbstractFeatureCall)
Check if the call is discouraged.
void checkForbiddenCalls(XAbstractFeatureCall)
Check if the call is forbidden.
void checkLeftHandSideIsVariable(XAssignment)
void checkOperatorSignature(XtendFunction)
void checkTernaryExpressionUsed(XIfExpression)
Constructor Details
new
new
Action Details
checkAmbiguousInterpretationMinusUnaryOperator(XUnaryOperation)
def checkAmbiguousInterpretationMinusUnaryOperator(XUnaryOperation)
Check if the call to an unary minus operator may be ambiguous interpretation for the SARL developer.

Let the SARL expression -125.abs that is invoking the function Math.abs with extension method notation. According to the precedence of the the SARL operator, this expression is interpreted as -abs(125) and not abs(-125). Indeed the minus sign is an operator and not considered as a part of the number literal itself.

To avoid invalid interpretation of the expression by the SARL developper, a warning is generated.
Parameters:
expression - the expression.
Since:
0.13
checkAssertKeywordUse(SarlAssertExpression)
def checkAssertKeywordUse(SarlAssertExpression)
Check for usage of assert keyword.
Parameters:
expression - the expression to analyze.
checkAssumeKeywordUse(SarlAssertExpression)
def checkAssumeKeywordUse(SarlAssertExpression)
Check for usage of assert keyword.
Parameters:
expression - the expression to analyze.
checkBreakKeywordUse(SarlBreakExpression)
def checkBreakKeywordUse(SarlBreakExpression)
Check for usage of break inside loops.
Parameters:
expression - the expression to analyze.
checkContinueKeywordUse(SarlContinueExpression)
def checkContinueKeywordUse(SarlContinueExpression)
Check for usage of continue inside loops.
Parameters:
expression - the expression to analyze.
Since:
0.7
checkDiscouragedCalls(XAbstractFeatureCall)
def checkDiscouragedCalls(XAbstractFeatureCall)
Check if the call is discouraged.

One example of a discouraged feature is err.
Parameters:
expression - the expression.
checkForbiddenCalls(XAbstractFeatureCall)
def checkForbiddenCalls(XAbstractFeatureCall)
Check if the call is forbidden.

One example of a forbidden feature is exit(int).
Parameters:
expression - the expression.
checkLeftHandSideIsVariable(XAssignment)
def checkLeftHandSideIsVariable(XAssignment)
checkOperatorSignature(XtendFunction)
def checkOperatorSignature(XtendFunction)
checkTernaryExpressionUsed(XIfExpression)
def checkTernaryExpressionUsed(XIfExpression)