From 032098897c13c8b87f8a915f0e97ce21ffd60d29 Mon Sep 17 00:00:00 2001 From: parsons Date: Wed, 9 Jan 2002 17:42:57 +0000 Subject: ChangeLogTag: Wed Jan 9 11:39:02 2002 Jeff Parsons --- TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp | 19 +++++++++------- TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp | 28 +++++++++--------------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp index dafa1c3db8d..bfc4212b152 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp @@ -78,18 +78,20 @@ be_visitor_array_cdr_op_ci::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) + AST_Decl::NodeType nt = bt->node_type (); + + // If the node is an array of anonymous sequence, we need to + // generate the sequence's cdr operator declaration here. + if (nt == AST_Decl::NT_sequence && bt->anonymous ()) { - // CDR operators for sequences are now declared in the .i file, - // so we pass this state to the function. - if (this->gen_anonymous_base_type (bt, - TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CH) - == -1) + be_visitor_sequence_cdr_op_ci visitor (this->ctx_); + + if (bt->accept (&visitor) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_array_cdr_op_ci::" + "be_visitor_array_cdr_op_ci::" "visit_array - " - "gen_anonymous_base_type failed\n"), + "accept on anonymous base type failed\n"), -1); } } @@ -142,6 +144,7 @@ be_visitor_array_cdr_op_ci::visit_array (be_array *node) "Base type codegen failed\n"), -1); } + *os << "}\n\n"; // Set the sub state as generating code for the input operator. diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp index 614e272f79e..cff75285ad5 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp @@ -56,29 +56,21 @@ be_visitor_sequence_cdr_op_ci::visit_sequence (be_sequence *node) // If we contain an anonymous sequence, // generate code for the sequence here. - // retrieve the base type - be_type *base = be_type::narrow_from_decl (node->base_type ()); - if (!base) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_sequence_cdr_op_ci::" - "visit_sequence - " - "Bad base type\n"), - -1); - } + // Retrieve the base type. + AST_Type *base = node->base_type (); + AST_Decl::NodeType nt = base->node_type (); - if (base->node_type () == AST_Decl::NT_sequence) + if (nt == AST_Decl::NT_sequence && base->anonymous ()) { - // CDR operators for sequences are now declared in the .i file, - // so we pass this state to the function. - if (this->gen_anonymous_base_type (base, - TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CI) - == -1) + be_sequence *bs = be_sequence::narrow_from_decl (base); + be_visitor_sequence_cdr_op_ci visitor (this->ctx_); + + if (bs->accept (&visitor) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_sequence_cdr_op_ci::" + "be_visitor_sequence_cdr_op_ci::" "visit_sequence - " - "gen_anonymous_base_type failed\n"), + "accept on anonymous base type failed\n"), -1); } } -- cgit v1.2.1