Search in sources :

Example 1 with ExtensionsAttribute

use of org.eclipse.titan.designer.AST.TTCN3.attributes.ExtensionsAttribute in project titan.EclipsePlug-ins by eclipse.

the class ComponentTypeBody method collectExtensionAttributes.

/**
 * Collects the extends extension attributes, from the with attributes assigned to the component type.
 *
 * @param timestamp the timestamp of the actual semantic check cycle
 */
private void collectExtensionAttributes(final CompilationTimeStamp timestamp) {
    if (withAttributesPath == null) {
        return;
    }
    final List<SingleWithAttribute> realAttributes = withAttributesPath.getRealAttributes(timestamp);
    SingleWithAttribute attribute;
    List<AttributeSpecification> specifications = null;
    for (int i = 0; i < realAttributes.size(); i++) {
        attribute = realAttributes.get(i);
        if (Attribute_Type.Extension_Attribute.equals(attribute.getAttributeType())) {
            final Qualifiers qualifiers = attribute.getQualifiers();
            if (qualifiers == null || qualifiers.getNofQualifiers() == 0) {
                if (specifications == null) {
                    specifications = new ArrayList<AttributeSpecification>();
                }
                specifications.add(attribute.getAttributeSpecification());
            }
        }
    }
    if (specifications == null) {
        return;
    }
    final List<ExtensionAttribute> attributes = new ArrayList<ExtensionAttribute>();
    AttributeSpecification specification;
    for (int i = 0; i < specifications.size(); i++) {
        specification = specifications.get(i);
        final ExtensionAttributeAnalyzer analyzer = new ExtensionAttributeAnalyzer();
        analyzer.parse(specification);
        final List<ExtensionAttribute> temp = analyzer.getAttributes();
        if (temp != null) {
            attributes.addAll(temp);
        }
    }
    if (attributes.isEmpty()) {
        return;
    }
    attrExtendsReferences = new ComponentTypeReferenceList();
    for (int i = 0, size = attributes.size(); i < size; i++) {
        final ExtensionAttribute tempAttribute = attributes.get(i);
        if (ExtensionAttribute_type.EXTENDS.equals(tempAttribute.getAttributeType())) {
            final ExtensionsAttribute extensionsAttribute = (ExtensionsAttribute) tempAttribute;
            for (int j = 0, size2 = extensionsAttribute.getNofTypes(); j < size2; j++) {
                final IType tempType = extensionsAttribute.getType(j);
                if (Type_type.TYPE_REFERENCED.equals(tempType.getTypetype())) {
                    attrExtendsReferences.addReference(((Referenced_Type) tempType).getReference());
                }
            }
        }
    }
    attrExtendsReferences.setFullNameParent(new BridgingNamedNode(this, ".<extends attribute>"));
    attrExtendsReferences.setMyScope(parentScope);
}
Also used : ArrayList(java.util.ArrayList) SingleWithAttribute(org.eclipse.titan.designer.AST.TTCN3.attributes.SingleWithAttribute) BridgingNamedNode(org.eclipse.titan.designer.AST.BridgingNamedNode) ExtensionAttribute(org.eclipse.titan.designer.AST.TTCN3.attributes.ExtensionAttribute) IType(org.eclipse.titan.designer.AST.IType) AttributeSpecification(org.eclipse.titan.designer.AST.TTCN3.attributes.AttributeSpecification) ExtensionsAttribute(org.eclipse.titan.designer.AST.TTCN3.attributes.ExtensionsAttribute) ExtensionAttributeAnalyzer(org.eclipse.titan.designer.parsers.extensionattributeparser.ExtensionAttributeAnalyzer) Qualifiers(org.eclipse.titan.designer.AST.TTCN3.attributes.Qualifiers)

Aggregations

ArrayList (java.util.ArrayList)1 BridgingNamedNode (org.eclipse.titan.designer.AST.BridgingNamedNode)1 IType (org.eclipse.titan.designer.AST.IType)1 AttributeSpecification (org.eclipse.titan.designer.AST.TTCN3.attributes.AttributeSpecification)1 ExtensionAttribute (org.eclipse.titan.designer.AST.TTCN3.attributes.ExtensionAttribute)1 ExtensionsAttribute (org.eclipse.titan.designer.AST.TTCN3.attributes.ExtensionsAttribute)1 Qualifiers (org.eclipse.titan.designer.AST.TTCN3.attributes.Qualifiers)1 SingleWithAttribute (org.eclipse.titan.designer.AST.TTCN3.attributes.SingleWithAttribute)1 ExtensionAttributeAnalyzer (org.eclipse.titan.designer.parsers.extensionattributeparser.ExtensionAttributeAnalyzer)1