Search in sources :

Example 31 with Type_type

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

the class Oct2UnicharExpression 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.
 */
private void checkExpressionOperands(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
    if (value == null) {
        return;
    }
    value.setLoweridToReference(timestamp);
    final Type_type tempType = value.getExpressionReturntype(timestamp, expectedValue);
    switch(tempType) {
        case TYPE_OCTETSTRING:
            // TODO: uncomment and implement missing part if range check is needed
            break;
        case TYPE_UNDEFINED:
            setIsErroneous(true);
            break;
        default:
            if (!value.getIsErroneous(timestamp)) {
                location.reportSemanticError(OPERANDERROR1);
                setIsErroneous(true);
            }
            break;
    }
    if (code_string == null) {
        return;
    }
    code_string.setLoweridToReference(timestamp);
    final Type_type tempType2 = code_string.getExpressionReturntype(timestamp, expectedValue);
    switch(tempType2) {
        case TYPE_CHARSTRING:
            // TODO: implement missing part if range check is needed
            return;
        case TYPE_UNDEFINED:
            setIsErroneous(true);
            return;
        default:
            if (!code_string.getIsErroneous(timestamp)) {
                location.reportSemanticError(OPERANDERROR2);
                setIsErroneous(true);
            }
            return;
    }
}
Also used : Type_type(org.eclipse.titan.designer.AST.IType.Type_type)

Example 32 with Type_type

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

the class OrExpression 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.
 */
private void checkExpressionOperands(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
    Type_type tempType1 = null;
    Type_type tempType2 = null;
    if (value1 != null) {
        value1.setLoweridToReference(timestamp);
        tempType1 = value1.getExpressionReturntype(timestamp, expectedValue);
        switch(tempType1) {
            case TYPE_BOOL:
                value1.getValueRefdLast(timestamp, expectedValue, referenceChain);
                break;
            case TYPE_UNDEFINED:
                setIsErroneous(true);
                break;
            default:
                value1.getLocation().reportSemanticError(FIRSTOPERANDERROR);
                setIsErroneous(true);
                break;
        }
    }
    if (value2 != null) {
        value2.setLoweridToReference(timestamp);
        tempType2 = value2.getExpressionReturntype(timestamp, expectedValue);
        switch(tempType2) {
            case TYPE_BOOL:
                value2.getValueRefdLast(timestamp, expectedValue, referenceChain);
                break;
            case TYPE_UNDEFINED:
                setIsErroneous(true);
                break;
            default:
                value2.getLocation().reportSemanticError(SECONDOPERANDERROR);
                setIsErroneous(true);
                break;
        }
    }
}
Also used : Type_type(org.eclipse.titan.designer.AST.IType.Type_type)

Example 33 with Type_type

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

the class DecodeBase64Expression 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.
 */
private void checkExpressionOperands(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
    if (value == null) {
        return;
    }
    value.setLoweridToReference(timestamp);
    final Type_type tempType = value.getExpressionReturntype(timestamp, expectedValue);
    switch(tempType) {
        case TYPE_CHARSTRING:
            value.getValueRefdLast(timestamp, expectedValue, referenceChain);
            return;
        case TYPE_UNDEFINED:
            setIsErroneous(true);
            return;
        default:
            if (!isErroneous) {
                location.reportSemanticError(OPERANDERROR);
                setIsErroneous(true);
            }
            return;
    }
}
Also used : Type_type(org.eclipse.titan.designer.AST.IType.Type_type)

Example 34 with Type_type

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

the class DecvalueUnicharExpression method checkExpressionOperand1.

/**
 * Checks the 1st operand
 * inout universal charstring
 * @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.
 */
private void checkExpressionOperand1(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
    if (reference1 == null) {
        setIsErroneous(true);
        return;
    }
    final Assignment temporalAssignment = reference1.getRefdAssignment(timestamp, true);
    if (temporalAssignment == null) {
        setIsErroneous(true);
        return;
    }
    switch(temporalAssignment.getAssignmentType()) {
        case A_CONST:
        case A_EXT_CONST:
        case A_MODULEPAR:
        case A_TEMPLATE:
            reference1.getLocation().reportSemanticError(MessageFormat.format(OPERAND1_ERROR2, temporalAssignment.getAssignmentName()));
            setIsErroneous(true);
            break;
        case A_VAR:
        case A_PAR_VAL:
        case A_PAR_VAL_IN:
        case A_PAR_VAL_OUT:
        case A_PAR_VAL_INOUT:
            break;
        case A_VAR_TEMPLATE:
        case A_PAR_TEMP_IN:
        case A_PAR_TEMP_OUT:
        case A_PAR_TEMP_INOUT:
            {
                final Referenced_Template template = new Referenced_Template(reference1);
                template.setMyScope(getMyScope());
                template.setFullNameParent(new BridgingNamedNode(this, ".<operand>"));
                final ITTCN3Template last = template.getTemplateReferencedLast(timestamp);
                if (!Template_type.SPECIFIC_VALUE.equals(last.getTemplatetype()) && last != template) {
                    reference1.getLocation().reportSemanticError(MessageFormat.format(OPERAND1_ERROR3, last.getTemplateTypeName()));
                    setIsErroneous(true);
                    return;
                }
                break;
            }
        default:
            reference1.getLocation().reportSemanticError(MessageFormat.format(OPERAND1_ERROR4, temporalAssignment.getAssignmentName()));
            setIsErroneous(true);
            return;
    }
    final IType temporalType = temporalAssignment.getType(timestamp).getFieldType(timestamp, reference1, 1, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, false);
    if (temporalType == null) {
        setIsErroneous(true);
        return;
    }
    final Type_type type_type = temporalType.getTypeRefdLast(timestamp).getTypetype();
    if (type_type != Type_type.TYPE_UCHARSTRING) {
        if (!isErroneous) {
            location.reportSemanticError(OPERAND1_ERROR1);
            setIsErroneous(true);
        }
        return;
    }
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) ITTCN3Template(org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template) Referenced_Template(org.eclipse.titan.designer.AST.TTCN3.templates.Referenced_Template) Type_type(org.eclipse.titan.designer.AST.IType.Type_type) BridgingNamedNode(org.eclipse.titan.designer.AST.BridgingNamedNode) IType(org.eclipse.titan.designer.AST.IType)

Example 35 with Type_type

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

the class DecvalueUnicharExpression method checkExpressionOperand4.

/**
 * Checks the 4th operand
 * universal charstring (optional)
 * @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.
 */
private void checkExpressionOperand4(final CompilationTimeStamp timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) {
    if (value4 == null) {
        return;
    }
    value4.setLoweridToReference(timestamp);
    final Type_type tempType = value4.getExpressionReturntype(timestamp, expectedValue);
    switch(tempType) {
        case TYPE_CHARSTRING:
        case TYPE_UCHARSTRING:
            break;
        case TYPE_UNDEFINED:
            setIsErroneous(true);
            break;
        default:
            if (!isErroneous) {
                location.reportSemanticError(OPERAND4_ERROR1);
                setIsErroneous(true);
            }
            break;
    }
}
Also used : Type_type(org.eclipse.titan.designer.AST.IType.Type_type)

Aggregations

Type_type (org.eclipse.titan.designer.AST.IType.Type_type)130 IValue (org.eclipse.titan.designer.AST.IValue)79 Integer_Value (org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value)19 IType (org.eclipse.titan.designer.AST.IType)13 Charstring_Value (org.eclipse.titan.designer.AST.TTCN3.values.Charstring_Value)13 ITTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template)12 CharstringExtractor (org.eclipse.titan.designer.AST.TTCN3.values.CharstringExtractor)9 Real_Value (org.eclipse.titan.designer.AST.TTCN3.values.Real_Value)9 Assignment (org.eclipse.titan.designer.AST.Assignment)7 Boolean_Type (org.eclipse.titan.designer.AST.TTCN3.types.Boolean_Type)7 Expected_Value_type (org.eclipse.titan.designer.AST.TTCN3.Expected_Value_type)5 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)3 ValueCheckingOptions (org.eclipse.titan.designer.AST.IType.ValueCheckingOptions)3 Identifier (org.eclipse.titan.designer.AST.Identifier)3 ActualParameterList (org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList)3 FormalParameterList (org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameterList)3 SpecificValue_Template (org.eclipse.titan.designer.AST.TTCN3.templates.SpecificValue_Template)3 Boolean_Value (org.eclipse.titan.designer.AST.TTCN3.values.Boolean_Value)3 SetOf_Value (org.eclipse.titan.designer.AST.TTCN3.values.SetOf_Value)3 Module (org.eclipse.titan.designer.AST.Module)2