summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp57
1 files changed, 32 insertions, 25 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp
index 455a6619aae..86c35484097 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp
@@ -45,43 +45,50 @@ be_visitor_operation_exceptlist_cs::~be_visitor_operation_exceptlist_cs (void)
int
be_visitor_operation_exceptlist_cs::visit_operation (be_operation *node)
{
- TAO_OutStream *os = this->ctx_->stream ();
-
- // Don't do anything if the exception list is empty.
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ // don't do anything if the exception list is empty
if (node->exceptions ())
{
os->indent ();
*os << "static TAO_Exception_Data " << "_tao_" << node->flat_name ()
<< "_exceptiondata [] = " << be_nl;
*os << "{" << be_idt_nl;
-
- // Initialize an iterator to iterate thru the exception list.
- UTL_ExceptlistActiveIterator ei (node->exceptions ());
-
- AST_Decl *d = 0;
-
- // Continue until each element is visited.
- while (!ei.is_done ())
+ // initialize an iterator to iterate thru the exception list
+ UTL_ExceptlistActiveIterator *ei;
+ ACE_NEW_RETURN (ei,
+ UTL_ExceptlistActiveIterator (node->exceptions ()),
+ -1);
+ // continue until each element is visited
+ while (!ei->is_done ())
{
- d = ei.item ();
-
- *os << "{" << be_idt_nl
- << "\"" << d->repoID () << "\"," << be_nl;
- // Allocator method.
- *os << d->name () << "::_alloc" << be_uidt_nl
- << "}";
+ be_exception *excp = be_exception::narrow_from_decl (ei->item ());
- ei.next ();
+ if (excp == 0)
+ {
+ delete ei;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_exceptlist_cs"
+ "visit_operation - "
+ "codegen for scope failed\n"), -1);
- if (!ei.is_done ())
+ }
+ *os << "{";
+ // the typecode name
+ *os << excp->tc_name ();
+ *os << ", ";
+ // allocator method
+ *os << excp->name () << "::_alloc}";
+ ei->next ();
+ if (!ei->is_done ())
{
- *os << "," << be_nl;
+ *os << ",\n";
+ os->indent ();
}
+ // except the last one is processed?
- }
-
+ } // end of while loop
+ delete ei;
*os << be_uidt_nl << "};\n\n";
- }
-
+ } // end of if
return 0;
}