From 6487ad7a338a3705a82c95fe89ed542d24f5a301 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Thu, 14 Mar 2019 13:12:31 -0400 Subject: [PATCH] [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 Commit-Queue: Caitlin Potter Cr-Commit-Position: refs/heads/master@{#60246} --- src/parsing/parser.cc | 2 +- test/mjsunit/harmony/hashbang-eval.js | 10 +++++----- test/test262/test262.status | 25 ------------------------- 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc index 867d9517bc..fb6c363fb5 100644 --- a/src/parsing/parser.cc +++ b/src/parsing/parser.cc @@ -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); diff --git a/test/mjsunit/harmony/hashbang-eval.js b/test/mjsunit/harmony/hashbang-eval.js index c5040f7bee..f30ebd0c45 100644 --- a/test/mjsunit/harmony/hashbang-eval.js +++ b/test/mjsunit/harmony/hashbang-eval.js @@ -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); diff --git a/test/test262/test262.status b/test/test262/test262.status index 6b49d1eaaa..5ab430ce05 100644 --- a/test/test262/test262.status +++ b/test/test262/test262.status @@ -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