diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-01-28 20:06:41 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-01-28 20:06:41 +0000 |
commit | 2cba83c54b9c90f07bec40104ce5c3f1dcaa3c3e (patch) | |
tree | 5ff9d5251149801d955ff40fd5a63c008bc246df | |
parent | db6bde7bb1a0ec1f5b10f8d959c5ac4fdf1dd16e (diff) | |
download | ATCD-2cba83c54b9c90f07bec40104ce5c3f1dcaa3c3e.tar.gz |
ChangeLogTag: Thu Jan 28 20:04:42 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | modules/TAO/ChangeLog | 18 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/ast/ast_decl.cpp | 14 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/ast/ast_interface.cpp | 53 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/ast/ast_interface_fwd.cpp | 2 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/ast/ast_module.cpp | 60 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/be/be_sequence.cpp | 1 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp | 2 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp | 4 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/fe/fe_extern.cpp | 5 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/fe/idl.yy | 2 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/fe/y.tab.cpp | 2 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/include/ast_decl.h | 6 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/include/utl_scope.h | 70 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/util/utl_scope.cpp | 622 |
14 files changed, 49 insertions, 812 deletions
diff --git a/modules/TAO/ChangeLog b/modules/TAO/ChangeLog index 22150139784..7a7389fcd35 100644 --- a/modules/TAO/ChangeLog +++ b/modules/TAO/ChangeLog @@ -1,3 +1,21 @@ +Thu Jan 28 20:04:42 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/include/ast_decl.h: + * TAO_IDL/include/utl_scope.h: + * TAO_IDL/be/be_visitor_operation/arglist.cpp: + * TAO_IDL/be/be_visitor_operation/argument.cpp: + * TAO_IDL/be/be_sequence.cpp: + * TAO_IDL/ast/ast_interface.cpp: + * TAO_IDL/ast/ast_module.cpp: + * TAO_IDL/ast/ast_interface_fwd.cpp: + * TAO_IDL/ast/ast_decl.cpp: + * TAO_IDL/fe/y.tab.cpp: + * TAO_IDL/fe/fe_extern.cpp: + * TAO_IDL/fe/idl.yy: + * TAO_IDL/util/utl_scope.cpp: + + Removal of more unnecessary code. + Thu Jan 28 18:13:19 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_union.cpp: diff --git a/modules/TAO/TAO_IDL/ast/ast_decl.cpp b/modules/TAO/TAO_IDL/ast/ast_decl.cpp index 6c7b8682681..9207840d6a1 100644 --- a/modules/TAO/TAO_IDL/ast/ast_decl.cpp +++ b/modules/TAO/TAO_IDL/ast/ast_decl.cpp @@ -144,7 +144,6 @@ AST_Decl::AST_Decl (void) pd_line (-1), pd_local_name (0), pd_original_local_name (0), - pd_added (false), full_name_ (0), prefix_ (0), version_ (0), @@ -172,7 +171,6 @@ AST_Decl::AST_Decl (NodeType nt, pd_name (0), pd_local_name (n == 0 ? 0 : n->last_component ()->copy ()), pd_original_local_name (0), - pd_added (false), full_name_ (0), prefix_ (0), version_ (0), @@ -1197,18 +1195,6 @@ AST_Decl::set_in_main_file (bool is_it) this->pd_in_main_file = is_it; } -bool -AST_Decl::added (void) -{ - return this->pd_added; -} - -void -AST_Decl::set_added (bool is_it) -{ - this->pd_added = is_it; -} - UTL_Scope * AST_Decl::defined_in (void) { diff --git a/modules/TAO/TAO_IDL/ast/ast_interface.cpp b/modules/TAO/TAO_IDL/ast/ast_interface.cpp index dc9392558c9..e89b106bdd5 100644 --- a/modules/TAO/TAO_IDL/ast/ast_interface.cpp +++ b/modules/TAO/TAO_IDL/ast/ast_interface.cpp @@ -585,18 +585,10 @@ AST_Interface::fe_add_structure_fwd (AST_StructureFwd *t) { AST_Structure *s = AST_Structure::narrow_from_decl (d); t->set_full_definition (s); - - if (t->added () == 0) - { - t->set_added (1); - this->add_to_scope (t); - - // Must check later that all struct and union forward declarations - // are defined in the same IDL file. - AST_record_fwd_decl (t); - } - - return t; + + // Must check later that all struct and union forward declarations + // are defined in the same IDL file. + AST_record_fwd_decl (t); } else { @@ -798,17 +790,9 @@ AST_Interface::fe_add_union_fwd (AST_UnionFwd *t) AST_Union *s = AST_Union::narrow_from_decl (d); t->set_full_definition (s); - if (t->added () == 0) - { - t->set_added (1); - this->add_to_scope (t); - - // Must check later that all struct and union forward declarations - // are defined in the same IDL file. - AST_record_fwd_decl (t); - } - - return t; + // Must check later that all struct and union forward declarations + // are defined in the same IDL file. + AST_record_fwd_decl (t); } else { @@ -1123,20 +1107,6 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i, scope = parent->defined_in (); } - // (JP) This could give a bogus error, since typeprefix can - // appear any time after the corresponding declaration. - // The right way to do this is with a separate traversal - // after the entire AST is built. - /* - if (ACE_OS::strcmp (i->prefix (), d->prefix ()) != 0) - { - idl_global->err ()->error1 (UTL_Error::EIDL_PREFIX_CONFLICT, - i); - - return; - } - */ - fd = AST_Interface::narrow_from_decl (d); // Successful? @@ -1182,7 +1152,14 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i, } fd->redefine (i); - + + AST_InterfaceFwd *fwd = fd->fwd_decl (); + + if (fwd != 0) + { + fwd->set_as_defined (); + } + // Use full definition node. i->destroy (); delete i; diff --git a/modules/TAO/TAO_IDL/ast/ast_interface_fwd.cpp b/modules/TAO/TAO_IDL/ast/ast_interface_fwd.cpp index 50f86f20e2d..eccce8b48a0 100644 --- a/modules/TAO/TAO_IDL/ast/ast_interface_fwd.cpp +++ b/modules/TAO/TAO_IDL/ast/ast_interface_fwd.cpp @@ -245,7 +245,7 @@ AST_InterfaceFwd::is_defined (void) // is a sufficient way to tell if our full // definition has already gone through the // add_to_scope process. - if (0 != fwd && fwd->full_definition ()->added ()) + if (0 != fwd && fwd->is_defined ()) { this->is_defined_ = true; } diff --git a/modules/TAO/TAO_IDL/ast/ast_module.cpp b/modules/TAO/TAO_IDL/ast/ast_module.cpp index 2df82d58e21..c7fb1c62d73 100644 --- a/modules/TAO/TAO_IDL/ast/ast_module.cpp +++ b/modules/TAO/TAO_IDL/ast/ast_module.cpp @@ -868,12 +868,6 @@ AST_Module::fe_add_interface_fwd (AST_InterfaceFwd *i) return 0; } - if (i->added () == 0) - { - i->set_added (true); - this->add_to_scope (i); - } - // If the lookup found the full_definition member of another // interface_fwd, don't reset this full_definition. Otherwise // reset the member and set is_defined_ on i so it itf won't @@ -892,7 +886,7 @@ AST_Module::fe_add_interface_fwd (AST_InterfaceFwd *i) i->set_as_defined (); } - return i; +// return i; } if (!can_be_redefined (d)) { @@ -959,15 +953,9 @@ AST_Module::fe_add_valuetype_fwd (AST_ValueTypeFwd *v) return 0; } - if (v->added () == 0) - { - v->set_added (1); - this->add_to_scope (v); - } - // @@ Redefinition of forward. Type check not implemented. v->set_full_definition (vtf); // @@ Memory leak. - return v; +// return v; } if (!can_be_redefined (d)) { @@ -1040,15 +1028,9 @@ AST_Module::fe_add_eventtype_fwd (AST_EventTypeFwd *v) return 0; } - if (v->added () == 0) - { - v->set_added (1); - this->add_to_scope (v); - } - // @@ Redefinition of forward. Type check not implemented. v->set_full_definition (vtf); // @@ Memory leak. - return v; +// return v; } if (!can_be_redefined (d)) { @@ -1121,15 +1103,9 @@ AST_Module::fe_add_component_fwd (AST_ComponentFwd *c) return 0; } - if (c->added () == 0) - { - c->set_added (1); - this->add_to_scope (c); - } - // @@ Redefinition of forward. Type check not implemented. c->set_full_definition (cf); // @@ Memory leak. - return c; +// return c; } if (!can_be_redefined (d)) { @@ -1373,17 +1349,9 @@ AST_Module::fe_add_union_fwd (AST_UnionFwd *t) AST_Union *s = AST_Union::narrow_from_decl (d); t->set_full_definition (s); - if (t->added () == 0) - { - t->set_added (1); - this->add_to_scope (t); - - // Must check later that all struct and union forward declarations - // are defined in the same IDL file. - AST_record_fwd_decl (t); - } - - return t; + // Must check later that all struct and union forward declarations + // are defined in the same IDL file. + AST_record_fwd_decl (t); } else { @@ -1533,17 +1501,9 @@ AST_Module::fe_add_structure_fwd (AST_StructureFwd *t) AST_Structure *s = AST_Structure::narrow_from_decl (d); t->set_full_definition (s); - if (t->added () == 0) - { - t->set_added (1); - this->add_to_scope (t); - - // Must check later that all struct and union forward declarations - // are defined in the same IDL file. - AST_record_fwd_decl (t); - } - - return t; + // Must check later that all struct and union forward declarations + // are defined in the same IDL file. + AST_record_fwd_decl (t); } else { diff --git a/modules/TAO/TAO_IDL/be/be_sequence.cpp b/modules/TAO/TAO_IDL/be/be_sequence.cpp index 63e4bce34e6..76efef6aa72 100644 --- a/modules/TAO/TAO_IDL/be/be_sequence.cpp +++ b/modules/TAO/TAO_IDL/be/be_sequence.cpp @@ -205,7 +205,6 @@ be_sequence::gen_name (void) // template and non-template implementations of IDL sequences. UTL_Scope *parent = this->defined_in (); seq->set_defined_in (parent); - parent->add_sequence (seq); char *seq_name = seq->gen_name (); ACE_OS::sprintf (namebuf, diff --git a/modules/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp b/modules/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp index 146b894023c..edfad396bd6 100644 --- a/modules/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp +++ b/modules/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp @@ -123,7 +123,7 @@ be_visitor_operation_arglist::visit_argument (be_argument *node) // inside the scope of the interface node. In such cases, we would like to // generate the appropriate relative scoped names. be_operation *op = - be_operation::narrow_from_decl (this->ctx_->node ()); + be_operation::narrow_from_scope (this->ctx_->scope ()); if (op == 0) { diff --git a/modules/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp b/modules/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp index 5432ea40657..90e49b3122e 100644 --- a/modules/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp +++ b/modules/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp @@ -90,12 +90,12 @@ be_visitor_operation_argument::visit_argument (be_argument *node) // signature. be_visitor_context ctx (*this->ctx_); - // first grab the interface definition inside which this operation is + // First grab the interface definition inside which this operation is // defined. We need this since argument types may very well be declared // inside the scope of the interface node. In such cases, we would like to // generate the appropriate relative scoped names. be_operation *op = - be_operation::narrow_from_decl (this->ctx_->node ()); + be_operation::narrow_from_scope (this->ctx_->scope ()); if (op == 0) { diff --git a/modules/TAO/TAO_IDL/fe/fe_extern.cpp b/modules/TAO/TAO_IDL/fe/fe_extern.cpp index 7cd5a879eab..874f02b33ac 100644 --- a/modules/TAO/TAO_IDL/fe/fe_extern.cpp +++ b/modules/TAO/TAO_IDL/fe/fe_extern.cpp @@ -91,11 +91,6 @@ FE_yyparse (void) { int const result = tao_yyparse (); - if (0 == idl_global->err_count ()) - { - idl_global->root ()->call_add (); - } - #ifdef USE_MCPP_BUFFER_LEXING ACE_OS::free (tao_preproc_buffer); tao_preproc_buffer_length = 0; diff --git a/modules/TAO/TAO_IDL/fe/idl.yy b/modules/TAO/TAO_IDL/fe/idl.yy index a979f815d3f..a5a1a992f1b 100644 --- a/modules/TAO/TAO_IDL/fe/idl.yy +++ b/modules/TAO/TAO_IDL/fe/idl.yy @@ -1666,7 +1666,7 @@ interface_forward : AST_PredefinedType::PT_pseudo, &n ); - (void) s->add_predefined_type (pdt); + s->add_to_scope (pdt); $1->destroy (); diff --git a/modules/TAO/TAO_IDL/fe/y.tab.cpp b/modules/TAO/TAO_IDL/fe/y.tab.cpp index d5d640abfea..2cf4c2e05f8 100644 --- a/modules/TAO/TAO_IDL/fe/y.tab.cpp +++ b/modules/TAO/TAO_IDL/fe/y.tab.cpp @@ -4103,7 +4103,7 @@ tao_yyreduce: AST_PredefinedType::PT_pseudo, &n ); - (void) s->add_predefined_type (pdt); + s->add_to_scope (pdt); (tao_yyvsp[(1) - (1)].idval)->destroy (); diff --git a/modules/TAO/TAO_IDL/include/ast_decl.h b/modules/TAO/TAO_IDL/include/ast_decl.h index 5187a98fc9f..5599d0dbbb6 100644 --- a/modules/TAO/TAO_IDL/include/ast_decl.h +++ b/modules/TAO/TAO_IDL/include/ast_decl.h @@ -261,9 +261,6 @@ public: Identifier *original_local_name (void); void original_local_name (Identifier *); - bool added (void); - void set_added (bool is_it); - // Narrowing. DEF_NARROW_FROM_DECL(AST_Decl); @@ -357,9 +354,6 @@ private: Identifier *pd_original_local_name; // _cxx_ removed if any. - bool pd_added; - // Already added. - char *full_name_; // Our full scoped name. diff --git a/modules/TAO/TAO_IDL/include/utl_scope.h b/modules/TAO/TAO_IDL/include/utl_scope.h index 3dd7943b7ab..f20104e3811 100644 --- a/modules/TAO/TAO_IDL/include/utl_scope.h +++ b/modules/TAO/TAO_IDL/include/utl_scope.h @@ -154,76 +154,6 @@ public: // Destructor. virtual ~UTL_Scope (void); - // Scope Management Protocol. - virtual AST_PredefinedType *add_predefined_type (AST_PredefinedType *t); - - virtual AST_Module *add_module (AST_Module *m); - - virtual AST_Interface *add_interface (AST_Interface *i); - - virtual AST_InterfaceFwd *add_interface_fwd (AST_InterfaceFwd *i); - - virtual AST_ValueType *add_valuetype (AST_ValueType *i); - - virtual AST_ValueTypeFwd *add_valuetype_fwd (AST_ValueTypeFwd *i); - - virtual AST_EventType *add_eventtype (AST_EventType *i); - - virtual AST_EventTypeFwd *add_eventtype_fwd (AST_EventTypeFwd *i); - - virtual AST_Component *add_component (AST_Component *i); - - virtual AST_ComponentFwd *add_component_fwd (AST_ComponentFwd *i); - - virtual AST_Home *add_home (AST_Home *i); - - virtual AST_Constant *add_constant (AST_Constant *c); - - virtual AST_Exception *add_exception (AST_Exception *e); - - virtual AST_Attribute *add_attribute (AST_Attribute *a); - - virtual AST_Operation *add_operation (AST_Operation *o); - - virtual AST_Argument *add_argument (AST_Argument *a); - - virtual AST_Union *add_union (AST_Union *u); - - virtual AST_UnionFwd *add_union_fwd (AST_UnionFwd *u); - - virtual AST_UnionBranch *add_union_branch (AST_UnionBranch *b); - - virtual AST_Structure *add_structure (AST_Structure *s); - - virtual AST_StructureFwd *add_structure_fwd (AST_StructureFwd *s); - - virtual AST_Field *add_field (AST_Field *f); - - virtual AST_Enum *add_enum (AST_Enum *e); - - virtual AST_EnumVal *add_enum_val (AST_EnumVal *v); - - virtual AST_Typedef *add_typedef (AST_Typedef *t); - - virtual UTL_StrList *add_context (UTL_StrList *c); - - virtual UTL_NameList *add_exceptions (UTL_NameList *e); - - virtual AST_Sequence *add_sequence (AST_Sequence *s); - - virtual AST_String *add_string (AST_String *s); - - virtual AST_Array *add_array (AST_Array *a); - - virtual AST_Native *add_native (AST_Native *n); - - virtual AST_Factory *add_factory (AST_Factory *f); - - virtual AST_PortType *add_porttype (AST_PortType *p); - - // Call back end add_XXX functions for this scope. - virtual AST_Decl *call_add (void); - // Data Accessors. AST_Decl::NodeType scope_node_type (void) { diff --git a/modules/TAO/TAO_IDL/util/utl_scope.cpp b/modules/TAO/TAO_IDL/util/utl_scope.cpp index ec5dabfb5e2..f4272394f4d 100644 --- a/modules/TAO/TAO_IDL/util/utl_scope.cpp +++ b/modules/TAO/TAO_IDL/util/utl_scope.cpp @@ -296,63 +296,6 @@ UTL_Scope::~UTL_Scope (void) { } -// Private operations. - -static AST_Decl * -add_type (AST_Type *type) -{ - AST_Decl *result = 0; - UTL_Scope *scope = 0; - - switch (type->node_type()) - { - case AST_Decl::NT_array: - result = - idl_global->root ()->add_array (AST_Array::narrow_from_decl (type)); - break; - case AST_Decl::NT_enum: - result = - type->defined_in ()->add_enum (AST_Enum::narrow_from_decl (type)); - scope = AST_Enum::narrow_from_decl (type); - break; - case AST_Decl::NT_sequence: - result = - idl_global->root ()->add_sequence ( - AST_Sequence::narrow_from_decl (type) - ); - break; - case AST_Decl::NT_string: - case AST_Decl::NT_wstring: - result = - idl_global->root ()->add_string (AST_String::narrow_from_decl (type)); - break; - case AST_Decl::NT_struct: - result = - type->defined_in ()->add_structure ( - AST_Structure::narrow_from_decl (type) - ); - scope = AST_Structure::narrow_from_decl (type); - break; - case AST_Decl::NT_union: - result = - type->defined_in ()->add_union (AST_Union::narrow_from_decl (type)); - scope = AST_Union::narrow_from_decl (type); - break; - default: - // For non-complex types, like predefined types - // no additional add needed, assume everything is ok. - result = (AST_Decl *) 1; - break; - } - - if (scope != 0) - { - result = scope->call_add (); - } - - return result; -} - // Protected operations. // Special version of lookup which only looks at the local name instead of @@ -581,460 +524,6 @@ UTL_Scope::check_for_predef_seq (AST_Decl *d) // Public operations. -// Scope Management Protocol. -// -// All members of the protocol defined in UTL_Scope simply return the node -// and don't do a thing. These members are simply dummies to retain -// compatibility with pre-two-pass compiler back-ends. - -AST_PredefinedType * -UTL_Scope::add_predefined_type (AST_PredefinedType *p) -{ - if (p == 0) - { - return 0; - } - - p->set_added (true); - return p; -} - -AST_Module * -UTL_Scope::add_module (AST_Module *m) -{ - if (m == 0) - { - return 0; - } - - m->set_added (true); - return m; -} - -AST_Interface * -UTL_Scope::add_interface (AST_Interface *i) -{ - if (i == 0) - { - return 0; - } - - i->set_added (true); - return i; -} - -AST_InterfaceFwd * -UTL_Scope::add_interface_fwd (AST_InterfaceFwd *i) -{ - if (i == 0) - { - return 0; - } - - i->set_added (true); - return i; -} - -AST_ValueType * -UTL_Scope::add_valuetype (AST_ValueType *i) -{ - if (i == 0) - { - return 0; - } - - i->set_added (true); - return i; -} - -AST_ValueTypeFwd * -UTL_Scope::add_valuetype_fwd (AST_ValueTypeFwd *i) -{ - if (i == 0) - { - return 0; - } - - i->set_added (true); - return i; -} - -AST_EventType * -UTL_Scope::add_eventtype (AST_EventType *i) -{ - if (i == 0) - { - return 0; - } - - i->set_added (true); - return i; -} - -AST_EventTypeFwd * -UTL_Scope::add_eventtype_fwd (AST_EventTypeFwd *i) -{ - if (i == 0) - { - return 0; - } - - i->set_added (true); - return i; -} - -AST_Component * -UTL_Scope::add_component (AST_Component *i) -{ - if (i == 0) - { - return 0; - } - - i->set_added (true); - return i; -} - -AST_ComponentFwd * -UTL_Scope::add_component_fwd (AST_ComponentFwd *i) -{ - if (i == 0) - { - return 0; - } - - i->set_added (true); - return i; -} - -AST_Home * -UTL_Scope::add_home (AST_Home *i) -{ - if (i == 0) - { - return 0; - } - - i->set_added (true); - return i; -} - -AST_Exception * -UTL_Scope::add_exception (AST_Exception *e) -{ - if (e == 0) - { - return 0; - } - - e->set_added (true); - return e; -} - -AST_Constant * -UTL_Scope::add_constant (AST_Constant *c) -{ - if (c == 0) - { - return 0; - } - - c->set_added (true); - return c; -} - -UTL_StrList * -UTL_Scope::add_context (UTL_StrList *c) -{ - return c; -} - -UTL_NameList * -UTL_Scope::add_exceptions (UTL_NameList *e) -{ - return e; -} - -AST_Attribute * -UTL_Scope::add_attribute (AST_Attribute *a) -{ - if (a == 0) - { - return 0; - } - - a->set_added (true); - - if (!a->field_type ()->added ()) - { - return add_type (a->field_type ()) ? a : 0; - } - else - { - return a; - } -} - -AST_Operation * -UTL_Scope::add_operation (AST_Operation *o) -{ - if (o == 0) - { - return 0; - } - - o->set_added (true); - - if (!o->return_type ()->added ()) - { - return add_type (o->return_type ()) ? o : 0; - } - else - { - return o; - } -} - -AST_Argument * -UTL_Scope::add_argument (AST_Argument *a) -{ - if (a == 0) - { - return 0; - } - - a->set_added (true); - - if (!a->field_type ()->added ()) - { - return add_type (a->field_type ()) ? a : 0; - } - else - { - return a; - } -} - -AST_Union * -UTL_Scope::add_union (AST_Union *u) -{ - if (u == 0) - { - return 0; - } - - u->set_added (true); - return u; -} - -AST_UnionFwd * -UTL_Scope::add_union_fwd (AST_UnionFwd *u) -{ - if (u == 0) - { - return 0; - } - - u->set_added (true); - return u; -} - -AST_UnionBranch * -UTL_Scope::add_union_branch (AST_UnionBranch *u) -{ - if (u == 0) - { - return 0; - } - - u->set_added (true); - - if (!u->field_type ()->added ()) - { - return add_type (u->field_type ()) ? u : 0; - } - else - { - return u; - } -} - -AST_Structure * -UTL_Scope::add_structure (AST_Structure *s) -{ - if (s == 0) - { - return 0; - } - - s->set_added (true); - return s; -} - -AST_StructureFwd * -UTL_Scope::add_structure_fwd (AST_StructureFwd *s) -{ - if (s == 0) - { - return 0; - } - - s->set_added (true); - return s; -} - -AST_Field * -UTL_Scope::add_field (AST_Field *f) -{ - if (f == 0) - { - return 0; - } - - f->set_added (true); - - if (!f->field_type ()->added ()) - { - return add_type (f->field_type ()) ? f : 0; - } - else - { - return f; - } -} - -AST_Enum * -UTL_Scope::add_enum (AST_Enum *e) -{ - if (e == 0) - { - return 0; - } - - e->set_added (true); - return e; -} - -AST_EnumVal * -UTL_Scope::add_enum_val (AST_EnumVal *e) -{ - if (e == 0) - { - return 0; - } - - e->set_added (true); - return e; -} - -AST_Typedef * -UTL_Scope::add_typedef (AST_Typedef *t) -{ - if (t == 0) - { - return 0; - } - - t->set_added (true); - if (!t->base_type ()->added ()) - { - return add_type (t->base_type ()) ? t : 0; - } - else - { - return t; - } -} - -AST_Sequence * -UTL_Scope::add_sequence (AST_Sequence *s) -{ - if (s == 0) - { - return 0; - } - - s->set_added (true); - - if (!s->base_type ()->added ()) - { - return add_type (s->base_type ()) ? s : 0; - } - else - { - return s; - } -} - -AST_String * -UTL_Scope::add_string (AST_String *s) -{ - if (s == 0) - { - return 0; - } - - s->set_added (true); - return s; -} - -AST_Array * -UTL_Scope::add_array (AST_Array *a) -{ - if (a == 0) - { - return 0; - } - - a->set_added (true); - - if (!a->base_type ()->added ()) - { - return add_type (a->base_type ()) ? a : 0; - } - else - { - return a; - } -} - -AST_Native * -UTL_Scope::add_native (AST_Native *n) -{ - if (n == 0) - { - return 0; - } - - n->set_added (true); - return n; -} - -AST_Factory * -UTL_Scope::add_factory (AST_Factory *f) -{ - // We don't invite any new types so there is nothing actually to add - if (f == 0) - { - return 0; - } - - f->set_added (true); - return f; -} - -AST_PortType * -UTL_Scope::add_porttype (AST_PortType *p) -{ - if (p == 0) - { - return 0; - } - - p->set_added (true); - return p; -} - // Protected Front End Scope Management Protocol. // // All members of the protocol defined in UTL_Scope simply return NULL @@ -1306,117 +795,6 @@ UTL_Scope::fe_add_connector (AST_Connector *) return 0; } -// This is the second pass of the front end -// It calls the public add protocol on everything in scope. -// It calls the add_xx functions of the most derived AST_Node. - -AST_Decl * -UTL_Scope::call_add (void) -{ - AST_Decl *result = 0; - AST_Decl *decl = 0; - - UTL_ScopeActiveIterator i (this, - UTL_Scope::IK_decls); - UTL_Scope *scope = 0; - - while (!i.is_done ()) - { - decl = i.item (); - scope = 0; - - switch (decl->node_type ()) - { - case AST_Decl::NT_argument: - result = add_argument (AST_Argument::narrow_from_decl (decl)); - break; - case AST_Decl::NT_array: - result = add_array (AST_Array::narrow_from_decl (decl)); - break; - case AST_Decl::NT_attr: - result = add_attribute (AST_Attribute::narrow_from_decl (decl)); - break; - case AST_Decl::NT_const: - result = add_constant (AST_Constant::narrow_from_decl (decl)); - break; - case AST_Decl::NT_enum: - scope = AST_Enum::narrow_from_decl (decl); - result = add_enum (AST_Enum::narrow_from_decl (decl)); - break; - case AST_Decl::NT_enum_val: - result = add_enum_val (AST_EnumVal::narrow_from_decl (decl)); - break; - case AST_Decl::NT_except: - scope = AST_Exception::narrow_from_decl (decl); - result = add_exception (AST_Exception::narrow_from_decl (decl)); - break; - case AST_Decl::NT_field: - result = add_field (AST_Field::narrow_from_decl (decl)); - break; - case AST_Decl::NT_interface: - scope = AST_Interface::narrow_from_decl (decl); - result = add_interface (AST_Interface::narrow_from_decl (decl)); - break; - case AST_Decl::NT_interface_fwd: - result = - add_interface_fwd (AST_InterfaceFwd::narrow_from_decl (decl)); - break; - case AST_Decl::NT_module: - scope = AST_Module::narrow_from_decl (decl); - result = add_module (AST_Module::narrow_from_decl (decl)); - break; - case AST_Decl::NT_native: - result = add_native (AST_Native::narrow_from_decl (decl)); - break; - case AST_Decl::NT_op: - result = add_operation (AST_Operation::narrow_from_decl (decl)); - scope = AST_Operation::narrow_from_decl (decl); - break; - case AST_Decl::NT_pre_defined: - result = - add_predefined_type (AST_PredefinedType::narrow_from_decl (decl)); - break; - case AST_Decl::NT_sequence: - result = add_sequence (AST_Sequence::narrow_from_decl (decl)); - break; - case AST_Decl::NT_string: - case AST_Decl::NT_wstring: - result = add_string (AST_String::narrow_from_decl (decl)); - break; - case AST_Decl::NT_struct: - result = add_structure (AST_Structure::narrow_from_decl (decl)); - scope = AST_Structure::narrow_from_decl (decl); - break; - case AST_Decl::NT_typedef: - result = add_typedef (AST_Typedef::narrow_from_decl (decl)); - break; - case AST_Decl::NT_union: - result = add_union (AST_Union::narrow_from_decl (decl)); - scope = AST_Union::narrow_from_decl (decl); - break; - case AST_Decl::NT_union_branch: - result = - add_union_branch (AST_UnionBranch::narrow_from_decl (decl)); - break; - case AST_Decl::NT_factory: - result = add_factory (AST_Factory::narrow_from_decl (decl)); - scope = AST_Factory::narrow_from_decl (decl); - break; - default: - return 0; - } - - if (scope != 0) - { - scope->call_add (); - } - - i.next (); - } - - return result; -} - // Private lookup mechanism. // For dealing with lookups of 'Object' and 'TypeCode'. |