diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-10-18 16:55:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-10-18 16:55:26 +0200 |
commit | 8e6bde581d4fb817c7b10d3b2dbaf2b5e0f5dd48 (patch) | |
tree | 9e02cd6710c2d8eb1dba67dccbd578155b78907d | |
parent | c319d785aef76c4e05859b81f956e446eb5a674d (diff) |
Check that a type actually classifies something
-rw-r--r-- | xsde/cxx/parser/parser-source.cxx | 42 | ||||
-rw-r--r-- | xsde/cxx/serializer/serializer-source.cxx | 42 |
2 files changed, 52 insertions, 32 deletions
diff --git a/xsde/cxx/parser/parser-source.cxx b/xsde/cxx/parser/parser-source.cxx index 54d5a05..69f2432 100644 --- a/xsde/cxx/parser/parser-source.cxx +++ b/xsde/cxx/parser/parser-source.cxx @@ -116,16 +116,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; + } } } @@ -1293,16 +1298,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; + } } } diff --git a/xsde/cxx/serializer/serializer-source.cxx b/xsde/cxx/serializer/serializer-source.cxx index 630d052..a11a221 100644 --- a/xsde/cxx/serializer/serializer-source.cxx +++ b/xsde/cxx/serializer/serializer-source.cxx @@ -446,16 +446,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; + } } } @@ -2461,16 +2466,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; + } } } |