514 prev_il_instruction = symbol; |
510 prev_il_instruction = symbol; |
515 return NULL; |
511 return NULL; |
516 } |
512 } |
517 |
513 |
518 void *print_datatypes_error_c::visit(S_operator_c *symbol) { |
514 void *print_datatypes_error_c::visit(S_operator_c *symbol) { |
519 if (NULL != symbol->datatype) return NULL; |
|
520 |
|
521 il_operand->accept(*this); |
515 il_operand->accept(*this); |
522 if ((symbol->candidate_datatypes.size() == 0) && |
516 if ((symbol->candidate_datatypes.size() == 0) && |
523 (il_operand->candidate_datatypes.size() > 0)) |
517 (il_operand->candidate_datatypes.size() > 0)) |
524 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'S' operator."); |
518 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'S' operator."); |
525 prev_il_instruction = symbol; |
519 prev_il_instruction = symbol; |
526 return NULL; |
520 return NULL; |
527 } |
521 } |
528 |
522 |
529 void *print_datatypes_error_c::visit(R_operator_c *symbol) { |
523 void *print_datatypes_error_c::visit(R_operator_c *symbol) { |
530 if (NULL != symbol->datatype) return NULL; |
|
531 |
|
532 il_operand->accept(*this); |
524 il_operand->accept(*this); |
533 if ((symbol->candidate_datatypes.size() == 0) && |
525 if ((symbol->candidate_datatypes.size() == 0) && |
534 (il_operand->candidate_datatypes.size() > 0)) |
526 (il_operand->candidate_datatypes.size() > 0)) |
535 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'R' operator."); |
527 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'R' operator."); |
536 prev_il_instruction = symbol; |
528 prev_il_instruction = symbol; |
537 return NULL; |
529 return NULL; |
538 } |
530 } |
539 |
531 |
540 void *print_datatypes_error_c::visit(S1_operator_c *symbol) { |
532 void *print_datatypes_error_c::visit(S1_operator_c *symbol) { |
541 if (NULL != symbol->datatype) return NULL; |
|
542 |
|
543 il_operand->accept(*this); |
533 il_operand->accept(*this); |
544 if ((symbol->candidate_datatypes.size() == 0) && |
534 if ((symbol->candidate_datatypes.size() == 0) && |
545 (il_operand->candidate_datatypes.size() > 0)) |
535 (il_operand->candidate_datatypes.size() > 0)) |
546 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'S1' operator."); |
536 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'S1' operator."); |
547 prev_il_instruction = symbol; |
537 prev_il_instruction = symbol; |
548 return NULL; |
538 return NULL; |
549 } |
539 } |
550 |
540 |
551 void *print_datatypes_error_c::visit(R1_operator_c *symbol) { |
541 void *print_datatypes_error_c::visit(R1_operator_c *symbol) { |
552 if (NULL != symbol->datatype) return NULL; |
|
553 |
|
554 il_operand->accept(*this); |
542 il_operand->accept(*this); |
555 if ((symbol->candidate_datatypes.size() == 0) && |
543 if ((symbol->candidate_datatypes.size() == 0) && |
556 (il_operand->candidate_datatypes.size() > 0)) |
544 (il_operand->candidate_datatypes.size() > 0)) |
557 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'R1' operator."); |
545 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'R1' operator."); |
558 prev_il_instruction = symbol; |
546 prev_il_instruction = symbol; |
588 prev_il_instruction = symbol; |
576 prev_il_instruction = symbol; |
589 return NULL; |
577 return NULL; |
590 } |
578 } |
591 |
579 |
592 void *print_datatypes_error_c::visit(AND_operator_c *symbol) { |
580 void *print_datatypes_error_c::visit(AND_operator_c *symbol) { |
593 if (NULL != symbol->datatype) return NULL; |
|
594 |
|
595 il_operand->accept(*this); |
581 il_operand->accept(*this); |
596 if ((symbol->candidate_datatypes.size() == 0) && |
582 if ((symbol->candidate_datatypes.size() == 0) && |
597 (il_operand->candidate_datatypes.size() > 0)) |
583 (il_operand->candidate_datatypes.size() > 0)) |
598 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'AND' operator."); |
584 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'AND' operator."); |
599 prev_il_instruction = symbol; |
585 prev_il_instruction = symbol; |
600 return NULL; |
586 return NULL; |
601 } |
587 } |
602 |
588 |
603 void *print_datatypes_error_c::visit(OR_operator_c *symbol) { |
589 void *print_datatypes_error_c::visit(OR_operator_c *symbol) { |
604 if (NULL != symbol->datatype) return NULL; |
|
605 |
|
606 il_operand->accept(*this); |
590 il_operand->accept(*this); |
607 if ((symbol->candidate_datatypes.size() == 0) && |
591 if ((symbol->candidate_datatypes.size() == 0) && |
608 (il_operand->candidate_datatypes.size() > 0)) |
592 (il_operand->candidate_datatypes.size() > 0)) |
609 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'OR' operator."); |
593 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'OR' operator."); |
610 prev_il_instruction = symbol; |
594 prev_il_instruction = symbol; |
611 return NULL; |
595 return NULL; |
612 } |
596 } |
613 |
597 |
614 void *print_datatypes_error_c::visit(XOR_operator_c *symbol) { |
598 void *print_datatypes_error_c::visit(XOR_operator_c *symbol) { |
615 if (NULL != symbol->datatype) return NULL; |
|
616 |
|
617 il_operand->accept(*this); |
599 il_operand->accept(*this); |
618 if ((symbol->candidate_datatypes.size() == 0) && |
600 if ((symbol->candidate_datatypes.size() == 0) && |
619 (il_operand->candidate_datatypes.size() > 0)) |
601 (il_operand->candidate_datatypes.size() > 0)) |
620 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'XOR' operator."); |
602 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'XOR' operator."); |
621 prev_il_instruction = symbol; |
603 prev_il_instruction = symbol; |
622 return NULL; |
604 return NULL; |
623 } |
605 } |
624 |
606 |
625 void *print_datatypes_error_c::visit(ANDN_operator_c *symbol) { |
607 void *print_datatypes_error_c::visit(ANDN_operator_c *symbol) { |
626 if (NULL != symbol->datatype) return NULL; |
|
627 |
|
628 il_operand->accept(*this); |
608 il_operand->accept(*this); |
629 if ((symbol->candidate_datatypes.size() == 0) && |
609 if ((symbol->candidate_datatypes.size() == 0) && |
630 (il_operand->candidate_datatypes.size() > 0)) |
610 (il_operand->candidate_datatypes.size() > 0)) |
631 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'ANDN' operator."); |
611 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'ANDN' operator."); |
632 prev_il_instruction = symbol; |
612 prev_il_instruction = symbol; |
633 return NULL; |
613 return NULL; |
634 } |
614 } |
635 |
615 |
636 void *print_datatypes_error_c::visit(ORN_operator_c *symbol) { |
616 void *print_datatypes_error_c::visit(ORN_operator_c *symbol) { |
637 if (NULL != symbol->datatype) return NULL; |
|
638 |
|
639 il_operand->accept(*this); |
617 il_operand->accept(*this); |
640 if ((symbol->candidate_datatypes.size() == 0) && |
618 if ((symbol->candidate_datatypes.size() == 0) && |
641 (il_operand->candidate_datatypes.size() > 0)) |
619 (il_operand->candidate_datatypes.size() > 0)) |
642 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'ORN' operator."); |
620 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'ORN' operator."); |
643 prev_il_instruction = symbol; |
621 prev_il_instruction = symbol; |
644 return NULL; |
622 return NULL; |
645 } |
623 } |
646 |
624 |
647 void *print_datatypes_error_c::visit(XORN_operator_c *symbol) { |
625 void *print_datatypes_error_c::visit(XORN_operator_c *symbol) { |
648 if (NULL != symbol->datatype) return NULL; |
|
649 |
|
650 il_operand->accept(*this); |
626 il_operand->accept(*this); |
651 if ((symbol->candidate_datatypes.size() == 0) && |
627 if ((symbol->candidate_datatypes.size() == 0) && |
652 (il_operand->candidate_datatypes.size() > 0)) |
628 (il_operand->candidate_datatypes.size() > 0)) |
653 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'ORN' operator."); |
629 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'ORN' operator."); |
654 prev_il_instruction = symbol; |
630 prev_il_instruction = symbol; |
655 return NULL; |
631 return NULL; |
656 } |
632 } |
657 |
633 |
658 void *print_datatypes_error_c::visit(ADD_operator_c *symbol) { |
634 void *print_datatypes_error_c::visit(ADD_operator_c *symbol) { |
659 if (NULL != symbol->datatype) return NULL; |
|
660 |
|
661 il_operand->accept(*this); |
635 il_operand->accept(*this); |
662 if ((symbol->candidate_datatypes.size() == 0) && |
636 if ((symbol->candidate_datatypes.size() == 0) && |
663 (il_operand->candidate_datatypes.size() > 0)) |
637 (il_operand->candidate_datatypes.size() > 0)) |
664 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'ADD' operator."); |
638 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'ADD' operator."); |
665 prev_il_instruction = symbol; |
639 prev_il_instruction = symbol; |
666 return NULL; |
640 return NULL; |
667 } |
641 } |
668 |
642 |
669 void *print_datatypes_error_c::visit(SUB_operator_c *symbol) { |
643 void *print_datatypes_error_c::visit(SUB_operator_c *symbol) { |
670 if (NULL != symbol->datatype) return NULL; |
|
671 |
|
672 il_operand->accept(*this); |
644 il_operand->accept(*this); |
673 if ((symbol->candidate_datatypes.size() == 0) && |
645 if ((symbol->candidate_datatypes.size() == 0) && |
674 (il_operand->candidate_datatypes.size() > 0)) |
646 (il_operand->candidate_datatypes.size() > 0)) |
675 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'SUB' operator."); |
647 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'SUB' operator."); |
676 prev_il_instruction = symbol; |
648 prev_il_instruction = symbol; |
677 return NULL; |
649 return NULL; |
678 } |
650 } |
679 |
651 |
680 void *print_datatypes_error_c::visit(MUL_operator_c *symbol) { |
652 void *print_datatypes_error_c::visit(MUL_operator_c *symbol) { |
681 if (NULL != symbol->datatype) return NULL; |
|
682 |
|
683 il_operand->accept(*this); |
653 il_operand->accept(*this); |
684 if ((symbol->candidate_datatypes.size() == 0) && |
654 if ((symbol->candidate_datatypes.size() == 0) && |
685 (il_operand->candidate_datatypes.size() > 0)) |
655 (il_operand->candidate_datatypes.size() > 0)) |
686 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'MUL' operator."); |
656 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'MUL' operator."); |
687 prev_il_instruction = symbol; |
657 prev_il_instruction = symbol; |
688 return NULL; |
658 return NULL; |
689 } |
659 } |
690 |
660 |
691 void *print_datatypes_error_c::visit(DIV_operator_c *symbol) { |
661 void *print_datatypes_error_c::visit(DIV_operator_c *symbol) { |
692 if (NULL != symbol->datatype) return NULL; |
|
693 |
|
694 il_operand->accept(*this); |
662 il_operand->accept(*this); |
695 if ((symbol->candidate_datatypes.size() == 0) && |
663 if ((symbol->candidate_datatypes.size() == 0) && |
696 (il_operand->candidate_datatypes.size() > 0)) |
664 (il_operand->candidate_datatypes.size() > 0)) |
697 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'DIV' operator."); |
665 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'DIV' operator."); |
698 prev_il_instruction = symbol; |
666 prev_il_instruction = symbol; |
699 return NULL; |
667 return NULL; |
700 } |
668 } |
701 |
669 |
702 void *print_datatypes_error_c::visit(MOD_operator_c *symbol) { |
670 void *print_datatypes_error_c::visit(MOD_operator_c *symbol) { |
703 if (NULL != symbol->datatype) return NULL; |
|
704 |
|
705 il_operand->accept(*this); |
671 il_operand->accept(*this); |
706 if ((symbol->candidate_datatypes.size() == 0) && |
672 if ((symbol->candidate_datatypes.size() == 0) && |
707 (il_operand->candidate_datatypes.size() > 0)) |
673 (il_operand->candidate_datatypes.size() > 0)) |
708 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'MOD' operator."); |
674 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'MOD' operator."); |
709 prev_il_instruction = symbol; |
675 prev_il_instruction = symbol; |
913 return NULL; |
861 return NULL; |
914 } |
862 } |
915 |
863 |
916 |
864 |
917 void *print_datatypes_error_c::visit(add_expression_c *symbol) { |
865 void *print_datatypes_error_c::visit(add_expression_c *symbol) { |
918 if (NULL != symbol->datatype) return NULL; |
866 symbol->l_exp->accept(*this); |
919 |
867 symbol->r_exp->accept(*this); |
920 symbol->l_exp->accept(*this); |
868 if ((symbol->candidate_datatypes.size() == 0) && |
921 symbol->r_exp->accept(*this); |
869 (symbol->l_exp->candidate_datatypes.size() > 0) && |
922 if ((symbol->candidate_datatypes.size() == 0) && |
870 (symbol->r_exp->candidate_datatypes.size() > 0)) |
923 (symbol->l_exp->candidate_datatypes.size() > 0) && |
871 STAGE3_ERROR(symbol, symbol, "Data type mismatch for '+' expression."); |
924 (symbol->r_exp->candidate_datatypes.size() > 0)) |
|
925 STAGE3_ERROR(symbol, symbol, "Current '+' result and operand not of same data type."); |
|
926 |
872 |
927 return NULL; |
873 return NULL; |
928 } |
874 } |
929 |
875 |
930 |
876 |
931 |
877 |
932 void *print_datatypes_error_c::visit(sub_expression_c *symbol) { |
878 void *print_datatypes_error_c::visit(sub_expression_c *symbol) { |
933 if (NULL != symbol->datatype) return NULL; |
879 symbol->l_exp->accept(*this); |
934 |
880 symbol->r_exp->accept(*this); |
935 symbol->l_exp->accept(*this); |
881 if ((symbol->candidate_datatypes.size() == 0) && |
936 symbol->r_exp->accept(*this); |
882 (symbol->l_exp->candidate_datatypes.size() > 0) && |
937 if ((symbol->candidate_datatypes.size() == 0) && |
883 (symbol->r_exp->candidate_datatypes.size() > 0)) |
938 (symbol->l_exp->candidate_datatypes.size() > 0) && |
884 STAGE3_ERROR(symbol, symbol, "Data type mismatch for '-' expression."); |
939 (symbol->r_exp->candidate_datatypes.size() > 0)) |
|
940 STAGE3_ERROR(symbol, symbol, "Current '-' result and operand not of same data type."); |
|
941 return NULL; |
885 return NULL; |
942 } |
886 } |
943 |
887 |
944 void *print_datatypes_error_c::visit(mul_expression_c *symbol) { |
888 void *print_datatypes_error_c::visit(mul_expression_c *symbol) { |
945 if (NULL != symbol->datatype) return NULL; |
889 symbol->l_exp->accept(*this); |
946 |
890 symbol->r_exp->accept(*this); |
947 symbol->l_exp->accept(*this); |
891 if ((symbol->candidate_datatypes.size() == 0) && |
948 symbol->r_exp->accept(*this); |
892 (symbol->l_exp->candidate_datatypes.size() > 0) && |
949 if ((symbol->candidate_datatypes.size() == 0) && |
893 (symbol->r_exp->candidate_datatypes.size() > 0)) |
950 (symbol->l_exp->candidate_datatypes.size() > 0) && |
894 STAGE3_ERROR(symbol, symbol, "Data type mismatch for '*' expression."); |
951 (symbol->r_exp->candidate_datatypes.size() > 0)) |
|
952 STAGE3_ERROR(symbol, symbol, "Current '*' result and operand not of same data type."); |
|
953 return NULL; |
895 return NULL; |
954 } |
896 } |
955 |
897 |
956 void *print_datatypes_error_c::visit(div_expression_c *symbol) { |
898 void *print_datatypes_error_c::visit(div_expression_c *symbol) { |
957 if (NULL != symbol->datatype) return NULL; |
899 symbol->l_exp->accept(*this); |
958 |
900 symbol->r_exp->accept(*this); |
959 symbol->l_exp->accept(*this); |
901 if ((symbol->candidate_datatypes.size() == 0) && |
960 symbol->r_exp->accept(*this); |
902 (symbol->l_exp->candidate_datatypes.size() > 0) && |
961 if ((symbol->candidate_datatypes.size() == 0) && |
903 (symbol->r_exp->candidate_datatypes.size() > 0)) |
962 (symbol->l_exp->candidate_datatypes.size() > 0) && |
904 STAGE3_ERROR(symbol, symbol, "Data type mismatch for '/' expression."); |
963 (symbol->r_exp->candidate_datatypes.size() > 0)) |
|
964 STAGE3_ERROR(symbol, symbol, "Current '/' result and operand not of same data type."); |
|
965 return NULL; |
905 return NULL; |
966 } |
906 } |
967 |
907 |
968 |
908 |
969 void *print_datatypes_error_c::visit(mod_expression_c *symbol) { |
909 void *print_datatypes_error_c::visit(mod_expression_c *symbol) { |
970 if (NULL != symbol->datatype) return NULL; |
910 symbol->l_exp->accept(*this); |
971 |
911 symbol->r_exp->accept(*this); |
972 symbol->l_exp->accept(*this); |
912 if ((symbol->candidate_datatypes.size() == 0) && |
973 symbol->r_exp->accept(*this); |
913 (symbol->l_exp->candidate_datatypes.size() > 0) && |
974 if ((symbol->candidate_datatypes.size() == 0) && |
914 (symbol->r_exp->candidate_datatypes.size() > 0)) |
975 (symbol->l_exp->candidate_datatypes.size() > 0) && |
915 STAGE3_ERROR(symbol, symbol, "Data type mismatch for 'MOD' expression."); |
976 (symbol->r_exp->candidate_datatypes.size() > 0)) |
|
977 STAGE3_ERROR(symbol, symbol, "Current 'MOD' result and operand not of same data type."); |
|
978 return NULL; |
916 return NULL; |
979 } |
917 } |
980 |
918 |
981 |
919 |
982 void *print_datatypes_error_c::visit(power_expression_c *symbol) { |
920 void *print_datatypes_error_c::visit(power_expression_c *symbol) { |
983 if (NULL != symbol->datatype) return NULL; |
|
984 |
|
985 symbol->l_exp->accept(*this); |
921 symbol->l_exp->accept(*this); |
986 symbol->r_exp->accept(*this); |
922 symbol->r_exp->accept(*this); |
987 if ((symbol->candidate_datatypes.size() == 0) && |
923 if ((symbol->candidate_datatypes.size() == 0) && |
988 (symbol->l_exp->candidate_datatypes.size() > 0) && |
924 (symbol->l_exp->candidate_datatypes.size() > 0) && |
989 (symbol->r_exp->candidate_datatypes.size() > 0)) |
925 (symbol->r_exp->candidate_datatypes.size() > 0)) |
991 return NULL; |
927 return NULL; |
992 } |
928 } |
993 |
929 |
994 |
930 |
995 void *print_datatypes_error_c::visit(neg_expression_c *symbol) { |
931 void *print_datatypes_error_c::visit(neg_expression_c *symbol) { |
996 if (NULL != symbol->datatype) return NULL; |
|
997 |
|
998 symbol->exp->accept(*this); |
932 symbol->exp->accept(*this); |
999 if ((symbol->candidate_datatypes.size() == 0) && |
933 if ((symbol->candidate_datatypes.size() == 0) && |
1000 (symbol->exp->candidate_datatypes.size() > 0)) |
934 (symbol->exp->candidate_datatypes.size() > 0)) |
1001 STAGE3_ERROR(symbol, symbol, "Invalid data type for 'NEG' expression."); |
935 STAGE3_ERROR(symbol, symbol, "Invalid data type for 'NEG' expression."); |
1002 return NULL; |
936 return NULL; |
1003 } |
937 } |
1004 |
938 |
1005 |
939 |
1006 void *print_datatypes_error_c::visit(not_expression_c *symbol) { |
940 void *print_datatypes_error_c::visit(not_expression_c *symbol) { |
1007 if (NULL != symbol->datatype) return NULL; |
|
1008 |
|
1009 symbol->exp->accept(*this); |
941 symbol->exp->accept(*this); |
1010 if ((symbol->candidate_datatypes.size() == 0) && |
942 if ((symbol->candidate_datatypes.size() == 0) && |
1011 (symbol->exp->candidate_datatypes.size() > 0)) |
943 (symbol->exp->candidate_datatypes.size() > 0)) |
1012 STAGE3_ERROR(symbol, symbol, "Invalid data type for 'NOT' expression."); |
944 STAGE3_ERROR(symbol, symbol, "Invalid data type for 'NOT' expression."); |
1013 return NULL; |
945 return NULL; |
1014 } |
946 } |
1015 |
947 |
1016 |
948 |
1017 void *print_datatypes_error_c::visit(function_invocation_c *symbol) { |
949 void *print_datatypes_error_c::visit(function_invocation_c *symbol) { |
1018 list_c *parameter_list; |
950 symbol_c *param_value, *param_name; |
1019 |
951 function_call_param_iterator_c fcp_iterator(symbol); |
1020 if (NULL != symbol->formal_param_list) |
952 bool function_invocation_error = false; |
1021 parameter_list = (list_c *)symbol->formal_param_list; |
953 |
1022 else if (NULL != symbol->nonformal_param_list) |
954 if ((NULL != symbol->formal_param_list) && (NULL != symbol->nonformal_param_list)) |
1023 parameter_list = (list_c *)symbol->nonformal_param_list; |
955 ERROR; |
1024 else ERROR; |
956 |
1025 |
957 if (NULL != symbol->formal_param_list) { |
1026 parameter_list->accept(*this); |
958 symbol->formal_param_list->accept(*this); |
1027 |
959 while ((param_name = fcp_iterator.next_f()) != NULL) { |
1028 if (symbol->candidate_datatypes.size() == 0) { |
960 param_value = fcp_iterator.get_current_value(); |
|
961 if (NULL == param_value->datatype) { |
|
962 function_invocation_error = true; |
|
963 } |
|
964 } |
|
965 } |
|
966 if (NULL != symbol->nonformal_param_list) { |
|
967 symbol->nonformal_param_list->accept(*this); |
|
968 while ((param_value = fcp_iterator.next_nf()) != NULL) { |
|
969 if (NULL == param_value->datatype) { |
|
970 function_invocation_error = true; |
|
971 } |
|
972 } |
|
973 } |
|
974 |
|
975 if (function_invocation_error) { |
1029 /* No compatible function exists */ |
976 /* No compatible function exists */ |
1030 STAGE3_ERROR(symbol, symbol, "Invalid parameters in function invocation: %s\n", ((identifier_c *)symbol->function_name)->value); |
977 STAGE3_ERROR(symbol, symbol, "Invalid parameters in function invocation: %s\n", ((identifier_c *)symbol->function_name)->value); |
1031 } |
978 } |
1032 #if 0 |
|
1033 else |
|
1034 if (NULL == symbol->datatype) { |
|
1035 /* One or compatible functions exists, but none chosen! */ |
|
1036 STAGE3_ERROR(symbol, symbol, "Invalid parameters in function invocation: %s\n", f_name->value); |
|
1037 } |
|
1038 #endif |
|
1039 |
979 |
1040 return NULL; |
980 return NULL; |
1041 } |
981 } |
1042 |
982 |
1043 /********************/ |
983 /********************/ |
1073 * and let the other classes handle it aproproately. |
1013 * and let the other classes handle it aproproately. |
1074 * It could also be used in stage 4, if required. |
1014 * It could also be used in stage 4, if required. |
1075 */ |
1015 */ |
1076 // SYM_REF3(fb_invocation_c, fb_name, formal_param_list, nonformal_param_list, symbol_c *called_fb_declaration;) |
1016 // SYM_REF3(fb_invocation_c, fb_name, formal_param_list, nonformal_param_list, symbol_c *called_fb_declaration;) |
1077 void *print_datatypes_error_c::visit(fb_invocation_c *symbol) { |
1017 void *print_datatypes_error_c::visit(fb_invocation_c *symbol) { |
1078 list_c *parameter_list; |
1018 symbol_c *param_value, *param_name; |
1079 |
1019 function_call_param_iterator_c fcp_iterator(symbol); |
1080 if (NULL != symbol->formal_param_list) |
1020 bool function_invocation_error = false; |
1081 parameter_list = (list_c *)symbol->formal_param_list; |
1021 |
1082 else if (NULL != symbol->nonformal_param_list) |
1022 if ((NULL != symbol->formal_param_list) && (NULL != symbol->nonformal_param_list)) |
1083 parameter_list = (list_c *)symbol->nonformal_param_list; |
1023 ERROR; |
1084 else ERROR; |
1024 |
1085 |
1025 if (NULL != symbol->formal_param_list) { |
1086 parameter_list->accept(*this); |
1026 symbol->formal_param_list->accept(*this); |
1087 |
1027 while ((param_name = fcp_iterator.next_f()) != NULL) { |
1088 if (NULL == symbol->called_fb_declaration) { |
1028 param_value = fcp_iterator.get_current_value(); |
|
1029 if (NULL == param_value->datatype) { |
|
1030 function_invocation_error = true; |
|
1031 } |
|
1032 } |
|
1033 } |
|
1034 if (NULL != symbol->nonformal_param_list) { |
|
1035 symbol->nonformal_param_list->accept(*this); |
|
1036 while ((param_value = fcp_iterator.next_nf()) != NULL) { |
|
1037 if (NULL == param_value->datatype) { |
|
1038 function_invocation_error = true; |
|
1039 } |
|
1040 } |
|
1041 } |
|
1042 |
|
1043 if (function_invocation_error) { |
1089 /* Invalid parameters for FB call! */ |
1044 /* Invalid parameters for FB call! */ |
1090 STAGE3_ERROR(symbol, symbol, "Invalid parameters in FB invocation: %s\n", ((identifier_c *)symbol->fb_name)->value); |
1045 STAGE3_ERROR(symbol, symbol, "Invalid parameters in FB invocation: %s\n", ((identifier_c *)symbol->fb_name)->value); |
1091 } |
1046 } |
1092 |
1047 |
1093 return NULL; |
1048 return NULL; |