use of org.eclipse.titan.designer.AST.IType.Type_type in project titan.EclipsePlug-ins by eclipse.
the class SingleArrayDimension method check.
@Override
public /**
* {@inheritDoc}
*/
void check(final CompilationTimeStamp timestamp) {
if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
return;
}
lastTimeChecked = timestamp;
setIsErroneous(false);
if (value == null) {
return;
}
final IValue last = value.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_CONSTANT, null);
if (last == null || last.getIsErroneous(timestamp)) {
return;
}
final Type_type ttype = value.getExpressionReturntype(timestamp, Expected_Value_type.EXPECTED_CONSTANT);
switch(ttype) {
case TYPE_INTEGER:
if (last.isUnfoldable(timestamp)) {
value.getLocation().reportSemanticError(OPERANDERROR);
setIsErroneous(true);
} else if (Value.Value_type.INTEGER_VALUE.equals(last.getValuetype())) {
if (!((Integer_Value) last).isNative()) {
value.getLocation().reportSemanticError(MessageFormat.format(LARGEINTEGERERROR, ((Integer_Value) last).getValueValue()));
setIsErroneous(true);
} else {
size = ((Integer_Value) last).getValue();
if (size < 0) {
value.getLocation().reportSemanticError(OPERANDERROR);
setIsErroneous(true);
}
}
}
return;
default:
value.getLocation().reportSemanticError(INTEGERVALUEEXPECTED);
value.setIsErroneous(true);
}
}
use of org.eclipse.titan.designer.AST.IType.Type_type in project titan.EclipsePlug-ins by eclipse.
the class CheckStateExpression method checkExpressionOperand1.
/**
* Checks the operand
* in charstring (mandatory)
* @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 checkExpressionOperand1(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
if (value == null) {
setIsErroneous(true);
return;
}
value.setLoweridToReference(timestamp);
final Type_type tempType = value.getExpressionReturntype(timestamp, expectedValue);
switch(tempType) {
case TYPE_CHARSTRING:
final IValue last = value.getValueRefdLast(timestamp, expectedValue, referenceChain);
if (!last.isUnfoldable(timestamp)) {
final String originalString = ((Charstring_Value) last).getValue();
final CharstringExtractor cs = new CharstringExtractor(originalString);
if (cs.isErrorneous()) {
value.getLocation().reportSemanticError(cs.getErrorMessage());
setIsErroneous(true);
}
}
break;
case TYPE_UNDEFINED:
setIsErroneous(true);
break;
default:
if (!isErroneous) {
location.reportSemanticError(OPERAND1_ERROR1);
setIsErroneous(true);
}
break;
}
}
use of org.eclipse.titan.designer.AST.IType.Type_type in project titan.EclipsePlug-ins by eclipse.
the class ComponentCreateExpression 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) {
checkCreate(timestamp);
if (name != null) {
final IValue last = name.setLoweridToReference(timestamp);
final Type_type typeType = last.getExpressionReturntype(timestamp, expectedValue);
if (!last.getIsErroneous(timestamp)) {
switch(typeType) {
case TYPE_CHARSTRING:
last.getValueRefdLast(timestamp, referenceChain);
break;
case TYPE_UNDEFINED:
break;
default:
name.getLocation().reportSemanticError(FIRSTOPERANDERROR);
setIsErroneous(true);
break;
}
}
}
if (location != null) {
final IValue last = location.setLoweridToReference(timestamp);
final Type_type typeType = last.getExpressionReturntype(timestamp, expectedValue);
if (!last.getIsErroneous(timestamp)) {
switch(typeType) {
case TYPE_CHARSTRING:
last.getValueRefdLast(timestamp, referenceChain);
break;
case TYPE_UNDEFINED:
break;
default:
name.getLocation().reportSemanticError(SECONDOPERANDERROR);
setIsErroneous(true);
break;
}
}
}
checkExpressionDynamicPart(expectedValue, OPERATIONNAME, false, true, false);
}
use of org.eclipse.titan.designer.AST.IType.Type_type in project titan.EclipsePlug-ins by eclipse.
the class DivideExpression 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) {
Type_type tempType1 = null;
Type_type tempType2 = null;
if (value1 != null) {
value1.setLoweridToReference(timestamp);
tempType1 = value1.getExpressionReturntype(timestamp, expectedValue);
switch(tempType1) {
case TYPE_INTEGER:
value1.getValueRefdLast(timestamp, expectedValue, referenceChain);
break;
case TYPE_REAL:
value1.getValueRefdLast(timestamp, expectedValue, referenceChain);
break;
case TYPE_UNDEFINED:
setIsErroneous(true);
break;
default:
value1.getLocation().reportSemanticError(FIRSTOPERANDERROR);
setIsErroneous(true);
break;
}
}
if (value2 != null) {
value2.setLoweridToReference(timestamp);
tempType2 = value2.getExpressionReturntype(timestamp, expectedValue);
switch(tempType2) {
case TYPE_INTEGER:
{
final IValue lastValue = value2.getValueRefdLast(timestamp, expectedValue, referenceChain);
if (!lastValue.getIsErroneous(timestamp) && !lastValue.isUnfoldable(timestamp)) {
if (((Integer_Value) lastValue).equals(new Integer_Value(0L))) {
value2.getLocation().reportSemanticError(ZEROOPERANDERROR);
setIsErroneous(true);
}
}
break;
}
case TYPE_REAL:
value2.getValueRefdLast(timestamp, expectedValue, referenceChain);
break;
case TYPE_UNDEFINED:
setIsErroneous(true);
break;
default:
value2.getLocation().reportSemanticError(SECONDOPERANDERROR);
setIsErroneous(true);
break;
}
}
if (value1 != null && value2 != null && !getIsErroneous(timestamp)) {
if (value1.getIsErroneous(timestamp) || value2.getIsErroneous(timestamp)) {
setIsErroneous(true);
return;
}
if (tempType1 != tempType2) {
location.reportSemanticError(SAMEOPERANDERROR);
setIsErroneous(true);
}
}
}
use of org.eclipse.titan.designer.AST.IType.Type_type in project titan.EclipsePlug-ins by eclipse.
the class DivideExpression method getExpressionReturntype.
@Override
public /**
* {@inheritDoc}
*/
Type_type getExpressionReturntype(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue) {
if (value1 == null) {
return Type_type.TYPE_UNDEFINED;
}
value1.setLoweridToReference(timestamp);
final Type_type tempType = value1.getExpressionReturntype(timestamp, expectedValue);
switch(tempType) {
case TYPE_INTEGER:
case TYPE_REAL:
return tempType;
case TYPE_UNDEFINED:
return tempType;
default:
getValueRefdLast(timestamp, expectedValue, null);
setIsErroneous(true);
return Type_type.TYPE_UNDEFINED;
}
}
Aggregations