diff options
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp | 14 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp | 31 |
2 files changed, 22 insertions, 23 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp index 7910e0133dc..9e1f82ad93b 100644 --- a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp @@ -157,8 +157,8 @@ int be_visitor_union_cs::visit_union (be_union *node) *os << "this->disc_ = u.disc_;" << be_nl; // now switch based on the disc value *os << "switch (this->disc_)" << be_nl; - *os << "{\n"; - os->incr_indent (0); + *os << "{" << be_idt_nl; + if (this->visit_scope (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -175,17 +175,13 @@ int be_visitor_union_cs::visit_union (be_union *node) // an enum, this does no harm. if (node->default_index () == -1) { - os->indent (); *os << "default:" << be_nl - << "break;" << be_uidt_nl; + << "break;"; } - os->decr_indent (); - *os << "}\n"; - os->decr_indent (); - *os << "}\n\n"; + *os << be_uidt_nl << "}" << be_uidt_nl + << "}" << be_nl << be_nl; - os->indent (); *os << "// destructor" << be_nl << node->name () << "::~" << node->local_name () << " (void)" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp index a6dd05fc94a..6349e48d814 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp @@ -73,7 +73,7 @@ be_visitor_union_branch_public_assign_cs::visit_union_branch (be_union_branch *n } } - *os << "{" << be_idt << "\n"; + *os << "{" << be_idt_nl; // first generate the type information be_type *bt = be_type::narrow_from_decl (node->field_type ()); @@ -168,7 +168,6 @@ be_visitor_union_branch_public_assign_cs::visit_array (be_array *node) ACE_OS::sprintf (fname, "%s", bt->full_name ()); } - os->indent (); // start from current indentation // set the discriminant to the appropriate label *os << "// make a deep copy" << be_nl; *os << "this->u_." << ub->local_name () @@ -198,7 +197,6 @@ be_visitor_union_branch_public_assign_cs::visit_enum (be_enum *) TAO_OutStream *os = this->ctx_->stream (); - os->indent (); // start from current indentation // set the discriminant to the appropriate label // valid label *os << "// set the value" << be_nl @@ -241,7 +239,12 @@ be_visitor_union_branch_public_assign_cs::visit_interface (be_interface *node) idl_bool bt_is_defined = node->is_defined (); - os->indent (); // start from current indentation + *os << "if (u.u_." << ub->local_name () << "_ == 0)" << be_idt_nl + << "{" << be_idt_nl + << "this->u_." << ub->local_name () << "_ = 0;" << be_uidt_nl + << "}" << be_uidt_nl + << "else" << be_idt_nl + << "{" << be_idt_nl; // So the template will work with the macro. *os << "typedef " @@ -287,6 +290,8 @@ be_visitor_union_branch_public_assign_cs::visit_interface (be_interface *node) << ");" << be_uidt << be_uidt_nl; } + *os << "}" << be_uidt << be_uidt_nl; + return 0; } @@ -324,7 +329,12 @@ be_visitor_union_branch_public_assign_cs::visit_interface_fwd ( idl_bool bt_is_defined = node->full_definition ()->is_defined (); - os->indent (); // start from current indentation + *os << "if (u.u_." << ub->local_name () << "_ == 0)" << be_idt_nl + << "{" << be_idt_nl + << "this->u_." << ub->local_name () << "_ = 0;" << be_uidt_nl + << "}" << be_uidt_nl + << "else" << be_idt_nl + << "{" << be_idt_nl; // So the template will work with the macro. *os << "typedef " @@ -370,6 +380,8 @@ be_visitor_union_branch_public_assign_cs::visit_interface_fwd ( << ");" << be_uidt << be_uidt_nl; } + *os << "}" << be_uidt << be_uidt_nl; + return 0; } @@ -405,7 +417,6 @@ be_visitor_union_branch_public_assign_cs::visit_predefined_type ( TAO_OutStream *os = this->ctx_->stream (); - os->indent (); // start from current indentation // set the discriminant to the appropriate label switch (node->pt ()) { @@ -515,8 +526,6 @@ be_visitor_union_branch_public_assign_cs::visit_sequence (be_sequence *node) TAO_OutStream *os = this->ctx_->stream (); - os->indent (); // start from current indentation - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR) { *os << "if (u.u_." << ub->local_name () << "_ == 0)" << be_idt_nl @@ -571,8 +580,6 @@ be_visitor_union_branch_public_assign_cs::visit_string (be_string *node) TAO_OutStream *os = this->ctx_->stream (); - os->indent (); // start from current indentation - // set the discriminant to the appropriate label *os << "this->u_." << ub->local_name () << "_ = "; @@ -620,8 +627,6 @@ be_visitor_union_branch_public_assign_cs::visit_structure (be_structure *node) TAO_OutStream *os = this->ctx_->stream (); - os->indent (); - if (bt->size_type () == be_type::VARIABLE || node->has_constructor ()) { if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR) @@ -717,8 +722,6 @@ be_visitor_union_branch_public_assign_cs::visit_union (be_union *node) TAO_OutStream *os = this->ctx_->stream (); - os->indent (); // start from current indentation - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_UNION_COPY_CONSTRUCTOR) { *os << "if (u.u_." << ub->local_name () << "_ == 0)" << be_idt_nl |