diff options
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp')
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp index 8040f161617..eccd4840dc7 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/array_cs.cpp @@ -305,11 +305,13 @@ int be_visitor_array_cs::visit_array (be_array *node) *os << be_uidt_nl << "}" << be_uidt; } - *os << be_uidt_nl << "}\n\n"; + *os << be_uidt_nl << "}" << be_nl << be_nl; + + AST_Decl::NodeType nt = bt->node_type (); // If we contain an anonymous sequence, - // generate code for the seuqence here. - if (bt->node_type () == AST_Decl::NT_sequence) + // generate code for the sequence here. + if (nt == AST_Decl::NT_sequence) { if (this->gen_anonymous_base_type (bt, TAO_CodeGen::TAO_SEQUENCE_CS) @@ -323,6 +325,52 @@ int be_visitor_array_cs::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_CS); + be_visitor_enum_cs ec_visitor (&ctx); + status = bt->accept (&ec_visitor); + break; + } + case AST_Decl::NT_struct: + { + ctx.state (TAO_CodeGen::TAO_STRUCT_CS); + be_visitor_structure_cs sc_visitor (&ctx); + status = bt->accept (&sc_visitor); + break; + } + case AST_Decl::NT_union: + { + ctx.state (TAO_CodeGen::TAO_UNION_CS); + be_visitor_union_cs 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); + } + } + node->cli_stub_gen (1); return 0; } |