diff mbox

[gccgo] Better error recover after top level declaration

Message ID mcry6b98mpm.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Sept. 10, 2010, 6:42 p.m. UTC
This gccgo patch improves error recovery when something goes wrong after
a top level declaration.  Committed to gccgo branch.

Ian
diff mbox

Patch

diff -r b59226aea9d4 go/parse.cc
--- a/go/parse.cc	Thu Sep 09 22:12:54 2010 -0700
+++ b/go/parse.cc	Fri Sep 10 11:40:58 2010 -0700
@@ -4613,7 +4613,10 @@ 
       if (token->is_op(OPERATOR_SEMICOLON))
 	token = this->advance_token();
       else if (!token->is_eof() || !saw_errors())
-	this->error("expected %<;%> or newline after top level declaration");
+	{
+	  this->error("expected %<;%> or newline after top level declaration");
+	  this->skip_past_error(OPERATOR_INVALID);
+	}
     }
 }