Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: test/cctest/test-parsing.cc

Issue 1407633002: [es6] parse arrow ConciseBody with accept_IN flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove pesky stray var Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/preparser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 5572a1a87fcf6d04340d3451ad218ad55fa5e280..a04e852bc212318307e2c96e124fc1271d5d2e16 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -3727,6 +3727,14 @@ TEST(ErrorsArrowFunctions) {
static const ParserFlag flags[] = {kAllowLazy};
RunParserSyncTest(context_data, statement_data, kError, flags,
arraysize(flags));
+
+ // In a context where a concise arrow body is parsed with [~In] variant,
+ // ensure that an error is reported in both full parser and preparser.
+ const char* loop_context_data[][2] = {{"for (", "; 0;);"},
+ {nullptr, nullptr}};
+ const char* loop_expr_data[] = {"f => 'key' in {}", nullptr};
+ RunParserSyncTest(loop_context_data, loop_expr_data, kError, flags,
+ arraysize(flags));
}
@@ -3801,6 +3809,15 @@ TEST(NoErrorsArrowFunctions) {
kAllowHarmonyDestructuring};
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
+
+ static const ParserFlag flags[] = {kAllowLazy};
+ // In a context where a concise arrow body is parsed with [~In] variant,
+ // ensure that nested expressions can still use the 'in' operator,
+ const char* loop_context_data[][2] = {{"for (", "; 0;);"},
+ {nullptr, nullptr}};
+ const char* loop_expr_data[] = {"f => ('key' in {})", nullptr};
+ RunParserSyncTest(loop_context_data, loop_expr_data, kSuccess, flags,
+ arraysize(flags));
}
« no previous file with comments | « src/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698