summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-02-18 20:37:07 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-02-18 20:37:07 +0000
commitd962de7484784d44a19ca5732689bdc4ae2f2007 (patch)
treed6960f89744d8219b9bd6a0a1dbd522df27e1f71
parentb7d404dec39364d950ab21ce9667535b358e4bb3 (diff)
downloadATCD-d962de7484784d44a19ca5732689bdc4ae2f2007.tar.gz
ChangeLogTag: Thu Feb 18 20:36:04 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/ChangeLog133
-rw-r--r--TAO/TAO_IDL/ast/ast_argument.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_array.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_attribute.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_component.cpp255
-rw-r--r--TAO/TAO_IDL/ast/ast_component_fwd.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_connector.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_constant.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_consumes.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_emits.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_enum.cpp4
-rw-r--r--TAO/TAO_IDL/ast/ast_enum_val.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_eventtype.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_eventtype_fwd.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_exception.cpp252
-rw-r--r--TAO/TAO_IDL/ast/ast_extended_port.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_factory.cpp48
-rw-r--r--TAO/TAO_IDL/ast/ast_field.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_finder.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_home.cpp107
-rw-r--r--TAO/TAO_IDL/ast/ast_interface.cpp792
-rw-r--r--TAO/TAO_IDL/ast/ast_interface_fwd.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_mirror_port.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_module.cpp1493
-rw-r--r--TAO/TAO_IDL/ast/ast_native.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_operation.cpp79
-rw-r--r--TAO/TAO_IDL/ast/ast_param_holder.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_porttype.cpp182
-rw-r--r--TAO/TAO_IDL/ast/ast_predefined_type.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_provides.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_publishes.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_redef.cpp29
-rw-r--r--TAO/TAO_IDL/ast/ast_root.cpp41
-rw-r--r--TAO/TAO_IDL/ast/ast_sequence.cpp5
-rw-r--r--TAO/TAO_IDL/ast/ast_string.cpp4
-rw-r--r--TAO/TAO_IDL/ast/ast_structure.cpp236
-rw-r--r--TAO/TAO_IDL/ast/ast_structure_fwd.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_template_module.cpp49
-rw-r--r--TAO/TAO_IDL/ast/ast_template_module_inst.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_template_module_ref.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_typedef.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_union.cpp259
-rw-r--r--TAO/TAO_IDL/ast/ast_union_branch.cpp5
-rw-r--r--TAO/TAO_IDL/ast/ast_union_fwd.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_uses.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_valuebox.cpp5
-rw-r--r--TAO/TAO_IDL/ast/ast_valuetype.cpp61
-rw-r--r--TAO/TAO_IDL/ast/ast_valuetype_fwd.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_root.cpp42
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union.cpp6
-rw-r--r--TAO/TAO_IDL/be_include/be_root.h7
-rw-r--r--TAO/TAO_IDL/fe/idl.ll28
-rw-r--r--TAO/TAO_IDL/fe/lex.yy.cpp28
-rw-r--r--TAO/TAO_IDL/include/ast_argument.h2
-rw-r--r--TAO/TAO_IDL/include/ast_array.h2
-rw-r--r--TAO/TAO_IDL/include/ast_attribute.h2
-rw-r--r--TAO/TAO_IDL/include/ast_component.h3
-rw-r--r--TAO/TAO_IDL/include/ast_component_fwd.h2
-rw-r--r--TAO/TAO_IDL/include/ast_connector.h2
-rw-r--r--TAO/TAO_IDL/include/ast_constant.h2
-rw-r--r--TAO/TAO_IDL/include/ast_consumes.h2
-rw-r--r--TAO/TAO_IDL/include/ast_decl.h2
-rw-r--r--TAO/TAO_IDL/include/ast_emits.h2
-rw-r--r--TAO/TAO_IDL/include/ast_enum.h2
-rw-r--r--TAO/TAO_IDL/include/ast_enum_val.h2
-rw-r--r--TAO/TAO_IDL/include/ast_eventtype.h3
-rw-r--r--TAO/TAO_IDL/include/ast_eventtype_fwd.h2
-rw-r--r--TAO/TAO_IDL/include/ast_exception.h10
-rw-r--r--TAO/TAO_IDL/include/ast_extended_port.h2
-rw-r--r--TAO/TAO_IDL/include/ast_factory.h2
-rw-r--r--TAO/TAO_IDL/include/ast_field.h2
-rw-r--r--TAO/TAO_IDL/include/ast_finder.h2
-rw-r--r--TAO/TAO_IDL/include/ast_home.h2
-rw-r--r--TAO/TAO_IDL/include/ast_interface.h5
-rw-r--r--TAO/TAO_IDL/include/ast_interface_fwd.h2
-rw-r--r--TAO/TAO_IDL/include/ast_mirror_port.h2
-rw-r--r--TAO/TAO_IDL/include/ast_module.h4
-rw-r--r--TAO/TAO_IDL/include/ast_native.h2
-rw-r--r--TAO/TAO_IDL/include/ast_operation.h2
-rw-r--r--TAO/TAO_IDL/include/ast_param_holder.h2
-rw-r--r--TAO/TAO_IDL/include/ast_porttype.h2
-rw-r--r--TAO/TAO_IDL/include/ast_predefined_type.h2
-rw-r--r--TAO/TAO_IDL/include/ast_provides.h2
-rw-r--r--TAO/TAO_IDL/include/ast_publishes.h2
-rw-r--r--TAO/TAO_IDL/include/ast_root.h2
-rw-r--r--TAO/TAO_IDL/include/ast_sequence.h2
-rw-r--r--TAO/TAO_IDL/include/ast_string.h2
-rw-r--r--TAO/TAO_IDL/include/ast_structure.h5
-rw-r--r--TAO/TAO_IDL/include/ast_structure_fwd.h2
-rw-r--r--TAO/TAO_IDL/include/ast_template_module.h2
-rw-r--r--TAO/TAO_IDL/include/ast_template_module_inst.h2
-rw-r--r--TAO/TAO_IDL/include/ast_template_module_ref.h2
-rw-r--r--TAO/TAO_IDL/include/ast_typedef.h2
-rw-r--r--TAO/TAO_IDL/include/ast_union.h2
-rw-r--r--TAO/TAO_IDL/include/ast_union_branch.h2
-rw-r--r--TAO/TAO_IDL/include/ast_union_fwd.h2
-rw-r--r--TAO/TAO_IDL/include/ast_uses.h2
-rw-r--r--TAO/TAO_IDL/include/ast_valuebox.h2
-rw-r--r--TAO/TAO_IDL/include/ast_valuetype.h5
-rw-r--r--TAO/TAO_IDL/include/ast_valuetype_fwd.h2
-rw-r--r--TAO/TAO_IDL/include/utl_scope.h39
-rw-r--r--TAO/TAO_IDL/include/utl_tmpl/UTL_Scope_T.cpp172
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp303
103 files changed, 1102 insertions, 3761 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 2dbab4d9451..bbc9ff7b245 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,136 @@
+Thu Feb 18 20:36:04 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/include/utl_tmpl/UTL_Scope_T.cpp:
+
+ New file, containing bodies of some newly
+ added template methods to class UTL_Scope.
+
+ * TAO_IDL/fe/lex.yy.cpp:
+ * TAO_IDL/fe/idl.ll:
+
+ Cosmetic changes.
+
+ * TAO_IDL/include/ast_root.h:
+ * TAO_IDL/include/ast_module.h:
+ * TAO_IDL/include/ast_valuebox.h:
+ * TAO_IDL/include/ast_union.h:
+ * TAO_IDL/include/ast_param_holder.h:
+ * TAO_IDL/include/ast_structure.h:
+ * TAO_IDL/include/ast_interface_fwd.h:
+ * TAO_IDL/include/ast_component_fwd.h:
+ * TAO_IDL/include/ast_string.h:
+ * TAO_IDL/include/ast_decl.h:
+ * TAO_IDL/include/ast_factory.h:
+ * TAO_IDL/include/ast_template_module_ref.h:
+ * TAO_IDL/include/ast_valuetype.h:
+ * TAO_IDL/include/ast_mirror_port.h:
+ * TAO_IDL/include/ast_argument.h:
+ * TAO_IDL/include/ast_eventtype.h:
+ * TAO_IDL/include/ast_native.h:
+ * TAO_IDL/include/ast_home.h:
+ * TAO_IDL/include/ast_union_fwd.h:
+ * TAO_IDL/include/ast_connector.h:
+ * TAO_IDL/include/ast_provides.h:
+ * TAO_IDL/include/ast_structure_fwd.h:
+ * TAO_IDL/include/ast_enum_val.h:
+ * TAO_IDL/include/ast_finder.h:
+ * TAO_IDL/include/ast_sequence.h:
+ * TAO_IDL/include/ast_valuetype_fwd.h:
+ * TAO_IDL/include/ast_template_module.h:
+ * TAO_IDL/include/ast_eventtype_fwd.h:
+ * TAO_IDL/include/ast_exception.h:
+ * TAO_IDL/include/ast_typedef.h:
+ * TAO_IDL/include/ast_attribute.h:
+ * TAO_IDL/include/ast_extended_port.h:
+ * TAO_IDL/include/ast_enum.h:
+ * TAO_IDL/include/ast_union_branch.h:
+ * TAO_IDL/include/ast_template_module_inst.
+ * TAO_IDL/include/ast_uses.h:
+ * TAO_IDL/include/ast_field.h:
+ * TAO_IDL/include/utl_scope.h:
+ * TAO_IDL/include/ast_porttype.h:
+ * TAO_IDL/include/ast_constant.h:
+ * TAO_IDL/include/ast_consumes.h:
+ * TAO_IDL/include/ast_publishes.h:
+ * TAO_IDL/include/ast_interface.h:
+ * TAO_IDL/include/ast_operation.h:
+ * TAO_IDL/include/ast_component.h:
+ * TAO_IDL/include/ast_predefined_type.h:
+ * TAO_IDL/include/ast_array.h:
+ * TAO_IDL/include/ast_emits.h:
+ * TAO_IDL/be/be_visitor_union/union.cpp:
+ * TAO_IDL/be/be_root.cpp:
+ * TAO_IDL/ast/ast_home.cpp:
+ * TAO_IDL/ast/ast_union_fwd.cpp:
+ * TAO_IDL/ast/ast_constant.cpp:
+ * TAO_IDL/ast/ast_connector.cpp:
+ * TAO_IDL/ast/ast_provides.cpp:
+ * TAO_IDL/ast/ast_consumes.cpp:
+ * TAO_IDL/ast/ast_publishes.cpp:
+ * TAO_IDL/ast/ast_structure_fwd.cpp:
+ * TAO_IDL/ast/ast_operation.cpp:
+ * TAO_IDL/ast/ast_interface.cpp:
+ * TAO_IDL/ast/ast_component.cpp:
+ * TAO_IDL/ast/ast_enum_val.cpp:
+ * TAO_IDL/ast/ast_predefined_type.cpp:
+ * TAO_IDL/ast/ast_finder.cpp:
+ * TAO_IDL/ast/ast_sequence.cpp:
+ * TAO_IDL/ast/ast_array.cpp:
+ * TAO_IDL/ast/ast_valuetype_fwd.cpp:
+ * TAO_IDL/ast/ast_template_module.cpp:
+ * TAO_IDL/ast/ast_emits.cpp:
+ * TAO_IDL/ast/ast_root.cpp:
+ * TAO_IDL/ast/ast_eventtype_fwd.cpp:
+ * TAO_IDL/ast/ast_redef.cpp:
+ * TAO_IDL/ast/ast_module.cpp:
+ * TAO_IDL/ast/ast_valuebox.cpp:
+ * TAO_IDL/ast/ast_union.cpp:
+ * TAO_IDL/ast/ast_param_holder.cpp:
+ * TAO_IDL/ast/ast_exception.cpp:
+ * TAO_IDL/ast/ast_typedef.cpp:
+ * TAO_IDL/ast/ast_interface_fwd.cpp:
+ * TAO_IDL/ast/ast_structure.cpp:
+ * TAO_IDL/ast/ast_component_fwd.cpp:
+ * TAO_IDL/ast/ast_attribute.cpp:
+ * TAO_IDL/ast/ast_enum.cpp:
+ * TAO_IDL/ast/ast_extended_port.cpp:
+ * TAO_IDL/ast/ast_union_branch.cpp:
+ * TAO_IDL/ast/ast_string.cpp:
+ * TAO_IDL/ast/ast_factory.cpp:
+ * TAO_IDL/ast/ast_template_module_ref.cpp:
+ * TAO_IDL/ast/ast_template_module_inst.cpp:
+ * TAO_IDL/ast/ast_valuetype.cpp:
+ * TAO_IDL/ast/ast_mirror_port.cpp:
+ * TAO_IDL/ast/ast_uses.cpp:
+ * TAO_IDL/ast/ast_argument.cpp:
+ * TAO_IDL/ast/ast_field.cpp:
+ * TAO_IDL/ast/ast_eventtype.cpp:
+ * TAO_IDL/ast/ast_native.cpp:
+ * TAO_IDL/ast/ast_porttype.cpp:
+ * TAO_IDL/be_include/be_root.h:
+ * TAO_IDL/util/utl_scope.cpp:
+
+ - Consolidated common code from all fe_add_*
+ methods into class UTL_Scope. All these
+ methods had large bodies, and most were
+ duplicated over several AST_* classes.
+ To encapsulate the forward declaration and
+ redefinition properties of AST_Interface
+ and it forward-declarable subtypes
+ AST_ValueType, AST_EventType, and
+ AST_Component), some template methods were
+ added to UTL_Scope.
+
+ - Static constants were added to each AST_*
+ class to associated it with its corresponding
+ NodeType enum value, as an aid to template
+ programming.
+
+ - Typedefs were added to forward_declarable
+ types to associate eachtype with its
+ AST_*Fwd counterpart, as an aid to template
+ programming.
+
Thu Feb 18 14:46:16 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/be/be_visitor_connector/connector_dds_exh.cpp(gen_connector_traits):
diff --git a/TAO/TAO_IDL/ast/ast_argument.cpp b/TAO/TAO_IDL/ast/ast_argument.cpp
index 1ace9b13072..ee1015b36a5 100644
--- a/TAO/TAO_IDL/ast/ast_argument.cpp
+++ b/TAO/TAO_IDL/ast/ast_argument.cpp
@@ -92,6 +92,9 @@ direction_to_string (AST_Argument::Direction d)
return 0;
}
+AST_Decl::NodeType const
+AST_Argument::NT = AST_Decl::NT_argument;
+
AST_Argument::AST_Argument (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_array.cpp b/TAO/TAO_IDL/ast/ast_array.cpp
index a474333473b..ccb87b660b1 100644
--- a/TAO/TAO_IDL/ast/ast_array.cpp
+++ b/TAO/TAO_IDL/ast/ast_array.cpp
@@ -82,6 +82,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// Constructor(s) and destructor.
+AST_Decl::NodeType const
+AST_Array::NT = AST_Decl::NT_array;
+
AST_Array::AST_Array (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_attribute.cpp b/TAO/TAO_IDL/ast/ast_attribute.cpp
index 26d770b0796..18eec60c143 100644
--- a/TAO/TAO_IDL/ast/ast_attribute.cpp
+++ b/TAO/TAO_IDL/ast/ast_attribute.cpp
@@ -79,6 +79,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "utl_err.h"
#include "global_extern.h"
+AST_Decl::NodeType const
+AST_Attribute::NT = AST_Decl::NT_attr;
+
// Constructor(s) and destructor.
AST_Attribute::AST_Attribute (void)
: COMMON_Base (),
diff --git a/TAO/TAO_IDL/ast/ast_component.cpp b/TAO/TAO_IDL/ast/ast_component.cpp
index 18ca9aaa8a4..058e020d279 100644
--- a/TAO/TAO_IDL/ast/ast_component.cpp
+++ b/TAO/TAO_IDL/ast/ast_component.cpp
@@ -14,6 +14,9 @@
#include "utl_err.h"
#include "global_extern.h"
+AST_Decl::NodeType const
+AST_Component::NT = AST_Decl::NT_component;
+
AST_Component::AST_Component (void)
: COMMON_Base (),
AST_Decl (),
@@ -206,267 +209,57 @@ AST_Component::ast_accept (ast_visitor *visitor)
AST_Provides *
AST_Component::fe_add_provides (AST_Provides *p)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (p, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- p,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, p->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- p,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (p);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (p,
- false,
- p->local_name ());
-
- return p;
+ return
+ AST_Provides::narrow_from_decl (
+ this->fe_add_ref_decl (p));
}
AST_Uses *
AST_Component::fe_add_uses (AST_Uses *u)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (u, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- u,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, u->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- u,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (u);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (u,
- false,
- u->local_name ());
-
- return u;
+ return
+ AST_Uses::narrow_from_decl (
+ this->fe_add_ref_decl (u));
}
AST_Publishes *
AST_Component::fe_add_publishes (AST_Publishes *p)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (p, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- p,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, p->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- p,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (p);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (p,
- false,
- p->local_name ());
-
- return p;
+ return
+ AST_Publishes::narrow_from_decl (
+ this->fe_add_ref_decl (p));
}
AST_Emits *
AST_Component::fe_add_emits (AST_Emits *e)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (e, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- e,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, e->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- e,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (e);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (e,
- false,
- e->local_name ());
-
- return e;
+ return
+ AST_Emits::narrow_from_decl (
+ this->fe_add_ref_decl (e));
}
AST_Consumes *
AST_Component::fe_add_consumes (AST_Consumes *c)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (c, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- c,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, c->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- c,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (c);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (c,
- false,
- c->local_name ());
-
- return c;
+ return
+ AST_Consumes::narrow_from_decl (
+ this->fe_add_ref_decl (c));
}
AST_Extended_Port *
AST_Component::fe_add_extended_port (AST_Extended_Port *p)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (p, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- p,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, p->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- p,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (p);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (p,
- false,
- p->local_name ());
-
- return p;
+ return
+ AST_Extended_Port::narrow_from_decl (
+ this->fe_add_ref_decl (p));
}
AST_Mirror_Port *
AST_Component::fe_add_mirror_port (AST_Mirror_Port *p)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (p, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- p,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, p->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- p,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (p);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (p,
- false,
- p->local_name ());
-
- return p;
+ return
+ AST_Mirror_Port::narrow_from_decl (
+ this->fe_add_ref_decl (p));
}
int
diff --git a/TAO/TAO_IDL/ast/ast_component_fwd.cpp b/TAO/TAO_IDL/ast/ast_component_fwd.cpp
index 60f5c773998..932c4348191 100644
--- a/TAO/TAO_IDL/ast/ast_component_fwd.cpp
+++ b/TAO/TAO_IDL/ast/ast_component_fwd.cpp
@@ -4,6 +4,9 @@
#include "ast_visitor.h"
#include "utl_identifier.h"
+AST_Decl::NodeType const
+AST_ComponentFwd::NT = AST_Decl::NT_component_fwd;
+
AST_ComponentFwd::AST_ComponentFwd (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_connector.cpp b/TAO/TAO_IDL/ast/ast_connector.cpp
index ba5d41de936..f2d6dc7a27d 100644
--- a/TAO/TAO_IDL/ast/ast_connector.cpp
+++ b/TAO/TAO_IDL/ast/ast_connector.cpp
@@ -7,6 +7,9 @@
#include "utl_err.h"
#include "global_extern.h"
+AST_Decl::NodeType const
+AST_Connector::NT = AST_Decl::NT_connector;
+
AST_Connector::AST_Connector (
UTL_ScopedName *n,
AST_Connector *base_connector)
diff --git a/TAO/TAO_IDL/ast/ast_constant.cpp b/TAO/TAO_IDL/ast/ast_constant.cpp
index 8ef4b604c41..b513dcefaf9 100644
--- a/TAO/TAO_IDL/ast/ast_constant.cpp
+++ b/TAO/TAO_IDL/ast/ast_constant.cpp
@@ -122,6 +122,9 @@ AST_Constant::exprtype_to_string (AST_Expression::ExprType et)
return 0;
}
+AST_Decl::NodeType const
+AST_Constant::NT = AST_Decl::NT_const;
+
// Constructor(s) and destructor.
// Default constructor.
diff --git a/TAO/TAO_IDL/ast/ast_consumes.cpp b/TAO/TAO_IDL/ast/ast_consumes.cpp
index 2e38ad8141d..61d164760f7 100644
--- a/TAO/TAO_IDL/ast/ast_consumes.cpp
+++ b/TAO/TAO_IDL/ast/ast_consumes.cpp
@@ -3,6 +3,9 @@
#include "ast_consumes.h"
#include "ast_visitor.h"
+AST_Decl::NodeType const
+AST_Consumes::NT = AST_Decl::NT_consumes;
+
AST_Consumes::AST_Consumes (UTL_ScopedName *n,
AST_Type *consumes_type)
: COMMON_Base (false,
diff --git a/TAO/TAO_IDL/ast/ast_emits.cpp b/TAO/TAO_IDL/ast/ast_emits.cpp
index 531d7441fdc..69450853908 100644
--- a/TAO/TAO_IDL/ast/ast_emits.cpp
+++ b/TAO/TAO_IDL/ast/ast_emits.cpp
@@ -3,6 +3,9 @@
#include "ast_emits.h"
#include "ast_visitor.h"
+AST_Decl::NodeType const
+AST_Emits::NT = AST_Decl::NT_emits;
+
AST_Emits::AST_Emits (UTL_ScopedName *n,
AST_Type *emits_type)
: COMMON_Base (),
diff --git a/TAO/TAO_IDL/ast/ast_enum.cpp b/TAO/TAO_IDL/ast/ast_enum.cpp
index a26070c3392..e32d768c503 100644
--- a/TAO/TAO_IDL/ast/ast_enum.cpp
+++ b/TAO/TAO_IDL/ast/ast_enum.cpp
@@ -72,6 +72,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "utl_err.h"
#include "utl_indenter.h"
+AST_Decl::NodeType const
+AST_Enum::NT = AST_Decl::NT_enum;
+
AST_Enum::AST_Enum (void)
: COMMON_Base (),
AST_Decl (),
@@ -245,7 +248,6 @@ AST_Enum::compute_member_count (void)
return 0;
}
-// Add an AST_EnumVal node to this scope.
AST_EnumVal *
AST_Enum::fe_add_enum_val (AST_EnumVal *t)
{
diff --git a/TAO/TAO_IDL/ast/ast_enum_val.cpp b/TAO/TAO_IDL/ast/ast_enum_val.cpp
index a43b918f9df..3f3aba24512 100644
--- a/TAO/TAO_IDL/ast/ast_enum_val.cpp
+++ b/TAO/TAO_IDL/ast/ast_enum_val.cpp
@@ -71,6 +71,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ast_enum_val.h"
#include "ast_visitor.h"
+AST_Decl::NodeType const
+AST_EnumVal::NT = AST_Decl::NT_enum_val;
+
AST_EnumVal::AST_EnumVal (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_eventtype.cpp b/TAO/TAO_IDL/ast/ast_eventtype.cpp
index 5a3fce42284..1b46cebd000 100644
--- a/TAO/TAO_IDL/ast/ast_eventtype.cpp
+++ b/TAO/TAO_IDL/ast/ast_eventtype.cpp
@@ -7,6 +7,9 @@
#include "utl_indenter.h"
#include "global_extern.h"
+AST_Decl::NodeType const
+AST_EventType::NT = AST_Decl::NT_eventtype;
+
AST_EventType::AST_EventType (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_eventtype_fwd.cpp b/TAO/TAO_IDL/ast/ast_eventtype_fwd.cpp
index ae987abfe2e..97928ede177 100644
--- a/TAO/TAO_IDL/ast/ast_eventtype_fwd.cpp
+++ b/TAO/TAO_IDL/ast/ast_eventtype_fwd.cpp
@@ -5,6 +5,9 @@
#include "ast_visitor.h"
#include "utl_identifier.h"
+AST_Decl::NodeType const
+AST_EventTypeFwd::NT = AST_Decl::NT_eventtype_fwd;
+
AST_EventTypeFwd::AST_EventTypeFwd (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_exception.cpp b/TAO/TAO_IDL/ast/ast_exception.cpp
index f322dc53962..ca6114ac195 100644
--- a/TAO/TAO_IDL/ast/ast_exception.cpp
+++ b/TAO/TAO_IDL/ast/ast_exception.cpp
@@ -80,6 +80,9 @@ 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 (),
@@ -167,253 +170,6 @@ 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)
@@ -438,7 +194,5 @@ AST_Exception::destroy (void)
this->AST_Structure::destroy ();
}
-
-
IMPL_NARROW_FROM_DECL(AST_Exception)
IMPL_NARROW_FROM_SCOPE(AST_Exception)
diff --git a/TAO/TAO_IDL/ast/ast_extended_port.cpp b/TAO/TAO_IDL/ast/ast_extended_port.cpp
index f2eef3975f3..633f3aecc37 100644
--- a/TAO/TAO_IDL/ast/ast_extended_port.cpp
+++ b/TAO/TAO_IDL/ast/ast_extended_port.cpp
@@ -7,6 +7,9 @@
#include "utl_indenter.h"
#include "global_extern.h"
+AST_Decl::NodeType const
+AST_Extended_Port::NT = AST_Decl::NT_ext_port;
+
AST_Extended_Port::AST_Extended_Port (
UTL_ScopedName *n,
AST_PortType *porttype_ref)
diff --git a/TAO/TAO_IDL/ast/ast_factory.cpp b/TAO/TAO_IDL/ast/ast_factory.cpp
index 7abb347a4d4..4fc921a7c4e 100644
--- a/TAO/TAO_IDL/ast/ast_factory.cpp
+++ b/TAO/TAO_IDL/ast/ast_factory.cpp
@@ -79,6 +79,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "utl_exceptlist.h"
#include "utl_namelist.h"
+AST_Decl::NodeType const
+AST_Factory::NT = AST_Decl::NT_factory;
+
AST_Factory::AST_Factory (void)
: COMMON_Base (),
AST_Decl (),
@@ -215,51 +218,12 @@ AST_Factory::compute_argument_attr (void)
return 0;
}
-// Add this AST_Argument node (an factory argument declaration)
-// to this scope.
AST_Argument *
AST_Factory::fe_add_argument (AST_Argument *t)
{
- AST_Decl *d = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = lookup_by_name_local (t->local_name(), 0)) != 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 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;
+ return
+ AST_Argument::narrow_from_decl (
+ this->fe_add_ref_decl (t));
}
UTL_NameList *
diff --git a/TAO/TAO_IDL/ast/ast_field.cpp b/TAO/TAO_IDL/ast/ast_field.cpp
index 426feddaaf8..2e399693659 100644
--- a/TAO/TAO_IDL/ast/ast_field.cpp
+++ b/TAO/TAO_IDL/ast/ast_field.cpp
@@ -83,6 +83,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "global_extern.h"
+AST_Decl::NodeType const
+AST_Field::NT = AST_Decl::NT_field;
+
AST_Field::AST_Field (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_finder.cpp b/TAO/TAO_IDL/ast/ast_finder.cpp
index c85626c5c67..972b21f5d4b 100644
--- a/TAO/TAO_IDL/ast/ast_finder.cpp
+++ b/TAO/TAO_IDL/ast/ast_finder.cpp
@@ -5,6 +5,9 @@
#include "utl_identifier.h"
+AST_Decl::NodeType const
+AST_Finder::NT = AST_Decl::NT_finder;
+
AST_Finder::AST_Finder (UTL_ScopedName *n)
: COMMON_Base (true,
false), //@@ Always local, never abstract
diff --git a/TAO/TAO_IDL/ast/ast_home.cpp b/TAO/TAO_IDL/ast/ast_home.cpp
index 83e2c631ad1..bdb945c8d18 100644
--- a/TAO/TAO_IDL/ast/ast_home.cpp
+++ b/TAO/TAO_IDL/ast/ast_home.cpp
@@ -13,6 +13,9 @@
#include "utl_err.h"
#include "global_extern.h"
+AST_Decl::NodeType const
+AST_Home::NT = AST_Decl::NT_home;
+
AST_Home::AST_Home (void)
: COMMON_Base (),
AST_Decl (),
@@ -264,109 +267,17 @@ AST_Home::ast_accept (ast_visitor *visitor)
AST_Factory *
AST_Home::fe_add_factory (AST_Factory *f)
{
- AST_Decl *d = 0;
-
- // Can't add to interface which was not yet defined.
- if (!this->is_defined ())
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- f);
- return 0;
- }
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (f, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- f,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, f->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- f,
- this,
- d);
- return 0;
- }
-
- if (f->has_ancestor (d))
- {
- idl_global->err ()->redefinition_in_scope (f,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (f);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (f,
- false,
- f->local_name ());
-
- return f;
+ return
+ AST_Factory::narrow_from_decl (
+ this->fe_add_decl (f));
}
AST_Finder *
AST_Home::fe_add_finder (AST_Finder *f)
{
- AST_Decl *d = 0;
-
- // Can't add to interface which was not yet defined.
- if (!this->is_defined ())
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- f);
- return 0;
- }
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (f, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- f,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, f->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- f,
- this,
- d);
- return 0;
- }
-
- if (f->has_ancestor (d))
- {
- idl_global->err ()->redefinition_in_scope (f,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (f);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (f,
- false,
- f->local_name ());
-
- return f;
+ return
+ AST_Finder::narrow_from_decl (
+ this->fe_add_decl (f));
}
// Narrowing.
diff --git a/TAO/TAO_IDL/ast/ast_interface.cpp b/TAO/TAO_IDL/ast/ast_interface.cpp
index 62a51dabed1..224204419e8 100644
--- a/TAO/TAO_IDL/ast/ast_interface.cpp
+++ b/TAO/TAO_IDL/ast/ast_interface.cpp
@@ -100,6 +100,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ace/streams.h"
+AST_Decl::NodeType const
+AST_Interface::NT = AST_Decl::NT_interface;
+
AST_Interface::AST_Interface (void)
: COMMON_Base (),
AST_Decl (),
@@ -188,646 +191,72 @@ AST_Interface::is_defined (void)
: this->fwd_decl_->is_defined ());
}
-// Add an AST_Constant node (a constant declaration) to this scope.
AST_Constant *
AST_Interface::fe_add_constant (AST_Constant *t)
{
- AST_Decl *d = 0;
-
- // Can't add to interface which was not yet defined
- if (!this->is_defined ())
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- t);
- return 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 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;
+ return
+ AST_Constant::narrow_from_decl (
+ this->fe_add_decl (t));
}
-// Add an AST_Exception node (an exception declaration) to this scope.
AST_Exception *
AST_Interface::fe_add_exception (AST_Exception *t)
{
- AST_Decl *d = 0;
-
- // Can't add to interface which was not yet defined
- if (!this->is_defined ())
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- t);
- return 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 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;
+ return
+ AST_Exception::narrow_from_decl (
+ this->fe_add_decl (t));
}
-// Add an AST_Attribute node (an attribute declaration) to this scope.
AST_Attribute *
AST_Interface::fe_add_attribute (AST_Attribute *t)
{
- AST_Decl *d = 0;
-
- // Can't add to interface which was not yet defined.
- if (!this->is_defined ())
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- t);
- return 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;
+ return
+ AST_Attribute::narrow_from_decl (
+ this->fe_add_decl (t));
}
-// Add this AST_Field node (a field declaration) to this scope
-// (only for valuetypes).
-AST_Field *
-AST_Interface::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 (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 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 ());
- }
-
- return t;
-}
-
-// Add an AST_Operation node (an operation declaration) to this scope.
AST_Operation *
AST_Interface::fe_add_operation (AST_Operation *t)
{
- AST_Decl *d = 0;
-
- // Can't add to interface which was not yet defined.
- if (!this->is_defined ())
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- t);
- return 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;
- }
- }
- else if ((d = this->look_in_inherited (t->name (), false)) != 0)
- {
- if (d->node_type () == AST_Decl::NT_op)
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- t,
- this,
- 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;
+ return
+ AST_Operation::narrow_from_decl (
+ this->fe_add_decl (t));
}
-// Add an AST_Structure (a struct declaration) to this scope.
AST_Structure *
AST_Interface::fe_add_structure (AST_Structure *t)
{
- AST_Decl *predef = 0;
- AST_StructureFwd *fwd = 0;
-
- if ((predef = this->lookup_for_add (t, false)) != 0)
- {
- // Treat fwd declared interfaces specially
- if (predef->node_type () == AST_Decl::NT_struct_fwd)
- {
- fwd = AST_StructureFwd::narrow_from_decl (predef);
-
- if (fwd == 0)
- {
- return 0;
- }
-
- // Forward declared and not defined yet.
- if (!fwd->is_defined ())
- {
- if (fwd->defined_in () == this)
- {
- fwd->set_full_definition (t);
- }
- else
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
- fwd,
- t,
- this);
-
- return 0;
- }
- }
- // OK, not illegal redef of forward declaration. Now check whether.
- // it has been referenced already.
- else if (this->referenced (predef, t->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
- }
- else if (!can_be_redefined (predef))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (referenced (predef, t->local_name ()) && !t->is_defined ())
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- 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;
+ return this->fe_add_full_struct_type (t);
}
-// Add this AST_StructureFwd node (a forward declaration of an IDL
-// struct) to this scope.
AST_StructureFwd *
AST_Interface::fe_add_structure_fwd (AST_StructureFwd *t)
{
- AST_Decl *d = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (t, false)) != 0)
- {
- AST_Decl::NodeType nt = d->node_type ();
-
- // There used to be another check here ANDed with the one below:
- // d->defined_in () == this. But lookup_for_add() calls only
- // lookup_by_name_local(), which does not bump up the scope.
- if (nt == AST_Decl::NT_struct_fwd)
- {
- // It's legal to forward declare something more than once,
- // but we need only one entry in the scope for lookup.
- AST_StructureFwd *fd = AST_StructureFwd::narrow_from_decl (d);
- t->destroy ();
- delete t;
- t = 0;
- return fd;
- }
- else if (nt == AST_Decl::NT_struct)
- {
- AST_Structure *s = AST_Structure::narrow_from_decl (d);
- t->set_full_definition (s);
-
- // Must check later that all struct and union forward declarations
- // are defined in the same IDL file.
- AST_record_fwd_decl (t);
- }
- else
- {
- 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;
- }
- }
- }
-
- // 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 ());
-
- // Must check later that all struct and union forward declarations
- // are defined in the same IDL file.
- AST_record_fwd_decl (t);
- return t;
+ return this->fe_add_fwd_struct_type (t);
}
-// Add an AST_Enum node (an enum declaration) to this scope.
AST_Enum *
AST_Interface::fe_add_enum (AST_Enum *t)
{
- AST_Decl *d = 0;
-
- // Can't add to interface which was not yet defined.
- if (!this->is_defined ())
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- t);
- return 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 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;
+ return
+ AST_Enum::narrow_from_decl (
+ this->fe_add_decl (t));
}
-// Add an AST_Union (a union declaration) to this scope.
AST_Union *
AST_Interface::fe_add_union (AST_Union *t)
{
- AST_Decl *predef = 0;
- AST_UnionFwd *fwd = 0;
-
- if ((predef = this->lookup_for_add (t, false)) != 0)
- {
- // Treat fwd declared interfaces specially
- if (predef->node_type () == AST_Decl::NT_union_fwd)
- {
- fwd = AST_UnionFwd::narrow_from_decl (predef);
-
- if (fwd == 0)
- {
- return 0;
- }
-
- // Forward declared and not defined yet.
- if (!fwd->is_defined ())
- {
- if (fwd->defined_in () == this)
- {
- fwd->set_full_definition (t);
- }
- else
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
- fwd,
- t,
- this);
-
- return 0;
- }
- }
- // OK, not illegal redef of forward declaration. Now check whether.
- // it has been referenced already.
- else if (this->referenced (predef, t->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
- }
- else if (!can_be_redefined (predef))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (referenced (predef, t->local_name ()) && !t->is_defined ())
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- 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;
+ return
+ AST_Union::narrow_from_decl (
+ this->fe_add_full_struct_type (t));
}
-// Add this AST_UnionFwd node (a forward declaration of an IDL
-// union) to this scope.
AST_UnionFwd *
AST_Interface::fe_add_union_fwd (AST_UnionFwd *t)
{
- AST_Decl *d = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (t, false)) != 0)
- {
- AST_Decl::NodeType nt = d->node_type ();
-
- // There used to be another check here ANDed with the one below:
- // d->defined_in () == this. But lookup_for_add() calls only
- // lookup_by_name_local(), which does not bump up the scope.
- if (nt == AST_Decl::NT_union_fwd)
- {
- // It's legal to forward declare something more than once,
- // but we need only one entry in the scope for lookup.
- AST_UnionFwd *fd = AST_UnionFwd::narrow_from_decl (d);
- t->destroy ();
- delete t;
- t = 0;
- return fd;
- }
- else if (nt == AST_Decl::NT_union)
- {
- AST_Union *s = AST_Union::narrow_from_decl (d);
- t->set_full_definition (s);
-
- // Must check later that all struct and union forward declarations
- // are defined in the same IDL file.
- AST_record_fwd_decl (t);
- }
- else
- {
- 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;
- }
- }
- }
-
- // 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 ());
-
- // Must check later that all struct and union forward declarations
- // are defined in the same IDL file.
- AST_record_fwd_decl (t);
- return t;
+ return
+ AST_UnionFwd::narrow_from_decl (
+ this->fe_add_fwd_struct_type (t));
}
// Add an AST_EnumVal node (an enumerator) to this scope.
@@ -837,177 +266,26 @@ AST_Interface::fe_add_union_fwd (AST_UnionFwd *t)
AST_EnumVal *
AST_Interface::fe_add_enum_val (AST_EnumVal *t)
{
- AST_Decl *d = 0;
-
- // Can't add to interface which was not yet defined.
- if (!this->is_defined ())
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- t);
- return 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 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;
+ return
+ AST_EnumVal::narrow_from_decl (
+ this->fe_add_decl (t));
}
// Add an AST_Typedef (a typedef) to the current scope.
AST_Typedef *
AST_Interface::fe_add_typedef (AST_Typedef *t)
{
- AST_Decl *d = 0;
-
- // Can't add to interface which was not yet defined.
- if (!this->is_defined ())
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- t);
- return 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 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 *bt = t->base_type ();
- UTL_ScopedName *mru = bt->last_referenced_as ();
-
- if (mru != 0)
- {
- this->add_to_referenced (
- bt,
- false,
- mru->first_component ()
- );
- }
-
- return t;
+ return
+ AST_Typedef::narrow_from_decl (
+ this->fe_add_ref_decl (t));
}
-// Add an AST_Native (a native declaration) to this scope.
AST_Native *
AST_Interface::fe_add_native (AST_Native *t)
{
- AST_Decl *d = 0;
-
- // Can't add to interface which was not yet defined.
- if (!this->is_defined ())
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- t);
- return 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 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;
+ return
+ AST_Native::narrow_from_decl (
+ this->fe_add_decl (t));
}
// Dump this AST_Interface node to the ostream o.
diff --git a/TAO/TAO_IDL/ast/ast_interface_fwd.cpp b/TAO/TAO_IDL/ast/ast_interface_fwd.cpp
index eccce8b48a0..b5b57c5eb0a 100644
--- a/TAO/TAO_IDL/ast/ast_interface_fwd.cpp
+++ b/TAO/TAO_IDL/ast/ast_interface_fwd.cpp
@@ -75,6 +75,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ast_visitor.h"
#include "utl_identifier.h"
+AST_Decl::NodeType const
+AST_InterfaceFwd::NT = AST_Decl::NT_interface_fwd;
+
AST_InterfaceFwd::AST_InterfaceFwd (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_mirror_port.cpp b/TAO/TAO_IDL/ast/ast_mirror_port.cpp
index ce79e976135..fa5aa5f2922 100644
--- a/TAO/TAO_IDL/ast/ast_mirror_port.cpp
+++ b/TAO/TAO_IDL/ast/ast_mirror_port.cpp
@@ -8,6 +8,9 @@
#include "utl_indenter.h"
#include "global_extern.h"
+AST_Decl::NodeType const
+AST_Mirror_Port::NT = AST_Decl::NT_mirror_port;
+
AST_Mirror_Port::AST_Mirror_Port (
UTL_ScopedName *n,
AST_PortType *porttype_ref)
diff --git a/TAO/TAO_IDL/ast/ast_module.cpp b/TAO/TAO_IDL/ast/ast_module.cpp
index 85c267ef02f..9f375555313 100644
--- a/TAO/TAO_IDL/ast/ast_module.cpp
+++ b/TAO/TAO_IDL/ast/ast_module.cpp
@@ -101,6 +101,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "global_extern.h"
#include "nr_extern.h"
+AST_Decl::NodeType const
+AST_Module::NT = AST_Decl::NT_module;
+
AST_Module::AST_Module (void)
: AST_Decl (),
UTL_Scope (),
@@ -120,55 +123,14 @@ AST_Module::~AST_Module (void)
{
}
-// Add this AST_PredefinedType node (a predefined type declaration) to
-// this scope.
-
AST_PredefinedType *
AST_Module::fe_add_predefined_type (AST_PredefinedType *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 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;
+ return
+ AST_PredefinedType::narrow_from_decl (
+ this->fe_add_decl (t));
}
-// Add this AST_Module node (a module declaration) to this scope.
AST_Module *
AST_Module::fe_add_module (AST_Module *t)
{
@@ -232,23 +194,6 @@ AST_Module::fe_add_module (AST_Module *t)
{
d->prefix (const_cast<char *> (this_prefix));
}
- // (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.
- /*
- else
- {
- if (ACE_OS::strcmp (this_prefix, prev_prefix) != 0)
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_PREFIX_CONFLICT,
- this,
- d);
-
- return 0;
- }
- }
- */
}
}
@@ -268,1477 +213,179 @@ AST_Module::fe_add_module (AST_Module *t)
}
AST_Template_Module_Inst *
-AST_Module::fe_add_template_module_inst (AST_Template_Module_Inst *m)
+AST_Module::fe_add_template_module_inst (AST_Template_Module_Inst *t)
{
- AST_Decl *d = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (m, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- m,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, m->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- m,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (m);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (m,
- false,
- m->local_name ());
-
- AST_Type *ft = m->field_type ();
- UTL_ScopedName *mru = ft->last_referenced_as ();
-
- if (mru != 0)
- {
- this->add_to_referenced (ft,
- false,
- mru->first_component ());
- }
-
- return m;
+ return
+ AST_Template_Module_Inst::narrow_from_decl (
+ this->fe_add_ref_decl (t));
}
-// Add this AST_Interface node (an interface declaration) to this scope.
AST_Interface *
AST_Module::fe_add_interface (AST_Interface *t)
{
- if (t->redef_clash ())
- {
- return 0;
- }
-
- AST_Decl *predef = 0;
- AST_Interface *fwd = 0;
-
- // Already defined?
- if ((predef = this->lookup_for_add (t, false)) != 0)
- {
- // Treat fwd declared interfaces specially
- if (predef->node_type () == AST_Decl::NT_interface)
- {
- fwd = AST_Interface::narrow_from_decl (predef);
-
- if (fwd == 0)
- {
- return 0;
- }
-
- // Forward declared and not defined yet.
- if (!fwd->is_defined ())
- {
- if (fwd->defined_in () != this)
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
- fwd,
- t,
- this);
-
- return 0;
- }
- }
- // OK, not illegal redef of forward declaration. Now check whether.
- // it has been referenced already.
- else if (this->referenced (predef, t->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
-
- }
- else if (!can_be_redefined (predef))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (referenced (predef, t->local_name ()) && !t->is_defined ())
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (t->has_ancestor (predef))
- {
- idl_global->err ()->redefinition_in_scope (t,
- predef);
-
- return 0;
- }
- }
-
- // Add it to scope
- this->add_to_scope (t);
-
- // We do this for interfaces, valuetypes and components in
- // a different place than we do for structs and unions,
- // since fwd declared structs and unions must be defined in
- // the same translation unit.
- AST_InterfaceFwd *fd = t->fwd_decl ();
-
- if (0 != fd)
- {
- fd->set_as_defined ();
- }
-
- // Add it to set of locally referenced symbols
- this->add_to_referenced (t,
- false,
- t->local_name ());
- return t;
+ return
+ this->fe_add_full_intf_decl<AST_Interface> (t);
}
-
-// Add this AST_ValueBox node (a value type declaration) to this scope.
AST_ValueBox *
AST_Module::fe_add_valuebox (AST_ValueBox *t)
{
- AST_Decl *predef = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((predef = this->lookup_for_add (t, false)) != 0)
- {
- if (!can_be_redefined (predef))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (referenced (predef, t->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (t->has_ancestor (predef))
- {
- idl_global->err ()->redefinition_in_scope (t,
- predef);
-
- 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;
+ return
+ AST_ValueBox::narrow_from_decl (
+ this->fe_add_decl (t));
}
-
-// Add this AST_ValueType node (a value type declaration) to this scope.
AST_ValueType *
AST_Module::fe_add_valuetype (AST_ValueType *t)
{
- if (t->redef_clash ())
- {
- return 0;
- }
-
- AST_Decl *predef = 0;
- AST_ValueType *fwd = 0;
-
- // Already defined?
- if ((predef = this->lookup_for_add (t, false)) != 0)
- {
- // Treat fwd declared interfaces specially
- if (predef->node_type () == AST_Decl::NT_valuetype)
- {
- fwd = AST_ValueType::narrow_from_decl (predef);
-
- if (fwd == 0)
- {
- return 0;
- }
-
- // Forward declared and not defined yet.
- if (!fwd->is_defined ())
- {
- if (fwd->defined_in () != this)
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
- fwd,
- t,
- this);
-
- return 0;
- }
- }
- // OK, not illegal redef of forward declaration. Now check whether.
- // it has been referenced already.
- else if (this->referenced (predef, t->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
- }
- else if (!can_be_redefined (predef))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (referenced (predef, t->local_name ()) && !t->is_defined ())
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (t->has_ancestor (predef))
- {
- idl_global->err ()->redefinition_in_scope (t,
- predef);
-
- return 0;
- }
- }
-
- // Add it to scope
- this->add_to_scope (t);
-
- // We do this for interfaces, valuetypes and components in
- // a different place than we do for structs and unions,
- // since fwd declared structs and unions must be defined in
- // the same translation unit.
- AST_InterfaceFwd *fd = t->fwd_decl ();
-
- if (0 != fd)
- {
- fd->set_as_defined ();
- }
-
- // Add it to set of locally referenced symbols
- this->add_to_referenced (t,
- false,
- t->local_name ());
- return t;
+ return
+ this->fe_add_full_intf_decl<AST_ValueType> (t);
}
-// Add this AST_EventType node (an event type declaration) to this scope.
AST_EventType *
AST_Module::fe_add_eventtype (AST_EventType *t)
{
- if (t->redef_clash ())
- {
- return 0;
- }
-
- AST_Decl *predef = 0;
- AST_EventType *fwd = 0;
-
- // Already defined?
- if ((predef = this->lookup_for_add (t, false)) != 0)
- {
- // Treat fwd declared interfaces specially
- if (predef->node_type () == AST_Decl::NT_eventtype)
- {
- fwd = AST_EventType::narrow_from_decl (predef);
-
- if (fwd == 0)
- {
- return 0;
- }
-
- // Forward declared and not defined yet.
- if (!fwd->is_defined ())
- {
- if (fwd->defined_in () != this)
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
- fwd,
- t,
- this);
-
- return 0;
- }
- }
- // OK, not illegal redef of forward declaration. Now check whether.
- // it has been referenced already.
- else if (this->referenced (predef, t->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
- }
- else if (!can_be_redefined (predef))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (referenced (predef, t->local_name ()) && !t->is_defined ())
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (t->has_ancestor (predef))
- {
- idl_global->err ()->redefinition_in_scope (t,
- predef);
-
- 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;
+ return
+ this->fe_add_full_intf_decl<AST_EventType> (t);
}
-// Add this AST_Component node (a value type declaration) to this scope.
AST_Component *
AST_Module::fe_add_component (AST_Component *t)
{
- if (t->redef_clash ())
- {
- return 0;
- }
-
- AST_Decl *predef = 0;
- AST_Component *fwd = 0;
-
- // Already defined?
- if ((predef = this->lookup_for_add (t, false)) != 0)
- {
- // Treat fwd declared interfaces specially
- if (predef->node_type () == AST_Decl::NT_component)
- {
- fwd = AST_Component::narrow_from_decl (predef);
-
- if (fwd == 0)
- {
- return 0;
- }
-
- // Forward declared and not defined yet.
- if (!fwd->is_defined ())
- {
- if (fwd->defined_in () != this)
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
- fwd,
- t,
- this);
-
- return 0;
- }
- }
- // OK, not illegal redef of forward declaration. Now check whether.
- // it has been referenced already.
- else if (this->referenced (predef, t->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
- }
- else if (!can_be_redefined (predef))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (referenced (predef, t->local_name ()) && !t->is_defined ())
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (t->has_ancestor (predef))
- {
- idl_global->err ()->redefinition_in_scope (t,
- predef);
-
- return 0;
- }
- }
-
- // Add it to scope
- this->add_to_scope (t);
-
- // We do this for interfaces, valuetypes and components in
- // a different place than we do for structs and unions,
- // since fwd declared structs and unions must be defined in
- // the same translation unit.
- AST_InterfaceFwd *fd = t->fwd_decl ();
-
- if (0 != fd)
- {
- fd->set_as_defined ();
- }
-
- // Add it to set of locally referenced symbols
- this->add_to_referenced (t,
- false,
- t->local_name ());
- return t;
+ return
+ this->fe_add_full_intf_decl<AST_Component> (t);
}
AST_Connector *
AST_Module::fe_add_connector (AST_Connector *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 scope.
- this->add_to_scope (t);
-
- return t;
+ return
+ AST_Connector::narrow_from_decl (
+ this->fe_add_decl (t));
}
-// Add this AST_Home node (a value type declaration) to this scope.
AST_Home *
AST_Module::fe_add_home (AST_Home *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 scope.
- this->add_to_scope (t);
-
- // The home's local name is not added to the referenced list, since
- // the name will later be mangled to allow a creation of an
- // equivalent interface with the original name.
-
- return t;
+ return
+ AST_Home::narrow_from_decl (
+ this->fe_add_decl (t));
}
-// Add this AST_InterfaceFwd node (a forward declaration of an IDL
-// interface) to this scope.
AST_InterfaceFwd *
-AST_Module::fe_add_interface_fwd (AST_InterfaceFwd *i)
+AST_Module::fe_add_interface_fwd (AST_InterfaceFwd *t)
{
- AST_Decl *d = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (i, false)) != 0)
- {
- AST_Decl::NodeType nt = d->node_type ();
-
- // There used to be another check here ANDed with the one below:
- // d->defined_in () == this. But lookup_for_add calls only
- // lookup_by_name_local(), which does not bump up the scope,
- // and look_in_previous() for modules. If look_in_previous()
- // finds something, the scopes will NOT be the same pointer
- // value, but the result is what we want.
- if (nt == AST_Decl::NT_interface)
- {
- AST_Interface *itf = AST_Interface::narrow_from_decl (d);
-
- if (itf == 0)
- {
- return 0;
- }
-
- // 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
- // get destroyed twice.
- if (itf->is_defined ())
- {
- if (!i->is_defined ())
- {
- AST_Interface *prev_fd = i->full_definition ();
- prev_fd->destroy ();
- // No need to delete prev_fd, the call to
- // set_full_definition() below will do it.
- }
-
- i->set_full_definition (itf);
- i->set_as_defined ();
- }
-
-// return i;
- }
-
- if (!can_be_redefined (d)) {
-
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- i,
- this,
- d);
- return 0;
- }
-
- // No need to call referenced() for forward declared interafces,
- // they can be redeclared after referencing.
-
- if (i->has_ancestor (d))
- {
- idl_global->err ()->redefinition_in_scope (i,
- d);
- return 0;
- }
- }
-
- // Add it to scope
- this->add_to_scope (i);
-
- // Add it to set of locally referenced symbols
- this->add_to_referenced (i,
- false,
- i->local_name ());
-
- return i;
+ return
+ this->fe_add_fwd_intf_decl<AST_Interface> (t);
}
-// Add this AST_ValueTypeFwd node (a forward declaration of an IDL
-// value type) to this scope.
AST_ValueTypeFwd *
-AST_Module::fe_add_valuetype_fwd (AST_ValueTypeFwd *v)
+AST_Module::fe_add_valuetype_fwd (AST_ValueTypeFwd *t)
{
- AST_Decl *d = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (v, false)) != 0)
- {
- AST_Decl::NodeType nt = d->node_type ();
-
- // There used to be another check here ANDed with the one below:
- // d->defined_in () == this. But lookup_for_add calls only
- // lookup_by_name_local(), which does not bump up the scope,
- // and look_in_previous() for modules. If look_in_previous()
- // finds something, the scopes will NOT be the same pointer
- // value, but the result is what we want.
- if (nt == AST_Decl::NT_valuetype)
- {
- AST_ValueType *vtf = AST_ValueType::narrow_from_decl (d);
-
- if (vtf == 0)
- {
- return 0;
- }
-
-// return v;
- }
-
- if (!can_be_redefined (d)) {
-
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- v,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, v->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- v,
- this,
- d);
- return 0;
- }
-
- if (v->has_ancestor (d))
- {
- idl_global->err ()->redefinition_in_scope (v,
- d);
- return 0;
- }
- }
-
- // Add it to scope
- this->add_to_scope (v);
-
- // Add it to set of locally referenced symbols
- this->add_to_referenced (v,
- false,
- v->local_name ());
-
- return v;
+ return
+ this->fe_add_fwd_intf_decl<AST_ValueType> (t);
}
-// Add this AST_EventTypeFwd node (a forward declaration of an IDL
-// event type) to this scope.
AST_EventTypeFwd *
-AST_Module::fe_add_eventtype_fwd (AST_EventTypeFwd *v)
+AST_Module::fe_add_eventtype_fwd (AST_EventTypeFwd *t)
{
- AST_Decl *d = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (v, false)) != 0)
- {
- AST_Decl::NodeType nt = d->node_type ();
-
- // There used to be another check here ANDed with the one below:
- // d->defined_in () == this. But lookup_for_add calls only
- // lookup_by_name_local(), which does not bump up the scope,
- // and look_in_previous() for modules. If look_in_previous()
- // finds something, the scopes will NOT be the same pointer
- // value, but the result is what we want.
- if (nt == AST_Decl::NT_eventtype)
- {
- AST_EventType *vtf = AST_EventType::narrow_from_decl (d);
-
- if (vtf == 0)
- {
- return 0;
- }
-
-// return v;
- }
-
- if (!can_be_redefined (d)) {
-
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- v,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, v->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- v,
- this,
- d);
- return 0;
- }
-
- if (v->has_ancestor (d))
- {
- idl_global->err ()->redefinition_in_scope (v,
- d);
- return 0;
- }
- }
-
- // Add it to scope
- this->add_to_scope (v);
-
- // Add it to set of locally referenced symbols
- this->add_to_referenced (v,
- false,
- v->local_name ());
-
- return v;
+ return
+ this->fe_add_fwd_intf_decl<AST_EventType> (t);
}
-// Add this AST_ComponentFwd node (a forward declaration of an IDL
-// value type) to this scope.
AST_ComponentFwd *
-AST_Module::fe_add_component_fwd (AST_ComponentFwd *c)
+AST_Module::fe_add_component_fwd (AST_ComponentFwd *t)
{
- AST_Decl *d = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (c, false)) != 0)
- {
- AST_Decl::NodeType nt = d->node_type ();
-
- // There used to be another check here ANDed with the one below:
- // d->defined_in () == this. But lookup_for_add calls only
- // lookup_by_name_local(), which does not bump up the scope,
- // and look_in_previous() for modules. If look_in_previous()
- // finds something, the scopes will NOT be the same pointer
- // value, but the result is what we want.
- if (nt == AST_Decl::NT_component)
- {
- AST_Component *cf = AST_Component::narrow_from_decl (d);
-
- if (cf == 0)
- {
- return 0;
- }
-
-// return c;
- }
-
- if (!can_be_redefined (d)) {
-
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- c,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, c->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- c,
- this,
- d);
- return 0;
- }
-
- if (c->has_ancestor (d))
- {
- idl_global->err ()->redefinition_in_scope (c,
- d);
- return 0;
- }
- }
-
- // Add it to scope
- this->add_to_scope (c);
-
- // Add it to set of locally referenced symbols
- this->add_to_referenced (c,
- false,
- c->local_name ());
-
- return c;
+ return
+ this->fe_add_fwd_intf_decl<AST_Component> (t);
}
-// Add this AST_Constant node (a constant declaration) to this scope.
AST_Constant *
AST_Module::fe_add_constant (AST_Constant *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 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;
+ return
+ AST_Constant::narrow_from_decl (
+ this->fe_add_decl (t));
}
-// Add this AST_Exception node (an exception declaration) to this scope
AST_Exception *
AST_Module::fe_add_exception (AST_Exception *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 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;
+ return
+ AST_Exception::narrow_from_decl (
+ this->fe_add_decl (t));
}
-// Add this AST_Union node (a union declaration) to this scope
AST_Union *
AST_Module::fe_add_union (AST_Union *t)
{
- AST_UnionFwd *fwd = 0;
- AST_Decl *predef = this->lookup_for_add (t, false);
-
- if (predef != 0)
- {
- // Treat fwd declared interfaces specially
- if (predef->node_type () == AST_Decl::NT_union_fwd)
- {
- fwd = AST_UnionFwd::narrow_from_decl (predef);
-
- if (fwd == 0)
- {
- return 0;
- }
-
- // Forward declared and not defined yet.
- if (!fwd->is_defined ())
- {
- UTL_Scope *s = fwd->defined_in ();
- UTL_ScopedName *sn = ScopeAsDecl (s)->name ();
-
- if (fwd->defined_in () == this
- || sn->compare (this->name ()) == 0)
- {
- fwd->set_full_definition (t);
- }
- else
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
- fwd,
- t,
- this);
-
- return 0;
- }
- }
- // OK, not illegal redef of forward declaration. Now check whether.
- // it has been referenced already.
- else if (this->referenced (predef, t->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
- }
- else if (!can_be_redefined (predef))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (referenced (predef, t->local_name ()) && !t->is_defined ())
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- 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;
+ return
+ AST_Union::narrow_from_decl (
+ this->fe_add_full_struct_type (t));
}
-// Add this AST_UnionFwd node (a forward declaration of an IDL
-// union) to this scope.
AST_UnionFwd *
AST_Module::fe_add_union_fwd (AST_UnionFwd *t)
{
- AST_Decl *d = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (t, false)) != 0)
- {
- AST_Decl::NodeType nt = d->node_type ();
-
- if (nt == AST_Decl::NT_union_fwd)
- {
- AST_UnionFwd *ufwd = AST_UnionFwd::narrow_from_decl (d);
- t->set_full_definition (ufwd->full_definition ());
- }
-
- // There used to be another check here ANDed with the one below:
- // d->defined_in () == this. But lookup_for_add calls only
- // lookup_by_name_local(), which does not bump up the scope,
- // and look_in_previous() for modules. If look_in_previous()
- // finds something, the scopes will NOT be the same pointer
- // value, but the result is what we want.
- if (nt == AST_Decl::NT_union)
- {
- AST_Union *s = AST_Union::narrow_from_decl (d);
- t->set_full_definition (s);
-
- // Must check later that all struct and union forward declarations
- // are defined in the same IDL file.
- AST_record_fwd_decl (t);
- }
- else
- {
- 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;
- }
- }
- }
-
- // 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 ());
-
- // Must check later that all struct and union forward declarations
- // are defined in the same IDL file.
- AST_record_fwd_decl (t);
- return t;
+ return
+ AST_UnionFwd::narrow_from_decl (
+ this->fe_add_fwd_struct_type (t));
}
-// Add this AST_Structure node (a struct declaration) to this scope.
AST_Structure *
AST_Module::fe_add_structure (AST_Structure *t)
{
- AST_Decl *predef = 0;
- AST_StructureFwd *fwd = 0;
-
- if ((predef = this->lookup_for_add (t, false)) != 0)
- {
- // Treat fwd declared interfaces specially
- if (predef->node_type () == AST_Decl::NT_struct_fwd)
- {
- fwd = AST_StructureFwd::narrow_from_decl (predef);
-
- if (fwd == 0)
- {
- return 0;
- }
-
- // Forward declared and not defined yet.
- if (!fwd->is_defined ())
- {
- UTL_Scope *s = fwd->defined_in ();
- UTL_ScopedName *sn = ScopeAsDecl (s)->name ();
-
- if (fwd->defined_in () == this
- || sn->compare (this->name ()) == 0)
- {
- fwd->set_full_definition (t);
- }
- else
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
- fwd,
- t,
- this);
-
- return 0;
- }
- }
- // OK, not illegal redef of forward declaration. Now check whether.
- // it has been referenced already.
- else if (this->referenced (predef, t->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- return 0;
- }
- }
- else if (!can_be_redefined (predef))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- t,
- this,
- predef);
-
- return 0;
- }
- else if (referenced (predef, t->local_name ()) && !t->is_defined ())
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- t,
- this,
- predef);
-
- 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;
+ return this->fe_add_full_struct_type (t);
}
-// Add this AST_StructureFwd node (a forward declaration of an IDL
-// struct) to this scope.
AST_StructureFwd *
AST_Module::fe_add_structure_fwd (AST_StructureFwd *t)
{
- AST_Decl *d = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (t, false)) != 0)
- {
- AST_Decl::NodeType nt = d->node_type ();
-
- if (nt == AST_Decl::NT_struct_fwd)
- {
- AST_StructureFwd *sfwd = AST_StructureFwd::narrow_from_decl (d);
- t->set_full_definition (sfwd->full_definition ());
- }
-
- // There used to be another check here ANDed with the one below:
- // d->defined_in () == this. But lookup_for_add calls only
- // lookup_by_name_local(), which does not bump up the scope,
- // and look_in_previous() for modules. If look_in_previous()
- // finds something, the scopes will NOT be the same pointer
- // value, but the result is what we want.
- if (nt == AST_Decl::NT_struct)
- {
- AST_Structure *s = AST_Structure::narrow_from_decl (d);
- t->set_full_definition (s);
-
- // Must check later that all struct and union forward declarations
- // are defined in the same IDL file.
- AST_record_fwd_decl (t);
- }
- else
- {
- 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;
- }
- }
- }
-
- // 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 ());
-
- // Must check later that all struct and union forward declarations
- // are defined in the same IDL file.
- AST_record_fwd_decl (t);
- return t;
+ return this->fe_add_fwd_struct_type (t);
}
-// Add this AST_Enum node (an enum declaration) to this scope.
AST_Enum *
AST_Module::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 (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 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;
+ return
+ AST_Enum::narrow_from_decl (
+ this->fe_add_decl (t));
}
-// Add this AST_EnumVal node (an enumerator declaration) to this scope
+// Add an AST_EnumVal node (an enumerator) to this 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_Module::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 (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 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;
+ return
+ AST_EnumVal::narrow_from_decl (
+ this->fe_add_decl (t));
}
-// Add this AST_Typedef node (a typedef) to this scope.
AST_Typedef *
AST_Module::fe_add_typedef (AST_Typedef *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 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 *bt = t->base_type ();
- UTL_ScopedName *mru = bt->last_referenced_as ();
-
- if (mru != 0)
- {
- this->add_to_referenced (bt,
- false,
- mru->first_component ());
- }
-
- return t;
+ return
+ AST_Typedef::narrow_from_decl (
+ this->fe_add_ref_decl (t));
}
-// Add an AST_Native (a native declaration) to this scope.
AST_Native *
AST_Module::fe_add_native (AST_Native *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 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;
+ return
+ AST_Native::narrow_from_decl (
+ this->fe_add_decl (t));
}
AST_PortType *
-AST_Module::fe_add_porttype (AST_PortType *pt)
+AST_Module::fe_add_porttype (AST_PortType *t)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (pt, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- pt,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, pt->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- pt,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (pt);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (pt,
- false,
- pt->local_name ());
-
- return pt;
+ return
+ AST_PortType::narrow_from_decl (
+ this->fe_add_decl (t));
}
// Dump this AST_Module node to the ostream o.
diff --git a/TAO/TAO_IDL/ast/ast_native.cpp b/TAO/TAO_IDL/ast/ast_native.cpp
index 5dbb45ad84b..67f332129d3 100644
--- a/TAO/TAO_IDL/ast/ast_native.cpp
+++ b/TAO/TAO_IDL/ast/ast_native.cpp
@@ -3,6 +3,9 @@
#include "ast_native.h"
#include "ast_visitor.h"
+AST_Decl::NodeType const
+AST_Native::NT = AST_Decl::NT_native;
+
AST_Native::AST_Native (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_operation.cpp b/TAO/TAO_IDL/ast/ast_operation.cpp
index bbcc676a0e1..64026d575f1 100644
--- a/TAO/TAO_IDL/ast/ast_operation.cpp
+++ b/TAO/TAO_IDL/ast/ast_operation.cpp
@@ -91,6 +91,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "global_extern.h"
+AST_Decl::NodeType const
+AST_Operation::NT = AST_Decl::NT_op;
+
AST_Operation::AST_Operation (void)
: COMMON_Base (),
AST_Decl(),
@@ -437,80 +440,12 @@ AST_Operation::fe_add_exceptions (UTL_NameList *t)
return 0;
}
-// Add this AST_Argument node (an operation argument declaration)
-// to this scope.
AST_Argument *
AST_Operation::fe_add_argument (AST_Argument *t)
{
- AST_Decl *d = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = lookup_by_name_local (t->local_name(), 0)) != 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;
- }
- }
-
- // Cannot add OUT or INOUT argument to oneway operation.
- if ((t->direction () == AST_Argument::dir_OUT
- || t->direction() == AST_Argument::dir_INOUT)
- && pd_flags == OP_oneway)
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_ONEWAY_CONFLICT,
- t,
- this);
- return 0;
- }
-
- AST_Type *arg_type = t->field_type ();
-
- // This error is not caught in y.tab.cpp so we check for it here.
- if (arg_type->node_type () == AST_Decl::NT_array
- && arg_type->anonymous () == true)
- {
- idl_global->err ()->syntax_error (idl_global->parse_state ());
- }
-
- // 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 ());
-
- UTL_ScopedName *mru = arg_type->last_referenced_as ();
-
- if (mru != 0)
- {
- this->add_to_referenced (arg_type,
- false,
- mru->first_component ());
- }
-
- return t;
+ return
+ AST_Argument::narrow_from_decl (
+ this->fe_add_decl (t));
}
// Dump this AST_Operation node (an operation) to the ostream o.
@@ -624,7 +559,5 @@ AST_Operation::exceptions (void)
return this->pd_exceptions;
}
-
-
IMPL_NARROW_FROM_DECL(AST_Operation)
IMPL_NARROW_FROM_SCOPE(AST_Operation)
diff --git a/TAO/TAO_IDL/ast/ast_param_holder.cpp b/TAO/TAO_IDL/ast/ast_param_holder.cpp
index 0dab66761b9..380f4cad97a 100644
--- a/TAO/TAO_IDL/ast/ast_param_holder.cpp
+++ b/TAO/TAO_IDL/ast/ast_param_holder.cpp
@@ -5,6 +5,9 @@
#include "utl_identifier.h"
+AST_Decl::NodeType const
+AST_Param_Holder::NT = AST_Decl::NT_param_holder;
+
AST_Param_Holder::AST_Param_Holder (UTL_ScopedName *parameter_name,
FE_Utils::T_Param_Info *info)
: COMMON_Base (false,
diff --git a/TAO/TAO_IDL/ast/ast_porttype.cpp b/TAO/TAO_IDL/ast/ast_porttype.cpp
index b43347908eb..7927246c404 100644
--- a/TAO/TAO_IDL/ast/ast_porttype.cpp
+++ b/TAO/TAO_IDL/ast/ast_porttype.cpp
@@ -12,6 +12,9 @@
#include "utl_indenter.h"
#include "global_extern.h"
+AST_Decl::NodeType const
+AST_PortType::NT = AST_Decl::NT_porttype;
+
AST_PortType::AST_PortType (UTL_ScopedName *n)
: COMMON_Base (false,
false),
@@ -48,191 +51,42 @@ AST_PortType::ast_accept (ast_visitor *visitor)
AST_Provides *
AST_PortType::fe_add_provides (AST_Provides *p)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (p, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- p,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, p->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- p,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (p);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (p,
- false,
- p->local_name ());
-
- return p;
+ return
+ AST_Provides::narrow_from_decl (
+ this->fe_add_ref_decl (p));
}
AST_Uses *
AST_PortType::fe_add_uses (AST_Uses *u)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (u, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- u,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, u->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- u,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (u);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (u,
- false,
- u->local_name ());
-
- return u;
+ return
+ AST_Uses::narrow_from_decl (
+ this->fe_add_ref_decl (u));
}
AST_Publishes *
AST_PortType::fe_add_publishes (AST_Publishes *p)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (p, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- p,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, p->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- p,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (p);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (p,
- false,
- p->local_name ());
-
- return p;
+ return
+ AST_Publishes::narrow_from_decl (
+ this->fe_add_ref_decl (p));
}
AST_Emits *
AST_PortType::fe_add_emits (AST_Emits *e)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (e, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- e,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, e->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- e,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (e);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (e,
- false,
- e->local_name ());
-
+ return
+ AST_Emits::narrow_from_decl (
+ this->fe_add_ref_decl (e));
return e;
}
AST_Consumes *
AST_PortType::fe_add_consumes (AST_Consumes *c)
{
- AST_Decl *d = 0;
-
- // Already defined? Or already used?
- if ((d = this->lookup_for_add (c, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- c,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, c->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- c,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (c);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (c,
- false,
- c->local_name ());
-
- return c;
+ return
+ AST_Consumes::narrow_from_decl (
+ this->fe_add_ref_decl (c));
}
IMPL_NARROW_FROM_DECL (AST_PortType)
diff --git a/TAO/TAO_IDL/ast/ast_predefined_type.cpp b/TAO/TAO_IDL/ast/ast_predefined_type.cpp
index 3c329b08a70..22481f8d310 100644
--- a/TAO/TAO_IDL/ast/ast_predefined_type.cpp
+++ b/TAO/TAO_IDL/ast/ast_predefined_type.cpp
@@ -78,6 +78,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ace/Log_Msg.h"
#include "ace/OS_NS_stdio.h"
+AST_Decl::NodeType const
+AST_PredefinedType::NT = AST_Decl::NT_pre_defined;
+
AST_PredefinedType::AST_PredefinedType (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_provides.cpp b/TAO/TAO_IDL/ast/ast_provides.cpp
index cc1798a1265..ffbc936c59e 100644
--- a/TAO/TAO_IDL/ast/ast_provides.cpp
+++ b/TAO/TAO_IDL/ast/ast_provides.cpp
@@ -4,6 +4,9 @@
#include "ast_interface.h"
#include "ast_visitor.h"
+AST_Decl::NodeType const
+AST_Provides::NT = AST_Decl::NT_provides;
+
AST_Provides::AST_Provides (UTL_ScopedName *n,
AST_Type *provides_type)
: COMMON_Base (),
diff --git a/TAO/TAO_IDL/ast/ast_publishes.cpp b/TAO/TAO_IDL/ast/ast_publishes.cpp
index b20f81b0956..76817a7373d 100644
--- a/TAO/TAO_IDL/ast/ast_publishes.cpp
+++ b/TAO/TAO_IDL/ast/ast_publishes.cpp
@@ -3,6 +3,9 @@
#include "ast_publishes.h"
#include "ast_visitor.h"
+AST_Decl::NodeType const
+AST_Publishes::NT = AST_Decl::NT_publishes;
+
AST_Publishes::AST_Publishes (UTL_ScopedName *n,
AST_Type *publishes_type)
: COMMON_Base (),
diff --git a/TAO/TAO_IDL/ast/ast_redef.cpp b/TAO/TAO_IDL/ast/ast_redef.cpp
index 2fc3bb464c6..3b8109e3a5c 100644
--- a/TAO/TAO_IDL/ast/ast_redef.cpp
+++ b/TAO/TAO_IDL/ast/ast_redef.cpp
@@ -82,40 +82,11 @@ can_be_redefined (AST_Decl *d)
case AST_Decl::NT_component_fwd:
case AST_Decl::NT_eventtype:
case AST_Decl::NT_eventtype_fwd:
- case AST_Decl::NT_porttype:
- case AST_Decl::NT_home:
- case AST_Decl::NT_const:
- case AST_Decl::NT_except:
- case AST_Decl::NT_argument:
- case AST_Decl::NT_enum_val:
- case AST_Decl::NT_string:
- case AST_Decl::NT_wstring:
- case AST_Decl::NT_array:
- case AST_Decl::NT_sequence:
case AST_Decl::NT_union:
case AST_Decl::NT_union_fwd:
case AST_Decl::NT_struct:
case AST_Decl::NT_struct_fwd:
- case AST_Decl::NT_enum:
- case AST_Decl::NT_typedef:
- case AST_Decl::NT_valuebox:
- case AST_Decl::NT_connector:
return true;
-
- case AST_Decl::NT_union_branch:
- case AST_Decl::NT_field:
- case AST_Decl::NT_attr:
- case AST_Decl::NT_op:
- case AST_Decl::NT_pre_defined:
- case AST_Decl::NT_factory:
- case AST_Decl::NT_finder:
- case AST_Decl::NT_provides:
- case AST_Decl::NT_uses:
- case AST_Decl::NT_publishes:
- case AST_Decl::NT_emits:
- case AST_Decl::NT_consumes:
- case AST_Decl::NT_ext_port:
- case AST_Decl::NT_mirror_port:
default:
return false;
}
diff --git a/TAO/TAO_IDL/ast/ast_root.cpp b/TAO/TAO_IDL/ast/ast_root.cpp
index 44ef45d76c9..596ba708e87 100644
--- a/TAO/TAO_IDL/ast/ast_root.cpp
+++ b/TAO/TAO_IDL/ast/ast_root.cpp
@@ -78,6 +78,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ace/OS_NS_string.h"
#include "ace/OS_Memory.h"
+AST_Decl::NodeType const
+AST_Root::NT = AST_Decl::NT_root;
+
AST_Root::AST_Root (void)
: COMMON_Base (),
AST_Decl (),
@@ -130,18 +133,6 @@ AST_Root::fe_add_sequence (AST_Sequence *t)
return 0;
}
- Identifier *id = 0;
- ACE_NEW_RETURN (id,
- Identifier ("local type"),
- 0);
-
- UTL_ScopedName *sn = 0;
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- 0);
-
- t->set_name (sn);
this->add_to_local_types (t);
return t;
}
@@ -155,18 +146,6 @@ AST_Root::fe_add_string (AST_String *t)
return 0;
}
- Identifier *id = 0;
- ACE_NEW_RETURN (id,
- Identifier ("local type"),
- 0);
-
- UTL_ScopedName *sn = 0;
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- 0);
-
- t->set_name (sn);
this->add_to_local_types (t);
return t;
}
@@ -180,18 +159,6 @@ AST_Root::fe_add_array (AST_Array *t)
return 0;
}
- Identifier *id = 0;
- ACE_NEW_RETURN (id,
- Identifier ("local type"),
- 0);
-
- UTL_ScopedName *sn = 0;
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- 0);
-
- t->set_name (sn);
this->add_to_local_types (t);
return t;
}
@@ -265,7 +232,5 @@ AST_Root::fini (void)
this->AST_Decl::destroy ();
}
-
-
IMPL_NARROW_FROM_DECL(AST_Root)
IMPL_NARROW_FROM_SCOPE(AST_Root)
diff --git a/TAO/TAO_IDL/ast/ast_sequence.cpp b/TAO/TAO_IDL/ast/ast_sequence.cpp
index ac1ed44f65e..4695760f9f2 100644
--- a/TAO/TAO_IDL/ast/ast_sequence.cpp
+++ b/TAO/TAO_IDL/ast/ast_sequence.cpp
@@ -86,6 +86,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
+AST_Decl::NodeType const
+AST_Sequence::NT = AST_Decl::NT_sequence;
+
AST_Sequence::AST_Sequence (void)
: COMMON_Base (),
AST_Decl (),
@@ -292,6 +295,4 @@ AST_Sequence::destroy (void)
this->AST_ConcreteType::destroy ();
}
-
-
IMPL_NARROW_FROM_DECL(AST_Sequence)
diff --git a/TAO/TAO_IDL/ast/ast_string.cpp b/TAO/TAO_IDL/ast/ast_string.cpp
index f472098eb8b..a11be1b2889 100644
--- a/TAO/TAO_IDL/ast/ast_string.cpp
+++ b/TAO/TAO_IDL/ast/ast_string.cpp
@@ -78,6 +78,10 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "idl_defines.h"
#include "global_extern.h"
+// Note we are overlooking the wstring case here.
+AST_Decl::NodeType const
+AST_String::NT = AST_Decl::NT_string;
+
AST_String::AST_String (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_structure.cpp b/TAO/TAO_IDL/ast/ast_structure.cpp
index 42af00b2451..6fce029d771 100644
--- a/TAO/TAO_IDL/ast/ast_structure.cpp
+++ b/TAO/TAO_IDL/ast/ast_structure.cpp
@@ -196,7 +196,6 @@ AST_Structure::in_recursion (ACE_Unbounded_Queue<AST_Type *> &list)
return this->in_recursion_;
}
-// Return the member count.
int
AST_Structure::member_count (void)
{
@@ -323,202 +322,40 @@ AST_Structure::fwd_decl (AST_StructureFwd *node)
this->fwd_decl_ = node;
}
+ACE_Unbounded_Queue<AST_Field *> &
+AST_Structure::fields (void)
+{
+ return this->fields_;
+}
+
// Private operations.
-// Add this AST_Field node (a field declaration) to this scope.
AST_Field *
AST_Structure::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 (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 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;
+ return this->fe_add_ref_decl (t);
}
-// Add an AST_Structure node (a manifest struct type) to this scope.
AST_Structure *
AST_Structure::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 ()->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;
+ return this->fe_add_full_struct_type (t);
}
-// Add an AST_Union node (a manifest union type) to this scope.
AST_Union *
AST_Structure::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;
+ return
+ AST_Union::narrow_from_decl (
+ this->fe_add_full_struct_type (t));
}
-// Add this AST_Enum node (a manifest enum declaration) to this scope.
AST_Enum *
AST_Structure::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 (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;
+ return
+ AST_Enum::narrow_from_decl (
+ this->fe_add_decl (t));
}
// Add this AST_EnumVal node (an enumerator declaration) to this scope.
@@ -528,46 +365,9 @@ AST_Structure::fe_add_enum (AST_Enum *t)
AST_EnumVal *
AST_Structure::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 (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 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;
+ return
+ AST_EnumVal::narrow_from_decl (
+ this->fe_add_decl (t));
}
// Compute total number of members.
@@ -781,8 +581,6 @@ AST_Structure::destroy (void)
this->UTL_Scope::destroy ();
}
-
-
IMPL_NARROW_FROM_DECL(AST_Structure)
IMPL_NARROW_FROM_SCOPE(AST_Structure)
diff --git a/TAO/TAO_IDL/ast/ast_structure_fwd.cpp b/TAO/TAO_IDL/ast/ast_structure_fwd.cpp
index 62567825d8b..755fd106428 100644
--- a/TAO/TAO_IDL/ast/ast_structure_fwd.cpp
+++ b/TAO/TAO_IDL/ast/ast_structure_fwd.cpp
@@ -10,6 +10,9 @@
#include "ast_visitor.h"
#include "utl_identifier.h"
+AST_Decl::NodeType const
+AST_StructureFwd::NT = AST_Decl::NT_struct_fwd;
+
AST_StructureFwd::AST_StructureFwd (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_template_module.cpp b/TAO/TAO_IDL/ast/ast_template_module.cpp
index 8f141b319df..6b6d3dfbba4 100644
--- a/TAO/TAO_IDL/ast/ast_template_module.cpp
+++ b/TAO/TAO_IDL/ast/ast_template_module.cpp
@@ -13,6 +13,9 @@
#include "global_extern.h"
#include "nr_extern.h"
+AST_Decl::NodeType const
+AST_Template_Module::NT = AST_Decl::NT_module;
+
AST_Template_Module::AST_Template_Module (
UTL_ScopedName *n,
FE_Utils::T_PARAMLIST_INFO *template_params)
@@ -150,49 +153,9 @@ AST_Template_Module_Ref *
AST_Template_Module::fe_add_template_module_ref (
AST_Template_Module_Ref *m)
{
- AST_Decl *d = 0;
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (m, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- m,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, m->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- m,
- this,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (m);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (m,
- false,
- m->local_name ());
-
- AST_Type *ft = m->field_type ();
- UTL_ScopedName *mru = ft->last_referenced_as ();
-
- if (mru != 0)
- {
- this->add_to_referenced (ft,
- false,
- mru->first_component ());
- }
-
- return m;
+ return
+ AST_Template_Module_Ref::narrow_from_decl (
+ this->fe_add_ref_decl (m));
}
void
diff --git a/TAO/TAO_IDL/ast/ast_template_module_inst.cpp b/TAO/TAO_IDL/ast/ast_template_module_inst.cpp
index a535ebb074d..e51d39128f9 100644
--- a/TAO/TAO_IDL/ast/ast_template_module_inst.cpp
+++ b/TAO/TAO_IDL/ast/ast_template_module_inst.cpp
@@ -4,6 +4,9 @@
#include "ast_template_module.h"
#include "ast_visitor.h"
+AST_Decl::NodeType const
+AST_Template_Module_Inst::NT = AST_Decl::NT_module;
+
AST_Template_Module_Inst::AST_Template_Module_Inst (
UTL_ScopedName *n,
AST_Template_Module *ref,
diff --git a/TAO/TAO_IDL/ast/ast_template_module_ref.cpp b/TAO/TAO_IDL/ast/ast_template_module_ref.cpp
index 358107c45a2..645a9433442 100644
--- a/TAO/TAO_IDL/ast/ast_template_module_ref.cpp
+++ b/TAO/TAO_IDL/ast/ast_template_module_ref.cpp
@@ -6,6 +6,9 @@
#include "utl_strlist.h"
+AST_Decl::NodeType const
+AST_Template_Module_Ref::NT = AST_Decl::NT_module;
+
AST_Template_Module_Ref::AST_Template_Module_Ref (
UTL_ScopedName *n,
AST_Template_Module *ref,
diff --git a/TAO/TAO_IDL/ast/ast_typedef.cpp b/TAO/TAO_IDL/ast/ast_typedef.cpp
index e8ae551d50e..3940069da80 100644
--- a/TAO/TAO_IDL/ast/ast_typedef.cpp
+++ b/TAO/TAO_IDL/ast/ast_typedef.cpp
@@ -76,6 +76,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ace/Log_Msg.h"
+AST_Decl::NodeType const
+AST_Typedef::NT = AST_Decl::NT_typedef;
+
AST_Typedef::AST_Typedef (AST_Type *bt,
UTL_ScopedName *n,
bool local,
diff --git a/TAO/TAO_IDL/ast/ast_union.cpp b/TAO/TAO_IDL/ast/ast_union.cpp
index 3d6e1a8f495..1c65135423c 100644
--- a/TAO/TAO_IDL/ast/ast_union.cpp
+++ b/TAO/TAO_IDL/ast/ast_union.cpp
@@ -917,228 +917,34 @@ AST_Union::compute_default_index (void)
// Redefinition of inherited virtual operations
-// Add this AST_UnionBranch node (a node representing one branch in a
-// union declaration) to this scope
AST_UnionBranch *
AST_Union::fe_add_union_branch (AST_UnionBranch *t)
{
- AST_Decl *d = 0;
-
- // If this is a malformed branch, don't do anything with it.
- if (t == 0 || t->label() == 0)
- {
- return 0;
- }
-
- // If branch with that label already exists, complain.
- if (lookup_branch (t) != 0)
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_MULTIPLE_BRANCH,
- this,
- t);
- return 0;
- }
-
- // If branch with same field name exists, complain.
- 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 scope.
- this->add_to_scope (t);
-
- // If we have an enum discriminator, add the label names to
- // the name_referenced list before we add the union branch,
- // so a branch name clash with a label name will be caught.
- if (this->pd_udisc_type == AST_Expression::EV_enum)
- {
- t->add_labels (this);
- }
- else
- {
- t->coerce_labels (this);
- }
-
- // 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;
+ return
+ AST_UnionBranch::narrow_from_decl (
+ this->fe_add_ref_decl (t));
}
-// Add this AST_Union (manifest union type) to this scope.
AST_Union *
AST_Union::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;
+ return
+ AST_Union::narrow_from_decl (
+ this->fe_add_full_struct_type (t));
}
-// Add this AST_Structure node (manifest struct type) to this scope.
AST_Structure *
AST_Union::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 ()->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;
+ return this->fe_add_full_struct_type (t);
}
-// Add this AST_Enum node (manifest enum type) to this scope.
AST_Enum *
AST_Union::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 (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;
+ return
+ AST_Enum::narrow_from_decl (
+ this->fe_add_decl (t));
}
// Add this AST_EnumVal node (enumerator declaration) to this scope.
@@ -1148,46 +954,9 @@ AST_Union::fe_add_enum (AST_Enum *t)
AST_EnumVal *
AST_Union::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 (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 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;
+ return
+ AST_EnumVal::narrow_from_decl (
+ this->fe_add_decl (t));
}
// Dump this AST_Union node to the ostream o.
@@ -1262,7 +1031,5 @@ AST_Union::udisc_type (void)
return this->pd_udisc_type;
}
-
-
IMPL_NARROW_FROM_DECL(AST_Union)
IMPL_NARROW_FROM_SCOPE(AST_Union)
diff --git a/TAO/TAO_IDL/ast/ast_union_branch.cpp b/TAO/TAO_IDL/ast/ast_union_branch.cpp
index 5203c4a023e..5861796d589 100644
--- a/TAO/TAO_IDL/ast/ast_union_branch.cpp
+++ b/TAO/TAO_IDL/ast/ast_union_branch.cpp
@@ -77,6 +77,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ast_visitor.h"
#include "utl_labellist.h"
+AST_Decl::NodeType const
+AST_UnionBranch::NT = AST_Decl::NT_union_branch;
+
AST_UnionBranch::AST_UnionBranch (void)
: COMMON_Base (),
AST_Decl (),
@@ -233,6 +236,4 @@ AST_UnionBranch::coerce_labels (AST_Union *u)
}
}
-
-
IMPL_NARROW_FROM_DECL(AST_UnionBranch)
diff --git a/TAO/TAO_IDL/ast/ast_union_fwd.cpp b/TAO/TAO_IDL/ast/ast_union_fwd.cpp
index 83f3ec8d647..ce51214dbe0 100644
--- a/TAO/TAO_IDL/ast/ast_union_fwd.cpp
+++ b/TAO/TAO_IDL/ast/ast_union_fwd.cpp
@@ -10,6 +10,9 @@
#include "ast_visitor.h"
#include "utl_identifier.h"
+AST_Decl::NodeType const
+AST_UnionFwd::NT = AST_Decl::NT_union_fwd;
+
AST_UnionFwd::AST_UnionFwd (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/ast/ast_uses.cpp b/TAO/TAO_IDL/ast/ast_uses.cpp
index fdd66a0bbca..647271ec313 100644
--- a/TAO/TAO_IDL/ast/ast_uses.cpp
+++ b/TAO/TAO_IDL/ast/ast_uses.cpp
@@ -4,6 +4,9 @@
#include "ast_interface.h"
#include "ast_visitor.h"
+AST_Decl::NodeType const
+AST_Uses::NT = AST_Decl::NT_uses;
+
AST_Uses::AST_Uses (UTL_ScopedName *n,
AST_Type *uses_type,
bool is_multiple)
diff --git a/TAO/TAO_IDL/ast/ast_valuebox.cpp b/TAO/TAO_IDL/ast/ast_valuebox.cpp
index 86288ea95ce..8911c5b7739 100644
--- a/TAO/TAO_IDL/ast/ast_valuebox.cpp
+++ b/TAO/TAO_IDL/ast/ast_valuebox.cpp
@@ -4,6 +4,9 @@
#include "ast_visitor.h"
#include "utl_identifier.h"
+AST_Decl::NodeType const
+AST_ValueBox::NT = AST_Decl::NT_valuebox;
+
AST_ValueBox::AST_ValueBox (void)
: COMMON_Base (),
AST_Decl (),
@@ -57,8 +60,6 @@ AST_ValueBox::destroy (void)
this->AST_ConcreteType::destroy ();
}
-
-
IMPL_NARROW_FROM_DECL(AST_ValueBox)
diff --git a/TAO/TAO_IDL/ast/ast_valuetype.cpp b/TAO/TAO_IDL/ast/ast_valuetype.cpp
index 3aad0bc9935..da4cde38869 100644
--- a/TAO/TAO_IDL/ast/ast_valuetype.cpp
+++ b/TAO/TAO_IDL/ast/ast_valuetype.cpp
@@ -19,6 +19,9 @@
#include "ace/streams.h"
+AST_Decl::NodeType const
+AST_ValueType::NT = AST_Decl::NT_valuetype;
+
AST_ValueType::AST_ValueType (void)
: COMMON_Base (),
AST_Decl (),
@@ -450,58 +453,18 @@ AST_ValueType::ast_accept (ast_visitor *visitor)
return visitor->visit_valuetype (this);
}
+AST_Field *
+AST_ValueType::fe_add_field (AST_Field *t)
+{
+ return this->fe_add_ref_decl (t);
+}
+
AST_Factory *
AST_ValueType::fe_add_factory (AST_Factory *f)
{
- AST_Decl *d = 0;
-
- // Can't add to interface which was not yet defined.
- if (!this->is_defined ())
- {
- idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED,
- this,
- f);
- return 0;
- }
-
- // Already defined and cannot be redefined? Or already used?
- if ((d = this->lookup_for_add (f, false)) != 0)
- {
- if (!can_be_redefined (d))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- f,
- this,
- d);
- return 0;
- }
-
- if (this->referenced (d, f->local_name ()))
- {
- idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
- f,
- this,
- d);
- return 0;
- }
-
- if (f->has_ancestor (d))
- {
- idl_global->err ()->redefinition_in_scope (f,
- d);
- return 0;
- }
- }
-
- // Add it to scope.
- this->add_to_scope (f);
-
- // Add it to set of locally referenced symbols.
- this->add_to_referenced (f,
- false,
- f->local_name ());
-
- return f;
+ return
+ AST_Factory::narrow_from_decl (
+ this->fe_add_decl (f));
}
bool
diff --git a/TAO/TAO_IDL/ast/ast_valuetype_fwd.cpp b/TAO/TAO_IDL/ast/ast_valuetype_fwd.cpp
index 03e89ad955e..eff8cf7da2b 100644
--- a/TAO/TAO_IDL/ast/ast_valuetype_fwd.cpp
+++ b/TAO/TAO_IDL/ast/ast_valuetype_fwd.cpp
@@ -5,6 +5,9 @@
#include "ast_visitor.h"
#include "utl_identifier.h"
+AST_Decl::NodeType const
+AST_ValueTypeFwd::NT = AST_Decl::NT_valuetype_fwd;
+
AST_ValueTypeFwd::AST_ValueTypeFwd (void)
: COMMON_Base (),
AST_Decl (),
diff --git a/TAO/TAO_IDL/be/be_root.cpp b/TAO/TAO_IDL/be/be_root.cpp
index 1efac757dca..20afa7e2cf0 100644
--- a/TAO/TAO_IDL/be/be_root.cpp
+++ b/TAO/TAO_IDL/be/be_root.cpp
@@ -50,48 +50,6 @@ be_root::~be_root (void)
{
}
-// We had to provide these since the AST_Root::fe_* method was setting the
-// names of these three to "local type".
-
-// Add this AST_Sequence to the locally defined types in this scope.
-AST_Sequence *
-be_root::fe_add_sequence (AST_Sequence *t)
-{
- if (t == 0)
- {
- return 0;
- }
-
- add_to_local_types (t);
- return t;
-}
-
-// Add this AST_String to the locally defined types in this scope
-AST_String *
-be_root::fe_add_string (AST_String *t)
-{
- if (t == 0)
- {
- return 0;
- }
-
- add_to_local_types (t);
- return t;
-}
-
-// Add this AST_Array to the locally defined types in this scope
-AST_Array *
-be_root::fe_add_array (AST_Array *t)
-{
- if (t == 0)
- {
- return 0;
- }
-
- add_to_local_types (t);
- return t;
-}
-
void
be_root::destroy (void)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union.cpp b/TAO/TAO_IDL/be/be_visitor_union/union.cpp
index d7f9871a2bb..7fdb4a0643e 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union.cpp
@@ -141,6 +141,12 @@ be_visitor_union_cdr_op_cs::pre_process (be_decl *bd)
be_union_branch* b =
be_union_branch::narrow_from_decl (bd);
+
+ // Could be a type decl.
+ if (b == 0)
+ {
+ return 0;
+ }
*os << be_nl;
diff --git a/TAO/TAO_IDL/be_include/be_root.h b/TAO/TAO_IDL/be_include/be_root.h
index 34c129f7f09..0a6ea46826a 100644
--- a/TAO/TAO_IDL/be_include/be_root.h
+++ b/TAO/TAO_IDL/be_include/be_root.h
@@ -42,13 +42,6 @@ public:
virtual ~be_root (void);
- // Scope management functions that override the AST scope management methods
- // since the AST methods set the names of the sequences, strings, and arrays
- // to a fixed value which interferes with our back-end code generation.
- AST_Sequence *fe_add_sequence (AST_Sequence *);
- AST_String *fe_add_string (AST_String *);
- AST_Array *fe_add_array (AST_Array *);
-
/// Cleanup method.
virtual void destroy (void);
diff --git a/TAO/TAO_IDL/fe/idl.ll b/TAO/TAO_IDL/fe/idl.ll
index 3392a1a55ad..ce71cf01de8 100644
--- a/TAO/TAO_IDL/fe/idl.ll
+++ b/TAO/TAO_IDL/fe/idl.ll
@@ -498,12 +498,14 @@ idl_parse_line_and_file (char *buf)
UTL_String *fname = idl_global->filename ();
bool in_main_file = false;
- bool is_real_filename
- = fname->compare (idl_global->real_filename ())
- || same_file (fname->get_string(),
- idl_global->real_filename ()->get_string());
+ bool is_real_filename =
+ fname->compare (idl_global->real_filename ())
+ || same_file (fname->get_string(),
+ idl_global->real_filename ()->get_string());
+
bool is_main_filename = false;
+
if (!is_real_filename)
{
#if defined (ACE_OPENVMS)
@@ -516,10 +518,10 @@ idl_parse_line_and_file (char *buf)
is_main_filename = idl_global->path_cmp (idl_global->main_filename ()->get_string (),
full_fname) == 0;
#else
- is_main_filename
- = fname->compare (idl_global->main_filename ())
- || same_file (fname->get_string(),
- idl_global->main_filename ()->get_string());
+ is_main_filename =
+ fname->compare (idl_global->main_filename ())
+ || same_file (fname->get_string(),
+ idl_global->main_filename ()->get_string());
#endif
}
@@ -534,12 +536,10 @@ idl_parse_line_and_file (char *buf)
// by the preprocessor.
if (!(idl_global->in_main_file ()) && idl_global->import ())
{
- ACE_NEW (
- nm,
- UTL_String (
- idl_global->stripped_preproc_include (fname->get_string ())
- )
- );
+ ACE_NEW (nm,
+ UTL_String (
+ idl_global->stripped_preproc_include (
+ fname->get_string ())));
// This call also manages the #pragma prefix.
idl_global->store_include_file_name (nm);
diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp b/TAO/TAO_IDL/fe/lex.yy.cpp
index 336a1087404..403208e15c0 100644
--- a/TAO/TAO_IDL/fe/lex.yy.cpp
+++ b/TAO/TAO_IDL/fe/lex.yy.cpp
@@ -2984,12 +2984,14 @@ idl_parse_line_and_file (char *buf)
UTL_String *fname = idl_global->filename ();
bool in_main_file = false;
- bool is_real_filename
- = fname->compare (idl_global->real_filename ())
- || same_file (fname->get_string(),
- idl_global->real_filename ()->get_string());
+
+ bool is_real_filename =
+ fname->compare (idl_global->real_filename ())
+ || same_file (fname->get_string(),
+ idl_global->real_filename ()->get_string());
bool is_main_filename = false;
+
if (!is_real_filename)
{
#if defined (ACE_OPENVMS)
@@ -3002,10 +3004,10 @@ idl_parse_line_and_file (char *buf)
is_main_filename = idl_global->path_cmp (idl_global->main_filename ()->get_string (),
full_fname) == 0;
#else
- is_main_filename
- = fname->compare (idl_global->main_filename ())
- || same_file (fname->get_string(),
- idl_global->main_filename ()->get_string());
+ is_main_filename =
+ fname->compare (idl_global->main_filename ())
+ || same_file (fname->get_string(),
+ idl_global->main_filename ()->get_string());
#endif
}
@@ -3020,12 +3022,10 @@ idl_parse_line_and_file (char *buf)
// by the preprocessor.
if (!(idl_global->in_main_file ()) && idl_global->import ())
{
- ACE_NEW (
- nm,
- UTL_String (
- idl_global->stripped_preproc_include (fname->get_string ())
- )
- );
+ ACE_NEW (nm,
+ UTL_String (
+ idl_global->stripped_preproc_include (
+ fname->get_string ())));
// This call also manages the #pragma prefix.
idl_global->store_include_file_name (nm);
diff --git a/TAO/TAO_IDL/include/ast_argument.h b/TAO/TAO_IDL/include/ast_argument.h
index abbf34a0a7b..d97411eb9d7 100644
--- a/TAO/TAO_IDL/include/ast_argument.h
+++ b/TAO/TAO_IDL/include/ast_argument.h
@@ -111,6 +111,8 @@ public:
// Cleanup.
virtual void destroy (void);
+
+ static AST_Decl::NodeType const NT;
private:
const Direction pd_direction;
diff --git a/TAO/TAO_IDL/include/ast_array.h b/TAO/TAO_IDL/include/ast_array.h
index ef0b1d9651c..5f70b4e7498 100644
--- a/TAO/TAO_IDL/include/ast_array.h
+++ b/TAO/TAO_IDL/include/ast_array.h
@@ -125,6 +125,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ static AST_Decl::NodeType const NT;
+
protected:
virtual int compute_size_type (void);
// Compute the size type if it is unknown.
diff --git a/TAO/TAO_IDL/include/ast_attribute.h b/TAO/TAO_IDL/include/ast_attribute.h
index 161dfe94a7b..4c721ef30dd 100644
--- a/TAO/TAO_IDL/include/ast_attribute.h
+++ b/TAO/TAO_IDL/include/ast_attribute.h
@@ -113,6 +113,8 @@ public:
UTL_ExceptList *be_add_get_exceptions (UTL_ExceptList *t);
UTL_ExceptList *be_add_set_exceptions (UTL_ExceptList *t);
+ static AST_Decl::NodeType const NT;
+
private:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_component.h b/TAO/TAO_IDL/include/ast_component.h
index c234196aeff..ee2a346f91c 100644
--- a/TAO/TAO_IDL/include/ast_component.h
+++ b/TAO/TAO_IDL/include/ast_component.h
@@ -69,6 +69,9 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ static AST_Decl::NodeType const NT;
+ typedef AST_ComponentFwd FWD_TYPE;
+
protected:
virtual AST_Provides *fe_add_provides (AST_Provides *p);
diff --git a/TAO/TAO_IDL/include/ast_component_fwd.h b/TAO/TAO_IDL/include/ast_component_fwd.h
index 3b5186f506b..f1dc89eb467 100644
--- a/TAO/TAO_IDL/include/ast_component_fwd.h
+++ b/TAO/TAO_IDL/include/ast_component_fwd.h
@@ -30,6 +30,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
};
#endif // _AST_COMPONENT_FWD_AST_COMPONENT_FWD_HH
diff --git a/TAO/TAO_IDL/include/ast_connector.h b/TAO/TAO_IDL/include/ast_connector.h
index f3cca4b475c..33c39f352e8 100644
--- a/TAO/TAO_IDL/include/ast_connector.h
+++ b/TAO/TAO_IDL/include/ast_connector.h
@@ -33,6 +33,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
};
#endif // AST_CONNECTOR_H
diff --git a/TAO/TAO_IDL/include/ast_constant.h b/TAO/TAO_IDL/include/ast_constant.h
index aee9aed5b9f..3303fb468ed 100644
--- a/TAO/TAO_IDL/include/ast_constant.h
+++ b/TAO/TAO_IDL/include/ast_constant.h
@@ -127,6 +127,8 @@ public:
// Cleanup.
virtual void destroy (void);
+ static AST_Decl::NodeType const NT;
+
protected:
AST_Expression *pd_constant_value;
// The value.
diff --git a/TAO/TAO_IDL/include/ast_consumes.h b/TAO/TAO_IDL/include/ast_consumes.h
index 58ef62049d6..df6f3b0fe9f 100644
--- a/TAO/TAO_IDL/include/ast_consumes.h
+++ b/TAO/TAO_IDL/include/ast_consumes.h
@@ -30,6 +30,8 @@ public:
// Cleanup.
virtual void destroy (void);
+
+ static AST_Decl::NodeType const NT;
};
#endif // AST_CONSUMES_H
diff --git a/TAO/TAO_IDL/include/ast_decl.h b/TAO/TAO_IDL/include/ast_decl.h
index 8d4b887cc6e..f3396d4f21c 100644
--- a/TAO/TAO_IDL/include/ast_decl.h
+++ b/TAO/TAO_IDL/include/ast_decl.h
@@ -159,7 +159,7 @@ public:
, NT_home // Denotes a CORBA component home
, NT_eventtype // Denotes a CCM event source or sink
, NT_eventtype_fwd // Denotes a forward declared CCM event
- , NT_valuebox // Denotes an value box
+ , NT_valuebox // Denotes a value box
, NT_type // Template interface parameter
, NT_fixed // Denotes (unsupported) fixed type
, NT_porttype // Denotes a port type
diff --git a/TAO/TAO_IDL/include/ast_emits.h b/TAO/TAO_IDL/include/ast_emits.h
index c9fc200dfce..d1aba825406 100644
--- a/TAO/TAO_IDL/include/ast_emits.h
+++ b/TAO/TAO_IDL/include/ast_emits.h
@@ -30,6 +30,8 @@ public:
// Cleanup.
virtual void destroy (void);
+
+ static AST_Decl::NodeType const NT;
};
#endif // AST_EMITS_H
diff --git a/TAO/TAO_IDL/include/ast_enum.h b/TAO/TAO_IDL/include/ast_enum.h
index d1df0ba3b1c..adf69fa5d35 100644
--- a/TAO/TAO_IDL/include/ast_enum.h
+++ b/TAO/TAO_IDL/include/ast_enum.h
@@ -109,6 +109,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ static AST_Decl::NodeType const NT;
+
private:
friend int tao_yyparse (void);
diff --git a/TAO/TAO_IDL/include/ast_enum_val.h b/TAO/TAO_IDL/include/ast_enum_val.h
index 80af9da9230..a5a3af9c675 100644
--- a/TAO/TAO_IDL/include/ast_enum_val.h
+++ b/TAO/TAO_IDL/include/ast_enum_val.h
@@ -94,6 +94,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
};
#endif // _AST_ENUM_VAL_AST_ENUM_VAL_HH
diff --git a/TAO/TAO_IDL/include/ast_eventtype.h b/TAO/TAO_IDL/include/ast_eventtype.h
index fad9ed9e40d..4ee1e3a995f 100644
--- a/TAO/TAO_IDL/include/ast_eventtype.h
+++ b/TAO/TAO_IDL/include/ast_eventtype.h
@@ -39,6 +39,9 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
+ typedef AST_EventTypeFwd FWD_TYPE;
};
#endif // _AST_VALUETYPE_AST_EVENTTYPE_HH
diff --git a/TAO/TAO_IDL/include/ast_eventtype_fwd.h b/TAO/TAO_IDL/include/ast_eventtype_fwd.h
index b7f2729b69d..38bbcfc408a 100644
--- a/TAO/TAO_IDL/include/ast_eventtype_fwd.h
+++ b/TAO/TAO_IDL/include/ast_eventtype_fwd.h
@@ -30,6 +30,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
};
#endif // _AST_VALUETYPE_FWD_AST_EVENTTYPE_FWD_HH
diff --git a/TAO/TAO_IDL/include/ast_exception.h b/TAO/TAO_IDL/include/ast_exception.h
index 7ea88871915..99f31f207c7 100644
--- a/TAO/TAO_IDL/include/ast_exception.h
+++ b/TAO/TAO_IDL/include/ast_exception.h
@@ -105,15 +105,7 @@ public:
// Cleanup.
virtual void destroy (void);
-private:
- friend int tao_yyparse (void);
-
- // Scope Management Protocol.
- virtual AST_Field *fe_add_field (AST_Field *f);
- virtual AST_Union *fe_add_union (AST_Union *u);
- virtual AST_Structure *fe_add_structure (AST_Structure *s);
- virtual AST_Enum *fe_add_enum (AST_Enum *e);
- virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v);
+ static AST_Decl::NodeType const NT;
};
#endif // _AST_EXCEPTION_AST_EXCEPTION_HH
diff --git a/TAO/TAO_IDL/include/ast_extended_port.h b/TAO/TAO_IDL/include/ast_extended_port.h
index f44748286c7..2874e565b0f 100644
--- a/TAO/TAO_IDL/include/ast_extended_port.h
+++ b/TAO/TAO_IDL/include/ast_extended_port.h
@@ -31,6 +31,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
};
#endif /* AST_EXTENDED_PORT_H */
diff --git a/TAO/TAO_IDL/include/ast_factory.h b/TAO/TAO_IDL/include/ast_factory.h
index b2dc4ba295f..0bee1e12d4f 100644
--- a/TAO/TAO_IDL/include/ast_factory.h
+++ b/TAO/TAO_IDL/include/ast_factory.h
@@ -124,6 +124,8 @@ public:
// Method to add exceptions.
UTL_ExceptList *be_add_exceptions (UTL_ExceptList *t);
+ static AST_Decl::NodeType const NT;
+
protected:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_field.h b/TAO/TAO_IDL/include/ast_field.h
index 3c5f9de1e35..f2bcf39eec4 100644
--- a/TAO/TAO_IDL/include/ast_field.h
+++ b/TAO/TAO_IDL/include/ast_field.h
@@ -132,6 +132,8 @@ public:
// Cleanup.
virtual void destroy (void);
+ static AST_Decl::NodeType const NT;
+
protected:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_finder.h b/TAO/TAO_IDL/include/ast_finder.h
index ad363897b8c..8e6b55f3688 100644
--- a/TAO/TAO_IDL/include/ast_finder.h
+++ b/TAO/TAO_IDL/include/ast_finder.h
@@ -28,6 +28,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
};
#endif // TAO_IDL_AST_FINDER_H
diff --git a/TAO/TAO_IDL/include/ast_home.h b/TAO/TAO_IDL/include/ast_home.h
index 547b6aae8bd..ae0379dd431 100644
--- a/TAO/TAO_IDL/include/ast_home.h
+++ b/TAO/TAO_IDL/include/ast_home.h
@@ -59,6 +59,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
private:
// Scope Management Protocol.
diff --git a/TAO/TAO_IDL/include/ast_interface.h b/TAO/TAO_IDL/include/ast_interface.h
index 2e59a7444a5..c9fd4533202 100644
--- a/TAO/TAO_IDL/include/ast_interface.h
+++ b/TAO/TAO_IDL/include/ast_interface.h
@@ -153,6 +153,9 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ static AST_Decl::NodeType const NT;
+ typedef AST_InterfaceFwd FWD_TYPE;
+
protected:
// Data.
@@ -203,8 +206,6 @@ protected:
virtual AST_Attribute *fe_add_attribute (AST_Attribute *a);
- virtual AST_Field *fe_add_field (AST_Field *o);
-
virtual AST_Operation *fe_add_operation (AST_Operation *o);
virtual AST_Union *fe_add_union (AST_Union *u);
diff --git a/TAO/TAO_IDL/include/ast_interface_fwd.h b/TAO/TAO_IDL/include/ast_interface_fwd.h
index 925f55bbc70..7aeea93db91 100644
--- a/TAO/TAO_IDL/include/ast_interface_fwd.h
+++ b/TAO/TAO_IDL/include/ast_interface_fwd.h
@@ -108,6 +108,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ static AST_Decl::NodeType const NT;
+
private:
AST_Interface *pd_full_definition;
// The interface this is a forward declaration of.
diff --git a/TAO/TAO_IDL/include/ast_mirror_port.h b/TAO/TAO_IDL/include/ast_mirror_port.h
index 1b7834d5914..60d926ecc33 100644
--- a/TAO/TAO_IDL/include/ast_mirror_port.h
+++ b/TAO/TAO_IDL/include/ast_mirror_port.h
@@ -28,6 +28,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
};
#endif /* AST_MIRROR_PORT_H */
diff --git a/TAO/TAO_IDL/include/ast_module.h b/TAO/TAO_IDL/include/ast_module.h
index d919f8d55f6..1918a7d8cf7 100644
--- a/TAO/TAO_IDL/include/ast_module.h
+++ b/TAO/TAO_IDL/include/ast_module.h
@@ -114,7 +114,7 @@ public:
// Has this node been referenced here already?
// Override of method in UTL_Scope.
virtual bool referenced (AST_Decl *e,
- Identifier *id = 0);
+ Identifier *id = 0);
// Add decls from previous opening of this module to the
// 'previous' set of this module, along with the argument's
@@ -134,6 +134,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ static AST_Decl::NodeType const NT;
+
private:
friend void fe_populate_global_scope (AST_Module *m);
friend int tao_yyparse (void);
diff --git a/TAO/TAO_IDL/include/ast_native.h b/TAO/TAO_IDL/include/ast_native.h
index 719e2a67915..6d79ca8a5ee 100644
--- a/TAO/TAO_IDL/include/ast_native.h
+++ b/TAO/TAO_IDL/include/ast_native.h
@@ -40,6 +40,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
};
#endif /* AST_NATIVE_H */
diff --git a/TAO/TAO_IDL/include/ast_operation.h b/TAO/TAO_IDL/include/ast_operation.h
index d1aef80a39a..48d0077e3c0 100644
--- a/TAO/TAO_IDL/include/ast_operation.h
+++ b/TAO/TAO_IDL/include/ast_operation.h
@@ -149,6 +149,8 @@ public:
// Method to add exceptions
UTL_ExceptList *be_add_exceptions (UTL_ExceptList *t);
+ static AST_Decl::NodeType const NT;
+
protected:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_param_holder.h b/TAO/TAO_IDL/include/ast_param_holder.h
index e3358fe273b..0f8fcb8a6a9 100644
--- a/TAO/TAO_IDL/include/ast_param_holder.h
+++ b/TAO/TAO_IDL/include/ast_param_holder.h
@@ -31,6 +31,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ static AST_Decl::NodeType const NT;
+
private:
FE_Utils::T_Param_Info *info_;
};
diff --git a/TAO/TAO_IDL/include/ast_porttype.h b/TAO/TAO_IDL/include/ast_porttype.h
index feabf056b20..27306bcc055 100644
--- a/TAO/TAO_IDL/include/ast_porttype.h
+++ b/TAO/TAO_IDL/include/ast_porttype.h
@@ -35,6 +35,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
protected:
virtual AST_Provides *fe_add_provides (AST_Provides *p);
diff --git a/TAO/TAO_IDL/include/ast_predefined_type.h b/TAO/TAO_IDL/include/ast_predefined_type.h
index e076bbe1ee4..24e48d991a2 100644
--- a/TAO/TAO_IDL/include/ast_predefined_type.h
+++ b/TAO/TAO_IDL/include/ast_predefined_type.h
@@ -124,6 +124,8 @@ public:
// Cleanup.
virtual void destroy (void);
+ static AST_Decl::NodeType const NT;
+
protected:
virtual int compute_size_type (void);
// Compute the size type if it is unknown.
diff --git a/TAO/TAO_IDL/include/ast_provides.h b/TAO/TAO_IDL/include/ast_provides.h
index 244954fb32f..8d4b5546092 100644
--- a/TAO/TAO_IDL/include/ast_provides.h
+++ b/TAO/TAO_IDL/include/ast_provides.h
@@ -28,6 +28,8 @@ public:
// Cleanup.
virtual void destroy (void);
+
+ static AST_Decl::NodeType const NT;
};
#endif // AST_PROVIDES_H
diff --git a/TAO/TAO_IDL/include/ast_publishes.h b/TAO/TAO_IDL/include/ast_publishes.h
index ceb225e7b80..a6208a1f59f 100644
--- a/TAO/TAO_IDL/include/ast_publishes.h
+++ b/TAO/TAO_IDL/include/ast_publishes.h
@@ -30,6 +30,8 @@ public:
// Cleanup.
virtual void destroy (void);
+
+ static AST_Decl::NodeType const NT;
};
#endif // AST_PUBLISHES_H
diff --git a/TAO/TAO_IDL/include/ast_root.h b/TAO/TAO_IDL/include/ast_root.h
index 133c5c2c642..90e39ee64c4 100644
--- a/TAO/TAO_IDL/include/ast_root.h
+++ b/TAO/TAO_IDL/include/ast_root.h
@@ -99,6 +99,8 @@ public:
// Final cleanup.
void fini (void);
+ static AST_Decl::NodeType const NT;
+
private:
friend class FE_Declarator;
friend int tao_yyparse (void);
diff --git a/TAO/TAO_IDL/include/ast_sequence.h b/TAO/TAO_IDL/include/ast_sequence.h
index 42646602968..70f54e134ce 100644
--- a/TAO/TAO_IDL/include/ast_sequence.h
+++ b/TAO/TAO_IDL/include/ast_sequence.h
@@ -121,6 +121,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ static AST_Decl::NodeType const NT;
+
private:
// Data.
AST_Expression *pd_max_size;
diff --git a/TAO/TAO_IDL/include/ast_string.h b/TAO/TAO_IDL/include/ast_string.h
index a786dd9f60a..c11d73324e0 100644
--- a/TAO/TAO_IDL/include/ast_string.h
+++ b/TAO/TAO_IDL/include/ast_string.h
@@ -107,6 +107,8 @@ public:
// Cleanup.
virtual void destroy (void);
+ static AST_Decl::NodeType const NT;
+
private:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_structure.h b/TAO/TAO_IDL/include/ast_structure.h
index d93f06a388b..bdd952aa5c4 100644
--- a/TAO/TAO_IDL/include/ast_structure.h
+++ b/TAO/TAO_IDL/include/ast_structure.h
@@ -151,6 +151,11 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ // Accessor for the member.
+ ACE_Unbounded_Queue<AST_Field *> &fields (void);
+
+ static AST_Decl::NodeType const NT;
protected:
friend int tao_yyparse (void);
diff --git a/TAO/TAO_IDL/include/ast_structure_fwd.h b/TAO/TAO_IDL/include/ast_structure_fwd.h
index 75db243bc69..e0ccf980c36 100644
--- a/TAO/TAO_IDL/include/ast_structure_fwd.h
+++ b/TAO/TAO_IDL/include/ast_structure_fwd.h
@@ -39,6 +39,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ static AST_Decl::NodeType const NT;
+
private:
AST_Structure *pd_full_definition;
// The structure this is a forward declaration of.
diff --git a/TAO/TAO_IDL/include/ast_template_module.h b/TAO/TAO_IDL/include/ast_template_module.h
index 618efcb3fd2..41a51e9fda1 100644
--- a/TAO/TAO_IDL/include/ast_template_module.h
+++ b/TAO/TAO_IDL/include/ast_template_module.h
@@ -46,6 +46,8 @@ public:
AST_Template_Module_Ref *fe_add_template_module_ref (
AST_Template_Module_Ref *m);
+ static AST_Decl::NodeType const NT;
+
protected:
FE_Utils::T_PARAMLIST_INFO * template_params_;
diff --git a/TAO/TAO_IDL/include/ast_template_module_inst.h b/TAO/TAO_IDL/include/ast_template_module_inst.h
index 2d40c1c6e10..ebe5e3c0d6c 100644
--- a/TAO/TAO_IDL/include/ast_template_module_inst.h
+++ b/TAO/TAO_IDL/include/ast_template_module_inst.h
@@ -35,6 +35,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
private:
FE_Utils::T_ARGLIST * template_args_;
diff --git a/TAO/TAO_IDL/include/ast_template_module_ref.h b/TAO/TAO_IDL/include/ast_template_module_ref.h
index 66c21b14391..f592554ab39 100644
--- a/TAO/TAO_IDL/include/ast_template_module_ref.h
+++ b/TAO/TAO_IDL/include/ast_template_module_ref.h
@@ -35,6 +35,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ static AST_Decl::NodeType const NT;
+
private:
UTL_StrList * param_refs_;
};
diff --git a/TAO/TAO_IDL/include/ast_typedef.h b/TAO/TAO_IDL/include/ast_typedef.h
index 711ac151be7..e5ce4633bd4 100644
--- a/TAO/TAO_IDL/include/ast_typedef.h
+++ b/TAO/TAO_IDL/include/ast_typedef.h
@@ -115,6 +115,8 @@ public:
// Cleanup.
virtual void destroy (void);
+ static AST_Decl::NodeType const NT;
+
protected:
virtual int compute_size_type (void);
// Compute the size type if it is unknown.
diff --git a/TAO/TAO_IDL/include/ast_union.h b/TAO/TAO_IDL/include/ast_union.h
index c38a01df8ff..b9c3627a8f1 100644
--- a/TAO/TAO_IDL/include/ast_union.h
+++ b/TAO/TAO_IDL/include/ast_union.h
@@ -144,6 +144,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ static AST_Decl::NodeType const NT;
+
protected:
virtual int compute_size_type (void);
// Compute the size type if it is unknown.
diff --git a/TAO/TAO_IDL/include/ast_union_branch.h b/TAO/TAO_IDL/include/ast_union_branch.h
index ef4a2f4ea22..3d36f980f90 100644
--- a/TAO/TAO_IDL/include/ast_union_branch.h
+++ b/TAO/TAO_IDL/include/ast_union_branch.h
@@ -122,6 +122,8 @@ public:
// Cleanup.
virtual void destroy (void);
+ static AST_Decl::NodeType const NT;
+
private:
// list of labels.
UTL_LabelList *pd_ll;
diff --git a/TAO/TAO_IDL/include/ast_union_fwd.h b/TAO/TAO_IDL/include/ast_union_fwd.h
index a731f4ad768..d1a39d78cb2 100644
--- a/TAO/TAO_IDL/include/ast_union_fwd.h
+++ b/TAO/TAO_IDL/include/ast_union_fwd.h
@@ -32,6 +32,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
};
#endif // _AST_UNION_FWD_AST_UNION_FWD_HH
diff --git a/TAO/TAO_IDL/include/ast_uses.h b/TAO/TAO_IDL/include/ast_uses.h
index 48bc0dd6794..0d3b7f00eba 100644
--- a/TAO/TAO_IDL/include/ast_uses.h
+++ b/TAO/TAO_IDL/include/ast_uses.h
@@ -30,6 +30,8 @@ public:
// Cleanup.
virtual void destroy (void);
+
+ static AST_Decl::NodeType const NT;
private:
bool is_multiple_;
diff --git a/TAO/TAO_IDL/include/ast_valuebox.h b/TAO/TAO_IDL/include/ast_valuebox.h
index 7cdfc40d51c..56d791c81ad 100644
--- a/TAO/TAO_IDL/include/ast_valuebox.h
+++ b/TAO/TAO_IDL/include/ast_valuebox.h
@@ -34,6 +34,8 @@ public:
// Cleanup.
virtual void destroy (void);
+ static AST_Decl::NodeType const NT;
+
protected:
AST_Type *pd_boxed_type;
};
diff --git a/TAO/TAO_IDL/include/ast_valuetype.h b/TAO/TAO_IDL/include/ast_valuetype.h
index 344570c7886..e412e31d614 100644
--- a/TAO/TAO_IDL/include/ast_valuetype.h
+++ b/TAO/TAO_IDL/include/ast_valuetype.h
@@ -70,6 +70,9 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+ static AST_Decl::NodeType const NT;
+ typedef AST_ValueTypeFwd FWD_TYPE;
+
protected:
AST_Type **pd_supports;
long pd_n_supports;
@@ -81,6 +84,8 @@ protected:
protected:
virtual AST_Factory *fe_add_factory (AST_Factory *f);
+ virtual AST_Field *fe_add_field (AST_Field *o);
+
bool derived_from_primary_key_base (const AST_ValueType *node,
const AST_ValueType *pk_base) const;
AST_ValueType *lookup_primary_key_base (void) const;
diff --git a/TAO/TAO_IDL/include/ast_valuetype_fwd.h b/TAO/TAO_IDL/include/ast_valuetype_fwd.h
index 2d525efbc01..dc455c3915d 100644
--- a/TAO/TAO_IDL/include/ast_valuetype_fwd.h
+++ b/TAO/TAO_IDL/include/ast_valuetype_fwd.h
@@ -30,6 +30,8 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ static AST_Decl::NodeType const NT;
};
#endif // _AST_INTERFACE_FWD_AST_VALUETYPE_FWD_HH
diff --git a/TAO/TAO_IDL/include/utl_scope.h b/TAO/TAO_IDL/include/utl_scope.h
index f9f697010da..cf9c8edb1c2 100644
--- a/TAO/TAO_IDL/include/utl_scope.h
+++ b/TAO/TAO_IDL/include/utl_scope.h
@@ -316,7 +316,26 @@ protected:
friend class AST_Enum;
friend class IDL_GlobalData;
- // Scope Management Protocol.
+ /// Scope Management Protocol.
+
+ /// Common code for most basic adding action.
+ AST_Decl *fe_add_decl (AST_Decl *d);
+
+ /// Specialized for types that reference another type.
+ AST_Field *fe_add_ref_decl (AST_Field *d);
+
+ template<typename DECL>
+ DECL *fe_add_full_intf_decl (DECL *t);
+
+ template<typename FULL_DECL>
+ typename FULL_DECL::FWD_TYPE *fe_add_fwd_intf_decl (
+ typename FULL_DECL::FWD_TYPE *t);
+
+ AST_Structure *fe_add_full_struct_type (AST_Structure *t);
+ AST_StructureFwd *fe_add_fwd_struct_type (AST_StructureFwd *t);
+
+ /// No-op base class version of the specialized adding actions.
+
virtual
AST_PredefinedType *fe_add_predefined_type (
AST_PredefinedType *t);
@@ -454,6 +473,16 @@ protected:
virtual
AST_Mirror_Port *fe_add_mirror_port (AST_Mirror_Port *mp);
+
+private:
+ /// Checks called from fe_add_decl() specific to interfaces
+ /// (and its subtypes) and operations respectively.
+ bool inherited_op_attr_clash (AST_Decl *t);
+ bool arg_specific_error (AST_Decl *t);
+
+ /// Encapsulates the vagaries of adding fields vs decls to
+ /// structs/unions vs other types.
+ void smart_local_add (AST_Decl *t);
};
// Active iterator for a UTL_Scope node
@@ -495,4 +524,12 @@ private:
long il;
};
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "utl_tmpl/UTL_Scope_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("utl_tmpl/UTL_Scope_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
#endif // _UTL_SCOPE_UTL_SCOPE_HH
diff --git a/TAO/TAO_IDL/include/utl_tmpl/UTL_Scope_T.cpp b/TAO/TAO_IDL/include/utl_tmpl/UTL_Scope_T.cpp
new file mode 100644
index 00000000000..b1b79f38411
--- /dev/null
+++ b/TAO/TAO_IDL/include/utl_tmpl/UTL_Scope_T.cpp
@@ -0,0 +1,172 @@
+template<typename DECL>
+DECL *
+UTL_Scope::fe_add_full_intf_decl (DECL *t)
+{
+ if (t->redef_clash ())
+ {
+ return 0;
+ }
+
+ AST_Decl *predef = 0;
+ DECL *fwd = 0;
+
+ // Already defined?
+ if ((predef = this->lookup_for_add (t, false)) != 0)
+ {
+ // Treat fwd declared interfaces specially
+ if (predef->node_type () == DECL::NT)
+ {
+ fwd = DECL::narrow_from_decl (predef);
+
+ if (fwd == 0)
+ {
+ return 0;
+ }
+
+ // Forward declared and not defined yet.
+ if (!fwd->is_defined ())
+ {
+ if (fwd->defined_in () != this)
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT,
+ fwd,
+ t,
+ ScopeAsDecl (this));
+
+ return 0;
+ }
+ }
+ // OK, not illegal redef of forward declaration. Now check whether.
+ // it has been referenced already.
+ else if (this->referenced (predef, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ ScopeAsDecl (this),
+ predef);
+
+ return 0;
+ }
+
+ }
+ else if (!can_be_redefined (predef))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ ScopeAsDecl (this),
+ predef);
+
+ return 0;
+ }
+ else if (referenced (predef, t->local_name ()) && !t->is_defined ())
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ ScopeAsDecl (this),
+ predef);
+
+ return 0;
+ }
+ else if (t->has_ancestor (predef))
+ {
+ idl_global->err ()->redefinition_in_scope (t, predef);
+
+ return 0;
+ }
+ }
+
+ // Add it to scope
+ this->add_to_scope (t);
+
+ // We do this for interfaces, valuetypes and components in
+ // a different place than we do for structs and unions,
+ // since fwd declared structs and unions must be defined in
+ // the same translation unit.
+ AST_InterfaceFwd *fd = t->fwd_decl ();
+
+ if (0 != fd)
+ {
+ fd->set_as_defined ();
+ }
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+ return t;
+}
+
+template<typename FULL_DECL>
+typename FULL_DECL::FWD_TYPE *
+UTL_Scope::fe_add_fwd_intf_decl (typename FULL_DECL::FWD_TYPE *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, false)) != 0)
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+
+ // There used to be another check here ANDed with the one below:
+ // d->defined_in () == this. But lookup_for_add calls only
+ // lookup_by_name_local(), which does not bump up the scope,
+ // and look_in_previous() for modules. If look_in_previous()
+ // finds something, the scopes will NOT be the same pointer
+ // value, but the result is what we want.
+ if (nt == FULL_DECL::NT)
+ {
+ FULL_DECL *itf = FULL_DECL::narrow_from_decl (d);
+
+ if (itf == 0)
+ {
+ return 0;
+ }
+
+ // 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
+ // get destroyed twice.
+ if (itf->is_defined ())
+ {
+ if (!t->is_defined ())
+ {
+ AST_Interface *prev_fd = t->full_definition ();
+ prev_fd->destroy ();
+ // No need to delete prev_fd, the call to
+ // set_full_definition() below will do it.
+ }
+
+ t->set_full_definition (itf);
+ t->set_as_defined ();
+ }
+ }
+
+ if (!can_be_redefined (d)) {
+
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ ScopeAsDecl (this),
+ d);
+ return 0;
+ }
+
+ // No need to call referenced() for forward declared interafces,
+ // they can be redeclared after referencing.
+
+ 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;
+}
diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp
index 581638442b6..93f4cabe624 100644
--- a/TAO/TAO_IDL/util/utl_scope.cpp
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -105,6 +105,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ast_factory.h"
#include "ast_visitor.h"
#include "ast_generator.h"
+#include "ast_extern.h"
#include "nr_extern.h"
#include "fe_extern.h"
@@ -531,6 +532,199 @@ UTL_Scope::check_for_predef_seq (AST_Decl *d)
// operations which should have been redefined to allow certain kinds of
// AST nodes to appear in a given context.
+AST_Decl *
+UTL_Scope::fe_add_decl (AST_Decl *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,
+ ScopeAsDecl (this),
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ ScopeAsDecl (this),
+ d);
+ return 0;
+ }
+
+ if (t->has_ancestor (d))
+ {
+ idl_global->err ()->redefinition_in_scope (t, d);
+ return 0;
+ }
+ }
+ else if (this->inherited_op_attr_clash (t))
+ {
+ return 0;
+ }
+
+ if (this->arg_specific_error (t))
+ {
+ return 0;
+ }
+
+ this->smart_local_add (t);
+
+ // Add it to set of locally referenced symbols, unless it is
+ // a home, in which case it will clash when the equivalent
+ // interface is created.
+ if (t->node_type () != AST_Decl::NT_home)
+ {
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+ }
+
+ return t;
+}
+
+AST_Field *
+UTL_Scope::fe_add_ref_decl (AST_Field *t)
+{
+ AST_Decl *d = this->fe_add_decl (t);
+
+ if (d != 0)
+ {
+ 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 ());
+ }
+ }
+
+ /// Catches struct/union/exception which all maintain a queue
+ /// for fields as distinct from decls and enum values.
+ AST_Structure *s = AST_Structure::narrow_from_scope (this);
+
+ if (s != 0)
+ {
+ s->fields ().enqueue_tail (t);
+ }
+
+ return AST_Field::narrow_from_decl (d);
+}
+
+AST_Structure *
+UTL_Scope::fe_add_full_struct_type (AST_Structure *t)
+{
+ AST_Decl *predef = 0;
+
+ if ((predef = this->lookup_for_add (t, false)) != 0)
+ {
+ if (!can_be_redefined (predef))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ ScopeAsDecl (this),
+ predef);
+
+ return 0;
+ }
+ else if (referenced (predef, t->local_name ())
+ && !t->is_defined ())
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ ScopeAsDecl (this),
+ predef);
+
+ return 0;
+ }
+ }
+
+ AST_Decl::NodeType nt = ScopeAsDecl (this)->node_type ();
+
+ /// Decls inside a struct or union are also referenced by
+ /// fields, and so must be handled differently.
+ if (nt == AST_Decl::NT_struct || nt == AST_Decl::NT_union)
+ {
+ this->add_to_local_types (t);
+ }
+ else
+ {
+ this->add_to_scope (t);
+ }
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (t,
+ false,
+ t->local_name ());
+
+ return t;
+}
+
+AST_StructureFwd *
+UTL_Scope::fe_add_fwd_struct_type (AST_StructureFwd *t)
+{
+ AST_Decl *d = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((d = this->lookup_for_add (t, false)) != 0)
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+
+ // There used to be another check here ANDed with the one below:
+ // d->defined_in () == this. But lookup_for_add calls only
+ // lookup_by_name_local(), which does not bump up the scope,
+ // and look_in_previous() for modules. If look_in_previous()
+ // finds something, the scopes will NOT be the same pointer
+ // value, but the result is what we want.
+ if (nt == AST_Decl::NT_struct)
+ {
+ AST_Structure *s = AST_Structure::narrow_from_decl (d);
+ t->set_full_definition (s);
+ }
+ else
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ ScopeAsDecl (this),
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ ScopeAsDecl (this),
+ 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 ());
+
+ // Must check later that all struct and union forward declarations
+ // are defined in the same IDL file.
+ AST_record_fwd_decl (t);
+ return t;
+}
+
AST_PredefinedType *
UTL_Scope::fe_add_predefined_type (AST_PredefinedType *)
{
@@ -1119,9 +1313,11 @@ UTL_Scope::lookup_by_name_local (Identifier *e,
{
AST_Decl::NodeType nt = d->node_type ();
- // Special case for forward declared interfaces,
+ // Special case for forward declared types,
// In this case, we want to return
- // the full definition member, whether defined yet or not
+ // the full definition member, whether defined yet or not.
+ // NOTE: corresponding full_definition fe_add_* methods
+ // depend on the behavior below!
if (nt == AST_Decl::NT_interface_fwd
|| nt == AST_Decl::NT_valuetype_fwd
|| nt == AST_Decl::NT_component_fwd
@@ -2093,7 +2289,110 @@ UTL_Scope::destroy (void)
this->pd_referenced_used = 0;
}
+bool
+UTL_Scope::inherited_op_attr_clash (AST_Decl *t)
+{
+ AST_Interface *i = AST_Interface::narrow_from_scope (this);
+
+ if (i == 0)
+ {
+ return false;
+ }
+
+ AST_Decl *d = i->look_in_inherited (t->name (), false);
+
+ if (d != 0)
+ {
+ AST_Decl::NodeType nt = d->node_type ();
+
+ if (nt == AST_Decl::NT_attr || nt == AST_Decl::NT_op)
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ i,
+ d);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool
+UTL_Scope::arg_specific_error (AST_Decl *t)
+{
+ AST_Operation *op = AST_Operation::narrow_from_scope (this);
+
+ if (op == 0)
+ {
+ return false;
+ }
+
+ AST_Argument *arg = AST_Argument::narrow_from_decl (t);
+ AST_Argument::Direction d = arg->direction ();
+ AST_Operation::Flags flag = op->flags ();
+
+ /// Cannot add OUT or INOUT argument to oneway operation.
+ if ((d == AST_Argument::dir_OUT || d == AST_Argument::dir_INOUT)
+ && flag == AST_Operation::OP_oneway)
+ {
+ idl_global->err ()->error2 (UTL_Error::EIDL_ONEWAY_CONFLICT,
+ t,
+ op);
+ return true;
+ }
+ AST_Type *arg_type = arg->field_type ();
+
+ /// This error is not caught in y.tab.cpp so we check for it here.
+ if (arg_type->node_type () == AST_Decl::NT_array
+ && arg_type->anonymous ())
+ {
+ idl_global->err ()->syntax_error (idl_global->parse_state ());
+ return true;
+ }
+
+ return false;
+}
+
+void
+UTL_Scope::smart_local_add (AST_Decl *t)
+{
+ /// Catches struct, union * exception
+ AST_Structure *s = AST_Structure::narrow_from_scope (this);
+
+ /// Catches AST_Field and AST_UnionBranch.
+ AST_Field *f = AST_Field::narrow_from_decl (t);
+
+ /// Decls inside a struct/union/exception are also referenced by
+ /// fields, and so must be handled differently.
+ if (s != 0 && f == 0)
+ {
+ this->add_to_local_types (t);
+ }
+ else
+ {
+ this->add_to_scope (t);
+ }
+
+ AST_Union *u = AST_Union::narrow_from_scope (this);
+ AST_UnionBranch *ub = AST_UnionBranch::narrow_from_decl (t);
+
+ // If we have an enum discriminator, add the label names to
+ // the name_referenced list before we add the union branch,
+ // so a branch name clash with a label name will be caught.
+ if (u != 0 && ub != 0)
+ {
+ if (u->udisc_type () == AST_Expression::EV_enum)
+ {
+ ub->add_labels (u);
+ }
+ else
+ {
+ ub->coerce_labels (u);
+ }
+ }
+}
IMPL_NARROW_FROM_SCOPE(UTL_Scope)