diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-01-27 20:09:20 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-01-27 20:09:20 +0000 |
commit | 85fa97286024c442de6fbcd389ccff671529407f (patch) | |
tree | 1a8cb18c484b77cdae19d90f0f3a089fa8d600a7 | |
parent | ce23e630cca0e3e8330f18cca7fbb4af9c331a06 (diff) | |
download | ATCD-85fa97286024c442de6fbcd389ccff671529407f.tar.gz |
ChangeLogTag: Wed Jan 27 20:08:48 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | modules/TAO/ChangeLog | 21 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/ast/ast_enum.cpp | 5 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/ast/ast_union_branch.cpp | 8 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/ast/ast_visitor_reifying.cpp | 2 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_inst.cpp | 115 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_ref.cpp | 4 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/be/be_union_label.cpp | 4 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/include/ast_union.h | 2 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/include/ast_union_branch.h | 9 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/include/ast_visitor_tmpl_module_inst.h | 7 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/include/utl_labellist.h | 5 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/include/utl_scope.h | 14 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/util/utl_exceptlist.cpp | 13 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/util/utl_idlist.cpp | 20 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/util/utl_labellist.cpp | 46 | ||||
-rw-r--r-- | modules/TAO/TAO_IDL/util/utl_scope.cpp | 91 |
16 files changed, 260 insertions, 106 deletions
diff --git a/modules/TAO/ChangeLog b/modules/TAO/ChangeLog index c4b1bb516ea..dcafd132a84 100644 --- a/modules/TAO/ChangeLog +++ b/modules/TAO/ChangeLog @@ -1,3 +1,24 @@ +Wed Jan 27 20:08:48 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/include/ast_union.h: + * TAO_IDL/include/ast_visitor_tmpl_module_inst.h: + * TAO_IDL/include/utl_labellist.h: + * TAO_IDL/include/ast_union_branch.h: + * TAO_IDL/include/utl_scope.h: + * TAO_IDL/be/be_union_label.cpp: + * TAO_IDL/ast/ast_visitor_tmpl_module_ref.cpp: + * TAO_IDL/ast/ast_visitor_tmpl_module_inst.cpp: + * TAO_IDL/ast/ast_visitor_reifying.cpp: + * TAO_IDL/ast/ast_enum.cpp: + * TAO_IDL/ast/ast_union_branch.cpp: + * TAO_IDL/util/utl_labellist.cpp: + * TAO_IDL/util/utl_exceptlist.cpp: + * TAO_IDL/util/utl_idlist.cpp: + * TAO_IDL/util/utl_scope.cpp: + + Added support for unions and enums in the scope of a + template module. + Tue Jan 26 20:21:30 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/include/ast_visitor_tmpl_module_ref.h: diff --git a/modules/TAO/TAO_IDL/ast/ast_enum.cpp b/modules/TAO/TAO_IDL/ast/ast_enum.cpp index 7acf84649da..679f2278f78 100644 --- a/modules/TAO/TAO_IDL/ast/ast_enum.cpp +++ b/modules/TAO/TAO_IDL/ast/ast_enum.cpp @@ -317,7 +317,10 @@ AST_Enum::fe_add_enum_val (AST_EnumVal *t) t->local_name ()); if (t1 == 0) - return 0; // Prevent dereferencing null pointer in nested calls. + { + // Prevent dereferencing null pointer in nested calls. + return 0; + } // Add it to enclosing scope. idl_global->scopes ().next_to_top ()->fe_add_enum_val (t1); diff --git a/modules/TAO/TAO_IDL/ast/ast_union_branch.cpp b/modules/TAO/TAO_IDL/ast/ast_union_branch.cpp index d62d2557e71..5203c4a023e 100644 --- a/modules/TAO/TAO_IDL/ast/ast_union_branch.cpp +++ b/modules/TAO/TAO_IDL/ast/ast_union_branch.cpp @@ -77,8 +77,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_visitor.h" #include "utl_labellist.h" -ACE_RCSID(ast, ast_union_branch, "$Id$") - AST_UnionBranch::AST_UnionBranch (void) : COMMON_Base (), AST_Decl (), @@ -139,7 +137,11 @@ AST_UnionBranch::destroy (void) this->AST_Field::destroy (); } -// Data accessors. +UTL_LabelList * +AST_UnionBranch::labels (void) const +{ + return this->pd_ll; +} AST_UnionLabel * AST_UnionBranch::label (unsigned long index) diff --git a/modules/TAO/TAO_IDL/ast/ast_visitor_reifying.cpp b/modules/TAO/TAO_IDL/ast/ast_visitor_reifying.cpp index 233e0fce466..7a2cdcf51db 100644 --- a/modules/TAO/TAO_IDL/ast/ast_visitor_reifying.cpp +++ b/modules/TAO/TAO_IDL/ast/ast_visitor_reifying.cpp @@ -509,7 +509,7 @@ ast_visitor_reifying::visit_param_holder (AST_Param_Holder *node) FE_Utils::T_Param_Info *item = 0; iter.next (item); - if (item == node->info ()) + if (item->name_ == node->info ()->name_) { AST_Decl **ret_ptr = 0; diff --git a/modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_inst.cpp b/modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_inst.cpp index 78fbe2dec75..a21216ca732 100644 --- a/modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_inst.cpp +++ b/modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_inst.cpp @@ -33,6 +33,9 @@ #include "ast_typedef.h" #include "ast_constant.h" #include "ast_union.h" +#include "ast_union_branch.h" +#include "ast_enum.h" +#include "ast_enum_val.h" #include "ast_factory.h" #include "ast_param_holder.h" #include "ast_expression.h" @@ -42,6 +45,7 @@ #include "utl_namelist.h" #include "utl_identifier.h" #include "utl_exceptlist.h" +#include "utl_labellist.h" #include "fe_obv_header.h" #include "fe_home_header.h" @@ -49,10 +53,12 @@ #include "nr_extern.h" ast_visitor_tmpl_module_inst::ast_visitor_tmpl_module_inst ( - ast_visitor_context *ctx) + ast_visitor_context *ctx, + bool ref_only) : ast_visitor (), ctx_ (ctx), - for_eventtype_ (false) + for_eventtype_ (false), + ref_only_ (ref_only) { } @@ -515,14 +521,63 @@ ast_visitor_tmpl_module_inst::visit_expression (AST_Expression *) } int -ast_visitor_tmpl_module_inst::visit_enum (AST_Enum *) +ast_visitor_tmpl_module_inst::visit_enum (AST_Enum *node) { + UTL_ScopedName sn (node->local_name (), 0); + + AST_Enum *added_enum = + idl_global->gen ()->create_enum (&sn, + node->is_local (), + node->is_abstract ()); + + idl_global->scopes ().top ()->add_to_scope (added_enum); + + idl_global->scopes ().push (added_enum); + + if (this->visit_scope (node) != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ast_visitor_tmpl_module_inst::") + ACE_TEXT ("visit_enum - ") + ACE_TEXT ("visit_scope failed\n")), + -1); + } + + idl_global->scopes ().pop (); + return 0; } int -ast_visitor_tmpl_module_inst::visit_union (AST_Union *) +ast_visitor_tmpl_module_inst::visit_union (AST_Union *node) { + UTL_ScopedName sn (node->local_name (), 0); + + AST_Union *added_union = + idl_global->gen ()->create_union (node->disc_type (), + &sn, + node->is_local (), + node->is_abstract ()); + + idl_global->scopes ().top ()->add_to_scope (added_union); + + // Update our scope stack. + idl_global->scopes ().push (added_union); + + if (this->visit_scope (node) != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ast_visitor_tmpl_module_inst::") + ACE_TEXT ("visit_union - ") + ACE_TEXT ("visit_scope() failed\n")), + -1); + } + + // Through with this scope. + idl_global->scopes ().pop (); + + int dummy = added_union->member_count (); + return 0; } @@ -533,8 +588,28 @@ ast_visitor_tmpl_module_inst::visit_union_fwd (AST_UnionFwd *) } int -ast_visitor_tmpl_module_inst::visit_union_branch (AST_UnionBranch *) +ast_visitor_tmpl_module_inst::visit_union_branch (AST_UnionBranch *node) { + AST_Type *ft = + AST_Type::narrow_from_decl ( + this->reify_type (node->field_type ())); + + UTL_ScopedName sn (node->local_name (), 0); + + // The union branch owns its label list so we have to copy it. + UTL_LabelList *ll = node->labels ()->copy (); + + AST_UnionBranch *added_branch = + idl_global->gen ()->create_union_branch (ll, ft, &sn); + + // fe_add_union_branch() does necessary things besides calling + // add_to_scope() so we need to reuse it. + + AST_Union *u = + AST_Union::narrow_from_scope (idl_global->scopes ().top ()); + + u->fe_add_union_branch (added_branch); + return 0; } @@ -545,8 +620,17 @@ ast_visitor_tmpl_module_inst::visit_union_label (AST_UnionLabel *) } int -ast_visitor_tmpl_module_inst::visit_enum_val (AST_EnumVal *) +ast_visitor_tmpl_module_inst::visit_enum_val (AST_EnumVal *node) { + UTL_ScopedName sn (node->local_name (), 0); + + AST_EnumVal *added_enum_val = + idl_global->gen ()->create_enum_val ( + node->constant_value ()->ev ()->u.ulval, + &sn); + + idl_global->scopes ().top ()->add_to_scope (added_enum_val); + return 0; } @@ -1089,6 +1173,25 @@ ast_visitor_tmpl_module_inst::reify_type (AST_Decl *d) return 0; } + if (this->ref_only_) + { + // If d is a param holder, the lookup will return a heap + // allocation, which we need since this node's destination + // owns param holders. + if (d->node_type () == AST_Decl::NT_param_holder) + { + const char *s = d->full_name (); + return + idl_global->scopes ().top ()->lookup_by_name ( + d->name (), + true); + } + else + { + return d; + } + } + ast_visitor_reifying rv (this->ctx_); if (d->ast_accept (&rv) != 0) diff --git a/modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_ref.cpp b/modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_ref.cpp index 0e657d8ff7c..172f4d6fcc3 100644 --- a/modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_ref.cpp +++ b/modules/TAO/TAO_IDL/ast/ast_visitor_tmpl_module_ref.cpp @@ -20,7 +20,7 @@ ast_visitor_tmpl_module_ref::ast_visitor_tmpl_module_ref ( ast_visitor_context *ctx) - : ast_visitor_tmpl_module_inst (ctx) + : ast_visitor_tmpl_module_inst (ctx, true) { } @@ -54,8 +54,6 @@ ast_visitor_tmpl_module_ref::visit_template_module_ref ( idl_global->scopes ().top ()->add_to_scope (added_module); - AST_Decl *d = ScopeAsDecl (idl_global->scopes ().top ()); - idl_global->scopes ().push (added_module); // Visit the scope of referenced template module. No need to diff --git a/modules/TAO/TAO_IDL/be/be_union_label.cpp b/modules/TAO/TAO_IDL/be/be_union_label.cpp index 27084ad740f..0707dfd59dd 100644 --- a/modules/TAO/TAO_IDL/be/be_union_label.cpp +++ b/modules/TAO/TAO_IDL/be/be_union_label.cpp @@ -5,10 +5,6 @@ #include "be_union_label.h" #include "be_visitor.h" -ACE_RCSID (be, - be_union_label, - "$Id$") - be_union_label::be_union_label (void) : AST_UnionLabel () { diff --git a/modules/TAO/TAO_IDL/include/ast_union.h b/modules/TAO/TAO_IDL/include/ast_union.h index e4d02136405..ca030315a1f 100644 --- a/modules/TAO/TAO_IDL/include/ast_union.h +++ b/modules/TAO/TAO_IDL/include/ast_union.h @@ -175,6 +175,8 @@ private: AST_UnionBranch *lookup_enum (AST_UnionBranch *b); friend int tao_yyparse (void); + friend class ast_visitor_tmpl_module_inst; + // Scope Management Protocol. virtual AST_Union *fe_add_union (AST_Union *u); diff --git a/modules/TAO/TAO_IDL/include/ast_union_branch.h b/modules/TAO/TAO_IDL/include/ast_union_branch.h index 64242af69f0..ef4a2f4ea22 100644 --- a/modules/TAO/TAO_IDL/include/ast_union_branch.h +++ b/modules/TAO/TAO_IDL/include/ast_union_branch.h @@ -92,12 +92,13 @@ public: virtual ~AST_UnionBranch (void); - // Data Accessors. + UTL_LabelList *labels (void) const; + AST_UnionLabel *label (unsigned long index = 0); unsigned long label_list_length (void); - // Called if our labels are enum values - adds them the + // Called if our labels are enum values - adds them to the // enclosing scope's name_referenced list. void add_labels (AST_Union *u); @@ -122,10 +123,8 @@ public: virtual void destroy (void); private: - // Data. - - UTL_LabelList *pd_ll; // list of labels. + UTL_LabelList *pd_ll; }; #endif // _AST_UNION_BRANCH_AST_UNION_BRAN_HH diff --git a/modules/TAO/TAO_IDL/include/ast_visitor_tmpl_module_inst.h b/modules/TAO/TAO_IDL/include/ast_visitor_tmpl_module_inst.h index f054c194b7e..6218689cec0 100644 --- a/modules/TAO/TAO_IDL/include/ast_visitor_tmpl_module_inst.h +++ b/modules/TAO/TAO_IDL/include/ast_visitor_tmpl_module_inst.h @@ -42,7 +42,8 @@ class ast_visitor_tmpl_module_inst : public ast_visitor // instantiation or alias of a template module. // public: - ast_visitor_tmpl_module_inst (ast_visitor_context *ctx); + ast_visitor_tmpl_module_inst (ast_visitor_context *ctx, + bool ref_only = false); virtual ~ast_visitor_tmpl_module_inst (void); @@ -117,6 +118,10 @@ private: // Flag to branch in visit_valuetype() where we create an // eventtype or a valuetype. bool for_eventtype_; + + // Flag to short_circuit reifying if we are the base class of + // ast_visitor_tmpl_module_ref. + bool ref_only_; }; #endif // TAO_AST_VISITOR_TMPL_MODULE_INST_H diff --git a/modules/TAO/TAO_IDL/include/utl_labellist.h b/modules/TAO/TAO_IDL/include/utl_labellist.h index 299cadfe0d2..1c365b59cfb 100644 --- a/modules/TAO/TAO_IDL/include/utl_labellist.h +++ b/modules/TAO/TAO_IDL/include/utl_labellist.h @@ -88,6 +88,9 @@ public: // Get list item. AST_UnionLabel *head (void); + // Override of base class method. + virtual UTL_LabelList *copy (void); + // Cleanup. virtual void destroy (void); @@ -96,7 +99,7 @@ private: }; // Active iterator for UTL_LabelList. -class UTL_LabellistActiveIterator : public UTL_ListActiveIterator +class UTL_LabellistActiveIterator : public UTL_ListActiveIterator { public: UTL_LabellistActiveIterator (UTL_LabelList *source); diff --git a/modules/TAO/TAO_IDL/include/utl_scope.h b/modules/TAO/TAO_IDL/include/utl_scope.h index ec602b71375..3dd7943b7ab 100644 --- a/modules/TAO/TAO_IDL/include/utl_scope.h +++ b/modules/TAO/TAO_IDL/include/utl_scope.h @@ -262,6 +262,12 @@ public: // How many entries are used? virtual unsigned long nmembers (void); + // If the Identifier string (from the scoped name which has been + // already determined to be of length 1) matches a param, + // create and return a param holder AST node, otherwise + // return 0. + static AST_Param_Holder *match_param (UTL_ScopedName *e); + // Add to decls. Node represents a local declaration // The new decl e is inserted after ex if ex is not 0. // This one is public because the case of a reopened @@ -338,14 +344,6 @@ protected: // Set the appropriate *_seen_ flag if we are seeing a spec-defined // sequence of a basic type. - AST_Param_Holder *match_param ( - UTL_ScopedName *e, - FE_Utils::T_PARAMLIST_INFO const *params); - // If the Identifier string (from the scoped name which has been - // already determined to be of length 1) matches a param, - // create and return a param holder AST node, otherwise - // return 0. - protected: // Data. diff --git a/modules/TAO/TAO_IDL/util/utl_exceptlist.cpp b/modules/TAO/TAO_IDL/util/utl_exceptlist.cpp index e0b04978be7..1f79b79409d 100644 --- a/modules/TAO/TAO_IDL/util/utl_exceptlist.cpp +++ b/modules/TAO/TAO_IDL/util/utl_exceptlist.cpp @@ -114,14 +114,15 @@ UTL_ExceptList::copy (void) { UTL_ExceptList *retval = 0; ACE_NEW_RETURN (retval, - UTL_ExceptList ( - this->pd_car_data, - this->tail () != 0 - ? (UTL_ExceptList *) this->tail ()->copy () - : 0 - ), + UTL_ExceptList (this->pd_car_data, + 0), 0); + if (this->tail () != 0) + { + retval->nconc ((UTL_ExceptList *) this->tail ()->copy ()); + } + return retval; } diff --git a/modules/TAO/TAO_IDL/util/utl_idlist.cpp b/modules/TAO/TAO_IDL/util/utl_idlist.cpp index 6404e7adf88..17007053795 100644 --- a/modules/TAO/TAO_IDL/util/utl_idlist.cpp +++ b/modules/TAO/TAO_IDL/util/utl_idlist.cpp @@ -90,25 +90,19 @@ UTL_IdList::UTL_IdList (Identifier *s, // Public operations -// Copy a list. +// Copy an IdList. UTL_IdList * UTL_IdList::copy (void) { UTL_IdList *retval = 0; + ACE_NEW_RETURN (retval, + UTL_IdList (this->head ()->copy (), + 0), + 0); - if (this->tail () == 0) - { - ACE_NEW_RETURN (retval, - UTL_IdList (this->head ()->copy (), - 0), - 0); - } - else + if (this->tail () != 0) { - ACE_NEW_RETURN (retval, - UTL_IdList (this->head ()->copy (), - (UTL_IdList *) this->tail ()->copy ()), - 0); + retval->nconc ((UTL_IdList *) this->tail ()->copy ()); } return retval; diff --git a/modules/TAO/TAO_IDL/util/utl_labellist.cpp b/modules/TAO/TAO_IDL/util/utl_labellist.cpp index 199917a5dd9..87a9c834bfc 100644 --- a/modules/TAO/TAO_IDL/util/utl_labellist.cpp +++ b/modules/TAO/TAO_IDL/util/utl_labellist.cpp @@ -74,15 +74,17 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "utl_labellist.h" #include "ast_union_label.h" +#include "ast_expression.h" +#include "ast_generator.h" -ACE_RCSID (util, - utl_labellist, - "$Id$") +#include "global_extern.h" + +#include "ace/OS_Memory.h" UTL_LabelList::UTL_LabelList (AST_UnionLabel *s, UTL_LabelList *cdr) - : UTL_List(cdr), - pd_car_data(s) + : UTL_List (cdr), + pd_car_data (s) { } @@ -93,6 +95,35 @@ UTL_LabelList::head (void) return this->pd_car_data; } +// Copy a label list. +UTL_LabelList * +UTL_LabelList::copy (void) +{ + AST_Expression *val = this->pd_car_data->label_val (); + + AST_Expression *val_copy = 0; + ACE_NEW_RETURN (val_copy, + AST_Expression (val, val->ev ()->et), + 0); + + AST_UnionLabel *label_copy = + idl_global->gen ()->create_union_label (this->pd_car_data->label_kind (), + val_copy); + + UTL_LabelList *retval = 0; + ACE_NEW_RETURN (retval, + UTL_LabelList (label_copy, + 0), + 0); + + if (this->tail () != 0) + { + retval->nconc ((UTL_LabelList *) this->tail ()->copy ()); + } + + return retval; +} + void UTL_LabelList::destroy (void) { @@ -108,16 +139,15 @@ UTL_LabellistActiveIterator::UTL_LabellistActiveIterator (UTL_LabelList *s) { } - // Get current item. AST_UnionLabel * UTL_LabellistActiveIterator::item (void) { - if (source == 0) + if (this->source == 0) { return 0; } - return ((UTL_LabelList *) source)->head (); + return (dynamic_cast<UTL_LabelList *> (this->source))->head (); } diff --git a/modules/TAO/TAO_IDL/util/utl_scope.cpp b/modules/TAO/TAO_IDL/util/utl_scope.cpp index 46d86a20562..ec5dabfb5e2 100644 --- a/modules/TAO/TAO_IDL/util/utl_scope.cpp +++ b/modules/TAO/TAO_IDL/util/utl_scope.cpp @@ -185,15 +185,7 @@ iter_lookup_by_name_local (AST_Decl *d, { return 0; } -/* - AST_Template_Module_Ref *tmr = - AST_Template_Module_Ref::narrow_from_decl (d); - - if (tmr != 0) - { - d = tmr->ref (); - } -*/ + // Try to convert the AST_Decl to a UTL_Scope. UTL_Scope *sc = DeclAsScope (d); @@ -214,15 +206,19 @@ iter_lookup_by_name_local (AST_Decl *d, return 0; } + UTL_ScopedName *sn = (UTL_ScopedName *) e->tail (); if (result == 0) { - return 0; + if (sn == 0) + { + result = UTL_Scope::match_param (e); + } + + return result; } else { - UTL_ScopedName *sn = (UTL_ScopedName *) e->tail (); - if (sn == 0) { // We're done. @@ -583,33 +579,6 @@ UTL_Scope::check_for_predef_seq (AST_Decl *d) } } -AST_Param_Holder * -UTL_Scope::match_param ( - UTL_ScopedName *e, - FE_Utils::T_PARAMLIST_INFO const *params) -{ - const char *name = e->first_component ()->get_string (); - AST_Param_Holder *retval = 0; - - for (FE_Utils::T_PARAMLIST_INFO::CONST_ITERATOR i (*params); - !i.done (); - i.advance ()) - { - FE_Utils::T_Param_Info *param = 0; - i.next (param); - - if (param->name_ == name) - { - retval = - idl_global->gen ()->create_param_holder (e, param); - - break; - } - } - - return retval; -} - // Public operations. // Scope Management Protocol. @@ -1855,15 +1824,10 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e, return 0; } - // If this call returns a non-zero value, we are in the scope - // of a template module. - FE_Utils::T_PARAMLIST_INFO const *params = - idl_global->current_params (); - - if (e->length () == 1 && params != 0) + if (e->length () == 1) { AST_Param_Holder *param_holder = - this->match_param (e, params); + UTL_Scope::match_param (e); // Since we are inside the scope of a template module, any // single-segment scoped name that matches a template @@ -2666,6 +2630,41 @@ UTL_Scope::nmembers (void) return this->pd_decls_used; } +AST_Param_Holder * +UTL_Scope::match_param (UTL_ScopedName *e) +{ + // If this call returns a zero value, we are not in the scope + // of a template module. + FE_Utils::T_PARAMLIST_INFO const *params = + idl_global->current_params (); + + if (params == 0) + { + return 0; + } + + const char *name = e->first_component ()->get_string (); + AST_Param_Holder *retval = 0; + + for (FE_Utils::T_PARAMLIST_INFO::CONST_ITERATOR i (*params); + !i.done (); + i.advance ()) + { + FE_Utils::T_Param_Info *param = 0; + i.next (param); + + if (param->name_ == name) + { + retval = + idl_global->gen ()->create_param_holder (e, param); + + break; + } + } + + return retval; +} + void UTL_Scope::destroy (void) { |