summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/ast/ast_exception.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/ast/ast_exception.cpp')
-rw-r--r--TAO/TAO_IDL/ast/ast_exception.cpp260
1 files changed, 258 insertions, 2 deletions
diff --git a/TAO/TAO_IDL/ast/ast_exception.cpp b/TAO/TAO_IDL/ast/ast_exception.cpp
index 685b66273e7..f322dc53962 100644
--- a/TAO/TAO_IDL/ast/ast_exception.cpp
+++ b/TAO/TAO_IDL/ast/ast_exception.cpp
@@ -80,8 +80,15 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "utl_identifier.h"
#include "utl_indenter.h"
-AST_Decl::NodeType const
-AST_Exception::NT = AST_Decl::NT_except;
+AST_Exception::AST_Exception (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType (),
+ UTL_Scope (),
+ AST_Structure ()
+{
+}
AST_Exception::AST_Exception (UTL_ScopedName *n,
bool local,
@@ -160,6 +167,253 @@ AST_Exception::in_recursion (ACE_Unbounded_Queue<AST_Type *> &list)
return this->in_recursion_;
}
+// Private operations.
+
+// Add this AST_Field node to the current scope.
+AST_Field *
+AST_Exception::fe_add_field (AST_Field *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (referenced (d, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (t->has_ancestor (d))
+ {
+ idl_global->err ()->redefinition_in_scope (t,
+ d);
+ return 0;
+ }
+ }
+
+ // Add it to scope.
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ AST_Type *ft = t->field_type ();
+ UTL_ScopedName *mru = ft->last_referenced_as ();
+
+ if (mru != 0)
+ {
+ this->add_to_referenced (ft,
+ false,
+ mru->first_component ());
+ }
+
+ this->fields_.enqueue_tail (t);
+
+ return t;
+}
+
+// Add this AST_Union (manifest type declaration) to the current scope.
+AST_Union *
+AST_Exception::fe_add_union (AST_Union *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (t->has_ancestor (d))
+ {
+ idl_global->err ()->redefinition_in_scope (t,
+ d);
+ return 0;
+ }
+ }
+
+ // Add it to local types.
+ this->add_to_local_types (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_Structure (manifest type declaration) to the current
+// scope.
+AST_Structure *
+AST_Exception::fe_add_structure (AST_Structure *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_REDEF,
+ t,
+ this);
+ return 0;
+ }
+
+ if (this->referenced (d, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (t->has_ancestor (d))
+ {
+ idl_global->err ()->redefinition_in_scope (t,
+ d);
+ return 0;
+ }
+ }
+
+ // Add it to local types.
+ this->add_to_local_types (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_Enum (manifest type declaration) to the current scope.
+AST_Enum *
+AST_Exception::fe_add_enum (AST_Enum *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (referenced (d, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (t->has_ancestor (d))
+ {
+ idl_global->err ()->redefinition_in_scope (t,
+ d);
+ return 0;
+ }
+ }
+
+ // Add it to local types.
+ this->add_to_local_types (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+// Add this AST_EnumVal (enumerator declaration) to the current scope.
+// This is done to conform to the C++ scoping rules which declare
+// enumerators in the enclosing scope (in addition to declaring them
+// in the enum itself).
+AST_EnumVal *
+AST_Exception::fe_add_enum_val (AST_EnumVal *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (referenced (d, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ d);
+ return 0;
+ }
+
+ if (t->has_ancestor (d))
+ {
+ idl_global->err ()->redefinition_in_scope (t,
+ d);
+ return 0;
+ }
+ }
+
+ // Add it to scope.
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
// Dump this AST_Exception node to the ostream o.
void
AST_Exception::dump (ACE_OSTREAM_TYPE &o)
@@ -184,5 +438,7 @@ AST_Exception::destroy (void)
this->AST_Structure::destroy ();
}
+
+
IMPL_NARROW_FROM_DECL(AST_Exception)
IMPL_NARROW_FROM_SCOPE(AST_Exception)