Search in sources :

Example 21 with IReferenceChain

use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.

the class TTCN3_Null_Value method checkEquality.

@Override
public /**
 * {@inheritDoc}
 */
boolean checkEquality(final CompilationTimeStamp timestamp, final IValue other) {
    final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
    final IValue last = other.getValueRefdLast(timestamp, referenceChain);
    referenceChain.release();
    return getValuetype().equals(last.getValuetype());
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain)

Example 22 with IReferenceChain

use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.

the class Testcase_Reference_Value method checkEquality.

@Override
public /**
 * {@inheritDoc}
 */
boolean checkEquality(final CompilationTimeStamp timestamp, final IValue other) {
    final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
    final IValue last = other.getValueRefdLast(timestamp, referenceChain);
    referenceChain.release();
    return Value_type.TESTCASE_REFERENCE_VALUE.equals(last.getValuetype()) && referredTestcase == ((Testcase_Reference_Value) last).getReferredTestcase();
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain)

Example 23 with IReferenceChain

use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.

the class ActivateDereferedExpression method generateCodeExpressionExpression.

@Override
public /**
 * {@inheritDoc}
 */
void generateCodeExpressionExpression(final JavaGenData aData, final ExpressionStruct expression) {
    final IReferenceChain chain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
    final IValue last = value.getValueRefdLast(CompilationTimeStamp.getBaseTimestamp(), chain);
    chain.release();
    if (last.getValuetype() == Value_type.ALTSTEP_REFERENCE_VALUE) {
        // the referred testcase is known
        final Def_Testcase testcase = ((Testcase_Reference_Value) last).getReferredTestcase();
        expression.expression.append(MessageFormat.format("{0}(", testcase.getGenNameFromScope(aData, expression.expression, myScope, "activate_")));
    } else {
        // the referred testcase is unknown
        value.generateCodeExpressionMandatory(aData, expression, true);
        expression.expression.append(".activate(");
    }
    actualParameters.generateCodeAlias(aData, expression);
    expression.expression.append(')');
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Def_Testcase(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Testcase) Testcase_Reference_Value(org.eclipse.titan.designer.AST.TTCN3.values.Testcase_Reference_Value) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain)

Example 24 with IReferenceChain

use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.

the class Def_ModulePar_Template method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp, final IReferenceChain refChain) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    lastTimeChecked = timestamp;
    T3Doc.check(this.getCommentLocation(), KIND);
    isUsed = false;
    NamingConventionHelper.checkConvention(PreferenceConstants.REPORTNAMINGCONVENTION_MODULEPAR, identifier, this);
    NamingConventionHelper.checkNameContents(identifier, getMyScope().getModuleScope().getIdentifier(), getDescription());
    if (withAttributesPath != null) {
        withAttributesPath.checkGlobalAttributes(timestamp, false);
        withAttributesPath.checkAttributes(timestamp);
    }
    if (type == null) {
        return;
    }
    type.setGenName("_T_", getGenName());
    type.check(timestamp);
    final IType lastType = type.getTypeRefdLast(timestamp);
    switch(lastType.getTypetype()) {
        case TYPE_PORT:
            location.reportSemanticError(MessageFormat.format(Def_ModulePar.PORTNOTALLOWED, lastType.getFullName()));
            break;
        case TYPE_SIGNATURE:
            location.reportSemanticError(MessageFormat.format(Def_ModulePar.SIGNATURENOTALLOWED, lastType.getFullName()));
            break;
        case TYPE_FUNCTION:
        case TYPE_ALTSTEP:
        case TYPE_TESTCASE:
            if (((Function_Type) lastType).isRunsOnSelf()) {
                location.reportSemanticError(MessageFormat.format(Def_ModulePar.RUNSONSELF_NOT_ALLOWED, lastType.getFullName()));
            }
            break;
        default:
            break;
    }
    if (defaultTemplate != null) {
        realTemplate = defaultTemplate;
        // Needed in case of universal charstring templates
        if (defaultTemplate.getTemplatetype() == Template_type.CSTR_PATTERN && lastType.getTypetype() == Type.Type_type.TYPE_UCHARSTRING) {
            realTemplate = defaultTemplate.setTemplatetype(timestamp, Template_type.USTR_PATTERN);
        // FIXME implement setting the pattern type,
        // once universal charstring pattern are
        // supported.
        }
        final ITTCN3Template temporalTemplate = type.checkThisTemplateRef(timestamp, realTemplate);
        temporalTemplate.checkThisTemplateGeneric(timestamp, type, false, true, true, true, false, null);
        final IReferenceChain tempReferenceChain = ReferenceChain.getInstance(Def_Template.CIRCULAREMBEDDEDRECURSION, true);
        tempReferenceChain.add(this);
        temporalTemplate.checkRecursions(timestamp, tempReferenceChain);
        tempReferenceChain.release();
        // defaultTemplate.setGenNamePrefix("modulepar_");//currently does not need the prefix
        defaultTemplate.setGenNameRecursive(getGenName());
        defaultTemplate.setCodeSection(CodeSectionType.CS_PRE_INIT);
    }
}
Also used : ITTCN3Template(org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain) Function_Type(org.eclipse.titan.designer.AST.TTCN3.types.Function_Type) IType(org.eclipse.titan.designer.AST.IType)

Example 25 with IReferenceChain

use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.

the class Def_Template method checkRecursiveDerivation.

/**
 * Checks if the derivation chain of the templates is recursive or not.
 *
 * @param timestamp
 *                the timestamp of the actual semantic check cycle
 */
private void checkRecursiveDerivation(final CompilationTimeStamp timestamp) {
    if (recursiveDerivationChecked != null && !recursiveDerivationChecked.isLess(timestamp)) {
        return;
    }
    if (baseTemplate != null) {
        final IReferenceChain tempReferenceChain = ReferenceChain.getInstance(CIRCULARBASETEMPLATES, true);
        tempReferenceChain.add(this);
        Def_Template iterator = baseTemplate;
        while (iterator != null) {
            if (iterator.recursiveDerivationChecked != null && !iterator.recursiveDerivationChecked.isLess(timestamp)) {
                break;
            }
            if (tempReferenceChain.add(iterator)) {
                iterator.recursiveDerivationChecked = timestamp;
            } else {
                break;
            }
            iterator = iterator.baseTemplate;
        }
        tempReferenceChain.release();
    }
    recursiveDerivationChecked = timestamp;
}
Also used : IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain)

Aggregations

IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)154 IValue (org.eclipse.titan.designer.AST.IValue)102 IType (org.eclipse.titan.designer.AST.IType)55 Integer_Value (org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value)21 ISubReference (org.eclipse.titan.designer.AST.ISubReference)18 Value (org.eclipse.titan.designer.AST.Value)18 Assignment (org.eclipse.titan.designer.AST.Assignment)16 BigInteger (java.math.BigInteger)15 IReferencingType (org.eclipse.titan.designer.AST.IReferencingType)14 ArraySubReference (org.eclipse.titan.designer.AST.ArraySubReference)13 Identifier (org.eclipse.titan.designer.AST.Identifier)12 Reference (org.eclipse.titan.designer.AST.Reference)9 ExpressionStruct (org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)8 ValueCheckingOptions (org.eclipse.titan.designer.AST.IType.ValueCheckingOptions)7 Expression_Value (org.eclipse.titan.designer.AST.TTCN3.values.Expression_Value)7 HashMap (java.util.HashMap)6 FieldSubReference (org.eclipse.titan.designer.AST.FieldSubReference)6 Referenced_Type (org.eclipse.titan.designer.AST.TTCN3.types.Referenced_Type)6 Real_Value (org.eclipse.titan.designer.AST.TTCN3.values.Real_Value)6 ParameterisedSubReference (org.eclipse.titan.designer.AST.ParameterisedSubReference)5