stage3/stage3.cc
changeset 564 dabffc3086dc
parent 560 13b5b7faa3d7
child 611 8e81d7db54be
--- a/stage3/stage3.cc	Tue Jun 05 11:10:12 2012 +0200
+++ b/stage3/stage3.cc	Tue Jun 05 19:17:29 2012 +0200
@@ -40,12 +40,18 @@
 #include "print_datatypes_error.hh"
 #include "lvalue_check.hh"
 #include "array_range_check.hh"
+#include "constant_folding.hh"
 
+static int constant_check(symbol_c *tree_root){
+    constant_folding_c constant_folding(tree_root);
+    tree_root->accept(constant_folding);
+    return constant_folding.get_error_count();
+}
 
 static int flow_control_analysis(symbol_c *tree_root){
-  flow_control_analysis_c flow_control_analysis(tree_root);
-  tree_root->accept(flow_control_analysis);
-  return 0;
+    flow_control_analysis_c flow_control_analysis(tree_root);
+    tree_root->accept(flow_control_analysis);
+    return 0;
 }
 
 
@@ -81,6 +87,7 @@
 
 int stage3(symbol_c *tree_root){
 	int error_count = 0;
+	error_count += constant_check(tree_root);
 	error_count += flow_control_analysis(tree_root);
 	error_count += type_safety(tree_root);
 	error_count += lvalue_check(tree_root);