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

Unified Diff: src/parsing/parser.cc

Issue 2176613002: Native try-catch syntax parsing should not crash. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/mjsunit/regress/regress-crbug-630559.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 01614c4af818884b1c5dbaa673b12e29a471c3ff..691c394ea9426e7a84bcb26c1ad157da45873b28 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -2993,18 +2993,18 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
}
Token::Value tok = peek();
+
bool catch_for_promise_reject = false;
+ if (allow_natives() && tok == Token::MOD) {
+ Consume(Token::MOD);
+ catch_for_promise_reject = true;
+ tok = peek();
+ }
+
if (tok != Token::CATCH && tok != Token::FINALLY) {
- if (allow_natives() && tok == Token::MOD) {
- Consume(Token::MOD);
- catch_for_promise_reject = true;
- tok = peek();
- DCHECK_EQ(Token::CATCH, tok);
- } else {
- ReportMessage(MessageTemplate::kNoCatchOrFinally);
- *ok = false;
- return NULL;
- }
+ ReportMessage(MessageTemplate::kNoCatchOrFinally);
+ *ok = false;
+ return NULL;
}
Scope* catch_scope = NULL;
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-630559.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698