Search in sources :

Example 1 with ASN1_Set_Seq_Choice_BaseType

use of org.eclipse.titan.designer.AST.ASN1.types.ASN1_Set_Seq_Choice_BaseType in project titan.EclipsePlug-ins by eclipse.

the class Type method checkThisVariant.

@Override
public /**
 * {@inheritDoc}
 */
void checkThisVariant(final CompilationTimeStamp timestamp, final SingleWithAttribute singleWithAttribute, final boolean global) {
    final IType type = getTypeWithCodingTable(timestamp, false);
    if (type == null) {
    // FIXME as only RAW is supported for now, we can not report this error
    // if (!global) {
    // singleWithAttribute.getLocation().reportSemanticError(MessageFormat.format("No encoding rules defined for type `{0}''", getTypename()));
    // }
    } else {
        final List<String> codingStrings = singleWithAttribute.getAttributeSpecification().getEncodings();
        // gather the built-in codecs referred to by the variant's encoding strings
        final ArrayList<MessageEncoding_type> codings = new ArrayList<IType.MessageEncoding_type>();
        boolean erroneous = false;
        if (codingStrings == null) {
            if (type.getCodingTable().size() > 1) {
                if (!global) {
                    singleWithAttribute.getLocation().reportSemanticError(MessageFormat.format("The encoding reference is mandatory for variant attributes of type  `{0}''", getTypename()));
                }
                erroneous = true;
            } else if (type.getCodingTable().get(0).builtIn) {
                codings.add(type.getCodingTable().get(0).builtInCoding);
            } else {
                // PER or custom encoding
                final MessageEncoding_type coding = "PER".equals(type.getCodingTable().get(0).customCoding.name) ? MessageEncoding_type.PER : MessageEncoding_type.CUSTOM;
                singleWithAttribute.getLocation().reportSemanticWarning(MessageFormat.format("Variant attributes related to `{0}'' encoding are ignored", coding.getEncodingName()));
            }
        } else {
            for (int i = 0; i < codingStrings.size(); i++) {
                final String encodingString = codingStrings.get(i);
                final MessageEncoding_type coding = getEncodingType(encodingString);
                if (!hasEncoding(timestamp, coding, encodingString)) {
                    erroneous = true;
                    // FIXME RAW restriction only exists because that is the only supported encoding right now
                    if (!global && coding == MessageEncoding_type.RAW) {
                        if (coding == MessageEncoding_type.CUSTOM) {
                            singleWithAttribute.getLocation().reportSemanticError(MessageFormat.format("Type `{0}'' does not support {1} encoding", getTypename(), coding.getEncodingName()));
                        } else {
                            singleWithAttribute.getLocation().reportSemanticError(MessageFormat.format("Type `{0}'' does not support custom encoding `{1}''", getTypename(), encodingString));
                        }
                    }
                } else if (coding != MessageEncoding_type.PER && coding != MessageEncoding_type.CUSTOM) {
                    codings.add(coding);
                } else {
                    // PER or custom encoding
                    singleWithAttribute.getLocation().reportSemanticWarning(MessageFormat.format("Variant attributes related to {0} encoding are ignored", coding.getEncodingName()));
                }
            }
        }
        // FIXME implement checks
        // TODO only raw data is extracted
        final VariantAttributeAnalyzer analyzer = new VariantAttributeAnalyzer();
        boolean newRaw = false;
        final AtomicBoolean rawFoud = new AtomicBoolean(false);
        if (rawAttribute == null) {
            IType t_refd = this;
            while (t_refd.getRawAttribute() == null && t_refd instanceof Referenced_Type) {
                final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
                t_refd = ((Referenced_Type) t_refd).getTypeRefd(timestamp, referenceChain);
                referenceChain.release();
            }
            rawAttribute = new RawAST(t_refd.getRawAttribute(), getDefaultRawFieldLength());
            newRaw = true;
        }
        analyzer.parse(rawAttribute, singleWithAttribute.getAttributeSpecification(), getLengthMultiplier(), rawFoud);
        if (!rawFoud.get() && newRaw) {
            rawAttribute = null;
        }
    }
    if (global) {
        // send global variant attributes to field/element types
        switch(getTypetype()) {
            case TYPE_TTCN3_CHOICE:
            case TYPE_TTCN3_SEQUENCE:
            case TYPE_TTCN3_SET:
                for (int i = 0; i < ((TTCN3_Set_Seq_Choice_BaseType) this).getNofComponents(); i++) {
                    ((TTCN3_Set_Seq_Choice_BaseType) this).getComponentByIndex(i).getType().checkThisVariant(timestamp, singleWithAttribute, global);
                }
                break;
            case TYPE_ASN1_CHOICE:
            case TYPE_ASN1_SEQUENCE:
            case TYPE_ASN1_SET:
                for (int i = 0; i < ((ASN1_Set_Seq_Choice_BaseType) this).getNofComponents(timestamp); i++) {
                    ((ASN1_Set_Seq_Choice_BaseType) this).getComponentByIndex(i).getType().checkThisVariant(timestamp, singleWithAttribute, global);
                }
                break;
            case TYPE_ANYTYPE:
                for (int i = 0; i < ((Anytype_Type) this).getNofComponents(); i++) {
                    ((Anytype_Type) this).getComponentByIndex(i).getType().checkThisVariant(timestamp, singleWithAttribute, global);
                }
                break;
            case TYPE_OPENTYPE:
                for (int i = 0; i < ((Open_Type) this).getNofComponents(); i++) {
                    ((Open_Type) this).getComponentByIndex(i).getType().checkThisVariant(timestamp, singleWithAttribute, global);
                }
                break;
            case TYPE_ARRAY:
                ((Array_Type) this).getElementType().checkThisVariant(timestamp, singleWithAttribute, global);
                break;
            case TYPE_SEQUENCE_OF:
                ((SequenceOf_Type) this).getOfType().checkThisVariant(timestamp, singleWithAttribute, global);
                break;
            case TYPE_SET_OF:
                ((SetOf_Type) this).getOfType().checkThisVariant(timestamp, singleWithAttribute, global);
                break;
            default:
                break;
        }
    }
}
Also used : VariantAttributeAnalyzer(org.eclipse.titan.designer.parsers.variantattributeparser.VariantAttributeAnalyzer) Open_Type(org.eclipse.titan.designer.AST.ASN1.types.Open_Type) RawAST(org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST) ASN1_Set_Seq_Choice_BaseType(org.eclipse.titan.designer.AST.ASN1.types.ASN1_Set_Seq_Choice_BaseType) ArrayList(java.util.ArrayList) Anytype_Type(org.eclipse.titan.designer.AST.TTCN3.types.Anytype_Type) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TTCN3_Set_Seq_Choice_BaseType(org.eclipse.titan.designer.AST.TTCN3.types.TTCN3_Set_Seq_Choice_BaseType) Referenced_Type(org.eclipse.titan.designer.AST.TTCN3.types.Referenced_Type)

Example 2 with ASN1_Set_Seq_Choice_BaseType

use of org.eclipse.titan.designer.AST.ASN1.types.ASN1_Set_Seq_Choice_BaseType in project titan.EclipsePlug-ins by eclipse.

the class TTCN3_Set_Seq_Choice_BaseType method convertRAWCodingAttributes.

// FIXME comment
protected RawASTStruct convertRAWCodingAttributes(final JavaGenData aData, final StringBuilder source, final boolean hasRaw, final List<FieldInfo> namesList) {
    RawASTStruct raw = null;
    if (hasRaw) {
        RawAST dummy_raw;
        if (rawAttribute == null) {
            dummy_raw = new RawAST(getDefaultRawFieldLength());
        } else {
            dummy_raw = rawAttribute;
        }
        raw = new RawASTStruct(dummy_raw);
        // building taglist
        final int taglistSize = dummy_raw.taglist == null ? 0 : dummy_raw.taglist.size();
        for (int c = 0; c < taglistSize; c++) {
            final rawAST_single_tag singleTag = dummy_raw.taglist.get(c);
            final rawAST_coding_taglist codingSingleTag = raw.taglist.list.get(c);
            if (singleTag.keyList != null) {
                codingSingleTag.fields = new ArrayList<RawASTStruct.rawAST_coding_field_list>(singleTag.keyList.size());
            }
            codingSingleTag.fieldname = singleTag.fieldName.getName();
            codingSingleTag.varName = FieldSubReference.getJavaGetterName(codingSingleTag.fieldname);
            final Identifier idf = singleTag.fieldName;
            codingSingleTag.fieldnum = getComponentIndexByName(idf);
            final int keyListSize = singleTag.keyList == null ? 0 : singleTag.keyList.size();
            for (int a = 0; a < keyListSize; a++) {
                final rawAST_tag_field_value key = singleTag.keyList.get(a);
                final RawASTStruct.rawAST_coding_field_list codingKey = new RawASTStruct.rawAST_coding_field_list();
                codingSingleTag.fields.add(codingKey);
                codingKey.fields = new ArrayList<RawASTStruct.rawAST_coding_fields>(key.keyField.names.size());
                // codingKey.value = key.value;
                final ExpressionStruct expression = new ExpressionStruct();
                key.v_value.generateCodeExpression(aData, expression, true);
                codingKey.expression = expression;
                codingKey.isOmitValue = key.v_value.getValuetype() == Value_type.OMIT_VALUE;
                codingKey.start_pos = 0;
                final CompField cf = getComponentByIndex(codingSingleTag.fieldnum);
                IType t = cf.getType().getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
                final RawASTStruct.rawAST_coding_fields tempField = new rawAST_coding_fields();
                tempField.nthfield = codingSingleTag.fieldnum;
                tempField.nthfieldname = singleTag.fieldName.getName();
                tempField.fieldtype = rawAST_coding_field_type.UNION_FIELD;
                tempField.type = t.getGenNameValue(aData, source, myScope);
                tempField.typedesc = t.getGenNameTypeDescriptor(aData, source, myScope);
                if (cf.isOptional()) {
                    tempField.fieldtype = rawAST_coding_field_type.OPTIONAL_FIELD;
                } else {
                    tempField.fieldtype = rawAST_coding_field_type.MANDATORY_FIELD;
                }
                codingKey.fields.add(tempField);
                for (int b = 0; b < key.keyField.names.size(); b++) {
                    final RawASTStruct.rawAST_coding_fields newField = new rawAST_coding_fields();
                    codingKey.fields.add(newField);
                    final Identifier idf2 = key.keyField.names.get(b);
                    int comp_index = 0;
                    CompField cf2;
                    switch(t.getTypetype()) {
                        case TYPE_TTCN3_CHOICE:
                            comp_index = ((TTCN3_Choice_Type) t).getComponentIndexByName(idf2);
                            cf2 = ((TTCN3_Choice_Type) t).getComponentByIndex(comp_index);
                            newField.nthfield = comp_index;
                            newField.nthfieldname = idf2.getName();
                            newField.fieldtype = rawAST_coding_field_type.UNION_FIELD;
                            break;
                        case TYPE_TTCN3_SEQUENCE:
                        case TYPE_TTCN3_SET:
                            comp_index = ((TTCN3_Set_Seq_Choice_BaseType) t).getComponentIndexByName(idf2);
                            cf2 = ((TTCN3_Set_Seq_Choice_BaseType) t).getComponentByIndex(comp_index);
                            newField.nthfield = comp_index;
                            newField.nthfieldname = idf2.getName();
                            if (cf2.isOptional()) {
                                newField.fieldtype = rawAST_coding_field_type.OPTIONAL_FIELD;
                            } else {
                                newField.fieldtype = rawAST_coding_field_type.MANDATORY_FIELD;
                            }
                            break;
                        default:
                            // internal error
                            return null;
                    }
                    final IType field_type = cf2.getType();
                    newField.type = field_type.getGenNameValue(aData, source, myScope);
                    newField.typedesc = field_type.getGenNameTypeDescriptor(aData, source, myScope);
                    if (field_type.getTypetype() == Type_type.TYPE_TTCN3_SEQUENCE && ((TTCN3_Sequence_Type) field_type).rawAttribute != null && (((TTCN3_Sequence_Type) field_type).rawAttribute.pointerto == null || ((TTCN3_Sequence_Type) field_type).rawAttribute.lengthto != null)) {
                        codingKey.start_pos = -1;
                    }
                    if (t.getTypetype() == Type_type.TYPE_TTCN3_SEQUENCE) {
                        IType t2;
                        for (int i = 0; i < comp_index && codingKey.start_pos >= 0; i++) {
                            t2 = ((TTCN3_Sequence_Type) t).getComponentByIndex(i).getType();
                            if (t2.getRawLength() >= 0) {
                                if (((Type) t2).rawAttribute != null) {
                                    codingKey.start_pos += ((Type) t2).rawAttribute.padding;
                                }
                                codingKey.start_pos += ((Type) t2).getRawLength();
                            } else {
                                codingKey.start_pos = -1;
                            }
                        }
                    }
                    t = field_type.getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
                }
            }
        }
        // building presence list
        final int presenceListSize = dummy_raw.presence == null || dummy_raw.presence.keyList == null ? 0 : dummy_raw.presence.keyList.size();
        for (int a = 0; a < presenceListSize; a++) {
            final rawAST_tag_field_value fieldValue = dummy_raw.presence.keyList.get(a);
            final rawAST_coding_field_list presences = new rawAST_coding_field_list();
            raw.presence.fields.add(presences);
            final ExpressionStruct expression = new ExpressionStruct();
            fieldValue.v_value.generateCodeExpression(aData, expression, true);
            presences.expression = expression;
            presences.isOmitValue = fieldValue.v_value.getValuetype() == Value_type.OMIT_VALUE;
            final int keySize = fieldValue.keyField == null || fieldValue.keyField.names == null ? 0 : fieldValue.keyField.names.size();
            presences.fields = new ArrayList<RawASTStruct.rawAST_coding_fields>(keySize);
            IType t = this;
            for (int b = 0; b < keySize; b++) {
                final RawASTStruct.rawAST_coding_fields newField = new rawAST_coding_fields();
                presences.fields.add(newField);
                final Identifier idf2 = fieldValue.keyField.names.get(b);
                int comp_index = 0;
                CompField cf2;
                switch(t.getTypetype()) {
                    case TYPE_TTCN3_CHOICE:
                        comp_index = ((TTCN3_Choice_Type) t).getComponentIndexByName(idf2);
                        cf2 = ((TTCN3_Choice_Type) t).getComponentByIndex(comp_index);
                        newField.nthfield = comp_index;
                        newField.nthfieldname = idf2.getName();
                        newField.fieldtype = rawAST_coding_field_type.UNION_FIELD;
                        break;
                    case TYPE_TTCN3_SEQUENCE:
                    case TYPE_TTCN3_SET:
                        comp_index = ((TTCN3_Set_Seq_Choice_BaseType) t).getComponentIndexByName(idf2);
                        cf2 = ((TTCN3_Set_Seq_Choice_BaseType) t).getComponentByIndex(comp_index);
                        newField.nthfield = comp_index;
                        newField.nthfieldname = idf2.getName();
                        if (cf2.isOptional()) {
                            newField.fieldtype = rawAST_coding_field_type.OPTIONAL_FIELD;
                        } else {
                            newField.fieldtype = rawAST_coding_field_type.MANDATORY_FIELD;
                        }
                        break;
                    default:
                        // internal error
                        return null;
                }
                final IType field_type = cf2.getType();
                newField.type = field_type.getGenNameValue(aData, source, myScope);
                newField.typedesc = field_type.getGenNameTypeDescriptor(aData, source, myScope);
                t = field_type.getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
            }
        }
        final int extBiGroupSize = dummy_raw.ext_bit_groups == null ? 0 : dummy_raw.ext_bit_groups.size();
        for (int c = 0; c < extBiGroupSize; c++) {
            final rawAST_ext_bit_group tempGroup = dummy_raw.ext_bit_groups.get(c);
            final Identifier idf = tempGroup.from;
            final Identifier idf2 = tempGroup.to;
            final rawAST_coding_ext_group codingGroup = new rawAST_coding_ext_group();
            raw.ext_bit_groups.add(codingGroup);
            codingGroup.ext_bit = tempGroup.ext_bit;
            codingGroup.from = getComponentIndexByName(idf);
            codingGroup.to = getComponentIndexByName(idf2);
        }
        for (int i = 0; i < getNofComponents(); i++) {
            final FieldInfo element_i = namesList.get(i);
            final CompField cf = getComponentByIndex(i);
            final IType t_field = cf.getType();
            final IType t_field_last = t_field.getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
            final RawAST rawpar = t_field.getRawAttribute();
            if (rawpar != null) {
                element_i.raw = new RawASTStruct(rawpar);
                final int lengthtoNum = rawpar.lengthto == null ? 0 : rawpar.lengthto.size();
                for (int j = 0; j < lengthtoNum; j++) {
                    final Identifier idf = rawpar.lengthto.get(j);
                    element_i.raw.lengthto.add(getComponentIndexByName(idf));
                }
                if (lengthtoNum > 0 && rawpar.lengthindex != null) {
                    final Identifier idf = rawpar.lengthindex.names.get(0);
                    int comp_index = 0;
                    CompField cf2;
                    switch(t_field_last.getTypetype()) {
                        case TYPE_TTCN3_CHOICE:
                            comp_index = ((TTCN3_Choice_Type) t_field_last).getComponentIndexByName(idf);
                            cf2 = ((TTCN3_Choice_Type) t_field_last).getComponentByIndex(comp_index);
                            element_i.raw.lengthindex.nthfield = comp_index;
                            element_i.raw.lengthindex.nthfieldname = idf.getName();
                            break;
                        case TYPE_TTCN3_SEQUENCE:
                        case TYPE_TTCN3_SET:
                            comp_index = ((TTCN3_Set_Seq_Choice_BaseType) t_field_last).getComponentIndexByName(idf);
                            cf2 = ((TTCN3_Set_Seq_Choice_BaseType) t_field_last).getComponentByIndex(comp_index);
                            element_i.raw.lengthindex.nthfield = comp_index;
                            element_i.raw.lengthindex.nthfieldname = idf.getName();
                            break;
                        default:
                            // internal error
                            return null;
                    }
                    final Type t_field2 = cf2.getType();
                    if (t_field2.getTypetype() == Type_type.TYPE_TTCN3_CHOICE) {
                        element_i.raw.lengthindex.fieldtype = rawAST_coding_field_type.UNION_FIELD;
                    } else if (cf2.isOptional()) {
                        element_i.raw.lengthindex.fieldtype = rawAST_coding_field_type.OPTIONAL_FIELD;
                    } else {
                        element_i.raw.lengthindex.fieldtype = rawAST_coding_field_type.MANDATORY_FIELD;
                    }
                    element_i.raw.lengthindex.type = t_field2.getGenNameValue(aData, source, myScope);
                    element_i.raw.lengthindex.typedesc = t_field2.getGenNameTypeDescriptor(aData, source, myScope);
                }
                if (lengthtoNum > 0 && rawpar.lengthindex == null) {
                    switch(t_field_last.getTypetype()) {
                        case TYPE_TTCN3_CHOICE:
                        case TYPE_TTCN3_SEQUENCE:
                        case TYPE_TTCN3_SET:
                            final int componentsNumber = ((TTCN3_Set_Seq_Choice_BaseType) t_field_last).getNofComponents();
                            element_i.raw.union_member_num = componentsNumber;
                            element_i.raw.member_name = new ArrayList<String>(componentsNumber + 1);
                            element_i.raw.member_name.add(t_field_last.getGenNameValue(aData, source, myScope));
                            for (int m = 1; m < componentsNumber + 1; m++) {
                                final CompField compf = ((TTCN3_Set_Seq_Choice_BaseType) t_field_last).getComponentByIndex(m - 1);
                                element_i.raw.member_name.add(compf.getIdentifier().getName());
                            }
                            break;
                        default:
                            break;
                    }
                }
                if (rawpar.pointerto != null) {
                    final Identifier idf = rawpar.pointerto;
                    element_i.raw.pointerto = getComponentIndexByName(idf);
                    if (rawpar.ptrbase != null) {
                        final Identifier idf2 = rawpar.ptrbase;
                        element_i.raw.pointerbase = getComponentIndexByName(idf2);
                    } else {
                        element_i.raw.pointerbase = i;
                    }
                }
                // building presence list
                final int parPresenceListSize = rawpar.presence == null || rawpar.presence.keyList == null ? 0 : rawpar.presence.keyList.size();
                for (int a = 0; a < parPresenceListSize; a++) {
                    final rawAST_coding_field_list presences = new rawAST_coding_field_list();
                    element_i.raw.presence.fields.add(presences);
                    final rawAST_tag_field_value fieldValue = rawpar.presence.keyList.get(a);
                    final ExpressionStruct expression = new ExpressionStruct();
                    fieldValue.v_value.generateCodeExpression(aData, expression, true);
                    presences.expression = expression;
                    presences.isOmitValue = fieldValue.v_value.getValuetype() == Value_type.OMIT_VALUE;
                    presences.fields = new ArrayList<RawASTStruct.rawAST_coding_fields>(fieldValue.keyField.names.size());
                    IType t = this;
                    for (int b = 0; b < fieldValue.keyField.names.size(); b++) {
                        final RawASTStruct.rawAST_coding_fields newField = new rawAST_coding_fields();
                        presences.fields.add(newField);
                        final Identifier idf2 = fieldValue.keyField.names.get(b);
                        int comp_index = 0;
                        CompField cf2;
                        switch(t.getTypetype()) {
                            case TYPE_TTCN3_CHOICE:
                                comp_index = ((TTCN3_Choice_Type) t).getComponentIndexByName(idf2);
                                cf2 = ((TTCN3_Choice_Type) t).getComponentByIndex(comp_index);
                                newField.nthfield = comp_index;
                                newField.nthfieldname = idf2.getName();
                                newField.fieldtype = rawAST_coding_field_type.UNION_FIELD;
                                break;
                            case TYPE_TTCN3_SEQUENCE:
                            case TYPE_TTCN3_SET:
                                comp_index = ((TTCN3_Set_Seq_Choice_BaseType) t).getComponentIndexByName(idf2);
                                cf2 = ((TTCN3_Set_Seq_Choice_BaseType) t).getComponentByIndex(comp_index);
                                newField.nthfield = comp_index;
                                newField.nthfieldname = idf2.getName();
                                if (cf2.isOptional()) {
                                    newField.fieldtype = rawAST_coding_field_type.OPTIONAL_FIELD;
                                } else {
                                    newField.fieldtype = rawAST_coding_field_type.MANDATORY_FIELD;
                                }
                                break;
                            default:
                                // internal error
                                return null;
                        }
                        final IType field_type = cf2.getType();
                        newField.type = field_type.getGenNameValue(aData, source, myScope);
                        newField.typedesc = field_type.getGenNameTypeDescriptor(aData, source, myScope);
                        t = field_type.getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
                    }
                }
                // building crosstaglist
                final int crossTaglistSize = rawpar.crosstaglist == null ? 0 : rawpar.crosstaglist.size();
                for (int c = 0; c < crossTaglistSize; c++) {
                    final rawAST_single_tag singleTag = rawpar.crosstaglist.get(c);
                    final rawAST_coding_taglist codingSingleTag = element_i.raw.crosstaglist.list.get(c);
                    if (singleTag.keyList != null) {
                        codingSingleTag.fields = new ArrayList<RawASTStruct.rawAST_coding_field_list>(singleTag.keyList.size());
                    }
                    codingSingleTag.fieldname = singleTag.fieldName.getName();
                    codingSingleTag.varName = FieldSubReference.getJavaGetterName(codingSingleTag.fieldname);
                    final Identifier idf = singleTag.fieldName;
                    switch(t_field_last.getTypetype()) {
                        case TYPE_TTCN3_CHOICE:
                        case TYPE_TTCN3_SEQUENCE:
                        case TYPE_TTCN3_SET:
                            codingSingleTag.fieldnum = ((TTCN3_Set_Seq_Choice_BaseType) t_field_last).getComponentIndexByName(idf);
                            break;
                        case TYPE_ASN1_CHOICE:
                            codingSingleTag.fieldnum = ((ASN1_Set_Seq_Choice_BaseType) t_field_last).getComponentIndexByName(idf);
                            break;
                        default:
                            codingSingleTag.fieldnum = -1;
                            break;
                    }
                    final int keyListSize = singleTag.keyList == null ? 0 : singleTag.keyList.size();
                    for (int a = 0; a < keyListSize; a++) {
                        final rawAST_tag_field_value key = singleTag.keyList.get(a);
                        final RawASTStruct.rawAST_coding_field_list codingKey = new RawASTStruct.rawAST_coding_field_list();
                        codingSingleTag.fields.add(codingKey);
                        codingKey.fields = new ArrayList<RawASTStruct.rawAST_coding_fields>(key.keyField.names.size());
                        final ExpressionStruct expression = new ExpressionStruct();
                        key.v_value.generateCodeExpression(aData, expression, true);
                        codingKey.expression = expression;
                        codingKey.isOmitValue = key.v_value.getValuetype() == Value_type.OMIT_VALUE;
                        IType t = this;
                        for (int b = 0; b < key.keyField.names.size(); b++) {
                            final RawASTStruct.rawAST_coding_fields newField = new rawAST_coding_fields();
                            codingKey.fields.add(newField);
                            final Identifier idf2 = key.keyField.names.get(b);
                            int comp_index = 0;
                            CompField cf2;
                            switch(t.getTypetype()) {
                                case TYPE_TTCN3_CHOICE:
                                    comp_index = ((TTCN3_Choice_Type) t).getComponentIndexByName(idf2);
                                    cf2 = ((TTCN3_Choice_Type) t).getComponentByIndex(comp_index);
                                    newField.nthfield = comp_index;
                                    newField.nthfieldname = idf2.getName();
                                    newField.fieldtype = rawAST_coding_field_type.UNION_FIELD;
                                    break;
                                case TYPE_TTCN3_SEQUENCE:
                                case TYPE_TTCN3_SET:
                                    comp_index = ((TTCN3_Set_Seq_Choice_BaseType) t).getComponentIndexByName(idf2);
                                    cf2 = ((TTCN3_Set_Seq_Choice_BaseType) t).getComponentByIndex(comp_index);
                                    newField.nthfield = comp_index;
                                    newField.nthfieldname = idf2.getName();
                                    if (cf2.isOptional()) {
                                        newField.fieldtype = rawAST_coding_field_type.OPTIONAL_FIELD;
                                    } else {
                                        newField.fieldtype = rawAST_coding_field_type.MANDATORY_FIELD;
                                    }
                                    break;
                                default:
                                    // internal error
                                    return null;
                            }
                            final IType field_type = cf2.getType();
                            newField.type = field_type.getGenNameValue(aData, source, myScope);
                            newField.typedesc = field_type.getGenNameTypeDescriptor(aData, source, myScope);
                            t = field_type.getTypeRefdLast(CompilationTimeStamp.getBaseTimestamp());
                        }
                    }
                }
                element_i.raw.length = t_field.getRawLength();
                element_i.hasRaw = true;
            } else {
                element_i.hasRaw = false;
            }
        }
    }
    return raw;
}
Also used : RawAST(org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST) RawASTStruct.rawAST_coding_taglist(org.eclipse.titan.designer.AST.TTCN3.attributes.RawASTStruct.rawAST_coding_taglist) RawAST.rawAST_ext_bit_group(org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST.rawAST_ext_bit_group) RawASTStruct.rawAST_coding_ext_group(org.eclipse.titan.designer.AST.TTCN3.attributes.RawASTStruct.rawAST_coding_ext_group) RawASTStruct.rawAST_coding_fields(org.eclipse.titan.designer.AST.TTCN3.attributes.RawASTStruct.rawAST_coding_fields) IType(org.eclipse.titan.designer.AST.IType) RawASTStruct.rawAST_coding_field_list(org.eclipse.titan.designer.AST.TTCN3.attributes.RawASTStruct.rawAST_coding_field_list) ASN1_Set_Seq_Choice_BaseType(org.eclipse.titan.designer.AST.ASN1.types.ASN1_Set_Seq_Choice_BaseType) Type(org.eclipse.titan.designer.AST.Type) ASN1_Choice_Type(org.eclipse.titan.designer.AST.ASN1.types.ASN1_Choice_Type) IType(org.eclipse.titan.designer.AST.IType) RawASTStruct.rawAST_coding_field_list(org.eclipse.titan.designer.AST.TTCN3.attributes.RawASTStruct.rawAST_coding_field_list) Identifier(org.eclipse.titan.designer.AST.Identifier) RawASTStruct(org.eclipse.titan.designer.AST.TTCN3.attributes.RawASTStruct) RawASTStruct.rawAST_coding_fields(org.eclipse.titan.designer.AST.TTCN3.attributes.RawASTStruct.rawAST_coding_fields) ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct) RawAST.rawAST_tag_field_value(org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST.rawAST_tag_field_value) RawAST.rawAST_single_tag(org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST.rawAST_single_tag) FieldInfo(org.eclipse.titan.designer.AST.TTCN3.types.RecordSetCodeGenerator.FieldInfo)

Example 3 with ASN1_Set_Seq_Choice_BaseType

use of org.eclipse.titan.designer.AST.ASN1.types.ASN1_Set_Seq_Choice_BaseType in project titan.EclipsePlug-ins by eclipse.

the class TTCN3_Set_Seq_Choice_BaseType method checkSetSeqRawCodingAttributes.

/**
 * Check the raw coding attributes of TTCN3 record and set types.
 *
 * @param timestamp the timestamp of the actual semantic check cycle.
 */
protected void checkSetSeqRawCodingAttributes(final CompilationTimeStamp timestamp) {
    // check raw attributes
    if (rawAttribute != null) {
        if (rawAttribute.taglist != null) {
            for (int c = 0; c < rawAttribute.taglist.size(); c++) {
                final rawAST_single_tag singleTag = rawAttribute.taglist.get(c);
                final Identifier fieldname = singleTag.fieldName;
                if (!hasComponentWithName(fieldname.getName())) {
                    fieldname.getLocation().reportSemanticError(MessageFormat.format("Invalid field name `{0}'' in RAW parameter TAG for type `{1}''", fieldname.getDisplayName(), getTypename()));
                    continue;
                }
                if (singleTag.keyList != null) {
                    for (int a = 0; a < singleTag.keyList.size(); a++) {
                        final Reference reference = new Reference(null);
                        reference.addSubReference(new FieldSubReference(fieldname));
                        for (int b = 0; b < singleTag.keyList.get(a).keyField.names.size(); b++) {
                            reference.addSubReference(new FieldSubReference(singleTag.keyList.get(a).keyField.names.get(b)));
                        }
                        final IType t = getFieldType(timestamp, reference, 0, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, false);
                        if (t != null) {
                            final Value v = singleTag.keyList.get(a).v_value;
                            if (v != null) {
                                v.setMyScope(getMyScope());
                                v.setMyGovernor(t);
                                final IValue tempValue = t.checkThisValueRef(timestamp, v);
                                t.checkThisValue(timestamp, tempValue, null, new ValueCheckingOptions(Expected_Value_type.EXPECTED_CONSTANT, false, false, false, false, false));
                            }
                        }
                    }
                }
            }
        }
        if (rawAttribute.ext_bit_groups != null) {
            for (int a = 0; a < rawAttribute.ext_bit_groups.size(); a++) {
                final rawAST_ext_bit_group tempExtBitGroup = rawAttribute.ext_bit_groups.get(a);
                final Identifier fromIdentifier = tempExtBitGroup.from;
                final Identifier toIdentifier = tempExtBitGroup.to;
                boolean foundError = false;
                if (!hasComponentWithName(fromIdentifier.getName())) {
                    fromIdentifier.getLocation().reportSemanticError(MessageFormat.format("Invalid field name `{0}'' in RAW parameter EXTENSION_BIT_GROUP for type `{1}''", fromIdentifier.getDisplayName(), getTypename()));
                    foundError = true;
                }
                if (!hasComponentWithName(toIdentifier.getName())) {
                    toIdentifier.getLocation().reportSemanticError(MessageFormat.format("Invalid field name `{0}'' in RAW parameter EXTENSION_BIT_GROUP for type `{1}''", toIdentifier.getDisplayName(), getTypename()));
                    foundError = true;
                }
                if (!foundError) {
                    boolean foundStart = false;
                    for (int i = 0; i < getNofComponents(); i++) {
                        final Identifier tempId = getComponentByIndex(i).getIdentifier();
                        if (tempId.equals(fromIdentifier)) {
                            foundStart = true;
                        } else if (tempId.equals(toIdentifier)) {
                            if (!foundStart) {
                                getLocation().reportSemanticError(MessageFormat.format("Invalid field order in RAW parameter EXTENSION_BIT_GROUP for type `{0}'': `{1}'', `{2}''", getTypename(), fromIdentifier.getDisplayName(), toIdentifier.getDisplayName()));
                            }
                            break;
                        }
                    }
                }
            }
        }
        if (rawAttribute.paddall != RawAST.XDEFDEFAULT) {
            for (int i = 0; i < getNofComponents(); i++) {
                final CompField cField = getComponentByIndex(i);
                final Type fieldType = cField.getType();
                RawAST fieldRawAttribute = fieldType.rawAttribute;
                if (fieldRawAttribute == null) {
                    IType t = fieldType;
                    if (t instanceof Referenced_Type) {
                        final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
                        t = ((Referenced_Type) t).getTypeRefd(timestamp, referenceChain);
                        referenceChain.release();
                    }
                    while (t.getRawAttribute() == null && t instanceof Referenced_Type) {
                        final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
                        t = ((Referenced_Type) t).getTypeRefd(timestamp, referenceChain);
                        referenceChain.release();
                    }
                    fieldRawAttribute = new RawAST(t.getRawAttribute(), fieldType.getDefaultRawFieldLength());
                    fieldType.setRawAttributes(fieldRawAttribute);
                }
                if (fieldRawAttribute.padding == 0) {
                    fieldRawAttribute.padding = rawAttribute.padding;
                }
                if (fieldRawAttribute.prepadding == 0) {
                    fieldRawAttribute.prepadding = rawAttribute.prepadding;
                }
                if (fieldRawAttribute.padding_pattern_length == 0 && rawAttribute.padding_pattern_length > 0) {
                    fieldRawAttribute.padding_pattern = rawAttribute.padding_pattern;
                    fieldRawAttribute.padding_pattern_length = rawAttribute.padding_pattern_length;
                }
            }
        }
        if (rawAttribute.fieldorder != RawAST.XDEFDEFAULT) {
            for (int i = 0; i < getNofComponents(); i++) {
                final CompField cField = getComponentByIndex(i);
                final Type fieldType = cField.getType();
                RawAST fieldRawAttribute = fieldType.rawAttribute;
                if (fieldRawAttribute == null) {
                    fieldRawAttribute = new RawAST(fieldType.getDefaultRawFieldLength());
                    fieldType.setRawAttributes(fieldRawAttribute);
                }
                if (fieldRawAttribute.fieldorder == RawAST.XDEFDEFAULT) {
                    fieldRawAttribute.fieldorder = rawAttribute.fieldorder;
                }
            }
        }
    }
    if (rawAttribute != null && rawAttribute.presence != null) {
        if (rawAttribute.presence.keyList != null) {
            for (int a = 0; a < rawAttribute.presence.keyList.size(); a++) {
                final rawAST_tag_field_value tempTagFieldValue = rawAttribute.presence.keyList.get(a);
                final Reference reference = new Reference(null);
                reference.addSubReference(new FieldSubReference(tempTagFieldValue.keyField.names.get(0)));
                for (int b = 1; b < tempTagFieldValue.keyField.names.size(); b++) {
                    reference.addSubReference(new FieldSubReference(tempTagFieldValue.keyField.names.get(b)));
                }
                final IType t = getFieldType(timestamp, reference, 0, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, false);
                if (t != null) {
                    final Value v = tempTagFieldValue.v_value;
                    if (v != null) {
                        v.setMyScope(getMyScope());
                        v.setMyGovernor(t);
                        final IValue tempValue = t.checkThisValueRef(timestamp, v);
                        t.checkThisValue(timestamp, tempValue, null, new ValueCheckingOptions(Expected_Value_type.EXPECTED_CONSTANT, false, false, false, false, false));
                    }
                }
            }
        }
    }
    // number of bits used to store all previous fields
    int usedBits = 0;
    for (int i = 0; i < getNofComponents(); i++) {
        final CompField cField = getComponentByIndex(i);
        final Type fieldType = cField.getType();
        fieldType.forceRaw(timestamp);
        final RawAST rawPar = fieldType.rawAttribute;
        if (rawPar != null) {
            final Identifier fieldId = cField.getIdentifier();
            final IType fieldTypeLast = fieldType.getTypeRefdLast(timestamp);
            if (rawPar.prepadding != 0) {
                usedBits = (usedBits + rawPar.prepadding - 1) / rawPar.prepadding * rawPar.prepadding;
            }
            if (rawPar.intX && fieldTypeLast.getTypetype() == Type_type.TYPE_INTEGER) {
                if (usedBits % 8 != 0 && (rawAttribute == null || rawAttribute.fieldorder != RawAST.XDEFMSB)) {
                    getLocation().reportSemanticError(MessageFormat.format("Using RAW parameter IntX in a record/set with FIELDORDER set to 'lsb' is only supported if the IntX field starts at the beginning of a new octet. There are {0} unused bits in the last octet before field {1}.", 8 - (usedBits % 8), fieldId.getDisplayName()));
                }
            } else if (rawPar.fieldlength > 0) {
                usedBits += rawPar.fieldlength;
            }
            if (rawPar.padding != 0) {
                usedBits = (usedBits + rawPar.padding - 1) / rawPar.padding * rawPar.padding;
            }
            if (rawPar.lengthto != null) {
                for (int j = 0; j < rawPar.lengthto.size(); j++) {
                    final Identifier id = rawPar.lengthto.get(j);
                    if (!hasComponentWithName(id.getName())) {
                        id.getLocation().reportSemanticError(MessageFormat.format("Invalid fieldname in RAW parameter LENGTHTO for field {0}: {1}", fieldId.getDisplayName(), id.getDisplayName()));
                    }
                }
            }
            if (rawPar.lengthto != null) {
                switch(fieldTypeLast.getTypetype()) {
                    case TYPE_INTEGER:
                    case TYPE_INTEGER_A:
                        break;
                    case TYPE_TTCN3_CHOICE:
                        for (int fi = 0; fi < ((TTCN3_Choice_Type) fieldTypeLast).getNofComponents(); fi++) {
                            final Type_type tt = ((TTCN3_Choice_Type) fieldTypeLast).getComponentByIndex(fi).getType().getTypetype();
                            if (tt != Type_type.TYPE_INTEGER && tt != Type_type.TYPE_INTEGER_A) {
                                getLocation().reportSemanticError("The union type LENGTHTO field must contain only integer fields");
                            }
                        }
                        break;
                    case TYPE_ASN1_CHOICE:
                        for (int fi = 0; fi < ((ASN1_Choice_Type) fieldTypeLast).getNofComponents(timestamp); fi++) {
                            final Type_type tt = ((ASN1_Choice_Type) fieldTypeLast).getComponentByIndex(fi).getType().getTypetype();
                            if (tt != Type_type.TYPE_INTEGER && tt != Type_type.TYPE_INTEGER_A) {
                                getLocation().reportSemanticError("The union type LENGTHTO field must contain only integer fields");
                            }
                        }
                        break;
                    case TYPE_ANYTYPE:
                    case TYPE_OPENTYPE:
                    case TYPE_TTCN3_SEQUENCE:
                    case TYPE_ASN1_SEQUENCE:
                    case TYPE_TTCN3_SET:
                    case TYPE_ASN1_SET:
                        if (rawPar.lengthindex != null) {
                            // will be checked in the next step
                            break;
                        }
                    default:
                        getLocation().reportSemanticError(MessageFormat.format("The LENGTHTO field must be an integer or union type instead of `{0}''", fieldTypeLast.getTypename()));
                        break;
                }
            }
            if (rawPar.lengthto != null && rawPar.lengthindex != null) {
                final Identifier id = rawPar.lengthindex.names.get(0);
                switch(fieldTypeLast.getTypetype()) {
                    case TYPE_TTCN3_CHOICE:
                    case TYPE_TTCN3_SEQUENCE:
                    case TYPE_TTCN3_SET:
                        if (!((TTCN3_Set_Seq_Choice_BaseType) fieldTypeLast).hasComponentWithName(id.getName())) {
                            id.getLocation().reportSemanticError(MessageFormat.format("Invalid fieldname in RAW parameter LENGTHINDEX for field {0}: {1}", fieldId.getDisplayName(), id.getDisplayName()));
                        }
                        break;
                    case TYPE_ASN1_CHOICE:
                    case TYPE_ASN1_SEQUENCE:
                    case TYPE_ASN1_SET:
                        if (!((ASN1_Set_Seq_Choice_BaseType) fieldTypeLast).hasComponentWithName(id)) {
                            id.getLocation().reportSemanticError(MessageFormat.format("Invalid fieldname in RAW parameter LENGTHINDEX for field {0}: {1}", fieldId.getDisplayName(), id.getDisplayName()));
                        }
                        break;
                    default:
                        fieldId.getLocation().reportSemanticError(MessageFormat.format("Invalid fieldmember type in RAW parameter LENGTHINDEX for field {0}.", fieldId.getDisplayName()));
                        break;
                }
            }
            if (rawPar.pointerto != null) {
                final Identifier id = rawPar.pointerto;
                boolean errorFound = false;
                int pointed = 0;
                if (!hasComponentWithName(id.getName())) {
                    id.getLocation().reportSemanticError(MessageFormat.format("Invalid fieldname in RAW parameter POINTERTO for field {0}: {1}", fieldId.getDisplayName(), id.getDisplayName()));
                    errorFound = true;
                }
                if (!errorFound) {
                    pointed = getComponentIndexByName(id);
                    if (pointed <= i) {
                        id.getLocation().reportSemanticError(MessageFormat.format("Pointer must precede the pointed field. Incorrect field name `{0}'' in RAW parameter POINTERTO for field `{1}''", id.getDisplayName(), fieldId.getDisplayName()));
                        errorFound = true;
                    }
                }
                if (!errorFound && rawPar.ptrbase != null) {
                    final Identifier idf2 = rawPar.ptrbase;
                    if (!hasComponentWithName(idf2.getName())) {
                        idf2.getLocation().reportSemanticError(MessageFormat.format("Invalid field name `{0}'' in RAW parameter PTROFFSET for field `{1}''", idf2.getDisplayName(), fieldId.getDisplayName()));
                        errorFound = true;
                    }
                    if (!errorFound && getComponentIndexByName(idf2) > pointed) {
                        idf2.getLocation().reportSemanticError(MessageFormat.format("Pointer base must precede the pointed field. Incorrect field name `{0}'' in RAW parameter PTROFFSET for field `{1}''", idf2.getDisplayName(), fieldId.getDisplayName()));
                    }
                }
            }
            if (rawPar.presence != null && rawPar.presence.keyList != null) {
                for (int a = 0; a < rawPar.presence.keyList.size(); a++) {
                    final rawAST_tag_field_value tempTagFieldValue = rawPar.presence.keyList.get(a);
                    final Reference reference = new Reference(null);
                    reference.addSubReference(new FieldSubReference(tempTagFieldValue.keyField.names.get(0)));
                    for (int b = 1; b < tempTagFieldValue.keyField.names.size(); b++) {
                        reference.addSubReference(new FieldSubReference(tempTagFieldValue.keyField.names.get(b)));
                    }
                    final IType t = getFieldType(timestamp, reference, 0, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, false);
                    if (t != null) {
                        final Value v = tempTagFieldValue.v_value;
                        if (v != null) {
                            v.setMyScope(getMyScope());
                            v.setMyGovernor(t);
                            final IValue tempValue = t.checkThisValueRef(timestamp, v);
                            t.checkThisValue(timestamp, tempValue, null, new ValueCheckingOptions(Expected_Value_type.EXPECTED_CONSTANT, false, false, false, false, false));
                        }
                    }
                }
            }
            if (rawPar.crosstaglist != null) {
                for (int c = 0; c < rawPar.crosstaglist.size(); c++) {
                    final rawAST_single_tag singleTag = rawPar.crosstaglist.get(c);
                    final Identifier idf = singleTag.fieldName;
                    switch(fieldTypeLast.getTypetype()) {
                        case TYPE_TTCN3_CHOICE:
                        case TYPE_TTCN3_SEQUENCE:
                        case TYPE_TTCN3_SET:
                            if (!((TTCN3_Set_Seq_Choice_BaseType) fieldTypeLast).hasComponentWithName(idf.getName())) {
                                idf.getLocation().reportSemanticError(MessageFormat.format("Invalid fieldname in RAW parameter CROSSTAG for field {0}: {1}", fieldId.getDisplayName(), idf.getDisplayName()));
                            }
                            break;
                        case TYPE_ASN1_CHOICE:
                        case TYPE_ASN1_SEQUENCE:
                        case TYPE_ASN1_SET:
                            if (!((ASN1_Set_Seq_Choice_BaseType) fieldTypeLast).hasComponentWithName(idf)) {
                                idf.getLocation().reportSemanticError(MessageFormat.format("Invalid fieldname in RAW parameter CROSSTAG for field {0}: {1}", fieldId.getDisplayName(), idf.getDisplayName()));
                            }
                            break;
                        default:
                            fieldId.getLocation().reportSemanticError(MessageFormat.format("Invalid fieldmember type in RAW parameter CROSSTAG for field {0}.", fieldId.getDisplayName()));
                            break;
                    }
                    if (singleTag.keyList != null) {
                        for (int a = 0; a < singleTag.keyList.size(); a++) {
                            IType t2 = this;
                            boolean errorFound = false;
                            boolean allow_omit = false;
                            final rawAST_tag_field_value tagField = singleTag.keyList.get(a);
                            for (int b = 0; b < tagField.keyField.names.size() && !errorFound; b++) {
                                final Identifier idf2 = tagField.keyField.names.get(b);
                                CompField cf2 = null;
                                switch(t2.getTypetype()) {
                                    case TYPE_TTCN3_CHOICE:
                                    case TYPE_TTCN3_SEQUENCE:
                                    case TYPE_TTCN3_SET:
                                        if (!((TTCN3_Set_Seq_Choice_BaseType) t2).hasComponentWithName(idf2.getName())) {
                                            idf2.getLocation().reportSemanticError(MessageFormat.format("Invalid fieldname in RAW parameter CROSSTAG for field {0}: {1}", fieldId.getDisplayName(), idf2.getDisplayName()));
                                            errorFound = true;
                                        } else {
                                            cf2 = ((TTCN3_Set_Seq_Choice_BaseType) t2).getComponentByName(idf2.getName());
                                        }
                                        break;
                                    case TYPE_ASN1_CHOICE:
                                    case TYPE_ASN1_SEQUENCE:
                                    case TYPE_ASN1_SET:
                                        if (!((ASN1_Set_Seq_Choice_BaseType) t2).hasComponentWithName(idf2)) {
                                            idf2.getLocation().reportSemanticError(MessageFormat.format("Invalid fieldname in RAW parameter CROSSTAG for field {0}: {1}", fieldId.getDisplayName(), idf2.getDisplayName()));
                                            errorFound = true;
                                        } else {
                                            cf2 = ((ASN1_Set_Seq_Choice_BaseType) t2).getComponentByName(idf2);
                                        }
                                        break;
                                    default:
                                        fieldId.getLocation().reportSemanticError(MessageFormat.format("Invalid fieldmember type in RAW parameter CROSSTAG for field {0}.", fieldId.getDisplayName()));
                                        errorFound = true;
                                        break;
                                }
                                if (b == 0) {
                                    final int fieldIndex = getComponentIndexByName(idf2);
                                    if (fieldIndex == i) {
                                        idf2.getLocation().reportSemanticError(MessageFormat.format("RAW parameter CROSSTAG for field `{0}'' cannot refer to the field itself", idf2.getDisplayName()));
                                        errorFound = true;
                                    } else if (fieldIndex > i) {
                                        if (cField.isOptional()) {
                                            // TODO || fieldType.getRawLength() < 0
                                            idf2.getLocation().reportSemanticError(MessageFormat.format("Field `{0}'' that CROSSTAG refers to must precede field `{1}'' or field `{1}'' must be mandatory with fixed length", idf2.getDisplayName(), fieldId.getDisplayName()));
                                            errorFound = true;
                                        }
                                    }
                                }
                                if (!errorFound) {
                                    t2 = cf2.getType().getTypeRefdLast(timestamp);
                                    if (b == tagField.keyField.names.size() - 1 && cf2.isOptional()) {
                                        allow_omit = true;
                                    }
                                }
                            }
                            if (!errorFound) {
                                final Value v = singleTag.keyList.get(a).v_value;
                                if (v != null) {
                                    v.setMyScope(getMyScope());
                                    v.setMyGovernor(t2);
                                    final IValue tempValue = t2.checkThisValueRef(timestamp, v);
                                    t2.checkThisValue(timestamp, tempValue, null, new ValueCheckingOptions(Expected_Value_type.EXPECTED_CONSTANT, false, allow_omit, false, false, false));
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : RawAST(org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST) FieldSubReference(org.eclipse.titan.designer.AST.FieldSubReference) ISubReference(org.eclipse.titan.designer.AST.ISubReference) FieldSubReference(org.eclipse.titan.designer.AST.FieldSubReference) ArraySubReference(org.eclipse.titan.designer.AST.ArraySubReference) Reference(org.eclipse.titan.designer.AST.Reference) ParameterisedSubReference(org.eclipse.titan.designer.AST.ParameterisedSubReference) RawAST.rawAST_ext_bit_group(org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST.rawAST_ext_bit_group) IType(org.eclipse.titan.designer.AST.IType) ASN1_Choice_Type(org.eclipse.titan.designer.AST.ASN1.types.ASN1_Choice_Type) ASN1_Set_Seq_Choice_BaseType(org.eclipse.titan.designer.AST.ASN1.types.ASN1_Set_Seq_Choice_BaseType) Type(org.eclipse.titan.designer.AST.Type) ASN1_Choice_Type(org.eclipse.titan.designer.AST.ASN1.types.ASN1_Choice_Type) IType(org.eclipse.titan.designer.AST.IType) Identifier(org.eclipse.titan.designer.AST.Identifier) IValue(org.eclipse.titan.designer.AST.IValue) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain) Value(org.eclipse.titan.designer.AST.Value) IValue(org.eclipse.titan.designer.AST.IValue) RawAST.rawAST_tag_field_value(org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST.rawAST_tag_field_value) RawAST.rawAST_single_tag(org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST.rawAST_single_tag)

Aggregations

ASN1_Set_Seq_Choice_BaseType (org.eclipse.titan.designer.AST.ASN1.types.ASN1_Set_Seq_Choice_BaseType)3 RawAST (org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST)3 ASN1_Choice_Type (org.eclipse.titan.designer.AST.ASN1.types.ASN1_Choice_Type)2 IType (org.eclipse.titan.designer.AST.IType)2 Identifier (org.eclipse.titan.designer.AST.Identifier)2 RawAST.rawAST_ext_bit_group (org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST.rawAST_ext_bit_group)2 RawAST.rawAST_single_tag (org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST.rawAST_single_tag)2 RawAST.rawAST_tag_field_value (org.eclipse.titan.designer.AST.TTCN3.attributes.RawAST.rawAST_tag_field_value)2 Type (org.eclipse.titan.designer.AST.Type)2 ArrayList (java.util.ArrayList)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Open_Type (org.eclipse.titan.designer.AST.ASN1.types.Open_Type)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 IValue (org.eclipse.titan.designer.AST.IValue)1 ParameterisedSubReference (org.eclipse.titan.designer.AST.ParameterisedSubReference)1 Reference (org.eclipse.titan.designer.AST.Reference)1 RawASTStruct (org.eclipse.titan.designer.AST.TTCN3.attributes.RawASTStruct)1