use of org.eclipse.titan.designer.AST.TTCN3.values.Choice_Value in project titan.EclipsePlug-ins by eclipse.
the class Open_Type method checkThisValue.
// FIXME add tests
@Override
public /**
* {@inheritDoc}
*/
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
if (getIsErroneous(timestamp)) {
return false;
}
boolean selfReference = super.checkThisValue(timestamp, value, lhs, valueCheckingOptions);
IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
if (null == last || last.getIsErroneous(timestamp)) {
return selfReference;
}
// already handled ones
switch(value.getValuetype()) {
case OMIT_VALUE:
case REFERENCED_VALUE:
return selfReference;
case UNDEFINED_LOWERIDENTIFIER_VALUE:
if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
return selfReference;
}
break;
default:
break;
}
this.check(timestamp);
switch(last.getValuetype()) {
case SEQUENCE_VALUE:
if (value.isAsn()) {
value.getLocation().reportSemanticError(MessageFormat.format(CHOICEEXPECTED, getFullName()));
value.setIsErroneous(true);
} else {
last = last.setValuetype(timestamp, Value_type.CHOICE_VALUE);
if (!last.getIsErroneous(timestamp)) {
selfReference = checkThisValueChoice(timestamp, (Choice_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.str_elem);
}
}
break;
case CHOICE_VALUE:
selfReference = checkThisValueChoice(timestamp, (Choice_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.str_elem);
break;
default:
if (value.isAsn()) {
value.getLocation().reportSemanticError(MessageFormat.format(CHOICEEXPECTED, getFullName()));
} else {
value.getLocation().reportSemanticError(MessageFormat.format(UNIONEXPECTED, getFullName()));
}
value.setIsErroneous(true);
}
value.setLastTimeChecked(timestamp);
return selfReference;
}
use of org.eclipse.titan.designer.AST.TTCN3.values.Choice_Value in project titan.EclipsePlug-ins by eclipse.
the class ASN1_Choice_Type method checkThisValue.
@Override
public /**
* {@inheritDoc}
*/
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
if (getIsErroneous(timestamp)) {
return false;
}
boolean selfReference = super.checkThisValue(timestamp, value, lhs, valueCheckingOptions);
IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
if (last == null || last.getIsErroneous(timestamp)) {
return selfReference;
}
// already handled ones
switch(value.getValuetype()) {
case OMIT_VALUE:
case REFERENCED_VALUE:
return selfReference;
case UNDEFINED_LOWERIDENTIFIER_VALUE:
if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
return selfReference;
}
break;
default:
break;
}
switch(last.getValuetype()) {
case SEQUENCE_VALUE:
if (value.isAsn()) {
value.getLocation().reportSemanticError(MessageFormat.format(CHOICEEXPECTED, getFullName()));
value.setIsErroneous(true);
} else {
last = last.setValuetype(timestamp, Value_type.CHOICE_VALUE);
if (!last.getIsErroneous(timestamp)) {
selfReference = checkThisValueChoice(timestamp, (Choice_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed);
}
}
break;
case CHOICE_VALUE:
selfReference = checkThisValueChoice(timestamp, (Choice_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed);
break;
case EXPRESSION_VALUE:
case MACRO_VALUE:
// already checked
break;
default:
if (value.isAsn()) {
value.getLocation().reportSemanticError(MessageFormat.format(CHOICEEXPECTED, getFullName()));
value.setIsErroneous(true);
} else {
value.getLocation().reportSemanticError(MessageFormat.format(UNIONEXPECTED, getFullName()));
value.setIsErroneous(true);
}
value.setIsErroneous(true);
}
value.setLastTimeChecked(timestamp);
return selfReference;
}
use of org.eclipse.titan.designer.AST.TTCN3.values.Choice_Value in project titan.EclipsePlug-ins by eclipse.
the class TTCN3_Choice_Type method checkThisValueChoice.
private boolean checkThisValueChoice(final CompilationTimeStamp timestamp, final Choice_Value value, final Assignment lhs, final Expected_Value_type expectedValue, final boolean incompleteAllowed, final boolean strElem) {
boolean selfReference = false;
final Identifier name = value.getName();
if (!hasComponentWithName(name.getName())) {
if (value.isAsn()) {
value.getLocation().reportSemanticError(MessageFormat.format(NONEXISTENTCHOICE, name.getDisplayName(), getFullName()));
value.setIsErroneous(true);
} else {
value.getLocation().reportSemanticError(MessageFormat.format(NONEXISTENTUNION, name.getDisplayName(), getFullName()));
value.setIsErroneous(true);
}
return selfReference;
}
IValue alternativeValue = value.getValue();
if (alternativeValue == null) {
return selfReference;
}
final Type alternativeType = getComponentByName(name.getName()).getType();
alternativeValue.setMyGovernor(alternativeType);
alternativeValue = alternativeType.checkThisValueRef(timestamp, alternativeValue);
selfReference = alternativeType.checkThisValue(timestamp, alternativeValue, lhs, new ValueCheckingOptions(expectedValue, incompleteAllowed, false, true, false, strElem));
value.setLastTimeChecked(timestamp);
return selfReference;
}
Aggregations