Revert "[parser] Improve error message for unclosed function bodies"

This reverts commit 92db073fce.

Reason for revert: Breaks devtools test https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8-Blink%20Win/15539

Devtools seems to parse our error messages, e.g. https://cs.chromium.org/chromium/src/third_party/blink/renderer/devtools/front_end/object_ui/JavaScriptAutocomplete.js?type=cs&q=isExpressionComplete+javascriptautocomplete&sq=package:chromium&g=0&l=612

Original change's description:
> [parser] Improve error message for unclosed function bodies
> 
> This patch changes the output from:
> 
>   function fn() {
>                 ^
>   SyntaxError: Unexpected end of input
> 
> to:
> 
>   function fn() {
>                 ^
>   SyntaxError: missing '}' after function body
> 
> Bug: v8:6513, v8:7321
> Change-Id: I4ca8a40fa0be246da2a3ff776b3fb3c87b4ba4e0
> Also-By: gsathya@chromium.org
> Reviewed-on: https://chromium-review.googlesource.com/c/1367448
> Commit-Queue: Mathias Bynens <mathias@chromium.org>
> Reviewed-by: Marja Hölttä <marja@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#58116}

TBR=marja@chromium.org,gsathya@chromium.org,mathias@chromium.org

Change-Id: Ia2ac413d67fda39eda903c056002ae632df73df9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6513, v8:7321
Reviewed-on: https://chromium-review.googlesource.com/c/1370026
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58124}
This commit is contained in:
Leszek Swirski 2018-12-10 13:08:50 +00:00 committed by Commit Bot
parent 6663ed49dc
commit 5e8301fd25
20 changed files with 20 additions and 85 deletions

View File

@ -113,7 +113,6 @@ namespace internal {
T(MethodInvokedOnNullOrUndefined, \
"Method invoked on undefined or null value.") \
T(MethodInvokedOnWrongType, "Method invoked on an object that is not %.") \
T(MissingBraceAfterFunctionBody, "missing '}' after function body") \
T(NoAccess, "no access") \
T(NonCallableInInstanceOfCheck, \
"Right-hand side of 'instanceof' is not callable") \

View File

@ -4564,12 +4564,6 @@ ParserBase<Impl>::ParseStatementList(StatementListT* body,
}
while (peek() != end_token) {
if (peek() == Token::EOS) {
DCHECK_EQ(end_token, Token::RBRACE);
ReportMessage(MessageTemplate::kMissingBraceAfterFunctionBody);
return kLazyParsingComplete;
}
StatementT stat = ParseStatementListItem();
if (impl()->IsNull(stat)) return kLazyParsingComplete;
if (stat->IsEmptyStatement()) continue;

View File

@ -362,7 +362,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(18),
B(LdaConstant), U8(14),
B(Star), R(19),

View File

@ -119,7 +119,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(15),
B(LdaConstant), U8(11),
B(Star), R(16),
@ -336,7 +336,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(15),
B(LdaConstant), U8(11),
B(Star), R(16),
@ -571,7 +571,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(15),
B(LdaConstant), U8(11),
B(Star), R(16),
@ -771,7 +771,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(13),
B(LdaConstant), U8(9),
B(Star), R(14),

View File

@ -85,7 +85,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(12),
B(LdaConstant), U8(7),
B(Star), R(13),
@ -217,7 +217,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(13),
B(LdaConstant), U8(7),
B(Star), R(14),
@ -361,7 +361,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(12),
B(LdaConstant), U8(7),
B(Star), R(13),
@ -495,7 +495,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(11),
B(LdaConstant), U8(9),
B(Star), R(12),

View File

@ -89,7 +89,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(14),
B(LdaConstant), U8(6),
B(Star), R(15),
@ -256,7 +256,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(14),
B(LdaConstant), U8(11),
B(Star), R(15),
@ -401,7 +401,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(12),
B(LdaConstant), U8(8),
B(Star), R(13),
@ -495,7 +495,7 @@ bytecodes: [
B(JumpIfUndefined), U8(6),
B(Ldar), R(6),
B(JumpIfNotNull), U8(16),
B(LdaSmi), I8(82),
B(LdaSmi), I8(81),
B(Star), R(18),
B(LdaConstant), U8(4),
B(Star), R(19),
@ -550,7 +550,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(17),
B(LdaConstant), U8(8),
B(Star), R(18),
@ -697,7 +697,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(15),
B(LdaConstant), U8(9),
B(Star), R(16),
@ -859,7 +859,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(14),
B(LdaConstant), U8(12),
B(Star), R(15),
@ -1008,7 +1008,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(16),
B(LdaConstant), U8(6),
B(Star), R(17),
@ -1184,7 +1184,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(15),
B(LdaConstant), U8(7),
B(Star), R(16),

View File

@ -203,7 +203,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(155),
B(Wide), B(LdaSmi), I16(154),
B(Star), R(14),
B(LdaConstant), U8(13),
B(Star), R(15),

View File

@ -228,7 +228,7 @@ bytecodes: [
B(JumpIfUndefined), U8(6),
B(Ldar), R(3),
B(JumpIfNotNull), U8(16),
B(LdaSmi), I8(82),
B(LdaSmi), I8(81),
B(Star), R(4),
B(LdaConstant), U8(1),
B(Star), R(5),

View File

@ -1,6 +0,0 @@
// Copyright 2018 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.
const fn = () => {
const x = 42;

View File

@ -1,4 +0,0 @@
*%(basename)s:6: SyntaxError: missing '}' after function body
const x = 42;
^
SyntaxError: missing '}' after function body

View File

@ -1,6 +0,0 @@
// Copyright 2018 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.
function fn() {
const x = 42;

View File

@ -1,4 +0,0 @@
*%(basename)s:6: SyntaxError: missing '}' after function body
const x = 42;
^
SyntaxError: missing '}' after function body

View File

@ -1,5 +0,0 @@
// Copyright 2018 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.
if (true) {

View File

@ -1,4 +0,0 @@
*%(basename)s:6: SyntaxError: Unexpected end of input
SyntaxError: Unexpected end of input

View File

@ -1,5 +0,0 @@
// Copyright 2018 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.
const { a: b } = {

View File

@ -1,4 +0,0 @@
*%(basename)s:6: SyntaxError: Unexpected end of input
SyntaxError: Unexpected end of input

View File

@ -1,5 +0,0 @@
// Copyright 2018 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.
if (true

View File

@ -1,4 +0,0 @@
*%(basename)s:6: SyntaxError: Unexpected end of input
SyntaxError: Unexpected end of input

View File

@ -1,7 +0,0 @@
// Copyright 2018 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.
(function fn() {
const x = 42;
}()

View File

@ -1,4 +0,0 @@
*%(basename)s:8: SyntaxError: Unexpected end of input
SyntaxError: Unexpected end of input