aboutsummaryrefslogtreecommitdiff
path: root/xsde/cxx/hybrid/parser-header.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-10 16:23:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-12-10 16:23:38 +0200
commite2eff99775d348fd11a59de0d3952d593dbaa65f (patch)
tree2dc1e48c8af031f31a9a259b1f505f5ac895f826 /xsde/cxx/hybrid/parser-header.cxx
parent49c21e87117032b88574887c1e6cc862fcb288a2 (diff)
Use derived (variadic) return type in polymorphic type post_*() callbacks
We cannot use the base return type since it is not assigned (by the type processor) for types that are in included/imported schemas.
Diffstat (limited to 'xsde/cxx/hybrid/parser-header.cxx')
-rw-r--r--xsde/cxx/hybrid/parser-header.cxx33
1 files changed, 18 insertions, 15 deletions
diff --git a/xsde/cxx/hybrid/parser-header.cxx b/xsde/cxx/hybrid/parser-header.cxx
index 340fd37..b950130 100644
--- a/xsde/cxx/hybrid/parser-header.cxx
+++ b/xsde/cxx/hybrid/parser-header.cxx
@@ -13,14 +13,10 @@ namespace CXX
{
namespace
{
- //
- //
struct PostOverride: Traversal::Complex, Context
{
- PostOverride (Context& c)
- : Context (c)
- {
- }
+ PostOverride (Context& c, SemanticGraph::Complex& scope)
+ : Context (c), scope_ (scope) {}
virtual void
traverse (SemanticGraph::Complex& c)
@@ -34,12 +30,18 @@ namespace CXX
if (tiein)
dispatch (b);
- os << "virtual " << pret_type (b) << endl
+ // Use variadic return type since base return type (pret_type)
+ // is not set for types in included/imported schemas.
+ //
+ os << "virtual " << pret_type (scope_) << endl
<< post_name (b) << " ();"
<< endl;
}
}
}
+
+ private:
+ SemanticGraph::Complex& scope_;
};
//
@@ -47,7 +49,7 @@ namespace CXX
struct Enumeration: Traversal::Enumeration, Context
{
Enumeration (Context& c, Traversal::Complex& complex)
- : Context (c), complex_ (complex), post_override_ (c)
+ : Context (c), complex_ (complex)
{
}
@@ -151,7 +153,10 @@ namespace CXX
String const& ret (pret_type (e));
if (polymorphic (e))
- post_override_.dispatch (e);
+ {
+ PostOverride po (*this, e);
+ po.dispatch (e);
+ }
os << "virtual " << ret << endl
<< post_name (e) << " ();"
@@ -221,7 +226,6 @@ namespace CXX
private:
Traversal::Complex& complex_;
- PostOverride post_override_;
};
struct List: Traversal::List, Context
@@ -566,8 +570,6 @@ namespace CXX
{
Complex (Context& c)
: Context (c),
- post_override_ (c),
-
// State.
//
compositor_state_ (c),
@@ -687,7 +689,10 @@ namespace CXX
// post
//
if (polymorphic (c))
- post_override_.dispatch (c);
+ {
+ PostOverride po (*this, c);
+ po.dispatch (c);
+ }
os << "virtual " << ret << endl
<< post_name (c) << " ();"
@@ -763,8 +768,6 @@ namespace CXX
}
private:
- PostOverride post_override_;
-
// State.
//
CompositorState compositor_state_;