Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: src/preparser.cc

Issue 10701116: Sync preparser and parser wrt syntax error in switch..case. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index 0c17eecd6a432a6d24efe93247acabcdbb6d13ff..3f26423f3889437211c7a994c860c186ebe8702a 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -603,13 +603,17 @@ PreParser::Statement PreParser::ParseSwitchStatement(bool* ok) {
Expect(i::Token::CASE, CHECK_OK);
ParseExpression(true, CHECK_OK);
Expect(i::Token::COLON, CHECK_OK);
Jakob Kummerow 2012/07/10 18:46:08 nit: The "Expect(...COLON...)" line is in both the
- } else if (token == i::Token::DEFAULT) {
+ } else {
Expect(i::Token::DEFAULT, CHECK_OK);
Expect(i::Token::COLON, CHECK_OK);
- } else {
- ParseStatement(CHECK_OK);
}
token = peek();
+ while (token != i::Token::CASE &&
+ token != i::Token::DEFAULT &&
+ token != i::Token::RBRACE) {
+ ParseStatement(CHECK_OK);
+ token = peek();
+ }
}
Expect(i::Token::RBRACE, ok);
return Statement::Default();
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698