use of org.eclipse.titan.designer.AST.IType.Type_type in project titan.EclipsePlug-ins by eclipse.
the class GreaterThanExpression method checkExpressionOperands.
/**
* Checks the parameters of the expression and if they are valid in
* their position in the expression or not.
*
* @param timestamp
* the timestamp of the actual semantic check cycle.
* @param expectedValue
* the kind of value expected.
* @param referenceChain
* a reference chain to detect cyclic references.
*/
private void checkExpressionOperands(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
if (value1 == null || value2 == null) {
return;
}
ExpressionUtilities.checkExpressionOperatorCompatibility(timestamp, this, referenceChain, expectedValue, value1, value2);
value1.setLoweridToReference(timestamp);
final Type_type tempType1 = value1.getExpressionReturntype(timestamp, expectedValue);
switch(tempType1) {
case TYPE_INTEGER:
case TYPE_REAL:
case TYPE_TTCN3_ENUMERATED:
case TYPE_ASN1_ENUMERATED:
value1.getValueRefdLast(timestamp, expectedValue, referenceChain);
break;
case TYPE_UNDEFINED:
setIsErroneous(true);
return;
default:
value1.getLocation().reportSemanticError(FIRSTOPERANDERROR);
setIsErroneous(true);
break;
}
value2.setLoweridToReference(timestamp);
final Type_type tempType2 = value2.getExpressionReturntype(timestamp, expectedValue);
switch(tempType2) {
case TYPE_INTEGER:
case TYPE_REAL:
case TYPE_TTCN3_ENUMERATED:
case TYPE_ASN1_ENUMERATED:
value2.getValueRefdLast(timestamp, expectedValue, referenceChain);
break;
case TYPE_UNDEFINED:
setIsErroneous(true);
return;
default:
value2.getLocation().reportSemanticError(SECONDOPERANDERROR);
setIsErroneous(true);
break;
}
}
use of org.eclipse.titan.designer.AST.IType.Type_type in project titan.EclipsePlug-ins by eclipse.
the class Hex2IntExpression method checkExpressionOperands.
/**
* Checks the parameters of the expression and if they are valid in
* their position in the expression or not.
*
* @param timestamp
* the timestamp of the actual semantic check cycle.
* @param expectedValue
* the kind of value expected.
* @param referenceChain
* a reference chain to detect cyclic references.
*/
private void checkExpressionOperands(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
if (value == null) {
return;
}
value.setLoweridToReference(timestamp);
final Type_type tempType = value.getExpressionReturntype(timestamp, expectedValue);
switch(tempType) {
case TYPE_HEXSTRING:
final IValue last = value.getValueRefdLast(timestamp, expectedValue, referenceChain);
if (!last.isUnfoldable(timestamp)) {
final String hexstring = ((Hexstring_Value) last).getValue();
int startIndex = 0;
while (startIndex < hexstring.length() && '0' == hexstring.charAt(startIndex)) {
startIndex++;
}
}
return;
case TYPE_UNDEFINED:
setIsErroneous(true);
return;
default:
if (!isErroneous) {
location.reportSemanticError(OPERANDERROR1);
setIsErroneous(true);
}
return;
}
}
use of org.eclipse.titan.designer.AST.IType.Type_type in project titan.EclipsePlug-ins by eclipse.
the class Hex2OctExpression method checkExpressionOperands.
/**
* Checks the parameters of the expression and if they are valid in
* their position in the expression or not.
*
* @param timestamp
* the timestamp of the actual semantic check cycle.
* @param expectedValue
* the kind of value expected.
* @param referenceChain
* a reference chain to detect cyclic references.
*/
private void checkExpressionOperands(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
if (value == null) {
return;
}
value.setLoweridToReference(timestamp);
final Type_type tempType = value.getExpressionReturntype(timestamp, expectedValue);
switch(tempType) {
case TYPE_HEXSTRING:
value.getValueRefdLast(timestamp, expectedValue, referenceChain);
return;
case TYPE_UNDEFINED:
setIsErroneous(true);
return;
default:
if (!isErroneous) {
location.reportSemanticError(OPERANDERROR);
setIsErroneous(true);
}
return;
}
}
use of org.eclipse.titan.designer.AST.IType.Type_type in project titan.EclipsePlug-ins by eclipse.
the class Bit2HexExpression method checkExpressionOperands.
/**
* Checks the parameters of the expression and if they are valid in
* their position in the expression or not.
*
* @param timestamp
* the timestamp of the actual semantic check cycle.
* @param expectedValue
* the kind of value expected.
* @param referenceChain
* a reference chain to detect cyclic references.
*/
private void checkExpressionOperands(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
if (value == null) {
return;
}
value.setLoweridToReference(timestamp);
final Type_type tempType = value.getExpressionReturntype(timestamp, expectedValue);
switch(tempType) {
case TYPE_BITSTRING:
value.getValueRefdLast(timestamp, expectedValue, referenceChain);
return;
case TYPE_UNDEFINED:
setIsErroneous(true);
return;
default:
if (!isErroneous) {
location.reportSemanticError(OPERANDERROR);
setIsErroneous(true);
}
return;
}
}
use of org.eclipse.titan.designer.AST.IType.Type_type in project titan.EclipsePlug-ins by eclipse.
the class For_Statement method check.
@Override
public /**
* {@inheritDoc}
*/
void check(final CompilationTimeStamp timestamp) {
if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
return;
}
if (definitions != null) {
definitions.check(timestamp);
}
if (initialAssignment != null) {
initialAssignment.check(timestamp);
}
if (finalExpression != null) {
finalExpression.setLoweridToReference(timestamp);
final IValue lastValue = finalExpression.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, null);
final Type_type temp = lastValue.getExpressionReturntype(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE);
switch(temp) {
case TYPE_BOOL:
if (!lastValue.isUnfoldable(timestamp)) {
if (((Boolean_Value) lastValue).getValue()) {
finalExpression.getLocation().reportConfigurableSemanticProblem(Platform.getPreferencesService().getString(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.REPORTUNNECESSARYCONTROLS, GeneralConstants.WARNING, null), UNNECESSARYCONTROL);
} else {
finalExpression.getLocation().reportConfigurableSemanticProblem(Platform.getPreferencesService().getString(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.REPORTUNNECESSARYCONTROLS, GeneralConstants.WARNING, null), NEVERREACH);
}
}
break;
default:
location.reportSemanticError(OPERANDERROR);
finalExpression.setIsErroneous(true);
break;
}
if (finalExpression.getMyGovernor() == null) {
finalExpression.setMyGovernor(new Boolean_Type());
}
}
if (stepAssignment != null) {
stepAssignment.check(timestamp);
}
if (statementblock != null) {
statementblock.setMyLaicStmt(null, this);
statementblock.check(timestamp);
// warning for "return" has been removed. Not valid problem
}
lastTimeChecked = timestamp;
}
Aggregations