aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-09-14 14:35:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-09-14 14:35:19 +0200
commita32d89c25b80f443d93a050a979e465f4d1dc39e (patch)
tree9e168504996951118230d24056811c4c48bd938d
parent62cadf03af778b508bd684be19c6e6958b2fe52f (diff)
Fix bug in aggregate generation for derived lists
-rw-r--r--tests/cxx/hybrid/list/test.xsd8
-rw-r--r--xsde/cxx/hybrid/parser-aggregate-header.cxx19
-rw-r--r--xsde/cxx/hybrid/serializer-aggregate-header.cxx19
-rw-r--r--xsde/cxx/hybrid/serializer-aggregate-source.cxx4
-rw-r--r--xsde/cxx/parser/driver-source.cxx21
-rw-r--r--xsde/cxx/parser/type-processor.cxx2
-rw-r--r--xsde/cxx/serializer/driver-source.cxx21
-rw-r--r--xsde/cxx/serializer/type-processor.cxx4
8 files changed, 77 insertions, 21 deletions
diff --git a/tests/cxx/hybrid/list/test.xsd b/tests/cxx/hybrid/list/test.xsd
index d864b12..3412de8 100644
--- a/tests/cxx/hybrid/list/test.xsd
+++ b/tests/cxx/hybrid/list/test.xsd
@@ -5,10 +5,16 @@
<list itemType="int"/>
</simpleType>
- <simpleType name="qname-list">
+ <simpleType name="qname-list-base">
<list itemType="QName"/>
</simpleType>
+ <simpleType name="qname-list">
+ <restriction base="t:qname-list-base">
+ <minLength value="1"/>
+ </restriction>
+ </simpleType>
+
<simpleType name="string-list">
<list itemType="string"/>
</simpleType>
diff --git a/xsde/cxx/hybrid/parser-aggregate-header.cxx b/xsde/cxx/hybrid/parser-aggregate-header.cxx
index 986db36..967f1db 100644
--- a/xsde/cxx/hybrid/parser-aggregate-header.cxx
+++ b/xsde/cxx/hybrid/parser-aggregate-header.cxx
@@ -23,10 +23,12 @@ namespace CXX
// For base types we only want member's types, but not the
// base itself.
//
- struct BaseType: Traversal::Complex, Context
+ struct BaseType: Traversal::Complex,
+ Traversal::List,
+ Context
{
- BaseType (Context& c)
- : Context (c)
+ BaseType (Context& c, Traversal::NodeBase& def)
+ : Context (c), def_ (def)
{
}
@@ -41,6 +43,15 @@ namespace CXX
contains_compositor (c);
}
}
+
+ virtual Void
+ traverse (SemanticGraph::List& l)
+ {
+ def_.dispatch (l.argumented ().type ());
+ }
+
+ private:
+ Traversal::NodeBase& def_;
};
struct ParserDef: Traversal::Type,
@@ -113,7 +124,7 @@ namespace CXX
map_ (map),
tid_map_ (tid_map),
set_ (set),
- base_ (c)
+ base_ (c, *this)
{
*this >> inherits_ >> base_ >> inherits_;
diff --git a/xsde/cxx/hybrid/serializer-aggregate-header.cxx b/xsde/cxx/hybrid/serializer-aggregate-header.cxx
index 07b24cd..cfcb203 100644
--- a/xsde/cxx/hybrid/serializer-aggregate-header.cxx
+++ b/xsde/cxx/hybrid/serializer-aggregate-header.cxx
@@ -24,10 +24,12 @@ namespace CXX
// For base types we only want member's types, but not the
// base itself.
//
- struct BaseType: Traversal::Complex, Context
+ struct BaseType: Traversal::Complex,
+ Traversal::List,
+ Context
{
- BaseType (Context& c)
- : Context (c)
+ BaseType (Context& c, Traversal::NodeBase& def)
+ : Context (c), def_ (def)
{
}
@@ -42,6 +44,15 @@ namespace CXX
contains_compositor (c);
}
}
+
+ virtual Void
+ traverse (SemanticGraph::List& l)
+ {
+ def_.dispatch (l.argumented ().type ());
+ }
+
+ private:
+ Traversal::NodeBase& def_;
};
struct SerializerDef: Traversal::Type,
@@ -114,7 +125,7 @@ namespace CXX
map_ (map),
tid_map_ (tid_map),
set_ (set),
- base_ (c)
+ base_ (c, *this)
{
*this >> inherits_ >> base_ >> inherits_;
diff --git a/xsde/cxx/hybrid/serializer-aggregate-source.cxx b/xsde/cxx/hybrid/serializer-aggregate-source.cxx
index 2a3deb0..e9edeea 100644
--- a/xsde/cxx/hybrid/serializer-aggregate-source.cxx
+++ b/xsde/cxx/hybrid/serializer-aggregate-source.cxx
@@ -205,8 +205,8 @@ namespace CXX
};
struct SerializerConnect: Traversal::List,
- Traversal::Complex,
- Context
+ Traversal::Complex,
+ Context
{
SerializerConnect (Context& c,
TypeInstanceMap& map,
diff --git a/xsde/cxx/parser/driver-source.cxx b/xsde/cxx/parser/driver-source.cxx
index 516b836..6c85cd1 100644
--- a/xsde/cxx/parser/driver-source.cxx
+++ b/xsde/cxx/parser/driver-source.cxx
@@ -29,10 +29,12 @@ namespace CXX
// For base types we only want member's types, but not the
// base itself.
//
- struct BaseType: Traversal::Complex, Context
+ struct BaseType: Traversal::Complex,
+ Traversal::List,
+ Context
{
- BaseType (Context& c)
- : Context (c)
+ BaseType (Context& c, Traversal::NodeBase& def)
+ : Context (c), def_ (def)
{
}
@@ -47,6 +49,15 @@ namespace CXX
contains_compositor (c);
}
}
+
+ virtual Void
+ traverse (SemanticGraph::List& l)
+ {
+ def_.dispatch (l.argumented ().type ());
+ }
+
+ private:
+ Traversal::NodeBase& def_;
};
struct ParserDef: Traversal::Type,
@@ -112,7 +123,7 @@ namespace CXX
Context
{
ParserDef (Context& c, TypeInstanceMap& map, InstanceSet& set)
- : Context (c), map_ (map), set_ (set), base_ (c)
+ : Context (c), map_ (map), set_ (set), base_ (c, *this)
{
*this >> inherits_ >> base_ >> inherits_;
@@ -641,7 +652,7 @@ namespace CXX
Context
{
ParserConnect (Context& c, TypeInstanceMap& map)
- : Context (c), map_ (map), base_ (c)
+ : Context (c), map_ (map), base_ (c, *this)
{
*this >> inherits_ >> base_ >> inherits_;
diff --git a/xsde/cxx/parser/type-processor.cxx b/xsde/cxx/parser/type-processor.cxx
index 07fa413..8605241 100644
--- a/xsde/cxx/parser/type-processor.cxx
+++ b/xsde/cxx/parser/type-processor.cxx
@@ -201,6 +201,8 @@ namespace CXX
{
Complex::inherits (c);
}
+
+ // @@ What about list?
};
//
diff --git a/xsde/cxx/serializer/driver-source.cxx b/xsde/cxx/serializer/driver-source.cxx
index 8ae20d8..9a46364 100644
--- a/xsde/cxx/serializer/driver-source.cxx
+++ b/xsde/cxx/serializer/driver-source.cxx
@@ -28,10 +28,12 @@ namespace CXX
// For base types we only want member's types, but not the
// base itself.
//
- struct BaseType: Traversal::Complex, Context
+ struct BaseType: Traversal::Complex,
+ Traversal::List,
+ Context
{
- BaseType (Context& c)
- : Context (c)
+ BaseType (Context& c, Traversal::NodeBase& def)
+ : Context (c), def_ (def)
{
}
@@ -46,6 +48,15 @@ namespace CXX
contains_compositor (c);
}
}
+
+ virtual Void
+ traverse (SemanticGraph::List& l)
+ {
+ def_.dispatch (l.argumented ().type ());
+ }
+
+ private:
+ Traversal::NodeBase& def_;
};
struct SerializerDef: Traversal::Type,
@@ -111,7 +122,7 @@ namespace CXX
Context
{
SerializerDef (Context& c, TypeInstanceMap& map, InstanceSet& set)
- : Context (c), map_ (map), set_ (set), base_ (c)
+ : Context (c), map_ (map), set_ (set), base_ (c, *this)
{
*this >> inherits_ >> base_ >> inherits_;
@@ -640,7 +651,7 @@ namespace CXX
Context
{
SerializerConnect (Context& c, TypeInstanceMap& map)
- : Context (c), map_ (map), base_ (c)
+ : Context (c), map_ (map), base_ (c, *this)
{
*this >> inherits_ >> base_ >> inherits_;
diff --git a/xsde/cxx/serializer/type-processor.cxx b/xsde/cxx/serializer/type-processor.cxx
index 86a18aa..a07ff31 100644
--- a/xsde/cxx/serializer/type-processor.cxx
+++ b/xsde/cxx/serializer/type-processor.cxx
@@ -206,6 +206,8 @@ namespace CXX
{
Complex::names (c);
}
+
+ // @@ What about list?
};
//
@@ -225,6 +227,8 @@ namespace CXX
Complex::inherits (c);
}
+ // @@ What about list?
+
private:
Serializer::Type& type_;
Traversal::Inherits inherits_;