summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp31
1 files changed, 17 insertions, 14 deletions
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