Stop lvalue checks after finding an error in the expression.
authorMario de Sousa <msousa@fe.up.pt>
Mon, 23 Apr 2012 16:50:10 +0100
changeset 529 629105224e57
parent 528 6510ee2eaab9
child 530 1eacd7afcab1
Stop lvalue checks after finding an error in the expression.
stage3/lvalue_check.cc
--- a/stage3/lvalue_check.cc	Mon Apr 23 16:44:05 2012 +0100
+++ b/stage3/lvalue_check.cc	Mon Apr 23 16:50:10 2012 +0100
@@ -229,10 +229,11 @@
 
 
 void lvalue_check_c::verify_is_lvalue(symbol_c *lvalue) {
-	check_assignment_to_expression(lvalue);
-	check_assignment_to_controlvar(lvalue);
-	check_assignment_to_output(lvalue);
-	check_assignment_to_constant(lvalue);
+	int init_error_count = error_count;  /* stop the checks once an error has been found... */
+	if (error_count == init_error_count)  check_assignment_to_expression(lvalue);
+	if (error_count == init_error_count)  check_assignment_to_controlvar(lvalue);
+	if (error_count == init_error_count)  check_assignment_to_output(lvalue);
+	if (error_count == init_error_count)  check_assignment_to_constant(lvalue);
 }