[esnext] allow hashbang in eval() and unskip hashbang test262 tests

Fix original imlpementation to support occurrence in eval(), and unskip
tests.

BUG=v8:8523
r=gsathya@chromium.org, mathias@chromium.org, littledan@chromium.org

Change-Id: I80a3e8623357947c564a6cdf865eeff435b8e640
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1510792
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Cr-Commit-Position: refs/heads/master@{#60246}
This commit is contained in:
Caitlin Potter 2019-03-14 13:12:31 -04:00 committed by Commit Bot
parent b240733fd5
commit 6487ad7a33
3 changed files with 6 additions and 31 deletions

View File

@ -500,7 +500,7 @@ FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) {
Scope::DeserializationMode::kIncludingVariables);
scanner_.Initialize();
if (FLAG_harmony_hashbang && !info->is_eval()) {
if (FLAG_harmony_hashbang) {
scanner_.SkipHashBang();
}
FunctionLiteral* result = DoParseProgram(isolate, info);

View File

@ -4,8 +4,8 @@
// Flags: --harmony-hashbang
// Hashbang syntax is not allowed in eval.
assertThrows("#!", SyntaxError);
assertThrows("#!\n", SyntaxError);
assertThrows("#!---IGNORED---", SyntaxError);
assertThrows("#!---IGNORED---\n", SyntaxError);
// Hashbang syntax is allowed in eval.
assertEquals(eval("#!"), undefined);
assertEquals(eval("#!\n"), undefined);
assertEquals(eval("#!---IGNORED---"), undefined);
assertEquals(eval("#!---IGNORED---\n"), undefined);

View File

@ -551,31 +551,6 @@
'language/expressions/prefix-increment/eval': [SKIP],
'language/expressions/prefix-increment/eval-nostrict': [SKIP],
# https://bugs.chromium.org/p/v8/issues/detail?id=8850
'language/comments/hashbang/escaped-bang-041': [SKIP],
'language/comments/hashbang/escaped-bang-u0021': [SKIP],
'language/comments/hashbang/escaped-bang-u21': [SKIP],
'language/comments/hashbang/escaped-bang-x21': [SKIP],
'language/comments/hashbang/escaped-hash-043': [SKIP],
'language/comments/hashbang/escaped-hash-u0023': [SKIP],
'language/comments/hashbang/escaped-hash-u23': [SKIP],
'language/comments/hashbang/escaped-hash-x23': [SKIP],
'language/comments/hashbang/escaped-hashbang': [SKIP],
'language/comments/hashbang/eval': [SKIP],
'language/comments/hashbang/eval-indirect': [SKIP],
'language/comments/hashbang/module': [SKIP],
'language/comments/hashbang/multi-line-comment': [SKIP],
'language/comments/hashbang/no-line-separator': [SKIP],
'language/comments/hashbang/not-empty': [SKIP],
'language/comments/hashbang/preceding-directive-prologue': [SKIP],
'language/comments/hashbang/preceding-directive-prologue-sc': [SKIP],
'language/comments/hashbang/preceding-empty-statement': [SKIP],
'language/comments/hashbang/preceding-hashbang': [SKIP],
'language/comments/hashbang/preceding-line-comment': [SKIP],
'language/comments/hashbang/preceding-multi-line-comment': [SKIP],
'language/comments/hashbang/preceding-whitespace': [SKIP],
'language/comments/hashbang/use-strict': [SKIP],
######################## NEEDS INVESTIGATION ###########################
# https://bugs.chromium.org/p/v8/issues/detail?id=7833