summaryrefslogtreecommitdiff
path: root/xsd/cxx/parser
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-10-19 22:43:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-10-19 22:43:25 +0200
commitf5a999730f38f98ef8af0bcb4148af47c74e1c25 (patch)
treeae9c623f64e5bfaf0aa5e3a247f719a33e759cb9 /xsd/cxx/parser
parentf0a4f34da1418cf299cf9f41a772f513b180e2cf (diff)
Make sure a type actually classifies something
Diffstat (limited to 'xsd/cxx/parser')
-rw-r--r--xsd/cxx/parser/parser-source.cxx42
1 files changed, 26 insertions, 16 deletions
diff --git a/xsd/cxx/parser/parser-source.cxx b/xsd/cxx/parser/parser-source.cxx
index 99bc566..cabcd15 100644
--- a/xsd/cxx/parser/parser-source.cxx
+++ b/xsd/cxx/parser/parser-source.cxx
@@ -89,16 +89,21 @@ namespace CXX
if (!gen)
{
// The first instance that this anonymous type classifies
- // is the prototype for others if any.
+ // is the prototype for others if any. If this type does
+ // not classify anything (e.g., it is a base), then we
+ // don't need to do anything.
//
- SemanticGraph::Instance& i (
- e.classifies_begin ()->instance ());
-
- if (SemanticGraph::Element* e =
- dynamic_cast<SemanticGraph::Element*> (&i))
+ if (e.classifies_begin () != e.classifies_end ())
{
- if (e->substitutes_p ())
- gen = true;
+ SemanticGraph::Instance& i (
+ e.classifies_begin ()->instance ());
+
+ if (SemanticGraph::Element* e =
+ dynamic_cast<SemanticGraph::Element*> (&i))
+ {
+ if (e->substitutes_p ())
+ gen = true;
+ }
}
}
@@ -591,16 +596,21 @@ namespace CXX
if (!gen)
{
// The first instance that this anonymous type classifies
- // is the prototype for others if any.
+ // is the prototype for others if any. If this type does
+ // not classify anything (e.g., it is a base), then we
+ // don't need to do anything.
//
- SemanticGraph::Instance& i (
- c.classifies_begin ()->instance ());
-
- if (SemanticGraph::Element* e =
- dynamic_cast<SemanticGraph::Element*> (&i))
+ if (c.classifies_begin () != c.classifies_end ())
{
- if (e->substitutes_p ())
- gen = true;
+ SemanticGraph::Instance& i (
+ c.classifies_begin ()->instance ());
+
+ if (SemanticGraph::Element* e =
+ dynamic_cast<SemanticGraph::Element*> (&i))
+ {
+ if (e->substitutes_p ())
+ gen = true;
+ }
}
}