stage3/stage3.cc
changeset 530 1eacd7afcab1
parent 516 8591746fa134
child 559 a3b8925e640c
equal deleted inserted replaced
529:629105224e57 530:1eacd7afcab1
    38 #include "fill_candidate_datatypes.hh"
    38 #include "fill_candidate_datatypes.hh"
    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 
    42 
       
    43 
       
    44 
    43 static int flow_control_analysis(symbol_c *tree_root){
    45 static int flow_control_analysis(symbol_c *tree_root){
    44   flow_control_analysis_c flow_control_analysis(tree_root);
    46   flow_control_analysis_c flow_control_analysis(tree_root);
    45   tree_root->accept(flow_control_analysis);
    47   tree_root->accept(flow_control_analysis);
    46   return 0;
    48   return 0;
    47 }
    49 }
       
    50 
    48 
    51 
    49 /* Type safety analysis assumes that flow control analysis has already been completed,
    52 /* Type safety analysis assumes that flow control analysis has already been completed,
    50  * so be sure to call flow_control_analysis() before calling this function
    53  * so be sure to call flow_control_analysis() before calling this function
    51  */
    54  */
    52 static int type_safety(symbol_c *tree_root){
    55 static int type_safety(symbol_c *tree_root){
    58 	tree_root->accept(print_datatypes_error);
    61 	tree_root->accept(print_datatypes_error);
    59 	return print_datatypes_error.get_error_count();
    62 	return print_datatypes_error.get_error_count();
    60 }
    63 }
    61 
    64 
    62 
    65 
    63 /* Type safety analysis assumes that flow control analysis has already been completed,
    66 /* Left value checking assumes that datat type analysis has already been completed,
    64  * so be sure to call flow_control_analysis() before calling this function
    67  * so be sure to call type_safety() before calling this function
    65  */
    68  */
    66 static int lvalue_check(symbol_c *tree_root){
    69 static int lvalue_check(symbol_c *tree_root){
    67 	lvalue_check_c lvalue_check(tree_root);
    70 	lvalue_check_c lvalue_check(tree_root);
    68 	tree_root->accept(lvalue_check);
    71 	tree_root->accept(lvalue_check);
    69 	return lvalue_check.get_error_count();
    72 	return lvalue_check.get_error_count();