use of org.eclipse.titan.designer.AST.TTCN3.values.Function_Reference_Value in project titan.EclipsePlug-ins by eclipse.
the class SpecificValue_Template method isValue.
@Override
public /**
* {@inheritDoc}
*/
boolean isValue(final CompilationTimeStamp timestamp) {
if (lengthRestriction != null || isIfpresent || getIsErroneous(timestamp)) {
return false;
}
if (realTemplate != null && realTemplate != this) {
return realTemplate.isValue(timestamp);
}
if (Value_type.FUNCTION_REFERENCE_VALUE.equals(specificValue.getValuetype())) {
final IType governor = ((Function_Reference_Value) specificValue).getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE);
if (governor == null) {
return true;
}
final IType last = governor.getTypeRefdLast(timestamp);
if (Type_type.TYPE_FUNCTION.equals(last.getTypetype()) && ((Function_Type) last).returnsTemplate()) {
return false;
}
} else if (Value_type.REFERENCED_VALUE.equals(specificValue.getValuetype())) {
final Reference reference = ((Referenced_Value) specificValue).getReference();
final Assignment assignment = reference.getRefdAssignment(timestamp, true);
if (assignment == null) {
return true;
}
switch(assignment.getAssignmentType()) {
case A_CONST:
case A_TIMER:
case A_EXT_CONST:
case A_PAR_VAL:
case A_PAR_VAL_IN:
case A_PAR_VAL_OUT:
case A_PAR_VAL_INOUT:
case A_VAR:
case A_FUNCTION_RVAL:
case A_EXT_FUNCTION_RVAL:
case A_MODULEPAR:
case A_MODULEPAR_TEMPLATE:
// runtime evaluation!
return true;
case A_TEMPLATE:
case A_PAR_TEMP_IN:
case A_PAR_TEMP_INOUT:
case A_FUNCTION_RTEMP:
case A_VAR_TEMPLATE:
boolean result = true;
final Restriction_type rt = ((Definition) assignment).getTemplateRestriction();
if (TemplateRestriction.Restriction_type.TR_OMIT.equals(rt) || TemplateRestriction.Restriction_type.TR_PRESENT.equals(rt)) {
result = false;
}
final TTCN3Template ttemplate = getTemplateReferencedLast(timestamp);
if ((!ttemplate.equals(this)) && (ttemplate.isValue(timestamp))) {
// ok
return result;
} else {
return false;
}
default:
return false;
}
}
return true;
}
Aggregations