stage3/visit_expression_type.cc
changeset 324 f763383992c9
parent 323 d3f2ef59b310
parent 321 a96399ab57c2
child 331 e08e14782a4f
equal deleted inserted replaced
323:d3f2ef59b310 324:f763383992c9
   898 /*********************/
   898 /*********************/
   899 /* B 1.4 - Variables */
   899 /* B 1.4 - Variables */
   900 /*********************/
   900 /*********************/
   901 
   901 
   902 void *visit_expression_type_c::visit(symbolic_variable_c *symbol) {
   902 void *visit_expression_type_c::visit(symbolic_variable_c *symbol) {
   903   return search_varfb_instance_type->get_type(symbol);
   903   return search_varfb_instance_type->get_basetype_decl(symbol);
   904 }
   904 }
   905 
   905 
   906 /********************************************/
   906 /********************************************/
   907 /* B 1.4.1 - Directly Represented Variables */
   907 /* B 1.4.1 - Directly Represented Variables */
   908 /********************************************/
   908 /********************************************/
   925 
   925 
   926 /*************************************/
   926 /*************************************/
   927 /* B 1.4.2 - Multi-element variables */
   927 /* B 1.4.2 - Multi-element variables */
   928 /*************************************/
   928 /*************************************/
   929 void *visit_expression_type_c::visit(array_variable_c *symbol) {
   929 void *visit_expression_type_c::visit(array_variable_c *symbol) {
   930   return search_varfb_instance_type->get_type(symbol);
   930   return search_varfb_instance_type->get_basetype_decl(symbol);
   931 }
   931 }
   932 
   932 
   933 void *visit_expression_type_c::visit(structured_variable_c *symbol) {
   933 void *visit_expression_type_c::visit(structured_variable_c *symbol) {
   934   return search_varfb_instance_type->get_type(symbol);
   934   return search_varfb_instance_type->get_basetype_decl(symbol);
   935 }
   935 }
   936 
   936 
   937 
   937 
   938 
   938 
   939 /********************************/
   939 /********************************/
  1118    *       Program test
  1118    *       Program test
  1119    *         var fb1 : foo_fb_type; end_var
  1119    *         var fb1 : foo_fb_type; end_var
  1120    *         fb1(...)
  1120    *         fb1(...)
  1121    *       End_Program
  1121    *       End_Program
  1122    *
  1122    *
  1123    *    search_varfb_instance_type->get_type( identifier_c("fb1") )
  1123    *    search_varfb_instance_type->get_basetype_decl( identifier_c("fb1") )
  1124    *    in the scope of Program 'test'
  1124    *    in the scope of Program 'test'
  1125    *    will return the fb declaration of foo_fb_type !!
  1125    *    will return the fb declaration of foo_fb_type !!
  1126    */
  1126    */
  1127 #if 0
  1127 #if 0
  1128   symbol_c *fb_decl_symbol = search_varfb_instance_type->get_type(symbol->fb_name);
  1128   symbol_c *fb_decl_symbol = search_varfb_instance_type->get_basetype_decl(symbol->fb_name);
  1129     /* The following should never occur. The function block must be defined, 
  1129     /* The following should never occur. The function block must be defined, 
  1130      * and the FB type being called MUST be in the symtable... 
  1130      * and the FB type being called MUST be in the symtable... 
  1131      * This was all already checked at stage 2!
  1131      * This was all already checked at stage 2!
  1132      */
  1132      */
  1133   if (NULL == fb_decl_symbol) ERROR;
  1133   if (NULL == fb_decl_symbol) ERROR;
  1134 
  1134 
  1135   function_block_declaration_c *fb_decl = dynamic_cast<function_block_declaration_c *>(fb_decl_symbol);
  1135   function_block_declaration_c *fb_decl = dynamic_cast<function_block_declaration_c *>(fb_decl_symbol);
  1136     /* should never occur. ... */
  1136     /* should never occur. ... */
  1137   if (NULL == fb_decl) ERROR;
  1137   if (NULL == fb_decl) ERROR;
  1138 #endif
  1138 #endif
  1139   symbol_c *fb_decl = search_varfb_instance_type->get_type(symbol->fb_name);
  1139   symbol_c *fb_decl = search_varfb_instance_type->get_basetype_decl(symbol->fb_name);
  1140     /* The following should never occur. The function block must be defined, 
  1140     /* The following should never occur. The function block must be defined, 
  1141      * and the FB type being called MUST be in the symtable... 
  1141      * and the FB type being called MUST be in the symtable... 
  1142      * This was all already checked at stage 2!
  1142      * This was all already checked at stage 2!
  1143      */
  1143      */
  1144   if (NULL == fb_decl) ERROR;
  1144   if (NULL == fb_decl) ERROR;
  2028 
  2028 
  2029 /* fb_name '(' [param_assignment_list] ')' */
  2029 /* fb_name '(' [param_assignment_list] ')' */
  2030 /* param_assignment_list -> may be NULL ! */
  2030 /* param_assignment_list -> may be NULL ! */
  2031 // SYM_REF3(fb_invocation_c, fb_name, formal_param_list, nonformal_param_list)
  2031 // SYM_REF3(fb_invocation_c, fb_name, formal_param_list, nonformal_param_list)
  2032 void *visit_expression_type_c::visit(fb_invocation_c *symbol) {
  2032 void *visit_expression_type_c::visit(fb_invocation_c *symbol) {
  2033   symbol_c *fb_decl = search_varfb_instance_type->get_type(symbol->fb_name);
  2033   symbol_c *fb_decl = search_varfb_instance_type->get_basetype_decl(symbol->fb_name);
  2034     /* The following should never occur. The function block must be defined, 
  2034     /* The following should never occur. The function block must be defined, 
  2035      * and the FB type being called MUST be in the symtable... 
  2035      * and the FB type being called MUST be in the symtable... 
  2036      * This was all already checked at stage 2!
  2036      * This was all already checked at stage 2!
  2037      */
  2037      */
  2038   if (NULL == fb_decl) ERROR;
  2038   if (NULL == fb_decl) ERROR;