Search in sources :

Example 1 with Def_Extfunction

use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Extfunction in project titan.EclipsePlug-ins by eclipse.

the class Reference method generateCodeIsPresentBoundChosen.

/**
 * Generates code for checking if the reference
 * and the referred objects are bound or not.
 *
 * generate_code_ispresentbound in the compiler
 *
 * @param aData only used to update imports if needed
 * @param expression the expression for code generated
 * @param isTemplate if the reference is pointing to a template
 * @param optype true to generate code for isbound, false otherwise
 */
public void generateCodeIsPresentBoundChosen(final JavaGenData aData, final ExpressionStruct expression, final boolean isTemplate, final Operation_type optype, final String field) {
    final Assignment assignment = getRefdAssignment(CompilationTimeStamp.getBaseTimestamp(), false);
    final String ass_id = assignment.getGenNameFromScope(aData, expression.expression, myScope, null);
    String ass_id2 = ass_id;
    FormalParameterList formalParameterList;
    switch(assignment.getAssignmentType()) {
        case A_FUNCTION:
        case A_FUNCTION_RVAL:
        case A_FUNCTION_RTEMP:
            formalParameterList = ((Def_Function) assignment).getFormalParameterList();
            break;
        case A_EXT_FUNCTION:
        case A_EXT_FUNCTION_RVAL:
        case A_EXT_FUNCTION_RTEMP:
            formalParameterList = ((Def_Extfunction) assignment).getFormalParameterList();
            break;
        case A_TEMPLATE:
            formalParameterList = ((Def_Template) assignment).getFormalParameterList();
            break;
        default:
            formalParameterList = null;
            break;
    }
    if (subReferences.size() > 0 && subReferences.get(0) instanceof ParameterisedSubReference) {
        final ParameterisedSubReference subReference = (ParameterisedSubReference) subReferences.get(0);
        final ExpressionStruct tempExpression = new ExpressionStruct();
        // FIXME should need the formal parameters and other
        // options
        subReference.getActualParameters().generateCodeAlias(aData, tempExpression);
        if (tempExpression.preamble.length() > 0) {
            expression.preamble.append(tempExpression.preamble);
        }
        ass_id2 = MessageFormat.format("{0}({1})", ass_id, tempExpression.expression);
    } else if (formalParameterList != null) {
        // the reference does not have an actual parameter list,
        // but the assignment has
        final ExpressionStruct tempExpression = new ExpressionStruct();
        final StringBuilder newId = new StringBuilder();
        newId.append(assignment.getGenNameFromScope(aData, tempExpression.expression, getMyScope(), null));
        newId.append("( ");
        // ((FieldSubReference)subReferences.get(0));
        for (int i = 0; i < formalParameterList.getNofParameters(); i++) {
            if (i > 0) {
                tempExpression.expression.append(", ");
            }
            formalParameterList.getParameterByIndex(i).getDefaultValue().generateCode(aData, tempExpression);
        }
        // expression);
        if (tempExpression.preamble.length() > 0) {
            expression.preamble.append(tempExpression.preamble);
        }
        newId.append(tempExpression.expression);
        newId.append(" )");
        ass_id2 = newId.toString();
    }
    if (subReferences.size() > 1) {
        final String tempGeneralId = aData.getTemporaryVariableName();
        final ExpressionStruct isboundExpression = new ExpressionStruct();
        isboundExpression.preamble.append(MessageFormat.format("boolean {0} = {1}.isBound();\n", tempGeneralId, ass_id2));
        final IType type = assignment.getType(CompilationTimeStamp.getBaseTimestamp());
        type.generateCodeIsPresentBoundChosen(aData, isboundExpression, subReferences, 1, tempGeneralId, ass_id2, isTemplate, optype, field);
        expression.preamble.append(isboundExpression.preamble);
        expression.preamble.append(isboundExpression.expression);
        expression.expression.append(tempGeneralId);
    } else {
        switch(optype) {
            case ISBOUND_OPERATION:
                expression.expression.append(MessageFormat.format("{0}.isBound()", ass_id2));
                break;
            case ISPRESENT_OPERATION:
                expression.expression.append(MessageFormat.format("{0}.isPresent({1})", ass_id2, isTemplate && aData.getAllowOmitInValueList() ? "true" : ""));
                break;
            case ISCHOOSEN_OPERATION:
                expression.expression.append(MessageFormat.format("{0}.isChosen({1})", ass_id2, field));
                break;
            default:
                ErrorReporter.INTERNAL_ERROR("FATAL ERROR while generating code for reference `" + getFullName() + "''");
                break;
        }
    }
}
Also used : IParameterisedAssignment(org.eclipse.titan.designer.AST.TTCN3.definitions.IParameterisedAssignment) ASN1Assignment(org.eclipse.titan.designer.AST.ASN1.ASN1Assignment) FormalParameterList(org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameterList) ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)

Example 2 with Def_Extfunction

use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Extfunction in project titan.EclipsePlug-ins by eclipse.

the class Reference method generateConstRef.

public void generateConstRef(final JavaGenData aData, final ExpressionStruct expression) {
    if (referredAssignment == null) {
        // TODO: handle null
        return;
    }
    boolean isTemplate;
    switch(referredAssignment.getAssignmentType()) {
        case A_CONST:
        case A_EXT_CONST:
        case A_MODULEPAR:
        case A_VAR:
        case A_FUNCTION_RVAL:
        case A_EXT_FUNCTION_RVAL:
        case A_PAR_VAL:
        case A_PAR_VAL_IN:
        case A_PAR_VAL_OUT:
        case A_PAR_VAL_INOUT:
            isTemplate = false;
            break;
        case A_MODULEPAR_TEMPLATE:
        case A_TEMPLATE:
        case A_VAR_TEMPLATE:
        case A_PAR_TEMP_IN:
        case A_PAR_TEMP_OUT:
        case A_PAR_TEMP_INOUT:
            isTemplate = true;
            break;
        default:
            isTemplate = false;
            break;
    }
    FormalParameterList formalParameterList;
    switch(referredAssignment.getAssignmentType()) {
        case A_FUNCTION:
        case A_FUNCTION_RVAL:
        case A_FUNCTION_RTEMP:
            formalParameterList = ((Def_Function) referredAssignment).getFormalParameterList();
            break;
        case A_EXT_FUNCTION:
        case A_EXT_FUNCTION_RVAL:
        case A_EXT_FUNCTION_RTEMP:
            formalParameterList = ((Def_Extfunction) referredAssignment).getFormalParameterList();
            break;
        case A_TEMPLATE:
            formalParameterList = ((Def_Template) referredAssignment).getFormalParameterList();
            break;
        default:
            formalParameterList = null;
            break;
    }
    final IType referedGovernor = referredAssignment.getType(CompilationTimeStamp.getBaseTimestamp());
    // ha parameterezett
    if (subReferences.get(0) instanceof ParameterisedSubReference) {
        expression.expression.append(referredAssignment.getGenNameFromScope(aData, expression.expression, getMyScope(), null));
        expression.expression.append("( ");
        final ParameterisedSubReference temp = ((ParameterisedSubReference) subReferences.get(0));
        final ActualParameterList actualParameterList = temp.getActualParameters();
        if (actualParameterList != null) {
            actualParameterList.generateCodeAlias(aData, expression);
        }
        expression.expression.append(" )");
    } else if (formalParameterList != null) {
        // the reference does not have an actual parameter list, but the assignment has
        expression.expression.append(referredAssignment.getGenNameFromScope(aData, expression.expression, getMyScope(), null));
        expression.expression.append("( ");
        // FieldSubReference temp = ((FieldSubReference)subReferences.get(0));
        for (int i = 0; i < formalParameterList.getNofParameters(); i++) {
            if (i > 0) {
                expression.expression.append(", ");
            }
            formalParameterList.getParameterByIndex(i).getDefaultValue().generateCode(aData, expression);
        }
        // temp.getActualParameters().generateCodeAlias(aData, expression);
        expression.expression.append(" )");
    } else {
        // TODO add fuzzy handling
        expression.expression.append(referredAssignment.getGenNameFromScope(aData, expression.expression, getMyScope(), null));
    }
    generateCode(aData, expression, isTemplate, true, referedGovernor);
}
Also used : FormalParameterList(org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameterList) ActualParameterList(org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList)

Example 3 with Def_Extfunction

use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Extfunction in project titan.EclipsePlug-ins by eclipse.

the class Reference method generateCode.

/**
 * Add generated java code on this level.
 * @param aData only used to update imports if needed
 * @param expression the expression for code generated
 */
public void generateCode(final JavaGenData aData, final ExpressionStruct expression) {
    if (referredAssignment == null) {
        return;
    }
    boolean isTemplate;
    IType referedGovernor;
    switch(referredAssignment.getAssignmentType()) {
        case A_CONST:
        case A_EXT_CONST:
        case A_MODULEPAR:
        case A_VAR:
        case A_FUNCTION_RVAL:
        case A_EXT_FUNCTION_RVAL:
        case A_PAR_VAL:
        case A_PAR_VAL_IN:
        case A_PAR_VAL_OUT:
        case A_PAR_VAL_INOUT:
            isTemplate = false;
            referedGovernor = referredAssignment.getType(CompilationTimeStamp.getBaseTimestamp());
            break;
        case A_MODULEPAR_TEMPLATE:
        case A_TEMPLATE:
        case A_VAR_TEMPLATE:
        case A_PAR_TEMP_IN:
        case A_PAR_TEMP_OUT:
        case A_PAR_TEMP_INOUT:
            isTemplate = true;
            referedGovernor = referredAssignment.getType(CompilationTimeStamp.getBaseTimestamp());
            break;
        default:
            isTemplate = false;
            referedGovernor = null;
            break;
    }
    FormalParameterList formalParameterList;
    switch(referredAssignment.getAssignmentType()) {
        case A_FUNCTION:
        case A_FUNCTION_RVAL:
        case A_FUNCTION_RTEMP:
            formalParameterList = ((Def_Function) referredAssignment).getFormalParameterList();
            break;
        case A_EXT_FUNCTION:
        case A_EXT_FUNCTION_RVAL:
        case A_EXT_FUNCTION_RTEMP:
            formalParameterList = ((Def_Extfunction) referredAssignment).getFormalParameterList();
            break;
        case A_TEMPLATE:
            formalParameterList = ((Def_Template) referredAssignment).getFormalParameterList();
            break;
        default:
            formalParameterList = null;
            break;
    }
    if (subReferences.get(0) instanceof ParameterisedSubReference) {
        expression.expression.append(referredAssignment.getGenNameFromScope(aData, expression.expression, getMyScope(), null));
        expression.expression.append("( ");
        final ParameterisedSubReference temp = ((ParameterisedSubReference) subReferences.get(0));
        temp.getActualParameters().generateCodeAlias(aData, expression);
        expression.expression.append(" )");
    } else if (formalParameterList != null) {
        // the reference does not have an actual parameter list, but the assignment has
        expression.expression.append(referredAssignment.getGenNameFromScope(aData, expression.expression, getMyScope(), null));
        expression.expression.append("( ");
        // FieldSubReference temp = ((FieldSubReference)subReferences.get(0));
        for (int i = 0; i < formalParameterList.getNofParameters(); i++) {
            if (i > 0) {
                expression.expression.append(", ");
            }
            formalParameterList.getParameterByIndex(i).getDefaultValue().generateCode(aData, expression);
        }
        // temp.getActualParameters().generateCodeAlias(aData, expression);
        expression.expression.append(" )");
    } else {
        // TODO add fuzzy handling
        expression.expression.append(referredAssignment.getGenNameFromScope(aData, expression.expression, getMyScope(), null));
    }
    generateCode(aData, expression, isTemplate, false, referedGovernor);
}
Also used : FormalParameterList(org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameterList)

Example 4 with Def_Extfunction

use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Extfunction in project titan.EclipsePlug-ins by eclipse.

the class FunctionTypeMappingTarget method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp, final Type source) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    lastTimeChecked = timestamp;
    functionReferenced = null;
    extfunctionReferenced = null;
    if (functionReference == null) {
        return;
    }
    final Assignment assignment = functionReference.getRefdAssignment(timestamp, false);
    if (assignment == null) {
        return;
    }
    assignment.check(timestamp);
    EncodingPrototype_type referencedPrototype;
    Type inputType;
    Type outputType;
    switch(assignment.getAssignmentType()) {
        case A_FUNCTION:
        case A_FUNCTION_RVAL:
        case A_FUNCTION_RTEMP:
            functionReferenced = (Def_Function) assignment;
            referencedPrototype = functionReferenced.getPrototype();
            inputType = functionReferenced.getInputType();
            outputType = functionReferenced.getOutputType();
            break;
        case A_EXT_FUNCTION:
        case A_EXT_FUNCTION_RVAL:
        case A_EXT_FUNCTION_RTEMP:
            extfunctionReferenced = (Def_Extfunction) assignment;
            referencedPrototype = extfunctionReferenced.getPrototype();
            inputType = extfunctionReferenced.getInputType();
            outputType = extfunctionReferenced.getOutputType();
            break;
        default:
            functionReference.getLocation().reportSemanticError(MessageFormat.format("Reference to a function or external function was expected instead of {0}", assignment.getDescription()));
            return;
    }
    if (EncodingPrototype_type.NONE.equals(referencedPrototype)) {
        functionReference.getLocation().reportSemanticError(MessageFormat.format("The referenced {0} does not have `prototype'' attribute", assignment.getDescription()));
        return;
    }
    if (inputType != null && source != null && !source.isIdentical(timestamp, inputType)) {
        final String message = MessageFormat.format("The input type of {0} must be the same as the source type of the mapping: `{1}'' was expected instead of `{2}''", assignment.getDescription(), source.getTypename(), inputType.getTypename());
        source.getLocation().reportSemanticError(message);
    }
    if (outputType != null && !targetType.isIdentical(timestamp, outputType)) {
        final String message = MessageFormat.format("The output type of {0} must be the same as the target type of the mapping: `{1}'' was expected instead of `{2}''", assignment.getDescription(), targetType.getTypename(), outputType.getTypename());
        targetType.getLocation().reportSemanticError(message);
    }
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) Type(org.eclipse.titan.designer.AST.Type) EncodingPrototype_type(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Function.EncodingPrototype_type)

Example 5 with Def_Extfunction

use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Extfunction in project titan.EclipsePlug-ins by eclipse.

the class Component_Type method checkExpressionOperandComponentRefernce.

/**
 * Checks if the provided value is a reference to a component or not.
 *
 * @param timestamp the timestamp of the actual semantic check cycle.
 * @param value the value to be checked
 * @param expected_value the value kind expected from the actual parameter.
 */
public static void checkExpressionOperandComponentRefernce(final CompilationTimeStamp timestamp, final IValue value, final String operationName) {
    switch(value.getValuetype()) {
        case EXPRESSION_VALUE:
            {
                final Expression_Value expression = (Expression_Value) value;
                if (Operation_type.APPLY_OPERATION.equals(expression.getOperationType())) {
                    final IReferenceChain chain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
                    final IValue last = value.getValueRefdLast(timestamp, chain);
                    chain.release();
                    if (last == null || last.getIsErroneous(timestamp)) {
                        value.setIsErroneous(true);
                        return;
                    }
                    IType type = last.getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE);
                    if (type == null) {
                        value.setIsErroneous(true);
                        return;
                    }
                    type = type.getTypeRefdLast(timestamp);
                    if (type.getIsErroneous(timestamp)) {
                        value.setIsErroneous(true);
                        // don't let spread an earlier mistake
                        return;
                    }
                    if (!Type_type.TYPE_COMPONENT.equals(type.getTypetype())) {
                        value.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'': Type mismatch: component reference was expected instead of `{1}''", operationName, type.getTypename()));
                        value.setIsErroneous(true);
                        return;
                    }
                }
                break;
            }
        case REFERENCED_VALUE:
            {
                final Reference reference = ((Referenced_Value) value).getReference();
                final Assignment assignment = reference.getRefdAssignment(timestamp, true);
                if (assignment == null) {
                    value.setIsErroneous(true);
                    return;
                }
                switch(assignment.getAssignmentType()) {
                    case A_CONST:
                        {
                            IType type = ((Def_Const) assignment).getType(timestamp).getFieldType(timestamp, reference, 1, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, false);
                            if (type == null) {
                                value.setIsErroneous(true);
                                return;
                            }
                            type = type.getTypeRefdLast(timestamp);
                            if (type.getIsErroneous(timestamp)) {
                                value.setIsErroneous(true);
                                // don't let spread an earlier mistake
                                return;
                            }
                            if (!Type_type.TYPE_COMPONENT.equals(type.getTypetype())) {
                                reference.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'': Type mismatch: component reference was expected instead of `{1}''", operationName, type.getTypename()));
                                value.setIsErroneous(true);
                                return;
                            }
                            IValue tempValue = ((Def_Const) assignment).getValue();
                            if (tempValue == null) {
                                return;
                            }
                            IReferenceChain chain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
                            tempValue = tempValue.getReferencedSubValue(timestamp, reference, 1, chain);
                            chain.release();
                            if (tempValue == null) {
                                return;
                            }
                            chain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
                            tempValue = tempValue.getValueRefdLast(timestamp, chain);
                            chain.release();
                            if (Value_type.TTCN3_NULL_VALUE.equals(tempValue.getValuetype())) {
                                reference.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'' refers to the `null'' component reference", operationName));
                                value.setIsErroneous(true);
                                return;
                            }
                            if (!Value_type.EXPRESSION_VALUE.equals(tempValue.getValuetype())) {
                                return;
                            }
                            switch(((Expression_Value) tempValue).getOperationType()) {
                                case MTC_COMPONENT_OPERATION:
                                    reference.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'' refers to the component reference of the `mtc''", operationName));
                                    value.setIsErroneous(true);
                                    return;
                                case COMPONENT_NULL_OPERATION:
                                    reference.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'' refers to the `null'' component reference", operationName));
                                    value.setIsErroneous(true);
                                    return;
                                case SYSTEM_COMPONENT_OPERATION:
                                    reference.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'' refers to the component reference of the `system''", operationName));
                                    value.setIsErroneous(true);
                                    return;
                                default:
                                    break;
                            }
                            break;
                        }
                    case A_EXT_CONST:
                        {
                            IType type = ((Def_ExternalConst) assignment).getType(timestamp).getFieldType(timestamp, reference, 1, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, false);
                            if (type == null) {
                                value.setIsErroneous(true);
                                return;
                            }
                            type = type.getTypeRefdLast(timestamp);
                            if (type.getIsErroneous(timestamp)) {
                                value.setIsErroneous(true);
                                // don't let spread an earlier mistake
                                return;
                            }
                            if (!Type_type.TYPE_COMPONENT.equals(type.getTypetype())) {
                                reference.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'': Type mismatch: component reference was expected instead of `{1}''", operationName, type.getTypename()));
                                value.setIsErroneous(true);
                                return;
                            }
                            break;
                        }
                    case A_MODULEPAR:
                        {
                            IType type = ((Def_ModulePar) assignment).getType(timestamp).getFieldType(timestamp, reference, 1, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, false);
                            if (type == null) {
                                value.setIsErroneous(true);
                                return;
                            }
                            type = type.getTypeRefdLast(timestamp);
                            if (type.getIsErroneous(timestamp)) {
                                value.setIsErroneous(true);
                                // don't let spread an earlier mistake
                                return;
                            }
                            if (!Type_type.TYPE_COMPONENT.equals(type.getTypetype())) {
                                reference.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'': Type mismatch: component reference was expected instead of `{1}''", operationName, type.getTypename()));
                                value.setIsErroneous(true);
                                return;
                            }
                            break;
                        }
                    case A_VAR:
                        {
                            IType type = ((Def_Var) assignment).getType(timestamp).getFieldType(timestamp, reference, 1, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, false);
                            if (type == null) {
                                value.setIsErroneous(true);
                                return;
                            }
                            type = type.getTypeRefdLast(timestamp);
                            if (type.getIsErroneous(timestamp)) {
                                value.setIsErroneous(true);
                                // don't let spread an earlier mistake
                                return;
                            }
                            if (!Type_type.TYPE_COMPONENT.equals(type.getTypetype())) {
                                reference.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'': Type mismatch: component reference was expected instead of `{1}''", operationName, type.getTypename()));
                                value.setIsErroneous(true);
                                return;
                            }
                            break;
                        }
                    case A_FUNCTION_RVAL:
                        {
                            IType type = ((Def_Function) assignment).getType(timestamp).getFieldType(timestamp, reference, 1, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, false);
                            if (type == null) {
                                value.setIsErroneous(true);
                                return;
                            }
                            type = type.getTypeRefdLast(timestamp);
                            if (type.getIsErroneous(timestamp)) {
                                value.setIsErroneous(true);
                                // don't let spread an earlier mistake
                                return;
                            }
                            if (!Type_type.TYPE_COMPONENT.equals(type.getTypetype())) {
                                reference.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'': Type mismatch: component reference was expected instead of `{1}''", operationName, type.getTypename()));
                                value.setIsErroneous(true);
                                return;
                            }
                            break;
                        }
                    case A_EXT_FUNCTION_RVAL:
                        {
                            IType type = ((Def_Extfunction) assignment).getType(timestamp).getFieldType(timestamp, reference, 1, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, false);
                            if (type == null) {
                                value.setIsErroneous(true);
                                return;
                            }
                            type = type.getTypeRefdLast(timestamp);
                            if (type.getIsErroneous(timestamp)) {
                                value.setIsErroneous(true);
                                // don't let spread an earlier mistake
                                return;
                            }
                            if (!Type_type.TYPE_COMPONENT.equals(type.getTypetype())) {
                                reference.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'': Type mismatch: component reference was expected instead of `{1}''", operationName, type.getTypename()));
                                value.setIsErroneous(true);
                                return;
                            }
                            break;
                        }
                    case A_PAR_VAL:
                    case A_PAR_VAL_IN:
                    case A_PAR_VAL_OUT:
                    case A_PAR_VAL_INOUT:
                        {
                            IType type = ((FormalParameter) assignment).getType(timestamp).getFieldType(timestamp, reference, 1, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, false);
                            if (type == null) {
                                value.setIsErroneous(true);
                                return;
                            }
                            type = type.getTypeRefdLast(timestamp);
                            if (type.getIsErroneous(timestamp)) {
                                value.setIsErroneous(true);
                                // don't let spread an earlier mistake
                                return;
                            }
                            if (!Type_type.TYPE_COMPONENT.equals(type.getTypetype())) {
                                reference.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'': Type mismatch: component reference was expected instead of `{1}''", operationName, type.getTypename()));
                                value.setIsErroneous(true);
                                return;
                            }
                            break;
                        }
                    default:
                        reference.getLocation().reportSemanticError(MessageFormat.format("The first operand of operation `{0}'' should be a component reference instead of `{1}''", operationName, assignment.getDescription()));
                        value.setIsErroneous(true);
                        return;
                }
                break;
            }
        default:
            // the error was already reported if possible.
            return;
    }
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) IValue(org.eclipse.titan.designer.AST.IValue) Reference(org.eclipse.titan.designer.AST.Reference) ISubReference(org.eclipse.titan.designer.AST.ISubReference) FieldSubReference(org.eclipse.titan.designer.AST.FieldSubReference) ArraySubReference(org.eclipse.titan.designer.AST.ArraySubReference) ParameterisedSubReference(org.eclipse.titan.designer.AST.ParameterisedSubReference) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain) Expression_Value(org.eclipse.titan.designer.AST.TTCN3.values.Expression_Value) Def_Const(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Const) IType(org.eclipse.titan.designer.AST.IType)

Aggregations

Def_Extfunction (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Extfunction)4 Assignment (org.eclipse.titan.designer.AST.Assignment)3 Def_Function (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Function)3 FormalParameterList (org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameterList)3 IType (org.eclipse.titan.designer.AST.IType)2 IValue (org.eclipse.titan.designer.AST.IValue)2 Def_Const (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Const)2 Def_Type (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Type)2 FormalParameter (org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter)2 ASN1Assignment (org.eclipse.titan.designer.AST.ASN1.ASN1Assignment)1 ArraySubReference (org.eclipse.titan.designer.AST.ArraySubReference)1 FieldSubReference (org.eclipse.titan.designer.AST.FieldSubReference)1 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)1 ISubReference (org.eclipse.titan.designer.AST.ISubReference)1 ParameterisedSubReference (org.eclipse.titan.designer.AST.ParameterisedSubReference)1 Reference (org.eclipse.titan.designer.AST.Reference)1 Scope (org.eclipse.titan.designer.AST.Scope)1 Restriction_type (org.eclipse.titan.designer.AST.TTCN3.TemplateRestriction.Restriction_type)1 ActualParameterList (org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList)1 Def_Altstep (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Altstep)1