diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-01-12 05:00:29 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-01-12 05:00:29 +0000 |
commit | a7d7baf2289becec8d80d672b0525b4b67a1fc77 (patch) | |
tree | ccf580684cb3905748db083465c9d6c62e954460 /TAO | |
parent | 472e4be228065da65e4f3dc40c5010c9c5d977a5 (diff) | |
download | ATCD-a7d7baf2289becec8d80d672b0525b4b67a1fc77.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog-99c | 9 | ||||
-rw-r--r-- | TAO/TAO_IDL/include/utl_scope.h | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_scope.cpp | 107 |
3 files changed, 70 insertions, 49 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index 2136d3e59d7..bcfca298c01 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -1,3 +1,12 @@ +Mon Jan 11 22:56:26 1999 Jeff Parsons <jp4@cs.wustl.edu> + + * tao_idl/include/utl_scope.h: + * tao_idl/utl_scope.cpp: + Added a patch sent in by Hamish Friedlander. This patch + modified his previous patch (which enabled re-opening of + modules) to further enable scoped lookups on these + re-opened modules. + Mon Jan 11 21:20:23 1999 Nanbor Wang <nanbor@cs.wustl.edu> * tao/GIOP.cpp (send_request): Fixed typos. diff --git a/TAO/TAO_IDL/include/utl_scope.h b/TAO/TAO_IDL/include/utl_scope.h index e4102d5bb06..9fb67002cf3 100644 --- a/TAO/TAO_IDL/include/utl_scope.h +++ b/TAO/TAO_IDL/include/utl_scope.h @@ -163,7 +163,8 @@ public: // Look up the Identifier * specified only in the local scope virtual AST_Decl *lookup_by_name_local(Identifier *, - idl_bool treat_as_ref); + idl_bool treat_as_ref, + long index = 0); // Look up a predefined type by its ExprType virtual AST_Decl diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp index 63176110668..273d0358d79 100644 --- a/TAO/TAO_IDL/util/utl_scope.cpp +++ b/TAO/TAO_IDL/util/utl_scope.cpp @@ -794,7 +794,9 @@ UTL_Scope::look_in_inherited(UTL_ScopedName *e, idl_bool treat_as_ref) * Look up a String * in local scope only */ AST_Decl * -UTL_Scope::lookup_by_name_local(Identifier *e, idl_bool) +UTL_Scope::lookup_by_name_local(Identifier *e, + idl_bool treat_as_ref, + long index) { UTL_ScopeActiveIterator *i = new UTL_ScopeActiveIterator(this, UTL_Scope::IK_both); @@ -807,19 +809,24 @@ UTL_Scope::lookup_by_name_local(Identifier *e, idl_bool) while (!(i->is_done())) { d = i->item(); if (d->local_name() != NULL && d->local_name()->compare(e)) { - delete i; - /* - * Special case for forward declared interfaces. Look through the - * forward declaration and retrieve the full definition - */ - if (d->node_type() == AST_Decl::NT_interface_fwd) { - fwd = AST_InterfaceFwd::narrow_from_decl(d); - if (fwd == NULL) - d = NULL; - else - d = fwd->full_definition(); + if (index == 0) { + delete i; + /* + * Special case for forward declared interfaces. Look through the + * forward declaration and retrieve the full definition + */ + if (d->node_type() == AST_Decl::NT_interface_fwd) { + fwd = AST_InterfaceFwd::narrow_from_decl(d); + if (fwd == NULL) + d = NULL; + else + d = fwd->full_definition(); + } + return d; + } + else { + index--; } - return d; } i->next(); } @@ -888,27 +895,45 @@ UTL_Scope::lookup_by_name(UTL_ScopedName *e, idl_bool treat_as_ref) * * Is name defined here? */ - d = lookup_by_name_local(e->head(), treat_as_ref); - if (d == NULL) { - /* - * OK, not found. Go down parent scope chain. - */ - d = ScopeAsDecl(this); - if (d != NULL) { - t = d->defined_in(); - if (t == NULL) - d = NULL; - else - d = t->lookup_by_name(e, treat_as_ref); + long index = 0 ; + while (true) { + d = lookup_by_name_local(e->head(), treat_as_ref, index); + if (d == NULL) { + /* + * OK, not found. Go down parent scope chain. + */ + d = ScopeAsDecl(this); + if (d != NULL) { + t = d->defined_in(); + if (t == NULL) + d = NULL; + else + d = t->lookup_by_name(e, treat_as_ref); + } + /* + * Special case for scope which is an interface. We have to look + * in the inherited interfaces as well.. + */ + if (d == NULL) { + if (pd_scope_node_type == AST_Decl::NT_interface) + d = look_in_inherited(e, treat_as_ref); + } + /* + * If treat_as_ref is true and d is not NULL, add d to + * set of nodes referenced here + */ + if (treat_as_ref && d != NULL) + add_to_referenced(d, I_FALSE); + /* + * OK, now return whatever we found + */ + return d; } /* - * Special case for scope which is an interface. We have to look - * in the inherited interfaces as well.. + * OK, start of name is defined. Now loop doing local lookups + * of subsequent elements of the name */ - if (d == NULL) { - if (pd_scope_node_type == AST_Decl::NT_interface) - d = look_in_inherited(e, treat_as_ref); - } + d = iter_lookup_by_name_local(d, e, treat_as_ref); /* * If treat_as_ref is true and d is not NULL, add d to * set of nodes referenced here @@ -916,25 +941,11 @@ UTL_Scope::lookup_by_name(UTL_ScopedName *e, idl_bool treat_as_ref) if (treat_as_ref && d != NULL) add_to_referenced(d, I_FALSE); /* - * OK, now return whatever we found + * All OK, name fully resolved */ - return d; + if ( d != NULL ) return d; + else index++ ; } - /* - * OK, start of name is defined. Now loop doing local lookups - * of subsequent elements of the name - */ - d = iter_lookup_by_name_local(d, e, treat_as_ref); - /* - * If treat_as_ref is true and d is not NULL, add d to set - * of nodes referenced here. - */ - if (treat_as_ref && d != NULL) - add_to_referenced(d, I_FALSE); - /* - * All OK, name fully resolved - */ - return d; } // Add a node to set of nodes referenced in this scope |