Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
deps: V8: cherry-pick f9257802c1c0
Original commit message:
Fix scanner-level error reporting for hashbang
When the file begins with a hashbang, the scanner is in a failed state
when SkipHashbang() is called. This is usually not an issue but when
the parser encounters an ILLEGAL token, it will reset the SyntaxError
location because of it.
Bug: v8:10110
Change-Id: I1c7344bf5ad20079cff80130c991f3bff4d7e9a8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1995312
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66038}
Refs: v8/v8@f925780
Fixes: #31284
Signed-off-by: Matheus Marchini <mmarchini@netflix.com>
PR-URL: #32180
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>- Loading branch information
Showing
with
22 additions
and 16 deletions.
- +1 −1 common.gypi
- +0 −1 deps/v8/src/parsing/parser.cc
- +0 −4 deps/v8/src/parsing/preparser.cc
- +4 −0 deps/v8/src/parsing/scanner-inl.h
- +0 −7 deps/v8/src/parsing/scanner.cc
- +0 −3 deps/v8/src/parsing/scanner.h
- +12 −0 deps/v8/test/message/fail/hashbang-incomplete-string.js
- +5 −0 deps/v8/test/message/fail/hashbang-incomplete-string.out
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -314,13 +314,6 @@ Token::Value Scanner::SkipMultiLineComment() { | ||
| return Token::ILLEGAL; | ||
| } | ||
|
|
||
| Token::Value Scanner::ScanHtmlComment() { | ||
| // Check for <!-- comments. | ||
| DCHECK_EQ(c0_, '!'); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,12 @@ | ||
| #!/usr/bin/env d8 | ||
| // Copyright 2015 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 x = 'valid code'; | ||
|
|
||
| 'incomplete string | ||
| const y = 'even more valid code!'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,5 @@ | ||
| *%(basename)s:10: SyntaxError: Invalid or unexpected token | ||
| 'incomplete string | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| SyntaxError: Invalid or unexpected token |