diff options
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp')
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp | 27 |
1 files changed, 11 insertions, 16 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 4b30f6c6a58..1deb76bc796 100644 --- a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp @@ -214,19 +214,15 @@ int be_visitor_union_cs::visit_union (be_union *node) *os << node->name () << " &" << be_nl; // return type *os << node->name () << "::operator= (const ::" << node->name () << " &u)" << be_nl; - *os << "{" << be_idt_nl; - // First check for self-assignment. - *os << "if (&u == this)" << be_idt_nl - << "{" << be_idt_nl - << "return *this;" << be_uidt_nl - << "}" << be_uidt_nl << be_nl; - // Reset and set the discriminant. + *os << "{\n"; + os->incr_indent (); + // first reset and set the discriminant *os << "this->_reset (u.disc_, 0);" << be_nl; - *os << "this->disc_ = u.disc_;" << be_nl << be_nl; + *os << "this->disc_ = u.disc_;" << be_nl; // now switch based on the disc value *os << "switch (this->disc_)" << be_nl; - *os << "{" << be_idt_nl; - + *os << "{\n"; + os->incr_indent (0); if (this->visit_scope (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -243,16 +239,15 @@ 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; } - else - { - *os << be_uidt_nl; - } - *os << "}" << be_nl << be_nl; - *os << "return *this;" << be_uidt_nl; + os->decr_indent (); + *os << "}" << be_nl; + *os << "return *this;\n"; + os->decr_indent (); *os << "}\n\n"; // the reset method |