Commit 0d814351 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

xsd2ttcn: fixed generation of cyclical definition (bug 569238)


Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
Change-Id: I23db1dcfcd69b4da9212af751b4d3d4b7413964e
parent 339d8d04
/****************************************************************************** /*******************************************************************************
* Copyright (c) 2000-2021 Ericsson Telecom AB * Copyright (c) 2000-2021 Ericsson Telecom AB
* *
* XSD to TTCN-3 Translator * XSD to TTCN-3 Translator
...@@ -11,15 +11,16 @@ ...@@ -11,15 +11,16 @@
* Contributors: * Contributors:
* Balasko, Jeno * Balasko, Jeno
* Szabo, Bence Janos * Szabo, Bence Janos
* Botond, Baranyi
* *
******************************************************************************/ *******************************************************************************/
// //
// File: www_example_org_type_substitution_simpletype.ttcn // File: www_example_org_type_substitution_simpletype.ttcn
// Description: // Description:
// References: // References:
// Rev: // Rev:
// Prodnr: // Prodnr:
// Updated: Wed Nov 18 11:56:35 2014 // Updated: Mon Jan 18 18:05:14 2021
// Contact: http://ttcn.ericsson.se // Contact: http://ttcn.ericsson.se
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
...@@ -141,6 +142,28 @@ with { ...@@ -141,6 +142,28 @@ with {
}; };
/* Bug 569238 - xsd2ttcn creates cyclical definitions */
type XSD.Token Head569238 (pattern "[0-9]#(6,15)");
type Head569238 Type569238;
type record Complex569238
{
union {
Head569238_derivations head,
Type569238 type_
} choice
}
with {
variant (choice) "untagged";
variant (choice.type_) "name as 'type'";
};
type union String_derivations type union String_derivations
{ {
@default XSD.String string, @default XSD.String string,
...@@ -184,6 +207,18 @@ with { ...@@ -184,6 +207,18 @@ with {
}; };
type union Head569238_derivations
{
@default Head569238 head569238,
Type569238 type569238
}
with {
variant "useType";
variant (head569238) "name as capitalized";
variant (type569238) "name as capitalized";
};
} }
with { with {
encode "XML"; encode "XML";
......
...@@ -59,5 +59,21 @@ ...@@ -59,5 +59,21 @@
</xsd:sequence> </xsd:sequence>
</xsd:complexType> </xsd:complexType>
<!-- Bug 569238 - xsd2ttcn creates cyclical definitions -->
<xsd:simpleType name="Head569238">
<xsd:restriction base="xsd:token">
<xsd:pattern value="[0-9]{6,15}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="Type569238">
<xsd:restriction base="this:Head569238"/>
</xsd:simpleType>
<xsd:complexType name="Complex569238">
<xsd:choice>
<xsd:element name="head" type="this:Head569238"/>
<xsd:element name="type" type="this:Type569238"/>
</xsd:choice>
</xsd:complexType>
</xsd:schema> </xsd:schema>
...@@ -862,8 +862,11 @@ void ComplexType::nameConversion_names(const List<NamespaceType> &) { ...@@ -862,8 +862,11 @@ void ComplexType::nameConversion_names(const List<NamespaceType> &) {
addVariant(V_onlyValue, var); addVariant(V_onlyValue, var);
} }
for (List<RootType*>::iterator dep = nameDepList.begin(); dep; dep = dep->Next) { for (List<RootType*>::iterator dep = nameDepList.begin(); dep; dep = dep->Next) {
SimpleType* dep_simple = typeSubsGroup == this ? dynamic_cast<SimpleType*>(dep->Data) : NULL;
if (dep_simple == NULL || dep_simple->parent != NULL || dep_simple->hasVariant(Mstring("\"element\""))) {
dep->Data->setTypeValueWoPrefix(res); dep->Data->setTypeValueWoPrefix(res);
} }
}
} }
void ComplexType::nameConversion_types(const List<NamespaceType> & ns) { void ComplexType::nameConversion_types(const List<NamespaceType> & ns) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment