equal
deleted
inserted
replaced
37 #include "flow_control_analysis.hh" |
37 #include "flow_control_analysis.hh" |
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 #include "range_check.hh" |
43 |
43 |
44 |
44 |
45 static int flow_control_analysis(symbol_c *tree_root){ |
45 static int flow_control_analysis(symbol_c *tree_root){ |
46 flow_control_analysis_c flow_control_analysis(tree_root); |
46 flow_control_analysis_c flow_control_analysis(tree_root); |
47 tree_root->accept(flow_control_analysis); |
47 tree_root->accept(flow_control_analysis); |
70 lvalue_check_c lvalue_check(tree_root); |
70 lvalue_check_c lvalue_check(tree_root); |
71 tree_root->accept(lvalue_check); |
71 tree_root->accept(lvalue_check); |
72 return lvalue_check.get_error_count(); |
72 return lvalue_check.get_error_count(); |
73 } |
73 } |
74 |
74 |
|
75 static int range_check(symbol_c *tree_root){ |
|
76 range_check_c range_check(tree_root); |
|
77 tree_root->accept(range_check); |
|
78 return range_check.get_error_count(); |
|
79 } |
|
80 |
75 |
81 |
76 int stage3(symbol_c *tree_root){ |
82 int stage3(symbol_c *tree_root){ |
77 int error_count = 0; |
83 int error_count = 0; |
78 error_count += flow_control_analysis(tree_root); |
84 error_count += flow_control_analysis(tree_root); |
79 error_count += type_safety(tree_root); |
85 error_count += type_safety(tree_root); |
80 error_count += lvalue_check(tree_root); |
86 error_count += lvalue_check(tree_root); |
|
87 error_count += range_check(tree_root); |
81 |
88 |
82 if (error_count > 0) { |
89 if (error_count > 0) { |
83 fprintf(stderr, "%d error(s) found. Bailing out!\n", error_count); |
90 fprintf(stderr, "%d error(s) found. Bailing out!\n", error_count); |
84 return -1; |
91 return -1; |
85 } |
92 } |