use of org.eclipse.titan.designer.AST.TTCN3.templates.Referenced_Template in project titan.EclipsePlug-ins by eclipse.
the class Referenced_Template method hasTemplateImpliciteOmit.
/**
* Returns whether in the chain of referenced templates there is one
* which was defined to have the implicit omit attribute set
*
* @param timestamp
* the time stamp of the actual semantic check cycle.
* @param referenceChain
* the ReferenceChain used to detect circular references
*
* @return true if it has, false otherwise.
*/
private boolean hasTemplateImpliciteOmit(final CompilationTimeStamp timestamp, final IReferenceChain referenceChain) {
final boolean newChain = null == referenceChain;
IReferenceChain tempReferenceChain;
if (newChain) {
tempReferenceChain = ReferenceChain.getInstance(CIRCULARTEMPLATEREFERENCE, true);
} else {
tempReferenceChain = referenceChain;
}
boolean result = false;
if (reference != null) {
final Assignment ass = reference.getRefdAssignment(timestamp, true);
if (ass != null && ass.getAssignmentType() == Assignment_type.A_TEMPLATE) {
final Def_Template templateDefinition = (Def_Template) ass;
if (templateDefinition.hasImplicitOmitAttribute(timestamp)) {
result = true;
} else {
tempReferenceChain.markState();
if (tempReferenceChain.add(this)) {
final ITTCN3Template refd = getTemplateReferenced(timestamp, tempReferenceChain);
if (refd != this && refd instanceof Referenced_Template) {
result = ((Referenced_Template) refd).hasTemplateImpliciteOmit(timestamp, referenceChain);
}
} else {
setIsErroneous(true);
}
tempReferenceChain.previousState();
}
}
}
if (newChain) {
tempReferenceChain.release();
}
return result;
}
Aggregations