absyntax_utils/search_varfb_instance_type.cc
changeset 367 6d94128ba5ad
parent 326 e3fbf97d2021
child 371 926490780952
equal deleted inserted replaced
366:1aeb29ee9381 367:6d94128ba5ad
   122    * This is done by this class visiting the var_decl.
   122    * This is done by this class visiting the var_decl.
   123    * This class, while visiting, will recursively call
   123    * This class, while visiting, will recursively call
   124    * decompose_var_instance_name->get_next() when and if required...
   124    * decompose_var_instance_name->get_next() when and if required...
   125    */
   125    */
   126   symbol_c *res = (symbol_c *)var_decl->accept(*this);
   126   symbol_c *res = (symbol_c *)var_decl->accept(*this);
   127   if (NULL == res) ERROR;
   127   /* NOTE: A Null result is not really an internal compiler error, but rather an error in 
       
   128    * the IEC 61131-3 source code being compiled. This means we cannot just abort the compiler with ERROR.
       
   129    * //   if (NULL == res) ERROR;
       
   130    */
       
   131   if (NULL == res) return NULL;
   128 
   132 
   129   /* make sure that we have decomposed all structure elements of the variable name */
   133   /* make sure that we have decomposed all structure elements of the variable name */
   130   symbol_c *var_name = decompose_var_instance_name->next_part();
   134   symbol_c *var_name = decompose_var_instance_name->next_part();
   131   if (NULL != var_name) ERROR;
   135   /* NOTE: A non-NULL result is not really an internal compiler error, but rather an error in 
       
   136    * the IEC 61131-3 source code being compiled. 
       
   137    *  (for example, 'int_var.struct_elem' in the source code, when 'int_var' is a simple integer,
       
   138    *   and not a structure, will result in this result being non-NULL!)
       
   139    * This means we cannot just abort the compiler with ERROR.
       
   140    * //   if (NULL != var_name) ERROR;
       
   141    */
       
   142   if (NULL != var_name) return NULL;
   132 
   143 
   133   return res;
   144   return res;
   134 }
   145 }
   135 
   146 
   136 unsigned int search_varfb_instance_type_c::get_vartype(symbol_c *variable_name) {
   147 unsigned int search_varfb_instance_type_c::get_vartype(symbol_c *variable_name) {