stage3/narrow_candidate_datatypes.cc
changeset 439 cf7d6862033d
parent 438 744b125d911e
child 441 e8de43eefcc5
equal deleted inserted replaced
438:744b125d911e 439:cf7d6862033d
   412 void *narrow_candidate_datatypes_c::visit(il_expression_c *symbol) {
   412 void *narrow_candidate_datatypes_c::visit(il_expression_c *symbol) {
   413 /* MJS: TODO... */
   413 /* MJS: TODO... */
   414 return NULL;
   414 return NULL;
   415 }
   415 }
   416 
   416 
       
   417 /*   il_call_operator prev_declared_fb_name
       
   418  * | il_call_operator prev_declared_fb_name '(' ')'
       
   419  * | il_call_operator prev_declared_fb_name '(' eol_list ')'
       
   420  * | il_call_operator prev_declared_fb_name '(' il_operand_list ')'
       
   421  * | il_call_operator prev_declared_fb_name '(' eol_list il_param_list ')'
       
   422  */
       
   423 /* NOTE: The parameter 'called_fb_declaration'is used to pass data between stage 3 and stage4 (although currently it is not used in stage 4 */
       
   424 // SYM_REF4(il_fb_call_c, il_call_operator, fb_name, il_operand_list, il_param_list, symbol_c *called_fb_declaration)
   417 void *narrow_candidate_datatypes_c::visit(il_fb_call_c *symbol) {
   425 void *narrow_candidate_datatypes_c::visit(il_fb_call_c *symbol) {
   418 	return NULL;
   426 	/* Note: We do not use the symbol->called_fb_declaration value (set in fill_candidate_datatypes_c)
   419 }
   427 	 *       because we try to identify any other datatype errors in the expressions used in the 
       
   428 	 *       parameters to the FB call. e.g.
       
   429 	 *          fb_var( 
       
   430 	 *             in1 := var1,
       
   431 	 *             in2 := (
       
   432 	 *                       LD 56
       
   433 	 *                       ADD 43
       
   434 	 *                    )
       
   435 	 *             )
       
   436 	 *       even it the call to the FB is invalid. 
       
   437 	 *       This makes sense because it may be errors in those expressions which are
       
   438 	 *       making this an invalid call, so it makes sense to point them out to the user!
       
   439 	 */
       
   440 	symbol_c *fb_decl = search_varfb_instance_type->get_basetype_decl(symbol->fb_name);
       
   441 
       
   442 	/* Although a call to a non-declared FB is a semantic error, this is currently caught by stage 2! */
       
   443 	if (NULL == fb_decl) ERROR;
       
   444 	if (NULL != symbol->il_operand_list)  narrow_nonformal_call(symbol, fb_decl);
       
   445 	if (NULL != symbol->  il_param_list)     narrow_formal_call(symbol, fb_decl);
       
   446 
       
   447 	return NULL;
       
   448 }
       
   449 
   420 
   450 
   421 /* | function_name '(' eol_list [il_param_list] ')' */
   451 /* | function_name '(' eol_list [il_param_list] ')' */
   422 /* NOTE: The parameter 'called_function_declaration' is used to pass data between the stage 3 and stage 4. */
   452 /* NOTE: The parameter 'called_function_declaration' is used to pass data between the stage 3 and stage 4. */
   423 // SYM_REF2(il_formal_funct_call_c, function_name, il_param_list, symbol_c *called_function_declaration; int extensible_param_count;)
   453 // SYM_REF2(il_formal_funct_call_c, function_name, il_param_list, symbol_c *called_function_declaration; int extensible_param_count;)
   424 void *narrow_candidate_datatypes_c::visit(il_formal_funct_call_c *symbol) {
   454 void *narrow_candidate_datatypes_c::visit(il_formal_funct_call_c *symbol) {