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

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

Issue 1891453005: [parser] Relex restriction on reserved words (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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
« src/parsing/parser-base.h ('K') | « src/parsing/parser-base.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 1b0ced08edc3d895d20c7570a3d466de3e3ae048..6e6f7ce59c306fa39efad3804337bd1f8651750f 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -2009,25 +2009,28 @@ TEST(NoErrorsEvalAndArgumentsStrict) {
RunParserSyncTest(context_data, statement_data, kSuccess);
}
+#define FUTURE_STRICT_RESERVED_WORDS_NO_LET(V) \
+ V(implements) \
+ V(interface) \
+ V(package) \
+ V(private) \
+ V(protected) \
+ V(public) \
+ V(static) \
+ V(yield)
Dan Ehrenberg 2016/04/20 20:59:56 I believe all of these extra tests would be valid
Dan Ehrenberg 2016/04/20 21:02:31 Actually, I see you are using 'no let' for your sl
mike3 2016/04/21 19:51:20 Sure thing, I'll add tests for both cases.
#define FUTURE_STRICT_RESERVED_WORDS(V) \
- V(implements) \
- V(interface) \
V(let) \
- V(package) \
- V(private) \
- V(protected) \
- V(public) \
- V(static) \
- V(yield)
+ FUTURE_STRICT_RESERVED_WORDS_NO_LET(V)
+#define LIMITED_FUTURE_STRICT_RESERVED_WORDS_NO_LET(V) \
+ V(implements) \
+ V(static) \
+ V(yield)
#define LIMITED_FUTURE_STRICT_RESERVED_WORDS(V) \
- V(implements) \
V(let) \
- V(static) \
- V(yield)
-
+ LIMITED_FUTURE_STRICT_RESERVED_WORDS_NO_LET(V)
#define FUTURE_STRICT_RESERVED_STATEMENTS(NAME) \
"var " #NAME ";", \
@@ -2043,6 +2046,13 @@ TEST(NoErrorsEvalAndArgumentsStrict) {
"++" #NAME ";", \
#NAME " ++;",
+// clang-format off
+#define FUTURE_STRICT_RESERVED_LET_BINDINGS(NAME) \
+ "let " #NAME ";", \
+ "for (let " #NAME "; false; ) {}", \
+ "for (let " #NAME " in {}) {}", \
+ "for (let " #NAME " of []) {}",
Dan Ehrenberg 2016/04/20 20:59:56 For completeness, you can use const for most of th
mike3 2016/04/21 19:51:20 Acknowledged.
+// clang-format on
TEST(ErrorsFutureStrictReservedWords) {
// Tests that both preparsing and parsing produce the right kind of errors for
@@ -2054,15 +2064,18 @@ TEST(ErrorsFutureStrictReservedWords) {
{"() => { \"use strict\"; ", "}"},
{NULL, NULL}};
+ // clang-format off
const char* statement_data[] {
LIMITED_FUTURE_STRICT_RESERVED_WORDS(FUTURE_STRICT_RESERVED_STATEMENTS)
+ LIMITED_FUTURE_STRICT_RESERVED_WORDS_NO_LET(
+ FUTURE_STRICT_RESERVED_LET_BINDINGS)
NULL
};
+ // clang-format on
RunParserSyncTest(context_data, statement_data, kError);
}
-
#undef LIMITED_FUTURE_STRICT_RESERVED_WORDS
@@ -2074,10 +2087,13 @@ TEST(NoErrorsFutureStrictReservedWords) {
{ NULL, NULL }
};
+ // clang-format off
const char* statement_data[] = {
FUTURE_STRICT_RESERVED_WORDS(FUTURE_STRICT_RESERVED_STATEMENTS)
+ FUTURE_STRICT_RESERVED_WORDS_NO_LET(FUTURE_STRICT_RESERVED_LET_BINDINGS)
NULL
};
+ // clang-format on
RunParserSyncTest(context_data, statement_data, kSuccess);
}
« src/parsing/parser-base.h ('K') | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698