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}
This commit is contained in:
parent
e3e347b85c
commit
986814218b
@ -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;
|
||||
|
7
test/mjsunit/regress/regress-crbug-630559.js
Normal file
7
test/mjsunit/regress/regress-crbug-630559.js
Normal file
@ -0,0 +1,7 @@
|
||||
// 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{}%");
|
Loading…
Reference in New Issue
Block a user