absyntax_utils/search_var_instance_decl.cc
changeset 813 0630cc31569f
parent 812 6679b6b21214
child 851 2c59c2b8fca4
equal deleted inserted replaced
804:7898ba56c7cf 813:0630cc31569f
   103 
   103 
   104 symbol_c *search_var_instance_decl_c::get_decl(symbol_c *variable) {
   104 symbol_c *search_var_instance_decl_c::get_decl(symbol_c *variable) {
   105   this->current_vartype = none_vt;
   105   this->current_vartype = none_vt;
   106   this->current_option  = none_opt;
   106   this->current_option  = none_opt;
   107   this->search_name = get_var_name_c::get_name(variable);
   107   this->search_name = get_var_name_c::get_name(variable);
       
   108   if (NULL == search_scope) return NULL; // NOTE: This is not an ERROR! declaration_check_c, for e.g., relies on this returning NULL!
   108   return (symbol_c *)search_scope->accept(*this);
   109   return (symbol_c *)search_scope->accept(*this);
   109 }
   110 }
   110 
   111 
   111 search_var_instance_decl_c::vt_t search_var_instance_decl_c::get_vartype(symbol_c *variable) {
   112 search_var_instance_decl_c::vt_t search_var_instance_decl_c::get_vartype(symbol_c *variable) {
   112   this->current_vartype = none_vt;
   113   this->current_vartype = none_vt;
   113   this->current_option  = none_opt;
   114   this->current_option  = none_opt;
   114   this->search_name = get_var_name_c::get_name(variable);
   115   this->search_name = get_var_name_c::get_name(variable);
       
   116   if (NULL == search_scope) ERROR;
   115   search_scope->accept(*this);
   117   search_scope->accept(*this);
   116   return this->current_vartype;
   118   return this->current_vartype;
   117 }
   119 }
   118 
   120 
   119 search_var_instance_decl_c::opt_t search_var_instance_decl_c::get_option(symbol_c *variable) {
   121 search_var_instance_decl_c::opt_t search_var_instance_decl_c::get_option(symbol_c *variable) {
   120   this->current_vartype = none_vt;
   122   this->current_vartype = none_vt;
   121   this->current_option  = none_opt;
   123   this->current_option  = none_opt;
   122   this->search_name = get_var_name_c::get_name(variable);
   124   this->search_name = get_var_name_c::get_name(variable);
       
   125   if (NULL == search_scope) ERROR;
   123   search_scope->accept(*this);
   126   search_scope->accept(*this);
   124   return this->current_option;
   127   return this->current_option;
   125 }
   128 }
   126 
   129 
   127 
   130 
   338 }
   341 }
   339 
   342 
   340 /* name_list ':' function_block_type_name ASSIGN structure_initialization */
   343 /* name_list ':' function_block_type_name ASSIGN structure_initialization */
   341 /* structure_initialization -> may be NULL ! */
   344 /* structure_initialization -> may be NULL ! */
   342 void *search_var_instance_decl_c::visit(fb_name_decl_c *symbol) {
   345 void *search_var_instance_decl_c::visit(fb_name_decl_c *symbol) {
   343   current_type_decl = symbol->function_block_type_name;
   346   // TODO: The following line is wrong! It should be
       
   347   // current_type_decl = symbol->fb_spec_init;
       
   348   //  However, this change will require a check of all callers, to see if they would handle this correctly.
       
   349   //  For now, just keep what we have had historically, and seems to be working.
       
   350   current_type_decl = spec_init_sperator_c::get_spec(symbol->fb_spec_init);
   344   return symbol->fb_name_list->accept(*this);
   351   return symbol->fb_name_list->accept(*this);
   345 }
   352 }
   346 
   353 
   347 /* name_list ',' fb_name */
   354 /* name_list ',' fb_name */
   348 void *search_var_instance_decl_c::visit(fb_name_list_c *symbol) {
   355 void *search_var_instance_decl_c::visit(fb_name_list_c *symbol) {