stage3/visit_expression_type.cc
changeset 321 a96399ab57c2
parent 319 1669977e84f4
child 324 f763383992c9
equal deleted inserted replaced
320:4df13059b982 321:a96399ab57c2
   908 /*********************/
   908 /*********************/
   909 /* B 1.4 - Variables */
   909 /* B 1.4 - Variables */
   910 /*********************/
   910 /*********************/
   911 
   911 
   912 void *visit_expression_type_c::visit(symbolic_variable_c *symbol) {
   912 void *visit_expression_type_c::visit(symbolic_variable_c *symbol) {
   913   return search_varfb_instance_type->get_type(symbol);
   913   return search_varfb_instance_type->get_basetype_decl(symbol);
   914 }
   914 }
   915 
   915 
   916 /********************************************/
   916 /********************************************/
   917 /* B 1.4.1 - Directly Represented Variables */
   917 /* B 1.4.1 - Directly Represented Variables */
   918 /********************************************/
   918 /********************************************/
   935 
   935 
   936 /*************************************/
   936 /*************************************/
   937 /* B 1.4.2 - Multi-element variables */
   937 /* B 1.4.2 - Multi-element variables */
   938 /*************************************/
   938 /*************************************/
   939 void *visit_expression_type_c::visit(array_variable_c *symbol) {
   939 void *visit_expression_type_c::visit(array_variable_c *symbol) {
   940   return search_varfb_instance_type->get_type(symbol);
   940   return search_varfb_instance_type->get_basetype_decl(symbol);
   941 }
   941 }
   942 
   942 
   943 void *visit_expression_type_c::visit(structured_variable_c *symbol) {
   943 void *visit_expression_type_c::visit(structured_variable_c *symbol) {
   944   return search_varfb_instance_type->get_type(symbol);
   944   return search_varfb_instance_type->get_basetype_decl(symbol);
   945 }
   945 }
   946 
   946 
   947 
   947 
   948 
   948 
   949 /********************************/
   949 /********************************/
  1128    *       Program test
  1128    *       Program test
  1129    *         var fb1 : foo_fb_type; end_var
  1129    *         var fb1 : foo_fb_type; end_var
  1130    *         fb1(...)
  1130    *         fb1(...)
  1131    *       End_Program
  1131    *       End_Program
  1132    *
  1132    *
  1133    *    search_varfb_instance_type->get_type( identifier_c("fb1") )
  1133    *    search_varfb_instance_type->get_basetype_decl( identifier_c("fb1") )
  1134    *    in the scope of Program 'test'
  1134    *    in the scope of Program 'test'
  1135    *    will return the fb declaration of foo_fb_type !!
  1135    *    will return the fb declaration of foo_fb_type !!
  1136    */
  1136    */
  1137 #if 0
  1137 #if 0
  1138   symbol_c *fb_decl_symbol = search_varfb_instance_type->get_type(symbol->fb_name);
  1138   symbol_c *fb_decl_symbol = search_varfb_instance_type->get_basetype_decl(symbol->fb_name);
  1139     /* The following should never occur. The function block must be defined, 
  1139     /* The following should never occur. The function block must be defined, 
  1140      * and the FB type being called MUST be in the symtable... 
  1140      * and the FB type being called MUST be in the symtable... 
  1141      * This was all already checked at stage 2!
  1141      * This was all already checked at stage 2!
  1142      */
  1142      */
  1143   if (NULL == fb_decl_symbol) ERROR;
  1143   if (NULL == fb_decl_symbol) ERROR;
  1144 
  1144 
  1145   function_block_declaration_c *fb_decl = dynamic_cast<function_block_declaration_c *>(fb_decl_symbol);
  1145   function_block_declaration_c *fb_decl = dynamic_cast<function_block_declaration_c *>(fb_decl_symbol);
  1146     /* should never occur. ... */
  1146     /* should never occur. ... */
  1147   if (NULL == fb_decl) ERROR;
  1147   if (NULL == fb_decl) ERROR;
  1148 #endif
  1148 #endif
  1149   symbol_c *fb_decl = search_varfb_instance_type->get_type(symbol->fb_name);
  1149   symbol_c *fb_decl = search_varfb_instance_type->get_basetype_decl(symbol->fb_name);
  1150     /* The following should never occur. The function block must be defined, 
  1150     /* The following should never occur. The function block must be defined, 
  1151      * and the FB type being called MUST be in the symtable... 
  1151      * and the FB type being called MUST be in the symtable... 
  1152      * This was all already checked at stage 2!
  1152      * This was all already checked at stage 2!
  1153      */
  1153      */
  1154   if (NULL == fb_decl) ERROR;
  1154   if (NULL == fb_decl) ERROR;
  2038 
  2038 
  2039 /* fb_name '(' [param_assignment_list] ')' */
  2039 /* fb_name '(' [param_assignment_list] ')' */
  2040 /* param_assignment_list -> may be NULL ! */
  2040 /* param_assignment_list -> may be NULL ! */
  2041 // SYM_REF3(fb_invocation_c, fb_name, formal_param_list, nonformal_param_list)
  2041 // SYM_REF3(fb_invocation_c, fb_name, formal_param_list, nonformal_param_list)
  2042 void *visit_expression_type_c::visit(fb_invocation_c *symbol) {
  2042 void *visit_expression_type_c::visit(fb_invocation_c *symbol) {
  2043   symbol_c *fb_decl = search_varfb_instance_type->get_type(symbol->fb_name);
  2043   symbol_c *fb_decl = search_varfb_instance_type->get_basetype_decl(symbol->fb_name);
  2044     /* The following should never occur. The function block must be defined, 
  2044     /* The following should never occur. The function block must be defined, 
  2045      * and the FB type being called MUST be in the symtable... 
  2045      * and the FB type being called MUST be in the symtable... 
  2046      * This was all already checked at stage 2!
  2046      * This was all already checked at stage 2!
  2047      */
  2047      */
  2048   if (NULL == fb_decl) ERROR;
  2048   if (NULL == fb_decl) ERROR;