summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp49
1 files changed, 48 insertions, 1 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
index 1825b00443e..d3b499e53b2 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
@@ -50,6 +50,7 @@ int be_visitor_array_ch::visit_array (be_array *node)
// Retrieve the type.
be_type *bt = be_type::narrow_from_decl (node->base_type ());
+ AST_Decl::NodeType nt = bt->node_type ();
if (!bt)
{
@@ -69,7 +70,7 @@ int be_visitor_array_ch::visit_array (be_array *node)
// If we contain an anonymous sequence,
// generate code for the sequence here.
- if (bt->node_type () == AST_Decl::NT_sequence)
+ if (nt == AST_Decl::NT_sequence)
{
if (this->gen_anonymous_base_type (bt,
TAO_CodeGen::TAO_SEQUENCE_CH)
@@ -83,6 +84,52 @@ int be_visitor_array_ch::visit_array (be_array *node)
}
}
+ // If the array is an anonymous member and if its element type
+ // is a declaration (not a reference), we must generate code for
+ // the declaration.
+ if (this->ctx_->alias () == 0 // Not a typedef.
+ && bt->is_child (this->ctx_->scope ()))
+ {
+ int status = 0;
+ be_visitor_context ctx (*this->ctx_);
+
+ switch (nt)
+ {
+ case AST_Decl::NT_enum:
+ {
+ ctx.state (TAO_CodeGen::TAO_ENUM_CH);
+ be_visitor_enum_ch ec_visitor (&ctx);
+ status = bt->accept (&ec_visitor);
+ break;
+ }
+ case AST_Decl::NT_struct:
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
+ be_visitor_structure_ch sc_visitor (&ctx);
+ status = bt->accept (&sc_visitor);
+ break;
+ }
+ case AST_Decl::NT_union:
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CH);
+ be_visitor_union_ch uc_visitor (&ctx);
+ status = bt->accept (&uc_visitor);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ch::"
+ "visit_array - "
+ "array base type codegen failed\n"),
+ -1);
+ }
+ }
+
*os << "typedef ";
if (bt->accept (this) == -1)