stage3/stage3.cc
changeset 656 45a796bce487
parent 612 c062ff18d04f
child 677 740da3255d9d
equal deleted inserted replaced
655:a77514dd0040 656:45a796bce487
    39 #include "narrow_candidate_datatypes.hh"
    39 #include "narrow_candidate_datatypes.hh"
    40 #include "print_datatypes_error.hh"
    40 #include "print_datatypes_error.hh"
    41 #include "lvalue_check.hh"
    41 #include "lvalue_check.hh"
    42 #include "array_range_check.hh"
    42 #include "array_range_check.hh"
    43 #include "constant_folding.hh"
    43 #include "constant_folding.hh"
       
    44 #include "declaration_check.hh"
    44 
    45 
    45 
    46 static int declaration_safety(symbol_c *tree_root){
       
    47     declaration_check_c declaration_check(tree_root);
       
    48     tree_root->accept(declaration_check);
       
    49     return declaration_check.get_error_count();
       
    50 }
    46 
    51 
    47 static int flow_control_analysis(symbol_c *tree_root){
    52 static int flow_control_analysis(symbol_c *tree_root){
    48     flow_control_analysis_c flow_control_analysis(tree_root);
    53     flow_control_analysis_c flow_control_analysis(tree_root);
    49     tree_root->accept(flow_control_analysis);
    54     tree_root->accept(flow_control_analysis);
    50     return 0;
    55     return 0;
    97 }
   102 }
    98 
   103 
    99 
   104 
   100 int stage3(symbol_c *tree_root){
   105 int stage3(symbol_c *tree_root){
   101 	int error_count = 0;
   106 	int error_count = 0;
       
   107 	error_count += declaration_safety(tree_root);
   102 	error_count += flow_control_analysis(tree_root);
   108 	error_count += flow_control_analysis(tree_root);
   103 	error_count += constant_folding(tree_root);
   109 	error_count += constant_folding(tree_root);
   104 	error_count += type_safety(tree_root);
   110 	error_count += type_safety(tree_root);
   105 	error_count += lvalue_check(tree_root);
   111 	error_count += lvalue_check(tree_root);
   106 	error_count += array_range_check(tree_root);
   112 	error_count += array_range_check(tree_root);