Search in sources :

Example 1 with PortTypeBody

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

the class Def_Type_Visit_Handler method visitDefTypeChildrenNodes.

public void visitDefTypeChildrenNodes(IVisitableNode node) {
    if (node instanceof Def_Port) {
        Def_Port port = (Def_Port) node;
        componentPortNames.add(port.getIdentifier().toString());
    }
    if (node instanceof Def_Var) {
        Def_Var var = (Def_Var) node;
        componentVarNames.add(var.getIdentifier().toString());
        if (var.getType(compilationCounter) instanceof Integer_Type) {
            componentVarTypes.add("INTEGER");
        }
    }
    if (waitForCompReference && (node instanceof Reference)) {
        componentPortTypes.add(((Reference) node).getId().toString());
    }
    if (waitForSetOfFieldType) {
        if (node instanceof Reference) {
            setOfFieldType = node.toString();
            myASTVisitor.nodeNameSetOfTypesHashMap.put(parentName, setOfFieldType);
            waitForSetOfFieldType = false;
        } else if (node instanceof Type && !(node instanceof Referenced_Type) && !(node instanceof SetOf_Type)) {
            Type type = (Type) node;
            setOfFieldType = TypeMapper.map(type.getTypename());
            myASTVisitor.nodeNameSetOfTypesHashMap.put(parentName, setOfFieldType);
            waitForSetOfFieldType = false;
        }
    }
    if (waitForRecordOfFieldType) {
        if (node instanceof Reference) {
            recordOfFieldType = node.toString();
            myASTVisitor.nodeNameRecordOfTypesHashMap.put(parentName, recordOfFieldType);
            waitForRecordOfFieldType = false;
        } else if (node instanceof Type && !(node instanceof Referenced_Type) && !(node instanceof SequenceOf_Type)) {
            Type type = (Type) node;
            recordOfFieldType = TypeMapper.map(type.getTypename());
            myASTVisitor.nodeNameRecordOfTypesHashMap.put(parentName, recordOfFieldType);
            waitForRecordOfFieldType = false;
        }
    }
    if (node instanceof CompField) {
        // component
        CompField compFieldNode = (CompField) node;
        if (compFieldNode.getType() instanceof Referenced_Type) {
            compFieldTypes.add(((Referenced_Type) compFieldNode.getType()).getReference().getId().toString());
        } else {
            compFieldTypes.add(myASTVisitor.cutModuleNameFromBeginning(compFieldNode.getType().getTypename()));
        }
        compFieldNames.add(compFieldNode.getIdentifier().toString());
    }
    if (node instanceof Charstring_Value) {
        // charstring
        Charstring_Value singleValuedNode = (Charstring_Value) node;
        charstringValue = singleValuedNode.getValue();
    }
    if (node instanceof Integer_Value) {
        String value = ((Integer_Value) node).toString();
        if (myASTVisitor.isNextIntegerNegative) {
            value = "-" + value;
        }
        expressionValue.add("new INTEGER(\"" + value + "\")");
    }
    if (node instanceof Real_Value) {
        String value = ((Real_Value) node).toString();
        if (myASTVisitor.isNextIntegerNegative) {
            value = "-" + value;
        }
        if (value.equals("-Infinity") || value.equals("Infinity")) {
            value = "null";
        }
        expressionValue.add(value);
    }
    if (node instanceof Undefined_LowerIdentifier_Value) {
        String value = ((Undefined_LowerIdentifier_Value) node).getIdentifier().toString();
        if (myASTVisitor.isNextIntegerNegative) {
            value = "-" + value;
        }
        expressionValue.add(value);
    }
    if (node instanceof EnumerationItems) {
        for (int i = 0; i < ((EnumerationItems) node).getItems().size(); i++) {
            enumItems.add(((EnumerationItems) node).getItems().get(i).getId().toString());
            if (((EnumerationItems) node).getItems().get(i).getValue() != null) {
                enumItemValues.add(((EnumerationItems) node).getItems().get(i).getValue().toString());
            } else {
                enumItemValues.add(null);
            }
        }
    }
    if (waitingForPortAttriburtes && (node instanceof Referenced_Type)) {
        isPortTypeAReferencedType = true;
    }
    if (waitingForPortAttriburtes && (node instanceof PortTypeBody)) {
        PortTypeBody body = (PortTypeBody) node;
        int inCount = body.getInMessages().getNofTypes();
        int outCount = body.getOutMessage().getNofTypes();
        for (int i = 0; i < inCount; i++) {
            inMessageName.add(myASTVisitor.cutModuleNameFromBeginning(body.getInMessages().getTypeByIndex(i).getTypename()));
        }
        for (int i = 0; i < outCount; i++) {
            outMessageName.add(myASTVisitor.cutModuleNameFromBeginning(body.getOutMessage().getTypeByIndex(i).getTypename()));
        }
        int shorterListSize = inMessageName.size() <= outMessageName.size() ? inMessageName.size() : outMessageName.size();
        // if inout delete from both lists and add to inout
        for (int i = 0; i < inMessageName.size(); i++) {
            for (int j = 0; j < outMessageName.size(); j++) {
                if (inMessageName.get(i).equals(outMessageName.get(j))) {
                    inOutMessageName.add(inMessageName.get(i));
                    inMessageName.remove(i);
                    if (j == (outMessageName.size() - 1)) {
                        i--;
                    }
                    outMessageName.remove(j);
                    j--;
                }
            }
        }
        myASTVisitor.portNamePortTypeHashMap.put(currentPortName, body.getTestportType().toString());
        portTypeList.add(body.getTestportType().toString());
    }
}
Also used : Def_Var(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Var) Reference(org.eclipse.titan.designer.AST.Reference) Integer_Value(org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value) Def_Port(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Port) Real_Value(org.eclipse.titan.designer.AST.TTCN3.values.Real_Value) Range_ParsedSubType(org.eclipse.titan.designer.AST.TTCN3.types.subtypes.Range_ParsedSubType) SequenceOf_Type(org.eclipse.titan.designer.AST.TTCN3.types.SequenceOf_Type) Integer_Type(org.eclipse.titan.designer.AST.TTCN3.types.Integer_Type) TTCN3_Enumerated_Type(org.eclipse.titan.designer.AST.TTCN3.types.TTCN3_Enumerated_Type) SetOf_Type(org.eclipse.titan.designer.AST.TTCN3.types.SetOf_Type) Referenced_Type(org.eclipse.titan.designer.AST.TTCN3.types.Referenced_Type) Type(org.eclipse.titan.designer.AST.Type) Def_Type(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Type) CharString_Type(org.eclipse.titan.designer.AST.TTCN3.types.CharString_Type) SetOf_Type(org.eclipse.titan.designer.AST.TTCN3.types.SetOf_Type) Integer_Type(org.eclipse.titan.designer.AST.TTCN3.types.Integer_Type) CompField(org.eclipse.titan.designer.AST.TTCN3.types.CompField) Charstring_Value(org.eclipse.titan.designer.AST.TTCN3.values.Charstring_Value) EnumerationItems(org.eclipse.titan.designer.AST.TTCN3.types.EnumerationItems) PortTypeBody(org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody) Referenced_Type(org.eclipse.titan.designer.AST.TTCN3.types.Referenced_Type) SequenceOf_Type(org.eclipse.titan.designer.AST.TTCN3.types.SequenceOf_Type) Undefined_LowerIdentifier_Value(org.eclipse.titan.designer.AST.TTCN3.values.Undefined_LowerIdentifier_Value)

Example 2 with PortTypeBody

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

the class Getreply_Statement method checkGetreply.

public static void checkGetreply(final CompilationTimeStamp timestamp, final Statement source, final String statementName, final Reference portReference, final TemplateInstance parameter, final TemplateInstance valueMatch, final TemplateInstance fromClause, final Reference redirectValue, final Parameter_Redirect redirectParameter, final Reference redirectSender) {
    final Port_Type portType = Port_Utility.checkPortReference(timestamp, source, portReference);
    if (parameter == null) {
        if (portType != null) {
            final PortTypeBody body = portType.getPortBody();
            if (!body.getreplyAllowed(timestamp)) {
                if (OperationModes.OP_Message.equals(body.getOperationMode())) {
                    portReference.getLocation().reportSemanticError(MessageFormat.format(GETREPLYONMESSAGEPORT, statementName, portType.getTypename()));
                } else {
                    portReference.getLocation().reportSemanticError(MessageFormat.format(GETREPLYNOTSUPPORTEDONPORT, portType.getTypename()));
                }
            }
        }
        if (redirectValue != null) {
            redirectValue.getLocation().reportSemanticError(VALUEREDIRECTWITHOUTSIGNATURE);
            Port_Utility.checkValueRedirect(timestamp, redirectValue, null);
        }
        if (redirectParameter != null) {
            // true?
            redirectParameter.check(timestamp, null, true);
            redirectParameter.getLocation().reportSemanticError(PARAMETERREDIRECTWITHOUTSIGNATURE);
        }
    } else {
        IType signature = null;
        boolean signatureDetermined = false;
        if (portType != null) {
            final PortTypeBody body = portType.getPortBody();
            if (OperationModes.OP_Message.equals(body.getOperationMode())) {
                portReference.getLocation().reportSemanticError(MessageFormat.format(GETREPLYONMESSAGEPORT, statementName, portType.getTypename()));
            } else if (body.getreplyAllowed(timestamp)) {
                final TypeSet outSignatures = body.getOutSignatures();
                if (outSignatures.getNofTypes() == 1) {
                    signature = outSignatures.getTypeByIndex(0);
                } else {
                    signature = Port_Utility.getOutgoingType(timestamp, parameter);
                    if (signature == null) {
                        parameter.getLocation().reportSemanticError(UNKNOWNSIGNATURETYPE);
                    } else {
                        if (!outSignatures.hasType(timestamp, signature)) {
                            parameter.getLocation().reportSemanticError(MessageFormat.format(SIGNATUREMISSING, signature.getTypename(), portType.getTypename()));
                        }
                    }
                }
                signatureDetermined = true;
            } else {
                portReference.getLocation().reportSemanticError(MessageFormat.format(GETREPLYNOTSUPPORTEDONPORT, portType.getTypename()));
            }
        } else if (portReference == null) {
            // the statement refers to any port or there was
            // a syntax error
            parameter.getLocation().reportSemanticError(MessageFormat.format(ANYPORTWITHPARAMETER, statementName));
            if (valueMatch != null) {
                valueMatch.getLocation().reportSemanticError(MessageFormat.format(ANYPORTWITHVALUEMATCH, statementName));
            }
            if (redirectValue != null) {
                redirectValue.getLocation().reportSemanticError(MessageFormat.format(ANYPORTWITHVALUEREDIRECTION, statementName));
            }
            if (redirectParameter != null) {
                redirectParameter.getLocation().reportSemanticError(MessageFormat.format(ANYPORTWITHPARAMETERREDIRECTION, statementName));
            }
        }
        if (!signatureDetermined) {
            signature = Port_Utility.getOutgoingType(timestamp, parameter);
        }
        if (signature != null) {
            parameter.check(timestamp, signature);
            signature = signature.getTypeRefdLast(timestamp);
            Type returnType = null;
            switch(signature.getTypetype()) {
                case TYPE_SIGNATURE:
                    {
                        final Signature_Type signatureType = (Signature_Type) signature;
                        if (signatureType.isNonblocking()) {
                            final String message = MessageFormat.format(NONBLOCKINGSIGNATURE, statementName, signatureType.getTypename());
                            source.getLocation().reportSemanticError(message);
                        } else {
                            returnType = signatureType.getSignatureReturnType();
                        }
                        if (redirectParameter != null) {
                            redirectParameter.check(timestamp, signatureType, true);
                        }
                        if (returnType == null) {
                            if (valueMatch != null) {
                                valueMatch.getLocation().reportSemanticError(MessageFormat.format(VALUEMATCHWITHOUTRETURNTYPE, signature.getTypename()));
                            }
                            if (redirectValue != null) {
                                final String message = MessageFormat.format(VALUEREDIRECTWITHOUTRETURNTYPE, signature.getTypename());
                                redirectValue.getLocation().reportSemanticError(message);
                            }
                        }
                        break;
                    }
                default:
                    parameter.getLocation().reportSemanticError(MessageFormat.format(SIGNATUREEXPECTED, signature.getTypename()));
                    if (redirectParameter != null) {
                        redirectParameter.checkErroneous(timestamp);
                    }
                    break;
            }
            if (valueMatch != null) {
                if (returnType != null) {
                    valueMatch.check(timestamp, returnType);
                }
            }
            Port_Utility.checkValueRedirect(timestamp, redirectValue, returnType);
        }
    }
    Port_Utility.checkFromClause(timestamp, source, portType, fromClause, redirectSender);
}
Also used : Signature_Type(org.eclipse.titan.designer.AST.TTCN3.types.Signature_Type) Port_Type(org.eclipse.titan.designer.AST.TTCN3.types.Port_Type) Type(org.eclipse.titan.designer.AST.Type) IType(org.eclipse.titan.designer.AST.IType) 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) PortTypeBody(org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody) IType(org.eclipse.titan.designer.AST.IType)

Example 3 with PortTypeBody

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

the class Getcall_Statement method checkGetcallStatement.

public static void checkGetcallStatement(final CompilationTimeStamp timestamp, final Statement statement, final String statementName, final Reference portReference, final TemplateInstance parameter, final TemplateInstance fromClause, final Parameter_Redirect redirect, final Reference redirectSender) {
    final Port_Type portType = Port_Utility.checkPortReference(timestamp, statement, portReference);
    if (parameter == null) {
        if (portType != null) {
            final PortTypeBody body = portType.getPortBody();
            if (OperationModes.OP_Message.equals(body.getOperationMode())) {
                portReference.getLocation().reportSemanticError(MessageFormat.format(MESSAGEBASEDPORT, statementName, portType.getTypename()));
            } else if (body.getInSignatures() == null) {
                portReference.getLocation().reportSemanticError(MessageFormat.format(NOINSIGNATURES, portType.getTypename()));
            }
        }
        if (redirect != null) {
            redirect.getLocation().reportSemanticError(REDIRECTWITHOUTSIGNATURE);
            redirect.checkErroneous(timestamp);
        }
    } else {
        IType signature = null;
        boolean signatureDetermined = false;
        if (portType != null) {
            final PortTypeBody body = portType.getPortBody();
            final TypeSet inSignatures = body.getInSignatures();
            if (OperationModes.OP_Message.equals(body.getOperationMode())) {
                portReference.getLocation().reportSemanticError(MessageFormat.format(MESSAGEBASEDPORT, statementName, portType.getTypename()));
            } else if (inSignatures != null) {
                if (inSignatures.getNofTypes() == 1) {
                    signature = inSignatures.getTypeByIndex(0);
                } else {
                    signature = Port_Utility.getOutgoingType(timestamp, parameter);
                    if (signature == null) {
                        parameter.getLocation().reportSemanticError(UNKNOWNSIGNATURETYPE);
                    } else {
                        if (!inSignatures.hasType(timestamp, signature)) {
                            parameter.getLocation().reportSemanticError(MessageFormat.format(SIGNATURENOTPRESENT, signature.getTypename(), portType.getTypename()));
                        }
                    }
                }
                signatureDetermined = true;
            } else {
                portReference.getLocation().reportSemanticError(MessageFormat.format(NOINSIGNATURES, portType.getTypename()));
            }
        } else if (portReference == null) {
            // any port is referenced, or there was a syntax
            // error
            parameter.getLocation().reportSemanticError(MessageFormat.format(ANYWITHPARAMETER, statementName));
            if (redirect != null) {
                redirect.getLocation().reportSemanticError(MessageFormat.format(ANYWITHREDIRECT, statementName));
            }
        }
        if (!signatureDetermined) {
            signature = Port_Utility.getOutgoingType(timestamp, parameter);
        }
        if (signature != null) {
            parameter.check(timestamp, signature);
            signature = signature.getTypeRefdLast(timestamp);
            switch(signature.getTypetype()) {
                case TYPE_SIGNATURE:
                    ((Signature_Type) signature).checkThisTemplate(timestamp, parameter.getTemplateBody(), false, false, null);
                    if (redirect != null) {
                        redirect.check(timestamp, (Signature_Type) signature, false);
                    }
                    break;
                default:
                    parameter.getLocation().reportSemanticError(MessageFormat.format(SIGNATUREPARAMETEREXPECTED, signature.getTypename()));
                    if (redirect != null) {
                        redirect.checkErroneous(timestamp);
                    }
                    break;
            }
        }
    }
    Port_Utility.checkFromClause(timestamp, statement, portType, fromClause, redirectSender);
}
Also used : 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) PortTypeBody(org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody) IType(org.eclipse.titan.designer.AST.IType)

Example 4 with PortTypeBody

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

the class Catch_Statement method checkCatch.

public static void checkCatch(final CompilationTimeStamp timestamp, final Statement statement, final String statementName, final Reference portReference, final Reference signatureReference, final TemplateInstance parameter, final boolean timeout, final TemplateInstance fromClause, final Reference redirectValue, final Reference redirectSender) {
    final Port_Type portType = Port_Utility.checkPortReference(timestamp, statement, portReference);
    if (signatureReference == null) {
        if (timeout) {
            if (portReference == null) {
                statement.getLocation().reportSemanticError(TIMEOUTONANYPORT);
            } else {
                if (portType != null) {
                    final PortTypeBody body = portType.getPortBody();
                    // in the compiler
                    if (OperationModes.OP_Message.equals(body.getOperationMode())) {
                        portReference.getLocation().reportSemanticError(MessageFormat.format(TIMEOUTONMESSAGEPORT, portType.getTypename()));
                    } else if (!body.getreplyAllowed(timestamp)) {
                        portReference.getLocation().reportSemanticError(MessageFormat.format(TIMEOUTWITHOUTOUTSIGNATURES, portType.getTypename()));
                    }
                }
            }
            if (statement instanceof Catch_Statement) {
                final Catch_Statement catchStatement = (Catch_Statement) statement;
                if (!catchStatement.inCall) {
                    statement.getLocation().reportSemanticError(TIMEOUTNOTPERMITTED1);
                } else if (!catchStatement.callHasTimer) {
                    statement.getLocation().reportSemanticError(TIMEOUTNOTPERMITTED2);
                }
            }
            if (fromClause != null) {
                fromClause.getLocation().reportSemanticError(TIMEOUTWITHFROM);
            }
            if (redirectSender != null) {
                redirectSender.getLocation().reportSemanticError(TIMEOUTWITHSENDERREDIRECT);
            }
        } else {
            if (portType != null) {
                final PortTypeBody body = portType.getPortBody();
                if (OperationModes.OP_Message.equals(body.getOperationMode())) {
                    portReference.getLocation().reportSemanticError(MessageFormat.format(MESSAGEPORT, statementName, portType.getTypename()));
                } else if (!body.catchAllowed(timestamp)) {
                    portReference.getLocation().reportSemanticError(MessageFormat.format(PORTWITHOUTEXCEPTIONSUPPORT, portType.getTypename()));
                }
            }
        }
        if (redirectValue != null) {
            redirectValue.getLocation().reportSemanticError(VALUEREDIRECTWITHOUTPARAMETER);
            Port_Utility.checkValueRedirect(timestamp, redirectValue, null);
        }
    } else {
        Signature_Type signature = Port_Utility.checkSignatureReference(timestamp, signatureReference);
        if (portType != null) {
            final PortTypeBody body = portType.getPortBody();
            if (OperationModes.OP_Message.equals(body.getOperationMode())) {
                portReference.getLocation().reportSemanticError(MessageFormat.format(MESSAGEPORT, statementName, portType.getTypename()));
            } else if (body.catchAllowed(timestamp)) {
                final TypeSet outSignatures = body.getOutSignatures();
                if (signature != null) {
                    if (!outSignatures.hasType(timestamp, signature)) {
                        signatureReference.getLocation().reportSemanticError(MessageFormat.format(MISSINGSIGNATURE, signature.getTypename(), portType.getTypename()));
                    }
                } else if (outSignatures.getNofTypes() == 1) {
                    signature = (Signature_Type) outSignatures.getTypeByIndex(0).getTypeRefdLast(timestamp);
                }
            } else {
                portReference.getLocation().reportSemanticError(MessageFormat.format(PORTWITHOUTEXCEPTIONSUPPORT, portType.getTypename()));
            }
        } else if (portReference == null) {
            if (parameter != null) {
                parameter.getLocation().reportSemanticError(MessageFormat.format(ANYPORTWITHPARAMETER, statementName));
            }
            if (redirectValue != null) {
                redirectValue.getLocation().reportSemanticError(MessageFormat.format(ANYPORTWITHVALUEREDIRECT, statementName));
            }
        }
        // the receive parameter must also be present
        IType exceptionType = null;
        boolean exceptionTypeDetermined = false;
        final boolean[] valueRedirectChecked = new boolean[] { false };
        if (signature != null) {
            final SignatureExceptions exceptions = signature.getSignatureExceptions();
            if (exceptions == null) {
                signatureReference.getLocation().reportSemanticError(MessageFormat.format(SIGNATUREWITHOUTEXCEPTIONS, signature.getTypename()));
            } else {
                if (exceptions.getNofExceptions() == 1) {
                    exceptionType = exceptions.getExceptionByIndex(0);
                } else if (parameter != null) {
                    exceptionType = Port_Utility.getIncomingType(timestamp, parameter, redirectValue, valueRedirectChecked);
                    if (exceptionType == null) {
                        parameter.getLocation().reportSemanticError(UNKNOWNEXCEPTIONTYPE);
                    } else {
                        final int nofCompatibleTypes = exceptions.getNofCompatibleExceptions(timestamp, exceptionType);
                        if (nofCompatibleTypes == 0) {
                            final String message = MessageFormat.format(MISSINGEXCEPTIONTYPE, exceptionType.getTypename(), signature.getTypename());
                            parameter.getLocation().reportSemanticError(message);
                        } else if (nofCompatibleTypes > 1) {
                            final String message = MessageFormat.format(AMBIGUOUSEXCEPTIONTYPE, exceptionType.getTypename(), signature.getTypename());
                            parameter.getLocation().reportSemanticError(message);
                        }
                    }
                }
                exceptionTypeDetermined = true;
            }
        }
        if (!exceptionTypeDetermined) {
            exceptionType = Port_Utility.getIncomingType(timestamp, parameter, redirectValue, valueRedirectChecked);
        }
        if (exceptionType != null && parameter != null) {
            parameter.check(timestamp, exceptionType);
            if (!valueRedirectChecked[0]) {
                Port_Utility.checkValueRedirect(timestamp, redirectValue, exceptionType);
            }
            exceptionType = exceptionType.getTypeRefdLast(timestamp);
            switch(exceptionType.getTypetype()) {
                case TYPE_SIGNATURE:
                    parameter.getLocation().reportSemanticError(MessageFormat.format(EXCEPTIONPARAMEXPECTED1, exceptionType.getTypename()));
                    break;
                case TYPE_PORT:
                    parameter.getLocation().reportSemanticError(MessageFormat.format(EXCEPTIONPARAMEXPECTED2, exceptionType.getTypename()));
                    break;
                case TYPE_DEFAULT:
                    parameter.getLocation().reportSemanticError(EXCEPTIONPARAMEXPECTED3);
                    break;
                default:
                    // accept it
                    break;
            }
        }
    }
    Port_Utility.checkFromClause(timestamp, statement, portType, fromClause, redirectSender);
}
Also used : SignatureExceptions(org.eclipse.titan.designer.AST.TTCN3.types.SignatureExceptions) Signature_Type(org.eclipse.titan.designer.AST.TTCN3.types.Signature_Type) TypeSet(org.eclipse.titan.designer.AST.TTCN3.types.TypeSet) Port_Type(org.eclipse.titan.designer.AST.TTCN3.types.Port_Type) PortTypeBody(org.eclipse.titan.designer.AST.TTCN3.types.PortTypeBody) IType(org.eclipse.titan.designer.AST.IType)

Example 5 with PortTypeBody

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

the class Connect_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(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)

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