use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Template in project titan.EclipsePlug-ins by eclipse.
the class SizeOfExpression 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.
*
* @return the size of the expression, or -1 in case of error
*/
private long checkExpressionOperands(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
Expected_Value_type internalExpectedValue;
if (Expected_Value_type.EXPECTED_DYNAMIC_VALUE.equals(expectedValue)) {
internalExpectedValue = Expected_Value_type.EXPECTED_TEMPLATE;
} else {
internalExpectedValue = expectedValue;
}
ITTCN3Template template = templateInstance.getTemplateBody();
template.setLoweridToReference(timestamp);
template = template.getTemplateReferencedLast(timestamp, referenceChain);
if (template.getIsErroneous(timestamp)) {
setIsErroneous(true);
return -1;
}
// Timer and port arrays are handled separately
if (template.getTemplatetype() == Template_type.SPECIFIC_VALUE) {
final SpecificValue_Template specValTempl = (SpecificValue_Template) template;
IValue val = specValTempl.getSpecificValue();
val.setMyGovernor(specValTempl.getMyGovernor());
if (val.getValuetype() == Value_type.UNDEFINED_LOWERIDENTIFIER_VALUE) {
val = val.setLoweridToReference(timestamp);
}
if (val != null && val.getValuetype() == Value_type.REFERENCED_VALUE) {
final Referenced_Value referencedValue = (Referenced_Value) val;
final Reference ref = referencedValue.getReference();
final Assignment temporalAss = ref.getRefdAssignment(timestamp, true);
if (temporalAss != null) {
final Assignment_type asstype = temporalAss.getAssignmentType();
ArrayDimensions dimensions;
if (asstype == Assignment_type.A_PORT) {
dimensions = ((Def_Port) temporalAss).getDimensions();
return checkTimerPort(timestamp, ref, dimensions, temporalAss);
} else if (asstype == Assignment_type.A_TIMER) {
dimensions = ((Def_Timer) temporalAss).getDimensions();
return checkTimerPort(timestamp, ref, dimensions, temporalAss);
}
}
}
}
IType governor = templateInstance.getExpressionGovernor(timestamp, internalExpectedValue);
if (governor == null) {
final ITTCN3Template templ = template.setLoweridToReference(timestamp);
governor = templ.getExpressionGovernor(timestamp, internalExpectedValue);
}
if (governor == null) {
if (!template.getIsErroneous(timestamp)) {
templateInstance.getLocation().reportSemanticError("Cannot determine the type of the argument in the `sizeof' operation. If type is known, use valueof(<type>: ...) as argument.");
}
setIsErroneous(true);
return -1;
}
IsValueExpression.checkExpressionTemplateInstance(timestamp, this, templateInstance, governor, referenceChain, internalExpectedValue);
if (isErroneous) {
return -1;
}
IType type = governor.getTypeRefdLast(timestamp);
switch(type.getTypetype()) {
case TYPE_SEQUENCE_OF:
case TYPE_SET_OF:
case TYPE_TTCN3_SEQUENCE:
case TYPE_TTCN3_SET:
case TYPE_ASN1_SEQUENCE:
case TYPE_ASN1_SET:
case TYPE_ARRAY:
case TYPE_OBJECTID:
case TYPE_ROID:
case TYPE_UNDEFINED:
break;
default:
templateInstance.getLocation().reportSemanticError("Reference to a value or template of type record, record of, set, set of, objid or array was expected");
setIsErroneous(true);
return -1;
}
IValue value = null;
Reference reference = null;
Assignment assignment = null;
List<ISubReference> subreferences = null;
switch(template.getTemplatetype()) {
case INDEXED_TEMPLATE_LIST:
return -1;
case TEMPLATE_REFD:
reference = ((Referenced_Template) template).getReference();
assignment = reference.getRefdAssignment(timestamp, false);
subreferences = reference.getSubreferences();
break;
case TEMPLATE_LIST:
case NAMED_TEMPLATE_LIST:
case SUBSET_MATCH:
case SUPERSET_MATCH:
// compute later
break;
case SPECIFIC_VALUE:
value = ((SpecificValue_Template) template).getSpecificValue().getValueRefdLast(timestamp, referenceChain);
if (value != null) {
switch(value.getValuetype()) {
case SEQUENCEOF_VALUE:
case SETOF_VALUE:
case ARRAY_VALUE:
case RELATIVEOBJECTIDENTIFIER_VALUE:
case OBJECTID_VALUE:
case SEQUENCE_VALUE:
case SET_VALUE:
break;
case REFERENCED_VALUE:
{
reference = ((Referenced_Value) value).getReference();
assignment = reference.getRefdAssignment(timestamp, false);
subreferences = reference.getSubreferences();
break;
}
default:
templateInstance.getLocation().reportSemanticError(MessageFormat.format("`sizeof'' operation is not applicable to `{0}''", value.createStringRepresentation()));
setIsErroneous(true);
return -1;
}
}
break;
default:
templateInstance.getLocation().reportSemanticError(MessageFormat.format("`sizeof'' operation is not applicable to {0}", template.getTemplateTypeName()));
setIsErroneous(true);
return -1;
}
if (assignment != null) {
if (assignment.getIsErroneous()) {
setIsErroneous(true);
return -1;
}
switch(assignment.getAssignmentType()) {
case A_CONST:
value = ((Def_Const) assignment).getValue();
break;
case A_EXT_CONST:
case A_MODULEPAR:
case A_MODULEPAR_TEMPLATE:
if (Expected_Value_type.EXPECTED_CONSTANT.equals(internalExpectedValue)) {
templateInstance.getLocation().reportSemanticError(MessageFormat.format("Reference to an (evaluable) constant value was expected instead of {0}", assignment.getDescription()));
setIsErroneous(true);
return -1;
}
break;
case A_VAR:
case A_PAR_VAL:
case A_PAR_VAL_IN:
case A_PAR_VAL_OUT:
case A_PAR_VAL_INOUT:
switch(internalExpectedValue) {
case EXPECTED_CONSTANT:
templateInstance.getLocation().reportSemanticError(MessageFormat.format("Reference to a constant value was expected instead of {0}", assignment.getDescription()));
setIsErroneous(true);
return -1;
case EXPECTED_STATIC_VALUE:
templateInstance.getLocation().reportSemanticError(MessageFormat.format("Reference to a static value was expected instead of {0}", assignment.getDescription()));
setIsErroneous(true);
return -1;
default:
break;
}
break;
case A_TEMPLATE:
template = ((Def_Template) assignment).getTemplate(timestamp);
if (!Expected_Value_type.EXPECTED_TEMPLATE.equals(internalExpectedValue)) {
templateInstance.getLocation().reportSemanticError(MessageFormat.format("Reference to a value was expected instead of {0}", assignment.getDescription()));
setIsErroneous(true);
return -1;
}
break;
case A_VAR_TEMPLATE:
case A_PAR_TEMP_IN:
case A_PAR_TEMP_OUT:
case A_PAR_TEMP_INOUT:
if (!Expected_Value_type.EXPECTED_TEMPLATE.equals(internalExpectedValue)) {
templateInstance.getLocation().reportSemanticError(MessageFormat.format("Reference to a value was expected instead of {0}", assignment.getDescription()));
setIsErroneous(true);
return -1;
}
break;
case A_FUNCTION_RVAL:
case A_EXT_FUNCTION_RVAL:
switch(internalExpectedValue) {
case EXPECTED_CONSTANT:
templateInstance.getLocation().reportSemanticError(MessageFormat.format("Reference to a constant value was expected instead of the return value of {0}", assignment.getDescription()));
setIsErroneous(true);
return -1;
case EXPECTED_STATIC_VALUE:
templateInstance.getLocation().reportSemanticError(MessageFormat.format("Reference to a static value was expected instead of the return value of {0}", assignment.getDescription()));
setIsErroneous(true);
return -1;
default:
break;
}
break;
case A_FUNCTION_RTEMP:
case A_EXT_FUNCTION_RTEMP:
if (!Expected_Value_type.EXPECTED_TEMPLATE.equals(internalExpectedValue)) {
templateInstance.getLocation().reportSemanticError(MessageFormat.format("Reference to a value was expected instead of a call of {0}, which returns a template", assignment.getDescription()));
setIsErroneous(true);
return -1;
}
break;
case A_TIMER:
case A_PORT:
// were already checked separately.
break;
default:
templateInstance.getLocation().reportSemanticError(MessageFormat.format("Reference to a {0} was expected instead of {1}", Expected_Value_type.EXPECTED_TEMPLATE.equals(internalExpectedValue) ? "value or template" : "value", assignment.getDescription()));
setIsErroneous(true);
return -1;
}
type = assignment.getType(timestamp).getFieldType(timestamp, reference, 1, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, false);
if (type == null || type.getIsErroneous(timestamp)) {
setIsErroneous(true);
return -1;
}
type = type.getTypeRefdLast(timestamp);
switch(type.getTypetype()) {
case TYPE_SEQUENCE_OF:
case TYPE_SET_OF:
case TYPE_TTCN3_SEQUENCE:
case TYPE_TTCN3_SET:
case TYPE_ASN1_SEQUENCE:
case TYPE_ASN1_SET:
case TYPE_ARRAY:
case TYPE_OBJECTID:
case TYPE_ROID:
case TYPE_UNDEFINED:
break;
default:
templateInstance.getLocation().reportSemanticError("Reference to a value or template of type record, record of, set, set of, objid or array was expected");
setIsErroneous(true);
return -1;
}
}
// check for index overflows in subrefs if possible
if (value != null) {
switch(value.getValuetype()) {
case SEQUENCEOF_VALUE:
if (((SequenceOf_Value) value).isIndexed()) {
return -1;
}
break;
case SETOF_VALUE:
if (((SetOf_Value) value).isIndexed()) {
return -1;
}
break;
case ARRAY_VALUE:
if (((Array_Value) value).isIndexed()) {
return -1;
}
break;
default:
break;
}
/* The reference points to a constant. */
if (subreferences != null && !reference.hasUnfoldableIndexSubReference(timestamp)) {
value = value.getReferencedSubValue(timestamp, reference, 1, referenceChain);
if (value == null) {
setIsErroneous(true);
return -1;
}
value = value.getValueRefdLast(timestamp, referenceChain);
} else {
// stop processing
value = null;
}
} else if (template != null) {
/* The size of INDEXED_TEMPLATE_LIST nodes is unknown at compile
time. Don't try to evaluate it at compile time. */
if (reference != null && reference.hasUnfoldableIndexSubReference(timestamp)) {
return -1;
}
if (reference != null && subreferences != null) {
template = template.getReferencedSubTemplate(timestamp, reference, referenceChain);
if (template == null) {
setIsErroneous(true);
return -1;
}
template = template.getTemplateReferencedLast(timestamp);
}
}
if (template != null) {
if (template.getIsErroneous(timestamp)) {
setIsErroneous(true);
return -1;
}
switch(template.getTemplatetype()) {
case TEMPLATE_REFD:
template = null;
break;
case SPECIFIC_VALUE:
value = ((SpecificValue_Template) template).getSpecificValue().getValueRefdLast(timestamp, referenceChain);
template = null;
break;
case TEMPLATE_LIST:
case NAMED_TEMPLATE_LIST:
case SUBSET_MATCH:
case SUPERSET_MATCH:
break;
default:
// FIXME this can not happen
templateInstance.getLocation().reportSemanticError(MessageFormat.format("`sizeof'' operation is not applicable to {0}", template.getTemplateTypeName()));
setIsErroneous(true);
return -1;
}
}
if (value != null) {
switch(value.getValuetype()) {
case SEQUENCEOF_VALUE:
case SETOF_VALUE:
case ARRAY_VALUE:
case RELATIVEOBJECTIDENTIFIER_VALUE:
case OBJECTID_VALUE:
case SEQUENCE_VALUE:
case SET_VALUE:
break;
default:
value = null;
return -1;
}
}
/* evaluation */
if (Type_type.TYPE_ARRAY.equals(type.getTypetype())) {
return ((Array_Type) type).getDimension().getSize();
} else if (template != null) {
return evaluateTemplate(template, timestamp);
} else if (value != null) {
return evaluateValue(value);
} else {
return -1;
}
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Template in project titan.EclipsePlug-ins by eclipse.
the class Referenced_Template method generateRearrangeInitCodeReferenced.
private void generateRearrangeInitCodeReferenced(final JavaGenData aData, final StringBuilder source, final ExpressionStruct expression) {
/**
* Initially we can assume that:
* - this is a referenced template and a part of a non-parameterized template
* - u.ref.ref points to (a field of) a non-parameterized template within the same module as this.
* - this ensures that the do-while loop will run at least twice (i.e. the first continue statement will be reached in the first iteration)
*/
final Stack<ISubReference> referenceStack = new Stack<ISubReference>();
ITTCN3Template template = this;
for (; ; ) {
if (template.getTemplatetype() == Template_type.TEMPLATE_REFD) {
final Reference reference = ((Referenced_Template) template).getReference();
final Assignment assignment = reference.getRefdAssignment(CompilationTimeStamp.getBaseTimestamp(), false);
/**
* Don't follow the reference if:
* - the referenced definition is not a template
* - the referenced template is parameterized or
* - the referenced template is in different module
*/
if (assignment.getAssignmentType() == Assignment_type.A_TEMPLATE && ((Def_Template) assignment).getFormalParameterList() == null && assignment.getMyScope().getModuleScope() == myScope.getModuleScope()) {
// accumulate the sub-references of the referred reference
final List<ISubReference> subReferences = reference.getSubreferences();
if (subReferences != null && subReferences.size() > 1) {
for (int i = subReferences.size(); i > 1; i--) {
referenceStack.push(subReferences.get(i - 1));
}
}
// jump to the referred top-level template
template = ((Def_Template) assignment).getTemplate(CompilationTimeStamp.getBaseTimestamp());
// start the iteration from the beginning
continue;
} else {
// the reference cannot be followed
break;
}
}
// stop if there are no sub-references
if (referenceStack.isEmpty()) {
break;
}
// take the topmost sub-reference
final ISubReference subReference = referenceStack.peek();
if (subReference instanceof FieldSubReference) {
if (template.getTemplatetype() != Template_type.NAMED_TEMPLATE_LIST) {
break;
}
// the field reference can be followed
final Identifier fieldId = ((FieldSubReference) subReference).getId();
template = ((Named_Template_List) template).getNamedTemplate(fieldId).getTemplate();
} else {
// trying to follow an array reference
if (template.getTemplatetype() != Template_type.TEMPLATE_LIST) {
break;
}
IValue arrayIndex = ((ArraySubReference) subReference).getValue();
final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
arrayIndex = arrayIndex.getValueRefdLast(CompilationTimeStamp.getBaseTimestamp(), referenceChain);
referenceChain.release();
if (arrayIndex.getValuetype() != Value_type.INTEGER_VALUE) {
break;
}
// the index is available at compilation time
long index = ((Integer_Value) arrayIndex).getValue();
// index transformation in case of arrays
if (template.getMyGovernor().getTypetype() == Type_type.TYPE_ARRAY) {
index = index - ((Array_Type) template.getMyGovernor()).getDimension().getOffset();
}
template = ((Template_List) template).getTemplateByIndex((int) index);
}
// the topmost sub-reference was processed
// it can be erased from the stack
referenceStack.pop();
}
// the smallest dependent template is now in t
// generate the initializer sequence for t
template.generateCodeInit(aData, source, template.get_lhs_name());
// the equivalent Java code of the referenced template is composed of the
// genname of t and the remained sub-references in refstack
expression.expression.append(template.getGenNameOwn(myScope));
while (!referenceStack.isEmpty()) {
final ISubReference subReference = referenceStack.pop();
if (subReference instanceof FieldSubReference) {
expression.expression.append(MessageFormat.format(".get{0}()", FieldSubReference.getJavaGetterName(((FieldSubReference) subReference).getId().getName())));
} else {
expression.expression.append(".getAt(");
((ArraySubReference) subReference).getValue().generateCodeExpression(aData, expression, false);
expression.expression.append(')');
}
}
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Template in project titan.EclipsePlug-ins by eclipse.
the class Referenced_Template method getTemplateReferenced.
/**
* Calculates the referenced template, and while doing so checks the
* reference too.
*
* @param timestamp
* the time stamp of the actual semantic check cycle.
* @param referenceChain
* the reference chain used to detect cyclic references.
*
* @return the template referenced
*/
private ITTCN3Template getTemplateReferenced(final CompilationTimeStamp timestamp, final IReferenceChain referenceChain) {
if (reference == null) {
setIsErroneous(true);
return null;
}
final Assignment ass = reference.getRefdAssignment(timestamp, true);
if (ass == null) {
setIsErroneous(true);
return this;
}
ITTCN3Template template = null;
switch(ass.getAssignmentType()) {
case A_TEMPLATE:
template = ((Def_Template) ass).getTemplate(timestamp);
break;
case A_VAR_TEMPLATE:
((Def_Var_Template) ass).check(timestamp);
template = ((Def_Var_Template) ass).getInitialValue();
break;
case A_MODULEPAR_TEMPLATE:
template = ((Def_ModulePar_Template) ass).getDefaultTemplate();
break;
default:
setIsErroneous(true);
return this;
}
if (template != null) {
template = template.getReferencedSubTemplate(timestamp, reference, referenceChain);
}
final List<ISubReference> subreferences = reference.getSubreferences();
if (template != null) {
return template;
} else if (subreferences != null && reference.hasUnfoldableIndexSubReference(timestamp)) {
// some array indices could not be evaluated
} else if (reference.getUsedInIsbound()) {
return this;
} else {
setIsErroneous(true);
}
return this;
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Template in project titan.EclipsePlug-ins by eclipse.
the class Referenced_Template method reArrangeInitCode.
@Override
public /**
* {@inheritDoc}
*/
void reArrangeInitCode(final JavaGenData aData, final StringBuilder source, final Module usageModule) {
final ISubReference tempSubreference = reference.getSubreferences().get(0);
if (tempSubreference instanceof ParameterisedSubReference) {
// generate code for the templates that are used in the actual parameter
// list of the reference
final ActualParameterList actualParameterList = ((ParameterisedSubReference) tempSubreference).getActualParameters();
if (actualParameterList != null) {
actualParameterList.reArrangeInitCode(aData, source, usageModule);
}
}
final Assignment assignment = reference.getRefdAssignment(CompilationTimeStamp.getBaseTimestamp(), false);
if (assignment.getAssignmentType() != Assignment_type.A_TEMPLATE) {
return;
}
ITTCN3Template template = ((Def_Template) assignment).getTemplate(CompilationTimeStamp.getBaseTimestamp());
final FormalParameterList formalParameterList = ((Def_Template) assignment).getFormalParameterList();
if (formalParameterList != null) {
// the reference points to a parameterized template
// we must perform the rearrangement for all non-parameterized templates
// that are referred by the parameterized template regardless of the
// sub-references of reference
template.reArrangeInitCode(aData, source, usageModule);
// be generated when the template's definition is reached)
if (assignment.getMyScope().getModuleScope() == usageModule) {
formalParameterList.generateCodeDefaultValues(aData, source);
}
} else {
// the reference points to a non-parameterized template
final List<ISubReference> subReferences = reference.getSubreferences();
if (subReferences != null && subReferences.size() > 1) {
// and perform the rearrangement for the referred field only
for (int i = 1; i < subReferences.size(); i++) {
final ISubReference subReference = subReferences.get(i);
if (subReference instanceof FieldSubReference) {
// stop if the body does not have fields
if (template.getTemplatetype() != Template_type.NAMED_TEMPLATE_LIST) {
break;
}
// the field reference can be followed
final Identifier fieldId = ((FieldSubReference) subReference).getId();
template = ((Named_Template_List) template).getNamedTemplate(fieldId).getTemplate();
} else {
// stop if the body is not a list
if (template.getTemplatetype() != Template_type.TEMPLATE_LIST) {
break;
}
IValue arrayIndex = ((ArraySubReference) subReference).getValue();
final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
arrayIndex = arrayIndex.getValueRefdLast(CompilationTimeStamp.getBaseTimestamp(), referenceChain);
referenceChain.release();
if (arrayIndex.getValuetype() != Value_type.INTEGER_VALUE) {
break;
}
// the index is available at compilation time
long index = ((Integer_Value) arrayIndex).getValue();
// index transformation in case of arrays
if (template.getMyGovernor().getTypetype() == Type_type.TYPE_ARRAY) {
index = index - ((Array_Type) template.getMyGovernor()).getDimension().getOffset();
}
template = ((Template_List) template).getTemplateByIndex((int) index);
}
}
}
// we should initialize its entire body
if (assignment.getMyScope().getModuleScope() == usageModule) {
template.generateCodeInit(aData, source, template.get_lhs_name());
}
}
if (lengthRestriction != null) {
lengthRestriction.reArrangeInitCode(aData, source, usageModule);
}
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Template in project titan.EclipsePlug-ins by eclipse.
the class Reference method generateCodeIsPresentBoundChosen.
/**
* Generates code for checking if the reference
* and the referred objects are bound or not.
*
* generate_code_ispresentbound in the compiler
*
* @param aData only used to update imports if needed
* @param expression the expression for code generated
* @param isTemplate if the reference is pointing to a template
* @param optype true to generate code for isbound, false otherwise
*/
public void generateCodeIsPresentBoundChosen(final JavaGenData aData, final ExpressionStruct expression, final boolean isTemplate, final Operation_type optype, final String field) {
final Assignment assignment = getRefdAssignment(CompilationTimeStamp.getBaseTimestamp(), false);
final String ass_id = assignment.getGenNameFromScope(aData, expression.expression, myScope, null);
String ass_id2 = ass_id;
FormalParameterList formalParameterList;
switch(assignment.getAssignmentType()) {
case A_FUNCTION:
case A_FUNCTION_RVAL:
case A_FUNCTION_RTEMP:
formalParameterList = ((Def_Function) assignment).getFormalParameterList();
break;
case A_EXT_FUNCTION:
case A_EXT_FUNCTION_RVAL:
case A_EXT_FUNCTION_RTEMP:
formalParameterList = ((Def_Extfunction) assignment).getFormalParameterList();
break;
case A_TEMPLATE:
formalParameterList = ((Def_Template) assignment).getFormalParameterList();
break;
default:
formalParameterList = null;
break;
}
if (subReferences.size() > 0 && subReferences.get(0) instanceof ParameterisedSubReference) {
final ParameterisedSubReference subReference = (ParameterisedSubReference) subReferences.get(0);
final ExpressionStruct tempExpression = new ExpressionStruct();
// FIXME should need the formal parameters and other
// options
subReference.getActualParameters().generateCodeAlias(aData, tempExpression);
if (tempExpression.preamble.length() > 0) {
expression.preamble.append(tempExpression.preamble);
}
ass_id2 = MessageFormat.format("{0}({1})", ass_id, tempExpression.expression);
} else if (formalParameterList != null) {
// the reference does not have an actual parameter list,
// but the assignment has
final ExpressionStruct tempExpression = new ExpressionStruct();
final StringBuilder newId = new StringBuilder();
newId.append(assignment.getGenNameFromScope(aData, tempExpression.expression, getMyScope(), null));
newId.append("( ");
// ((FieldSubReference)subReferences.get(0));
for (int i = 0; i < formalParameterList.getNofParameters(); i++) {
if (i > 0) {
tempExpression.expression.append(", ");
}
formalParameterList.getParameterByIndex(i).getDefaultValue().generateCode(aData, tempExpression);
}
// expression);
if (tempExpression.preamble.length() > 0) {
expression.preamble.append(tempExpression.preamble);
}
newId.append(tempExpression.expression);
newId.append(" )");
ass_id2 = newId.toString();
}
if (subReferences.size() > 1) {
final String tempGeneralId = aData.getTemporaryVariableName();
final ExpressionStruct isboundExpression = new ExpressionStruct();
isboundExpression.preamble.append(MessageFormat.format("boolean {0} = {1}.isBound();\n", tempGeneralId, ass_id2));
final IType type = assignment.getType(CompilationTimeStamp.getBaseTimestamp());
type.generateCodeIsPresentBoundChosen(aData, isboundExpression, subReferences, 1, tempGeneralId, ass_id2, isTemplate, optype, field);
expression.preamble.append(isboundExpression.preamble);
expression.preamble.append(isboundExpression.expression);
expression.expression.append(tempGeneralId);
} else {
switch(optype) {
case ISBOUND_OPERATION:
expression.expression.append(MessageFormat.format("{0}.isBound()", ass_id2));
break;
case ISPRESENT_OPERATION:
expression.expression.append(MessageFormat.format("{0}.isPresent({1})", ass_id2, isTemplate && aData.getAllowOmitInValueList() ? "true" : ""));
break;
case ISCHOOSEN_OPERATION:
expression.expression.append(MessageFormat.format("{0}.isChosen({1})", ass_id2, field));
break;
default:
ErrorReporter.INTERNAL_ERROR("FATAL ERROR while generating code for reference `" + getFullName() + "''");
break;
}
}
}
Aggregations