Skip to content

Commit

Permalink
Revert "deps: V8: cherry-pick f9257802c1c0"
Browse files Browse the repository at this point in the history
This reverts commit 75da64c.

PR-URL: #32521
Refs: v8/v8@8.1.307.20...8.1.307.26
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
mmarchini authored and BethGriggs committed Apr 7, 2020
1 parent d5da970 commit a9e4cec
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 21 deletions.
1 change: 1 addition & 0 deletions deps/v8/src/parsing/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ FunctionLiteral* Parser::ParseProgram(Isolate* isolate, Handle<Script> script,
Scope::DeserializationMode::kIncludingVariables);

scanner_.Initialize();
scanner_.SkipHashBang();
FunctionLiteral* result = DoParseProgram(isolate, info);
MaybeResetCharacterStream(info, result);
MaybeProcessSourceRanges(info, result, stack_limit_);
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/parsing/preparser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ PreParser::PreParseResult PreParser::PreParseProgram() {
scope->set_is_being_lazily_parsed(true);
#endif

// Note: We should only skip the hashbang in non-Eval scripts
// (currently, Eval is not handled by the PreParser).
scanner()->SkipHashBang();

// ModuleDeclarationInstantiation for Source Text Module Records creates a
// new Module Environment Record whose outer lexical environment record is
// the global scope.
Expand Down
4 changes: 0 additions & 4 deletions deps/v8/src/parsing/scanner-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,6 @@ V8_INLINE Token::Value Scanner::ScanSingleToken() {
return ScanTemplateSpan();

case Token::PRIVATE_NAME:
if (source_pos() == 0 && Peek() == '!') {
token = SkipSingleLineComment();
continue;
}
return ScanPrivateName();

case Token::WHITESPACE:
Expand Down
7 changes: 7 additions & 0 deletions deps/v8/src/parsing/scanner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,13 @@ Token::Value Scanner::SkipMultiLineComment() {
return Token::ILLEGAL;
}

void Scanner::SkipHashBang() {
if (c0_ == '#' && Peek() == '!' && source_pos() == 0) {
SkipSingleLineComment();
Scan();
}
}

Token::Value Scanner::ScanHtmlComment() {
// Check for <!-- comments.
DCHECK_EQ(c0_, '!');
Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/parsing/scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ class V8_EXPORT_PRIVATE Scanner {

const Utf16CharacterStream* stream() const { return source_; }

// If the next characters in the stream are "#!", the line is skipped.
void SkipHashBang();

private:
// Scoped helper for saving & restoring scanner error state.
// This is used for tagged template literals, in which normally forbidden
Expand Down
12 changes: 0 additions & 12 deletions deps/v8/test/message/fail/hashbang-incomplete-string.js

This file was deleted.

5 changes: 0 additions & 5 deletions deps/v8/test/message/fail/hashbang-incomplete-string.out

This file was deleted.

0 comments on commit a9e4cec

Please sign in to comment.