diff options
Diffstat (limited to 'TAO/TAO_IDL/ast/ast_enum.cpp')
-rw-r--r-- | TAO/TAO_IDL/ast/ast_enum.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/TAO/TAO_IDL/ast/ast_enum.cpp b/TAO/TAO_IDL/ast/ast_enum.cpp index 26024fb0478..8499d75889b 100644 --- a/TAO/TAO_IDL/ast/ast_enum.cpp +++ b/TAO/TAO_IDL/ast/ast_enum.cpp @@ -112,7 +112,7 @@ AST_Enum::member_count (void) UTL_ScopedName * AST_Enum::value_to_name (const unsigned long v) { - AST_EnumVal *item = 0; + AST_EnumVal *item = 0; AST_Decl *d = 0; for (UTL_ScopeActiveIterator i (this, IK_decls);!i.is_done ();i.next ()) @@ -136,7 +136,9 @@ AST_Enum::lookup_by_value (const AST_Expression *v) AST_EnumVal *item = 0; AST_Decl *d = 0; - for (UTL_ScopeActiveIterator i (this, IK_decls);!i.is_done ();i.next ()) + for (UTL_ScopeActiveIterator i (this, IK_decls); + !i.is_done (); + i.next ()) { d = i.item (); item = AST_EnumVal::narrow_from_decl (d); @@ -186,7 +188,7 @@ munge_name_for_enumval (UTL_ScopedName *n, UTL_IdList *id = 0; ACE_NEW_RETURN (id, - UTL_IdList (last_component, + UTL_IdList (last_component->copy (), 0), 0); @@ -206,7 +208,9 @@ AST_Enum::compute_member_count (void) // If there are elements in this scope if (this->nmembers () > 0) { - for (UTL_ScopeActiveIterator i (this, IK_decls);!i.is_done ();i.next ()) + for (UTL_ScopeActiveIterator i (this, IK_decls); + !i.is_done (); + i.next ()) { // Get the next AST decl node. ++this->member_count_; @@ -216,7 +220,7 @@ AST_Enum::compute_member_count (void) return 0; } -// Add an AST_EnumVal node to this scope +// Add an AST_EnumVal node to this scope. AST_EnumVal * AST_Enum::fe_add_enum_val (AST_EnumVal *t) { @@ -231,11 +235,16 @@ AST_Enum::fe_add_enum_val (AST_EnumVal *t) t1 = idl_global->gen ()->create_enum_val (tmp, t->name ()); - t->set_name (munge_name_for_enumval (t->name (), - t->local_name ())); + UTL_ScopedName *sn = + munge_name_for_enumval ((UTL_IdList *) t->name ()->copy (), + t->local_name ()); + + t->set_name (sn); + + sn = munge_name_for_enumval ((UTL_IdList *) t1->name ()->copy (), + t1->local_name ()); - t1->set_name (munge_name_for_enumval (t1->name (), - t1->local_name ())); + t1->set_name (sn); } // Already defined and cannot be redefined? Or already used? @@ -276,7 +285,7 @@ AST_Enum::fe_add_enum_val (AST_EnumVal *t) t->local_name ()); // Add it to enclosing scope. - idl_global->scopes ()->next_to_top ()->fe_add_enum_val (t1); + idl_global->scopes ().next_to_top ()->fe_add_enum_val (t1); return t; } @@ -328,6 +337,8 @@ AST_Enum::ast_accept (ast_visitor *visitor) void AST_Enum::destroy (void) { + this->UTL_Scope::destroy (); + this->AST_Decl::destroy (); } |