Commit 98681421 authored by yangguo's avatar yangguo Committed by Commit bot

Native try-catch syntax parsing should not crash.

R=littledan@chromium.org
BUG=chromium:630559

Review-Url: https://codereview.chromium.org/2176613002
Cr-Commit-Position: refs/heads/master@{#37996}
parent e3e347b8
......@@ -2993,19 +2993,19 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
}
Token::Value tok = peek();
bool catch_for_promise_reject = false;
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 {
}
if (tok != Token::CATCH && tok != Token::FINALLY) {
ReportMessage(MessageTemplate::kNoCatchOrFinally);
*ok = false;
return NULL;
}
}
Scope* catch_scope = NULL;
Variable* catch_variable = NULL;
......
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
assertThrows("try{}%");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment