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

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

Issue 348893007: Allow yield expressions without a RHS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update tests, fix function* () { yield* } Created 6 years, 6 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') | test/mjsunit/harmony/generators-iteration.js » ('j') | 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 af553ed6bb87c3fa1e323fe86ec38a4399746d20..47f5e6abecef02c5ae37e43f3249c61e781570be 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -1856,6 +1856,10 @@ TEST(NoErrorsGenerator) {
"yield 3; yield 4;",
"yield * 3; yield * 4;",
"(function (yield) { })",
+ "yield { yield: 12 }",
+ "yield /* comment */ { yield: 12 }",
+ "yield * \n { yield: 12 }",
+ "yield /* comment */ * \n { yield: 12 }",
// You can return in a generator.
"yield 1; return",
"yield * 1; return",
@@ -1866,8 +1870,21 @@ TEST(NoErrorsGenerator) {
// Yield is still a valid key in object literals.
"({ yield: 1 })",
"({ get yield() { } })",
- // TODO(348893007): Invalid (no newline allowed between yield and *).
- "yield\n*3",
+ // Yield without RHS.
+ "yield;",
+ "yield",
+ "yield\n",
+ "yield /* comment */"
+ "yield // comment\n"
+ "(yield)",
+ "[yield]",
+ "{yield}",
+ "yield, yield",
+ "yield; yield",
+ "(yield) ? yield : yield",
+ "(yield) \n ? yield : yield",
+ // If there is a newline before the next token, we don't look for RHS.
+ "yield\nfor (;;) {}",
NULL
};
@@ -1913,19 +1930,15 @@ TEST(ErrorsYieldGenerator) {
"yield ? 1 : 2",
// Parses as yield (/ yield): invalid.
"yield / yield",
- // TODO(348893007): The rest of these should be valid.
- "yield;",
- "yield",
- "yield\n",
- "(yield)",
- "[yield]",
- "{yield}",
- "yield, yield",
- "yield; yield",
- "(yield) ? yield : yield",
- "(yield) \n ? yield : yield",
- // Parses as yield (+ yield).
- "yield + yield",
+ "+ yield",
+ "+ yield 3",
+ // Invalid (no newline allowed between yield and *).
+ "yield\n*3",
+ // Invalid (we see a newline, so we parse {yield:42} as a statement, not an
+ // object literal, and yield is not a valid label).
+ "yield\n{yield: 42}",
+ "yield /* comment */\n {yield: 42}",
+ "yield //comment\n {yield: 42}",
NULL
};
« no previous file with comments | « src/preparser.h ('k') | test/mjsunit/harmony/generators-iteration.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698