Search in sources :

Example 16 with ValueCheckingOptions

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

the class FormalParameter method checkActualParameterValue.

/**
 * Checks if the actual parameter paired with this formal parameter is
 * semantically correct as a value parameter.
 *
 * @param timestamp
 *                the timestamp of the actual semantic check cycle.
 * @param actualParameter
 *                the template instance assigned as actual parameter to
 *                this formal parameter
 * @param expectedValue
 *                the value kind expected from the actual parameter.
 *
 * @return the actual parameter made from the provided parameter.
 */
private ActualParameter checkActualParameterValue(final CompilationTimeStamp timestamp, final TemplateInstance actualParameter, final Expected_Value_type expectedValue) {
    actualParameter.checkType(timestamp, type);
    final Reference derivedReference = actualParameter.getDerivedReference();
    if (derivedReference != null) {
        actualParameter.checkDerivedReference(timestamp, type);
    }
    final ITTCN3Template template = actualParameter.getTemplateBody();
    if (type != null) {
        final IValue value = template.getValue();
        if (value != null) {
            value.setMyGovernor(type);
            final IValue temp = type.checkThisValueRef(timestamp, value);
            if (!Value_type.NOTUSED_VALUE.equals(temp.getValuetype())) {
                type.checkThisValue(timestamp, temp, null, new ValueCheckingOptions(expectedValue, false, false, true, false, false));
            }
            return new Value_ActualParameter(temp);
        }
    }
    actualParameter.getLocation().reportSemanticError(MessageFormat.format(SPECIFICVALUEXPECTED, getAssignmentName()));
    final ActualParameter temp = new Value_ActualParameter(null);
    temp.setIsErroneous();
    return temp;
}
Also used : ITTCN3Template(org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template) IValue(org.eclipse.titan.designer.AST.IValue) Reference(org.eclipse.titan.designer.AST.Reference) ISubReference(org.eclipse.titan.designer.AST.ISubReference) ValueCheckingOptions(org.eclipse.titan.designer.AST.IType.ValueCheckingOptions)

Example 17 with ValueCheckingOptions

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

the class ErroneousAttributeSpecification method check.

public void check(final CompilationTimeStamp timestamp, final Scope scope) {
    templateInst.setMyScope(scope);
    if (isOmit()) {
        // special case, no type needed
        if (indicator == Indicator_Type.Before_Indicator || indicator == Indicator_Type.After_Indicator) {
            if (!hasAllKeyword) {
                final String message = MessageFormat.format("Keyword `all'' is expected after `omit'' when omitting all fields {0} the specified field", indicator.getDisplayName());
                templateInst.getLocation().reportSemanticError(message);
            }
        } else {
            if (hasAllKeyword) {
                templateInst.getLocation().reportSemanticError("Unexpected `all' keyword after `omit' when omitting one field");
            }
        }
        type = null;
        return;
    }
    if (hasAllKeyword) {
        templateInst.getLocation().reportSemanticError("Unexpected `all' keyword after the in-line template");
    }
    // determine the type of the tmpl_inst
    type = templateInst.getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_TEMPLATE);
    if (type == null) {
        templateInst.getTemplateBody().setLoweridToReference(timestamp);
        type = templateInst.getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_TEMPLATE);
    }
    if (type == null) {
        templateInst.getLocation().reportSemanticError("Cannot determine the type of the in-line template");
        return;
    }
    type.check(timestamp);
    final IType typeLast = type.getTypeRefdLast(timestamp);
    if (typeLast == null || typeLast.getIsErroneous(timestamp)) {
        type = null;
        return;
    }
    if (isRaw) {
        switch(typeLast.getTypetypeTtcn3()) {
            case TYPE_BITSTRING:
            case TYPE_OCTETSTRING:
            case TYPE_CHARSTRING:
            case TYPE_UCHARSTRING:
                break;
            default:
                templateInst.getLocation().reportSemanticError(MessageFormat.format("An in-line template of type `{0}'' cannot be used as a `raw'' erroneous value", typeLast.getTypename()));
        }
    }
    if (templateInst.getDerivedReference() != null) {
        templateInst.getLocation().reportSemanticError("Reference to a constant value was expected instead of an in-line modified template");
        type = null;
        return;
    }
    final ITTCN3Template templ = templateInst.getTemplateBody();
    if (templ.isValue(timestamp)) {
        value = templ.getValue();
        value.setMyGovernor(type);
        type.checkThisValueRef(timestamp, value);
        type.checkThisValue(timestamp, value, null, new ValueCheckingOptions(Expected_Value_type.EXPECTED_CONSTANT, false, false, true, false, false));
    } else {
        templateInst.getLocation().reportSemanticError("A specific value without matching symbols was expected");
        type = null;
        return;
    }
}
Also used : ITTCN3Template(org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template) ValueCheckingOptions(org.eclipse.titan.designer.AST.IType.ValueCheckingOptions) IType(org.eclipse.titan.designer.AST.IType)

Example 18 with ValueCheckingOptions

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

the class Def_Const method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp, final IReferenceChain refChain) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    lastTimeChecked = timestamp;
    isUsed = false;
    if (getMyScope() instanceof ComponentTypeBody) {
        NamingConventionHelper.checkConvention(PreferenceConstants.REPORTNAMINGCONVENTION_COMPONENT_CONSTANT, identifier, this);
    } else if (isLocal()) {
        NamingConventionHelper.checkConvention(PreferenceConstants.REPORTNAMINGCONVENTION_LOCAL_CONSTANT, identifier, this);
    } else {
        NamingConventionHelper.checkConvention(PreferenceConstants.REPORTNAMINGCONVENTION_GLOBAL_CONSTANT, identifier, this);
    }
    NamingConventionHelper.checkNameContents(identifier, getMyScope().getModuleScope().getIdentifier(), getDescription());
    if (type == null) {
        return;
    }
    T3Doc.check(this.getCommentLocation(), KIND, this.type.getTypetype());
    type.setGenName("_T_", getGenName());
    type.check(timestamp);
    if (withAttributesPath != null) {
        withAttributesPath.checkGlobalAttributes(timestamp, true);
        withAttributesPath.checkAttributes(timestamp, type.getTypeRefdLast(timestamp).getTypetype());
    }
    if (value == null) {
        return;
    }
    value.setMyGovernor(type);
    final IValue temporalValue = type.checkThisValueRef(timestamp, value);
    final IType lastType = type.getTypeRefdLast(timestamp);
    switch(lastType.getTypetype()) {
        case TYPE_PORT:
            location.reportSemanticError(MessageFormat.format(PORTNOTALLOWED, lastType.getFullName()));
            break;
        case TYPE_SIGNATURE:
            location.reportSemanticError(MessageFormat.format(SIGNATURENOTALLOWED, lastType.getFullName()));
            break;
        default:
            break;
    }
    type.checkThisValue(timestamp, temporalValue, null, new ValueCheckingOptions(Expected_Value_type.EXPECTED_CONSTANT, true, false, true, hasImplicitOmitAttribute(timestamp), false));
    checkErroneousAttributes(timestamp);
    final IReferenceChain chain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
    chain.add(this);
    temporalValue.checkRecursions(timestamp, chain);
    chain.release();
    // value.setGenNamePrefix("const_");//currently does not need the prefix
    value.setGenNameRecursive(getGenName());
    value.setCodeSection(CodeSectionType.CS_PRE_INIT);
}
Also used : ComponentTypeBody(org.eclipse.titan.designer.AST.TTCN3.types.ComponentTypeBody) IValue(org.eclipse.titan.designer.AST.IValue) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain) ValueCheckingOptions(org.eclipse.titan.designer.AST.IType.ValueCheckingOptions) IType(org.eclipse.titan.designer.AST.IType)

Example 19 with ValueCheckingOptions

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

the class ExpressionUtilities method checkExpressionOperatorCompatibilityInternal.

// the same as the previous but the last arg is template
private static void checkExpressionOperatorCompatibilityInternal(final CompilationTimeStamp timestamp, final Expression_Value expression, final IReferenceChain referenceChain, final Expected_Value_type expectedValue, final IValue param1, final TemplateInstance param2) {
    if (expression == null || param1 == null || param2 == null) {
        return;
    }
    if (param1.getIsErroneous(timestamp) || param2.getTemplateBody().getIsErroneous(timestamp)) {
        expression.setIsErroneous(true);
        return;
    }
    IValue operand1 = param1;
    final TemplateInstance operand2 = param2;
    final Type_type tempType1 = operand1.getExpressionReturntype(timestamp, expectedValue);
    final Type_type tempType2 = operand2.getExpressionReturntype(timestamp, expectedValue);
    ITTCN3Template temp2 = operand2.getTemplateBody();
    if (Type_type.TYPE_UNDEFINED.equals(tempType1)) {
        if (Type_type.TYPE_UNDEFINED.equals(tempType2)) {
            if (Value_type.UNDEFINED_LOWERIDENTIFIER_VALUE.equals(operand1.getValuetype())) {
                if (Template_type.SPECIFIC_VALUE.equals(temp2.getTemplatetype()) && Value_type.UNDEFINED_LOWERIDENTIFIER_VALUE.equals(((SpecificValue_Template) temp2).getSpecificValue().getValuetype())) {
                    final Scope scope = expression.getMyScope();
                    final Module module = scope.getModuleScope();
                    final Identifier identifier = ((Undefined_LowerIdentifier_Value) operand1).getIdentifier();
                    if (scope.hasAssignmentWithId(timestamp, identifier) || module.hasImportedAssignmentWithID(timestamp, identifier)) {
                        operand1 = operand1.setLoweridToReference(timestamp);
                        checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, operand2);
                        return;
                    }
                    final Identifier identifier2 = ((Undefined_LowerIdentifier_Value) ((SpecificValue_Template) temp2).getSpecificValue()).getIdentifier();
                    if (scope.hasAssignmentWithId(timestamp, identifier2) || module.hasImportedAssignmentWithID(timestamp, identifier2)) {
                        temp2 = temp2.setLoweridToReference(timestamp);
                        checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, operand2);
                        return;
                    }
                } else {
                    operand1 = operand1.setLoweridToReference(timestamp);
                    checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, operand2);
                    return;
                }
            } else if (Template_type.SPECIFIC_VALUE.equals(temp2.getTemplatetype()) && Value_type.UNDEFINED_LOWERIDENTIFIER_VALUE.equals(((SpecificValue_Template) temp2).getSpecificValue().getValuetype())) {
                temp2 = temp2.setLoweridToReference(timestamp);
                // To avoid infinite loop:
                final TemplateInstance tempTemplateInstance2 = new TemplateInstance(operand2.getType(), operand2.getDerivedReference(), (TTCN3Template) temp2);
                if (operand2 == tempTemplateInstance2) {
                    return;
                }
                checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, tempTemplateInstance2);
                return;
            }
            if (operand1.getIsErroneous(timestamp) || temp2.getIsErroneous(timestamp)) {
                expression.setIsErroneous(true);
                return;
            }
            expression.getLocation().reportSemanticError(UNDETERMINABLEOPERANDSERROR);
            expression.setIsErroneous(true);
            return;
        }
        if (Value_type.UNDEFINED_LOWERIDENTIFIER_VALUE.equals(operand1.getValuetype()) && !Type_type.TYPE_TTCN3_ENUMERATED.equals(tempType2)) {
            operand1 = operand1.setLoweridToReference(timestamp);
            checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, operand2);
            return;
        }
    } else if (Type_type.TYPE_UNDEFINED.equals(tempType2)) {
        if (Template_type.SPECIFIC_VALUE.equals(temp2.getTemplatetype()) && Value_type.UNDEFINED_LOWERIDENTIFIER_VALUE.equals(((SpecificValue_Template) temp2).getSpecificValue().getValuetype()) && !Type_type.TYPE_TTCN3_ENUMERATED.equals(tempType1)) {
            temp2 = temp2.setLoweridToReference(timestamp);
            // To avoid infinite loop:
            final TemplateInstance tempTemplateInstance2 = new TemplateInstance(operand2.getType(), operand2.getDerivedReference(), (TTCN3Template) temp2);
            if (operand2 == tempTemplateInstance2) {
                return;
            }
            checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, tempTemplateInstance2);
            return;
        }
    }
    final IType type1 = operand1.getExpressionGovernor(timestamp, expectedValue);
    final IType type2 = operand2.getExpressionGovernor(timestamp, expectedValue);
    if (operand1.getIsErroneous(timestamp) || temp2.getIsErroneous(timestamp)) {
        expression.setIsErroneous(true);
        return;
    }
    if (type1 != null) {
        if (type2 != null) {
            final TypeCompatibilityInfo info1 = new TypeCompatibilityInfo(type1, type2, true);
            final TypeCompatibilityInfo info2 = new TypeCompatibilityInfo(type2, type1, true);
            final boolean retVal1 = type1.isCompatible(timestamp, type2, info1, null, null);
            final boolean retVal2 = type2.isCompatible(timestamp, type1, info2, null, null);
            if (!retVal1 && !retVal2) {
                expression.getLocation().reportSemanticError(info1.toString());
                expression.setIsErroneous(true);
                return;
            }
            if (GeneralConstants.WARNING.equals(typeCompatibilitySeverity)) {
                if (info1.getNeedsConversion()) {
                    expression.getLocation().reportSemanticWarning(MessageFormat.format(TYPECOMPATWARNING, type1.getTypename(), type2.getTypename()));
                } else if (info2.getNeedsConversion()) {
                    expression.getLocation().reportSemanticWarning(MessageFormat.format(TYPECOMPATWARNING, type2.getTypename(), type1.getTypename()));
                }
            }
        } else {
            temp2.setMyGovernor(type1);
            final ITTCN3Template tempValue = type1.checkThisTemplateRef(timestamp, temp2);
            if (Template_type.OMIT_VALUE.equals(temp2.getTemplatetype()) || (Template_type.SPECIFIC_VALUE.equals(temp2.getTemplatetype()) && Value_type.OMIT_VALUE.equals(((SpecificValue_Template) temp2).getSpecificValue().getValuetype()))) {
                operand1.checkExpressionOmitComparison(timestamp, expectedValue);
            } else {
                type1.checkThisTemplate(timestamp, tempValue, false, false, null);
                final TemplateInstance tempTemplateInstance2 = new TemplateInstance(operand2.getType(), operand2.getDerivedReference(), (TTCN3Template) tempValue);
                if (operand2 == tempTemplateInstance2) {
                    return;
                }
                checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, tempTemplateInstance2);
                return;
            }
        }
    } else if (type2 != null) {
        operand1.setMyGovernor(type2);
        final IValue tempValue = type2.checkThisValueRef(timestamp, operand1);
        if (Value_type.OMIT_VALUE.equals(operand1.getValuetype())) {
        // temp2.check_expression_omit_comparison(timestamp,
        // expectedValue); ???
        } else {
            type2.checkThisValue(timestamp, tempValue, null, new ValueCheckingOptions(expectedValue, false, false, false, false, false));
            checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, tempValue, operand2);
            return;
        }
    } else {
        if (Type_type.TYPE_UNDEFINED.equals(tempType1) || Type_type.TYPE_UNDEFINED.equals(tempType2)) {
            expression.getLocation().reportSemanticError(PLEASEUSEREFERENCES);
            expression.setIsErroneous(true);
            return;
        }
        if (!Type.isCompatible(timestamp, tempType1, tempType2, false, false) && !Type.isCompatible(timestamp, tempType2, tempType1, false, false)) {
            expression.getLocation().reportSemanticError(INCOMPATIBLEOPERANDERROR);
            expression.setIsErroneous(true);
        }
    }
}
Also used : ITTCN3Template(org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template) TemplateInstance(org.eclipse.titan.designer.AST.TTCN3.templates.TemplateInstance) IType(org.eclipse.titan.designer.AST.IType) IValue(org.eclipse.titan.designer.AST.IValue) Identifier(org.eclipse.titan.designer.AST.Identifier) SpecificValue_Template(org.eclipse.titan.designer.AST.TTCN3.templates.SpecificValue_Template) Scope(org.eclipse.titan.designer.AST.Scope) Type_type(org.eclipse.titan.designer.AST.IType.Type_type) ITTCN3Template(org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template) TTCN3Template(org.eclipse.titan.designer.AST.TTCN3.templates.TTCN3Template) TypeCompatibilityInfo(org.eclipse.titan.designer.AST.TypeCompatibilityInfo) ValueCheckingOptions(org.eclipse.titan.designer.AST.IType.ValueCheckingOptions) Module(org.eclipse.titan.designer.AST.Module) Undefined_LowerIdentifier_Value(org.eclipse.titan.designer.AST.TTCN3.values.Undefined_LowerIdentifier_Value)

Example 20 with ValueCheckingOptions

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

the class ExpressionUtilities method checkExpressionOperatorCompatibilityInternal.

/**
 * Checks the compatibility of expression operands in cases where
 * operands are compared (and one or both of them can be enumerations).
 *
 * @param timestamp
 *                the timestamp of the actual semantic check cycle.
 * @param expression
 *                the original expression this check should be performed
 *                on (used to report errors if there are any)
 * @param referenceChain
 *                an initialized reference chain to help detecting
 *                circular references.
 * @param expectedValue
 *                the kind of the value to be expected.
 * @param param1
 *                the first operand.
 * @param param2
 *                the second operand.
 */
private static void checkExpressionOperatorCompatibilityInternal(final CompilationTimeStamp timestamp, final Expression_Value expression, final IReferenceChain referenceChain, final Expected_Value_type expectedValue, final IValue param1, final IValue param2) {
    if (expression == null || param1 == null || param2 == null) {
        return;
    }
    if (param1.getIsErroneous(timestamp) || param2.getIsErroneous(timestamp)) {
        expression.setIsErroneous(true);
        return;
    }
    IValue operand1 = param1;
    IValue operand2 = param2;
    final Type_type tempType1 = operand1.getExpressionReturntype(timestamp, expectedValue);
    final Type_type tempType2 = operand2.getExpressionReturntype(timestamp, expectedValue);
    if (Type_type.TYPE_UNDEFINED.equals(tempType1)) {
        if (Type_type.TYPE_UNDEFINED.equals(tempType2)) {
            if (Value_type.UNDEFINED_LOWERIDENTIFIER_VALUE.equals(operand1.getValuetype())) {
                if (Value_type.UNDEFINED_LOWERIDENTIFIER_VALUE.equals(operand2.getValuetype())) {
                    final Scope scope = expression.getMyScope();
                    final Module module = scope.getModuleScope();
                    final Identifier identifier = ((Undefined_LowerIdentifier_Value) operand1).getIdentifier();
                    if (scope.hasAssignmentWithId(timestamp, identifier) || module.hasImportedAssignmentWithID(timestamp, identifier)) {
                        operand1 = operand1.setLoweridToReference(timestamp);
                        checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, operand2);
                        return;
                    }
                    final Identifier identifier2 = ((Undefined_LowerIdentifier_Value) operand2).getIdentifier();
                    if (scope.hasAssignmentWithId(timestamp, identifier2) || module.hasImportedAssignmentWithID(timestamp, identifier2)) {
                        operand2 = operand2.setLoweridToReference(timestamp);
                        checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, operand2);
                        return;
                    }
                } else {
                    operand1 = operand1.setLoweridToReference(timestamp);
                    checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, operand2);
                    return;
                }
            } else if (Value_type.UNDEFINED_LOWERIDENTIFIER_VALUE.equals(operand2.getValuetype())) {
                operand2 = operand2.setLoweridToReference(timestamp);
                checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, operand2);
                return;
            }
            if (operand1.getIsErroneous(timestamp) || operand2.getIsErroneous(timestamp)) {
                expression.setIsErroneous(true);
                return;
            }
            expression.getLocation().reportSemanticError(UNDETERMINABLEOPERANDSERROR);
            expression.setIsErroneous(true);
            return;
        }
        if (Value_type.UNDEFINED_LOWERIDENTIFIER_VALUE.equals(operand1.getValuetype()) && !Type_type.TYPE_TTCN3_ENUMERATED.equals(tempType2)) {
            operand1 = operand1.setLoweridToReference(timestamp);
            checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, operand2);
            return;
        }
    } else if (Type_type.TYPE_UNDEFINED.equals(tempType2)) {
        if (Value_type.UNDEFINED_LOWERIDENTIFIER_VALUE.equals(operand2.getValuetype()) && !Type_type.TYPE_TTCN3_ENUMERATED.equals(tempType1)) {
            operand2 = operand2.setLoweridToReference(timestamp);
            checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, operand2);
            return;
        }
    }
    final IType type1 = operand1.getExpressionGovernor(timestamp, expectedValue);
    final IType type2 = operand2.getExpressionGovernor(timestamp, expectedValue);
    if (operand1.getIsErroneous(timestamp) || operand2.getIsErroneous(timestamp)) {
        expression.setIsErroneous(true);
        return;
    }
    if (type1 != null) {
        if (type2 != null) {
            final TypeCompatibilityInfo info1 = new TypeCompatibilityInfo(type1, type2, true);
            final TypeCompatibilityInfo info2 = new TypeCompatibilityInfo(type2, type1, true);
            final boolean retVal1 = type1.isCompatible(timestamp, type2, info1, null, null);
            final boolean retVal2 = type2.isCompatible(timestamp, type1, info2, null, null);
            if (!retVal1 && !retVal2) {
                expression.getLocation().reportSemanticError(info1.toString());
                expression.setIsErroneous(true);
                return;
            }
            if (GeneralConstants.WARNING.equals(typeCompatibilitySeverity)) {
                if (info1.getNeedsConversion()) {
                    expression.getLocation().reportSemanticWarning(MessageFormat.format(TYPECOMPATWARNING, type1.getTypename(), type2.getTypename()));
                } else if (info2.getNeedsConversion()) {
                    expression.getLocation().reportSemanticWarning(MessageFormat.format(TYPECOMPATWARNING, type2.getTypename(), type1.getTypename()));
                }
            }
        } else {
            operand2.setMyGovernor(type1);
            final IValue tempValue = type1.checkThisValueRef(timestamp, operand2);
            if (Value_type.OMIT_VALUE.equals(operand2.getValuetype())) {
                operand1.checkExpressionOmitComparison(timestamp, expectedValue);
            } else {
                type1.checkThisValue(timestamp, tempValue, null, new ValueCheckingOptions(expectedValue, false, false, false, false, false));
                checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, operand1, tempValue);
                return;
            }
        }
    } else if (type2 != null) {
        operand1.setMyGovernor(type2);
        final IValue tempValue = type2.checkThisValueRef(timestamp, operand1);
        if (Value_type.OMIT_VALUE.equals(operand1.getValuetype())) {
            operand2.checkExpressionOmitComparison(timestamp, expectedValue);
        } else {
            type2.checkThisValue(timestamp, tempValue, null, new ValueCheckingOptions(expectedValue, false, false, false, false, false));
            checkExpressionOperatorCompatibilityInternal(timestamp, expression, referenceChain, expectedValue, tempValue, operand2);
            return;
        }
    } else {
        if (Type_type.TYPE_UNDEFINED.equals(tempType1) || Type_type.TYPE_UNDEFINED.equals(tempType2)) {
            expression.getLocation().reportSemanticError(PLEASEUSEREFERENCES);
            expression.setIsErroneous(true);
            return;
        }
        if (!Type.isCompatible(timestamp, tempType1, tempType2, false, false) && !Type.isCompatible(timestamp, tempType2, tempType1, false, false)) {
            expression.getLocation().reportSemanticError(INCOMPATIBLEOPERANDERROR);
            expression.setIsErroneous(true);
        }
    }
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Identifier(org.eclipse.titan.designer.AST.Identifier) Scope(org.eclipse.titan.designer.AST.Scope) Type_type(org.eclipse.titan.designer.AST.IType.Type_type) TypeCompatibilityInfo(org.eclipse.titan.designer.AST.TypeCompatibilityInfo) ValueCheckingOptions(org.eclipse.titan.designer.AST.IType.ValueCheckingOptions) Module(org.eclipse.titan.designer.AST.Module) Undefined_LowerIdentifier_Value(org.eclipse.titan.designer.AST.TTCN3.values.Undefined_LowerIdentifier_Value) IType(org.eclipse.titan.designer.AST.IType)

Aggregations

ValueCheckingOptions (org.eclipse.titan.designer.AST.IType.ValueCheckingOptions)24 IValue (org.eclipse.titan.designer.AST.IValue)22 IType (org.eclipse.titan.designer.AST.IType)18 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)7 ITTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template)5 Reference (org.eclipse.titan.designer.AST.Reference)4 Charstring_Value (org.eclipse.titan.designer.AST.TTCN3.values.Charstring_Value)4 ISubReference (org.eclipse.titan.designer.AST.ISubReference)3 Type_type (org.eclipse.titan.designer.AST.IType.Type_type)3 Identifier (org.eclipse.titan.designer.AST.Identifier)3 Module (org.eclipse.titan.designer.AST.Module)3 UniversalCharstring_Value (org.eclipse.titan.designer.AST.TTCN3.values.UniversalCharstring_Value)3 BridgingNamedNode (org.eclipse.titan.designer.AST.BridgingNamedNode)2 Scope (org.eclipse.titan.designer.AST.Scope)2 ComponentTypeBody (org.eclipse.titan.designer.AST.TTCN3.types.ComponentTypeBody)2 Integer_Type (org.eclipse.titan.designer.AST.TTCN3.types.Integer_Type)2 Real_Value (org.eclipse.titan.designer.AST.TTCN3.values.Real_Value)2 Referenced_Value (org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value)2 Undefined_LowerIdentifier_Value (org.eclipse.titan.designer.AST.TTCN3.values.Undefined_LowerIdentifier_Value)2 UniversalCharstring (org.eclipse.titan.designer.AST.TTCN3.values.UniversalCharstring)2