stage3/fill_candidate_datatypes.cc
changeset 439 cf7d6862033d
parent 438 744b125d911e
child 440 a745f7d38a5d
equal deleted inserted replaced
438:744b125d911e 439:cf7d6862033d
   839   symbol->il_jump_operator->accept(*this);
   839   symbol->il_jump_operator->accept(*this);
   840   il_operand = NULL;
   840   il_operand = NULL;
   841   return NULL;
   841   return NULL;
   842 }
   842 }
   843 
   843 
       
   844 
       
   845 /*   il_call_operator prev_declared_fb_name
       
   846  * | il_call_operator prev_declared_fb_name '(' ')'
       
   847  * | il_call_operator prev_declared_fb_name '(' eol_list ')'
       
   848  * | il_call_operator prev_declared_fb_name '(' il_operand_list ')'
       
   849  * | il_call_operator prev_declared_fb_name '(' eol_list il_param_list ')'
       
   850  */
       
   851 /* 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 */
       
   852 // SYM_REF4(il_fb_call_c, il_call_operator, fb_name, il_operand_list, il_param_list, symbol_c *called_fb_declaration)
   844 void *fill_candidate_datatypes_c::visit(il_fb_call_c *symbol) {
   853 void *fill_candidate_datatypes_c::visit(il_fb_call_c *symbol) {
   845 }
   854 	bool compatible = false;
       
   855 	symbol_c *fb_decl = search_varfb_instance_type->get_basetype_decl(symbol->fb_name);
       
   856 	/* Although a call to a non-declared FB is a semantic error, this is currently caught by stage 2! */
       
   857 	if (NULL == fb_decl) ERROR;
       
   858 
       
   859 	if (symbol->  il_param_list != NULL) {
       
   860 		symbol->il_param_list->accept(*this);
       
   861 		compatible = match_formal_call(symbol, fb_decl);
       
   862 	}
       
   863 	if (symbol->il_operand_list != NULL) {
       
   864 		symbol->il_operand_list->accept(*this);
       
   865 		compatible = match_nonformal_call(symbol, fb_decl);
       
   866 	}
       
   867 
       
   868 	/* The print_datatypes_error_c does not rely on this called_fb_declaration pointer being != NULL to conclude that
       
   869 	 * we have a datat type incompatibility error, so setting it to the correct fb_decl is actually safe,
       
   870 	 * as the compiler will never reach the compilation stage!
       
   871 	 */
       
   872 	symbol->called_fb_declaration = fb_decl;
       
   873 
       
   874 	if (debug) std::cout << "FB [] ==> "  << symbol->candidate_datatypes.size() << " result.\n";
       
   875 	return NULL;
       
   876 }
       
   877 
   846 
   878 
   847 /* | function_name '(' eol_list [il_param_list] ')' */
   879 /* | function_name '(' eol_list [il_param_list] ')' */
   848 /* NOTE: The parameter 'called_function_declaration' is used to pass data between the stage 3 and stage 4. */
   880 /* NOTE: The parameter 'called_function_declaration' is used to pass data between the stage 3 and stage 4. */
   849 // SYM_REF2(il_formal_funct_call_c, function_name, il_param_list, symbol_c *called_function_declaration; int extensible_param_count;)
   881 // SYM_REF2(il_formal_funct_call_c, function_name, il_param_list, symbol_c *called_function_declaration; int extensible_param_count;)
   850 void *fill_candidate_datatypes_c::visit(il_formal_funct_call_c *symbol) {
   882 void *fill_candidate_datatypes_c::visit(il_formal_funct_call_c *symbol) {