Search in sources :

Example 11 with PortTypeBody

use of org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody in project titan.EclipsePlug-ins by eclipse.

the class Unmap_Statement method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    IType portType1;
    IType portType2;
    PortTypeBody body1;
    PortTypeBody body2;
    boolean cref1IsTestcomponents = false;
    boolean cref1IsSystem = false;
    boolean cref2IsTestcomponent = false;
    boolean cref2IsSystem = false;
    portType1 = Port_Utility.checkConnectionEndpoint(timestamp, this, componentReference1, portReference1, true);
    if (portType1 == null) {
        body1 = null;
    } else {
        body1 = ((Port_Type) portType1).getPortBody();
        if (body1.isInternal()) {
            componentReference1.getLocation().reportSemanticWarning(MessageFormat.format("Port type `{0}'' was marked as `internal''", portType1.getTypename()));
        }
    }
    final IValue configReference1 = componentReference1.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, null);
    if (Value_type.EXPRESSION_VALUE.equals(configReference1.getValuetype())) {
        switch(((Expression_Value) configReference1).getOperationType()) {
            case MTC_COMPONENT_OPERATION:
                cref1IsTestcomponents = true;
                break;
            case SELF_COMPONENT_OPERATION:
                cref1IsTestcomponents = true;
                break;
            case COMPONENT_CREATE_OPERATION:
                cref1IsTestcomponents = true;
                break;
            case SYSTEM_COMPONENT_OPERATION:
                cref1IsSystem = true;
                break;
            default:
                break;
        }
    }
    portType2 = Port_Utility.checkConnectionEndpoint(timestamp, this, componentReference2, portReference2, true);
    if (portType2 == null) {
        body2 = null;
    } else {
        body2 = ((Port_Type) portType2).getPortBody();
        if (body2.isInternal()) {
            componentReference2.getLocation().reportSemanticWarning(MessageFormat.format("Port type `{0}'' was marked as `internal''", portType2.getTypename()));
        }
    }
    final IValue configReference2 = componentReference2.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, null);
    if (Value_type.EXPRESSION_VALUE.equals(configReference2.getValuetype())) {
        switch(((Expression_Value) configReference2).getOperationType()) {
            case MTC_COMPONENT_OPERATION:
                cref2IsTestcomponent = true;
                break;
            case SELF_COMPONENT_OPERATION:
                cref2IsTestcomponent = true;
                break;
            case COMPONENT_CREATE_OPERATION:
                cref2IsTestcomponent = true;
                break;
            case SYSTEM_COMPONENT_OPERATION:
                cref2IsSystem = true;
                break;
            default:
                break;
        }
    }
    lastTimeChecked = timestamp;
    if (cref1IsTestcomponents && cref2IsTestcomponent) {
        location.reportSemanticError(Map_Statement.BOTHENDSARETESTCOMPONENTPORTS);
        return;
    }
    if (cref1IsSystem && cref2IsSystem) {
        location.reportSemanticError(Map_Statement.BOTHENDSARESYSTEMPORTS);
        return;
    }
    if (portType1 == null || portType2 == null || body1 == null || body2 == null) {
        return;
    }
    if (cref1IsTestcomponents || cref2IsSystem) {
        if (!body1.isMappable(timestamp, body2)) {
            location.reportSemanticError(MessageFormat.format(Map_Statement.INCONSISTENTMAPPING1, portType1.getTypename(), portType2.getTypename()));
            body1.reportMappingErrors(timestamp, body2);
        }
    } else if (cref2IsTestcomponent || cref1IsSystem) {
        if (!body2.isMappable(timestamp, body1)) {
            location.reportSemanticError(MessageFormat.format(Map_Statement.INCONSISTENTMAPPING2, portType1.getTypename(), portType2.getTypename()));
            body2.reportMappingErrors(timestamp, body1);
        }
    } else {
        // we don't know which is the system port
        if (!body1.isMappable(timestamp, body2) && !body2.isMappable(timestamp, body1)) {
            location.reportSemanticError(MessageFormat.format(Map_Statement.INCONSISTENTMAPPING3, portType1.getTypename(), portType2.getTypename()));
        }
    }
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Expression_Value(org.eclipse.titan.designer.AST.TTCN3.values.Expression_Value) PortTypeBody(org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody) IType(org.eclipse.titan.designer.AST.IType)

Example 12 with PortTypeBody

use of org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody in project titan.EclipsePlug-ins by eclipse.

the class Disconnect_Statement method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    IType portType1;
    IType portType2;
    PortTypeBody body1;
    PortTypeBody body2;
    portType1 = Port_Utility.checkConnectionEndpoint(timestamp, this, componentReference1, portReference1, false);
    if (portType1 == null) {
        body1 = null;
    } else {
        body1 = ((Port_Type) portType1).getPortBody();
    }
    portType2 = Port_Utility.checkConnectionEndpoint(timestamp, this, componentReference2, portReference2, false);
    if (portType2 == null) {
        body2 = null;
    } else {
        body2 = ((Port_Type) portType2).getPortBody();
    }
    if (portType1 == null || portType2 == null || body1 == null || body2 == null) {
        lastTimeChecked = timestamp;
        return;
    }
    if (!body1.isConnectable(timestamp, body2) || (body1 != body2 && !body2.isConnectable(timestamp, body1))) {
        location.reportSemanticError(MessageFormat.format(Connect_Statement.INCONSISTENTCONNECTION, portType1.getTypename(), portType2.getTypename()));
        body1.reportConnectionErrors(timestamp, body2, location);
        if (body1 != body2) {
            body2.reportConnectionErrors(timestamp, body1, location);
        }
    }
    lastTimeChecked = timestamp;
}
Also used : PortTypeBody(org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody) IType(org.eclipse.titan.designer.AST.IType)

Example 13 with PortTypeBody

use of org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody in project titan.EclipsePlug-ins by eclipse.

the class Map_Statement method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    IType portType1;
    IType portType2;
    PortTypeBody body1 = null;
    PortTypeBody body2 = null;
    boolean cref1IsTestcomponents = false;
    boolean cref1IsSystem = false;
    boolean cref2IsTestcomponent = false;
    boolean cref2IsSystem = false;
    portType1 = Port_Utility.checkConnectionEndpoint(timestamp, this, componentReference1, portReference1, true);
    if (portType1 != null) {
        body1 = ((Port_Type) portType1).getPortBody();
        if (body1.isInternal()) {
            componentReference1.getLocation().reportSemanticWarning(MessageFormat.format("Port type `{0}'' was marked as `internal''", portType1.getTypename()));
        }
        // sets the referenced assignment of this reference
        portReference1.getRefdAssignment(timestamp, false);
    }
    if (componentReference1 != null) {
        final IValue configReference1 = componentReference1.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, null);
        if (Value_type.EXPRESSION_VALUE.equals(configReference1.getValuetype())) {
            switch(((Expression_Value) configReference1).getOperationType()) {
                case MTC_COMPONENT_OPERATION:
                    cref1IsTestcomponents = true;
                    break;
                case SELF_COMPONENT_OPERATION:
                    cref1IsTestcomponents = true;
                    break;
                case COMPONENT_CREATE_OPERATION:
                    cref1IsTestcomponents = true;
                    break;
                case SYSTEM_COMPONENT_OPERATION:
                    cref1IsSystem = true;
                    break;
                default:
                    break;
            }
        }
    }
    portType2 = Port_Utility.checkConnectionEndpoint(timestamp, this, componentReference2, portReference2, true);
    if (portType2 != null) {
        body2 = ((Port_Type) portType2).getPortBody();
        if (body2.isInternal()) {
            componentReference2.getLocation().reportSemanticWarning(MessageFormat.format("Port type `{0}'' was marked as `internal''", portType2.getTypename()));
        }
        // sets the referenced assignment of this reference
        portReference2.getRefdAssignment(timestamp, false);
    }
    if (componentReference2 != null) {
        final IValue configReference2 = componentReference2.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, null);
        if (Value_type.EXPRESSION_VALUE.equals(configReference2.getValuetype())) {
            switch(((Expression_Value) configReference2).getOperationType()) {
                case MTC_COMPONENT_OPERATION:
                    cref2IsTestcomponent = true;
                    break;
                case SELF_COMPONENT_OPERATION:
                    cref2IsTestcomponent = true;
                    break;
                case COMPONENT_CREATE_OPERATION:
                    cref2IsTestcomponent = true;
                    break;
                case SYSTEM_COMPONENT_OPERATION:
                    cref2IsSystem = true;
                    break;
                default:
                    break;
            }
        }
    }
    lastTimeChecked = timestamp;
    if (cref1IsTestcomponents && cref2IsTestcomponent) {
        location.reportSemanticError(BOTHENDSARETESTCOMPONENTPORTS);
        return;
    }
    if (cref1IsSystem && cref2IsSystem) {
        location.reportSemanticError(BOTHENDSARESYSTEMPORTS);
        return;
    }
    if (body1 == null || body2 == null || portType1 == null || portType2 == null) {
        return;
    }
    if (cref1IsTestcomponents || cref2IsSystem) {
        if (!body1.isMappable(timestamp, body2)) {
            location.reportSemanticError(MessageFormat.format(INCONSISTENTMAPPING1, portType1.getTypename(), portType2.getTypename()));
            body1.reportMappingErrors(timestamp, body2);
        }
    } else if (cref2IsTestcomponent || cref1IsSystem) {
        if (!body2.isMappable(timestamp, body1)) {
            location.reportSemanticError(MessageFormat.format(INCONSISTENTMAPPING2, portType1.getTypename(), portType2.getTypename()));
            body2.reportMappingErrors(timestamp, body1);
        }
    } else {
        // we don't know which one is the system port
        if (!body1.isMappable(timestamp, body2) && !body2.isMappable(timestamp, body1)) {
            location.reportSemanticError(MessageFormat.format(INCONSISTENTMAPPING3, portType1.getTypename(), portType2.getTypename()));
        }
    }
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Expression_Value(org.eclipse.titan.designer.AST.TTCN3.values.Expression_Value) PortTypeBody(org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody) IType(org.eclipse.titan.designer.AST.IType)

Example 14 with PortTypeBody

use of org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody in project titan.EclipsePlug-ins by eclipse.

the class Call_Statement method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    final Port_Type portType = Port_Utility.checkPortReference(timestamp, this, portReference);
    if (parameter == null) {
        return;
    }
    IType signatureType = null;
    boolean signatureTypeDetermined = false;
    if (portType != null) {
        // the port type is known
        final PortTypeBody portTypeBody = portType.getPortBody();
        final TypeSet outSignatures = portTypeBody.getOutSignatures();
        if (OperationModes.OP_Message.equals(portTypeBody.getOperationMode())) {
            portReference.getLocation().reportSemanticError(MessageFormat.format(SENDONPORT, portType.getTypename()));
        } else if (outSignatures != null) {
            if (outSignatures.getNofTypes() == 1) {
                signatureType = outSignatures.getTypeByIndex(0);
            } else {
                signatureType = Port_Utility.getOutgoingType(timestamp, parameter);
                if (signatureType == null) {
                    parameter.getLocation().reportSemanticError(UNKNOWNSIGNATURE);
                } else {
                    if (!outSignatures.hasType(timestamp, signatureType)) {
                        parameter.getLocation().reportSemanticError(MessageFormat.format(TYPENOTPRESENT, signatureType.getTypename(), portType.getTypename()));
                    }
                }
            }
            signatureTypeDetermined = true;
        } else {
            portReference.getLocation().reportSemanticError(MessageFormat.format(NOOUTGOINGSIGNATURETYPES, portType.getTypename()));
        }
    }
    if (!signatureTypeDetermined) {
        signatureType = Port_Utility.getOutgoingType(timestamp, parameter);
    }
    boolean isNonblocking = false;
    if (signatureType != null) {
        parameter.check(timestamp, signatureType);
        signatureType = signatureType.getTypeRefdLast(timestamp);
        switch(signatureType.getTypetype()) {
            case TYPE_SIGNATURE:
                ((Signature_Type) signatureType).checkThisTemplate(timestamp, parameter.getTemplateBody(), false, false, null);
                isNonblocking = ((Signature_Type) signatureType).isNonblocking();
                break;
            default:
                parameter.getLocation().reportSemanticError(MessageFormat.format(CALLPARAMETERNOTSIGNATURE, signatureType.getTypename()));
                break;
        }
        if (isNonblocking) {
            if (timerValue != null) {
                timerValue.getLocation().reportSemanticError(MessageFormat.format(NONBLOCKINGWITHTIMER, signatureType.getTypename()));
            } else if (noWait) {
                location.reportSemanticError(MessageFormat.format(NONBLOCKINGWITHNOWAIT, signatureType.getTypename()));
            }
            if (altGuards != null) {
                location.reportSemanticError(MessageFormat.format(NONBLOCKINGWITHRESPONSEPART, signatureType.getTypename()));
            }
        } else if (noWait) {
            if (altGuards != null) {
                location.reportSemanticError(NOWAITWITHRESPONSEPART);
            }
        } else {
            if (!getIsErroneous() && altGuards == null) {
                location.reportSemanticError(RESPONSEPARTMISSING);
            }
        }
    }
    if (timerValue != null) {
        timerValue.setLoweridToReference(timestamp);
        final Type_type temporalType = timerValue.getExpressionReturntype(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE);
        switch(temporalType) {
            case TYPE_REAL:
                final IValue last = timerValue.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, null);
                if (Value_type.REAL_VALUE.equals(last.getValuetype()) && !last.getIsErroneous(timestamp)) {
                    final double temp = ((Real_Value) last).getValue();
                    if (temp < 0) {
                        timerValue.getLocation().reportSemanticError(MessageFormat.format(CALLTIMERNEGATIVE, temp));
                    }
                }
                break;
            case TYPE_UNDEFINED:
                setIsErroneous();
                break;
            default:
                if (!isErroneous) {
                    location.reportSemanticError(FLOATTIMEREXPECTED);
                }
                break;
        }
    }
    Port_Utility.checkToClause(timestamp, this, portType, toClause);
    if (altGuards != null) {
        checkCallBody(timestamp, portType, signatureType);
    }
    lastTimeChecked = timestamp;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) TypeSet(org.eclipse.titan.designer.AST.TTCN3.types.TypeSet) Signature_Type(org.eclipse.titan.designer.AST.TTCN3.types.Signature_Type) Port_Type(org.eclipse.titan.designer.AST.TTCN3.types.Port_Type) Type_type(org.eclipse.titan.designer.AST.IType.Type_type) PortTypeBody(org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody) IType(org.eclipse.titan.designer.AST.IType) Real_Value(org.eclipse.titan.designer.AST.TTCN3.values.Real_Value)

Example 15 with PortTypeBody

use of org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody in project titan.EclipsePlug-ins by eclipse.

the class PortTypeBody method checkUserAttribute.

/**
 * Checks the attributes for the specific case when the port is of user type.
 *
 * @param timestamp the time stamp of the actual semantic check cycle.
 */
private void checkUserAttribute(final CompilationTimeStamp timestamp) {
    if (providerReference == null) {
        return;
    }
    providerType = null;
    PortTypeBody providerBody = null;
    final Assignment assignment = providerReference.getRefdAssignment(timestamp, true);
    if (assignment != null) {
        if (Assignment_type.A_TYPE.semanticallyEquals(assignment.getAssignmentType())) {
            final IType type = assignment.getType(timestamp).getTypeRefdLast(timestamp);
            if (Type_type.TYPE_PORT.equals(type.getTypetype())) {
                providerType = type;
                providerBody = ((Port_Type) type).getPortBody();
            } else {
                providerReference.getLocation().reportSemanticError(MessageFormat.format("Type reference `{0}'' does not refer to a port type", providerReference.getDisplayName()));
            }
        } else {
            providerReference.getLocation().reportSemanticError(MessageFormat.format("Reference `{0}'' does not refer to a type", providerReference.getDisplayName()));
        }
    }
    // checking the consistency of attributes in this and provider_body
    if (providerBody != null && !TestPortAPI_type.TP_INTERNAL.equals(testportType)) {
        if (!PortType_type.PT_PROVIDER.equals(providerBody.portType)) {
            providerReference.getLocation().reportSemanticError(MessageFormat.format("The referenced port type `{0}'' must have the `provider'' attribute", providerType.getTypename()));
        }
        switch(providerBody.testportType) {
            case TP_REGULAR:
                if (TestPortAPI_type.TP_ADDRESS.equals(testportType)) {
                    providerReference.getLocation().reportSemanticError(MessageFormat.format("Attribute `address'' cannot be used because the provider port type `{0}''" + " does not have attribute `address''", providerType.getTypename()));
                }
                break;
            case TP_INTERNAL:
                providerReference.getLocation().reportSemanticError(MessageFormat.format("Missing attribute `internal''. Provider port type `{0}'' has attribute `internal''," + " which must be also present here", providerType.getTypename()));
                break;
            case TP_ADDRESS:
                break;
            default:
                break;
        }
        // inherit the test port API type from the provider
        testportType = providerBody.testportType;
    }
    // check the incoming mappings
    if (inMappings != null && inMappings.getNofMappings() != 0) {
        inMappings.check(timestamp);
        if (providerBody != null) {
            if (providerBody.inMessages != null) {
                // check if all source types are present on the `in' list of the provider
                for (int i = 0, size = inMappings.getNofMappings(); i < size; i++) {
                    final Type sourceType = inMappings.getMappingByIndex(i).getSourceType();
                    // }
                    if (sourceType != null && !providerBody.inMessages.hasType(timestamp, sourceType)) {
                        sourceType.getLocation().reportSemanticError(MessageFormat.format("Source type `{0}'' of the `in'' mapping is not present " + "on the list of incoming messages in provider port type `{1}''", sourceType.getTypename(), providerType.getTypename()));
                    }
                }
                // check if all types of the `in' list of the provider are handled by the mappings
                for (int i = 0, size = providerBody.inMessages.getNofTypes(); i < size; i++) {
                    final IType messageType = providerBody.inMessages.getTypeByIndex(i);
                    if (!inMappings.hasMappingForType(timestamp, messageType)) {
                        inMappings.getLocation().reportSemanticError(MessageFormat.format("Incoming message type `{0}'' of provider port type `{1}'' is not handled by the incoming mappings", messageType.getTypename(), providerType.getTypename()));
                        inMappings.hasMappingForType(timestamp, messageType);
                    }
                }
            } else {
                inMappings.getLocation().reportSemanticError(MessageFormat.format("Invalid incoming mappings. Provider port type `{0}' does not have incoming message types'", providerType.getTypename()));
            }
        }
        // checking target types
        for (int i = 0, size = inMappings.getNofMappings(); i < size; i++) {
            final TypeMapping mapping = inMappings.getMappingByIndex(i);
            for (int j = 0, nofTargets = mapping.getNofTargets(); j < nofTargets; j++) {
                final Type targetType = mapping.getTargetByIndex(j).getTargetType();
                if (targetType != null && (inMessages == null || !inMessages.hasType(timestamp, targetType))) {
                    targetType.getLocation().reportSemanticError(MessageFormat.format("Target type `{0}'' of the `in'' mapping is not present on the list of incoming messages in user port type `{1}''", targetType.getTypename(), myType.getTypename()));
                }
            }
        }
    } else if (providerBody != null && providerBody.inMessages != null) {
        location.reportSemanticError(MessageFormat.format("Missing `in'' mappings to handle the incoming message types of provider port type `{0}''", providerType.getTypename()));
    }
    if (outMappings != null && outMappings.getNofMappings() != 0) {
        outMappings.check(timestamp);
        if (outMessages != null) {
            // check if all source types are present on the `in' list of the provider
            for (int i = 0, size = outMappings.getNofMappings(); i < size; i++) {
                final Type sourceType = outMappings.getMappingByIndex(i).getSourceType();
                if (sourceType != null && !outMessages.hasType(timestamp, sourceType)) {
                    sourceType.getLocation().reportSemanticError(MessageFormat.format("Source type `{0}'' of the `out'' mapping is not present on the list of outgoing messages in user port type `{1}''", sourceType.getTypename(), myType.getTypename()));
                }
            }
            // check if all types of the `in' list of the provider are handled by the mappings
            for (int i = 0, size = outMessages.getNofTypes(); i < size; i++) {
                final IType messageType = outMessages.getTypeByIndex(i);
                if (!outMappings.hasMappingForType(timestamp, messageType)) {
                    outMappings.getLocation().reportSemanticError(MessageFormat.format("Outgoing message type `{0}'' of user port type `{1}'' is not handled by the outgoing mappings", messageType.getTypename(), myType.getTypename()));
                }
            }
        } else {
            outMappings.getLocation().reportSemanticError(MessageFormat.format("Invalid outgoing mappings. User port type `{0}'' does not have outgoing message types", myType.getTypename()));
        }
        // checking target types
        if (providerBody != null) {
            for (int i = 0, size = outMappings.getNofMappings(); i < size; i++) {
                final TypeMapping mapping = outMappings.getMappingByIndex(i);
                for (int j = 0, nofTargets = mapping.getNofTargets(); j < nofTargets; j++) {
                    final Type targetType = mapping.getTargetByIndex(j).getTargetType();
                    if (targetType != null && (providerBody.outMessages == null || !providerBody.outMessages.hasType(timestamp, targetType))) {
                        targetType.getLocation().reportSemanticError(MessageFormat.format("Target type `{0}'' of the `out'' mapping is not present " + "on the list of outgoing messages in provider port type `{1}''", targetType.getTypename(), providerType.getTypename()));
                    }
                }
            }
        }
    } else if (outMessages != null) {
        location.reportSemanticError(MessageFormat.format("Missing `out'' mapping to handle the outgoing message types of user port type `{0}''", myType.getTypename()));
    }
    // checking the compatibility of signature lists
    if (providerBody == null) {
        return;
    }
    if (inSignatures != null) {
        for (int i = 0, size = inSignatures.getNofTypes(); i < size; i++) {
            final IType signatureType = inSignatures.getTypeByIndex(i);
            if (providerBody.inSignatures == null || !providerBody.inSignatures.hasType(timestamp, signatureType)) {
                final IType last = signatureType.getTypeRefdLast(timestamp);
                if (!last.getIsErroneous(timestamp) && Type_type.TYPE_SIGNATURE.equals(last.getTypetype())) {
                    final Signature_Type lastSignature = (Signature_Type) last;
                    if (!lastSignature.isNonblocking() || lastSignature.getSignatureExceptions() != null) {
                        signatureType.getLocation().reportSemanticError(MessageFormat.format("Incoming signature `{0}'' of user port type `{1}'' is not present on the list " + "of incoming signatures in provider port type `{2}''", signatureType.getTypename(), myType.getTypename(), providerType.getTypename()));
                    }
                }
            }
        }
    }
    if (providerBody.inSignatures != null) {
        for (int i = 0, size = providerBody.inSignatures.getNofTypes(); i < size; i++) {
            final IType signatureType = providerBody.inSignatures.getTypeByIndex(i);
            if (inSignatures == null || !inSignatures.hasType(timestamp, signatureType)) {
                location.reportSemanticError(MessageFormat.format("Incoming signature `{0}'' of provider port type `{1}'' " + "is not present on the list of incoming signatures in user port type `{2}''", signatureType.getTypename(), providerType.getTypename(), myType.getTypename()));
            }
        }
    }
    if (outSignatures != null) {
        for (int i = 0, size = outSignatures.getNofTypes(); i < size; i++) {
            final IType signatureType = outSignatures.getTypeByIndex(i);
            if (providerBody.outSignatures == null || !providerBody.outSignatures.hasType(timestamp, signatureType)) {
                signatureType.getLocation().reportSemanticError(MessageFormat.format("Outgoing signature `{0}'' of user port type `{1}'' is not present " + "on the list of outgoing signatures in provider port type `{2}''", signatureType.getTypename(), myType.getTypename(), providerType.getTypename()));
            }
        }
    }
    if (providerBody.outSignatures != null) {
        for (int i = 0, size = providerBody.outSignatures.getNofTypes(); i < size; i++) {
            final IType signatureType = providerBody.outSignatures.getTypeByIndex(i);
            if (outSignatures == null || !outSignatures.hasType(timestamp, signatureType)) {
                final IType last = signatureType.getTypeRefdLast(timestamp);
                if (!last.getIsErroneous(timestamp) && Type_type.TYPE_SIGNATURE.equals(last.getTypetype())) {
                    final Signature_Type lastSignature = (Signature_Type) last;
                    if (!lastSignature.isNonblocking() || lastSignature.getSignatureExceptions() != null) {
                        location.reportSemanticError(MessageFormat.format("Outgoing signature `{0}'' of provider port type `{1}'' is not present " + "on the list of outgoing signatures in user port type `{2}''", signatureType.getTypename(), providerType.getTypename(), myType.getTypename()));
                    }
                }
            }
        }
    }
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) TestportType(org.eclipse.titan.designer.AST.TTCN3.types.PortGenerator.TestportType) Attribute_Type(org.eclipse.titan.designer.AST.TTCN3.attributes.SingleWithAttribute.Attribute_Type) Type(org.eclipse.titan.designer.AST.Type) IType(org.eclipse.titan.designer.AST.IType) TypeMapping(org.eclipse.titan.designer.AST.TTCN3.attributes.TypeMapping) IType(org.eclipse.titan.designer.AST.IType)

Aggregations

IType (org.eclipse.titan.designer.AST.IType)14 PortTypeBody (org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody)14 Port_Type (org.eclipse.titan.designer.AST.TTCN3.types.Port_Type)9 TypeSet (org.eclipse.titan.designer.AST.TTCN3.types.TypeSet)8 Signature_Type (org.eclipse.titan.designer.AST.TTCN3.types.Signature_Type)6 IValue (org.eclipse.titan.designer.AST.IValue)5 Type (org.eclipse.titan.designer.AST.Type)4 Expression_Value (org.eclipse.titan.designer.AST.TTCN3.values.Expression_Value)3 Assignment (org.eclipse.titan.designer.AST.Assignment)2 Type_type (org.eclipse.titan.designer.AST.IType.Type_type)2 Def_Port (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Port)2 SignatureExceptions (org.eclipse.titan.designer.AST.TTCN3.types.SignatureExceptions)2 Integer_Value (org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value)2 Real_Value (org.eclipse.titan.designer.AST.TTCN3.values.Real_Value)2 ArraySubReference (org.eclipse.titan.designer.AST.ArraySubReference)1 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)1 ISubReference (org.eclipse.titan.designer.AST.ISubReference)1 ValueCheckingOptions (org.eclipse.titan.designer.AST.IType.ValueCheckingOptions)1 Identifier (org.eclipse.titan.designer.AST.Identifier)1 Reference (org.eclipse.titan.designer.AST.Reference)1