Search in sources :

Example 16 with Referenced_Template

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;
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) Def_Template(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Template) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain)

Aggregations

IValue (org.eclipse.titan.designer.AST.IValue)12 ITTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template)12 Assignment (org.eclipse.titan.designer.AST.Assignment)11 SpecificValue_Template (org.eclipse.titan.designer.AST.TTCN3.templates.SpecificValue_Template)10 Reference (org.eclipse.titan.designer.AST.Reference)8 Referenced_Template (org.eclipse.titan.designer.AST.TTCN3.templates.Referenced_Template)8 Referenced_Value (org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value)8 TTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.TTCN3Template)7 ISubReference (org.eclipse.titan.designer.AST.ISubReference)4 IType (org.eclipse.titan.designer.AST.IType)4 Expected_Value_type (org.eclipse.titan.designer.AST.TTCN3.Expected_Value_type)4 BridgingNamedNode (org.eclipse.titan.designer.AST.BridgingNamedNode)3 FieldSubReference (org.eclipse.titan.designer.AST.FieldSubReference)2 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)2 ParameterisedSubReference (org.eclipse.titan.designer.AST.ParameterisedSubReference)2 Boolean_Value (org.eclipse.titan.designer.AST.TTCN3.values.Boolean_Value)2 Stack (java.util.Stack)1 ASN1_Choice_Type (org.eclipse.titan.designer.AST.ASN1.types.ASN1_Choice_Type)1 Open_Type (org.eclipse.titan.designer.AST.ASN1.types.Open_Type)1 ArraySubReference (org.eclipse.titan.designer.AST.ArraySubReference)1