diff options
Diffstat (limited to 'modules/TAO/TAO_IDL/fe/idl.yy')
-rw-r--r-- | modules/TAO/TAO_IDL/fe/idl.yy | 218 |
1 files changed, 178 insertions, 40 deletions
diff --git a/modules/TAO/TAO_IDL/fe/idl.yy b/modules/TAO/TAO_IDL/fe/idl.yy index 85fe1770b96..54b2d87cab2 100644 --- a/modules/TAO/TAO_IDL/fe/idl.yy +++ b/modules/TAO/TAO_IDL/fe/idl.yy @@ -5153,6 +5153,8 @@ provides_decl : IDL_PROVIDES interface_type id // provides_decl : IDL_PROVIDES interface_type id UTL_Scope *s = idl_global->scopes ().top_non_null (); bool so_far_so_good = true; + AST_Decl::NodeType nt = AST_Decl::NT_type; + AST_Param_Holder *ph = 0; AST_Decl *d = s->lookup_by_name ($2, true); @@ -5161,20 +5163,49 @@ provides_decl : IDL_PROVIDES interface_type id idl_global->err ()->lookup_error ($2); so_far_so_good = false; } - else if (d->node_type () != AST_Decl::NT_interface) + else { - // Nothing else but CORBA::Object can have - // this identifier. - int comp_result = - ACE_OS::strcmp (d->local_name ()->get_string (), - "Object"); - - // Simple provides port must use IDL interface - // or CORBA::Object. - if (comp_result != 0) + int compare = 0; + nt = d->node_type (); + + switch (nt) { - idl_global->err ()->interface_expected (d); - so_far_so_good = false; + case AST_Decl::NT_interface: + break; + case AST_Decl::NT_param_holder: + ph = AST_Param_Holder::narrow_from_decl (d); + nt = ph->info ()->type_; + + if (nt != AST_Decl::NT_type + && nt != AST_Decl::NT_interface) + { + idl_global->err ()->mismatched_template_param ( + ph->info ()->name_.c_str ()); + + so_far_so_good = false; + } + + break; + case AST_Decl::NT_pre_defined: + // Nothing else but CORBA::Object can have + // this identifier. + compare = + ACE_OS::strcmp (d->local_name ()->get_string (), + "Object"); + + // Simple provides port must use IDL interface + // or CORBA::Object. + if (compare != 0) + { + idl_global->err ()->interface_expected (d); + so_far_so_good = false; + } + + break; + default: + idl_global->err ()->interface_expected (d); + so_far_so_good = false; + break; } } @@ -5245,6 +5276,8 @@ uses_decl : uses_opt_multiple interface_type id // uses_decl : uses_opt_multiple interface_type id UTL_Scope *s = idl_global->scopes ().top_non_null (); bool so_far_so_good = true; + AST_Decl::NodeType nt = AST_Decl::NT_type; + AST_Param_Holder *ph = 0; AST_Decl *d = s->lookup_by_name ($2, true); @@ -5253,20 +5286,49 @@ uses_decl : uses_opt_multiple interface_type id idl_global->err ()->lookup_error ($2); so_far_so_good = false; } - else if (d->node_type () != AST_Decl::NT_interface) + else { - // Nothing else but CORBA::Object can have - // this identifier. - int comp_result = - ACE_OS::strcmp (d->local_name ()->get_string (), - "Object"); - - // Simple provides port must use IDL interface - // or CORBA::Object. - if (comp_result != 0) + int compare = 0; + nt = d->node_type (); + + switch (nt) { - idl_global->err ()->interface_expected (d); - so_far_so_good = false; + case AST_Decl::NT_interface: + break; + case AST_Decl::NT_param_holder: + ph = AST_Param_Holder::narrow_from_decl (d); + nt = ph->info ()->type_; + + if (nt != AST_Decl::NT_type + && nt != AST_Decl::NT_interface) + { + idl_global->err ()->mismatched_template_param ( + ph->info ()->name_.c_str ()); + + so_far_so_good = false; + } + + break; + case AST_Decl::NT_pre_defined: + // Nothing else but CORBA::Object can have + // this identifier. + compare = + ACE_OS::strcmp (d->local_name ()->get_string (), + "Object"); + + // Simple provides port must use IDL interface + // or CORBA::Object. + if (compare != 0) + { + idl_global->err ()->interface_expected (d); + so_far_so_good = false; + } + + break; + default: + idl_global->err ()->interface_expected (d); + so_far_so_good = false; + break; } } @@ -5294,7 +5356,8 @@ uses_decl : uses_opt_multiple interface_type id if (c != 0 && u->is_multiple () && !idl_global->using_ifr_backend () - && !idl_global->ignore_idl3 ()) + && !idl_global->ignore_idl3 () + && nt != AST_Decl::NT_param_holder) { // These datatypes must be created in the // front end so they can be looked up @@ -5349,16 +5412,39 @@ emits_decl : IDL_EMITS scoped_name id idl_global->err ()->lookup_error ($2); so_far_so_good = false; } - else if (d->node_type () != AST_Decl::NT_eventtype) + else { - idl_global->err ()->eventtype_expected (d); - so_far_so_good = false; + nt = d->node_type (); + + switch (nt) + { + case AST_Decl::NT_eventtype: + break; + case AST_Decl::NT_param_holder: + ph = AST_Param_Holder::narrow_from_decl (d); + nt = ph->info ()->type_; + + if (nt != AST_Decl::NT_type + && nt != AST_Decl::NT_eventtype) + { + idl_global->err ()->mismatched_template_param ( + ph->info ()->name_.c_str ()); + + so_far_so_good = false; + } + + break; + default: + idl_global->err ()->eventtype_expected (d); + so_far_so_good = false; + break; + } } if (so_far_so_good) { - AST_EventType *event_type = - AST_EventType::narrow_from_decl (d); + AST_Type *event_type = + AST_Type::narrow_from_decl (d); // Strip off _cxx_, if any, for port name. idl_global->original_local_name ($3); @@ -5388,6 +5474,9 @@ publishes_decl : IDL_PUBLISHES scoped_name id // publishes_decl : IDL_PUBLISHES scoped_name id UTL_Scope *s = idl_global->scopes ().top_non_null (); bool so_far_so_good = true; + AST_Decl::NodeType nt = AST_Decl::NT_type; + AST_Param_Holder *ph = 0; + AST_Decl *d = s->lookup_by_name ($2, true); @@ -5396,16 +5485,39 @@ publishes_decl : IDL_PUBLISHES scoped_name id idl_global->err ()->lookup_error ($2); so_far_so_good = false; } - else if (d->node_type () != AST_Decl::NT_eventtype) + else { - idl_global->err ()->eventtype_expected (d); - so_far_so_good = false; + nt = d->node_type (); + + switch (nt) + { + case AST_Decl::NT_eventtype: + break; + case AST_Decl::NT_param_holder: + ph = AST_Param_Holder::narrow_from_decl (d); + nt = ph->info ()->type_; + + if (nt != AST_Decl::NT_type + && nt != AST_Decl::NT_eventtype) + { + idl_global->err ()->mismatched_template_param ( + ph->info ()->name_.c_str ()); + + so_far_so_good = false; + } + + break; + default: + idl_global->err ()->eventtype_expected (d); + so_far_so_good = false; + break; + } } if (so_far_so_good) { - AST_EventType *event_type = - AST_EventType::narrow_from_decl (d); + AST_Type *event_type = + AST_Type::narrow_from_decl (d); // Strip off _cxx_, if any, for port name. idl_global->original_local_name ($3); @@ -5435,6 +5547,9 @@ consumes_decl : IDL_CONSUMES scoped_name id // consumes_decl : IDL_CONSUMES scoped_name id UTL_Scope *s = idl_global->scopes ().top_non_null (); bool so_far_so_good = true; + AST_Decl::NodeType nt = AST_Decl::NT_type; + AST_Param_Holder *ph = 0; + AST_Decl *d = s->lookup_by_name ($2, true); @@ -5443,16 +5558,39 @@ consumes_decl : IDL_CONSUMES scoped_name id idl_global->err ()->lookup_error ($2); so_far_so_good = false; } - else if (d->node_type () != AST_Decl::NT_eventtype) + else { - idl_global->err ()->eventtype_expected (d); - so_far_so_good = false; + nt = d->node_type (); + + switch (nt) + { + case AST_Decl::NT_eventtype: + break; + case AST_Decl::NT_param_holder: + ph = AST_Param_Holder::narrow_from_decl (d); + nt = ph->info ()->type_; + + if (nt != AST_Decl::NT_type + && nt != AST_Decl::NT_eventtype) + { + idl_global->err ()->mismatched_template_param ( + ph->info ()->name_.c_str ()); + + so_far_so_good = false; + } + + break; + default: + idl_global->err ()->eventtype_expected (d); + so_far_so_good = false; + break; + } } if (so_far_so_good) { - AST_EventType *event_type = - AST_EventType::narrow_from_decl (d); + AST_Type *event_type = + AST_Type::narrow_from_decl (d); // Strip off _cxx_, if any, for port name. idl_global->original_local_name ($3); |