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

Side by Side Diff: test/mjsunit/harmony/generators-iteration.js

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, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/mjsunit/harmony/generators-parsing.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 throw (yield (1 + (yield 2) + 3)) 330 throw (yield (1 + (yield 2) + 3))
331 } catch (e) { 331 } catch (e) {
332 if (typeof e == 'object') throw e; 332 if (typeof e == 'object') throw e;
333 return e + (yield (4 + (yield 5) + 6)); 333 return e + (yield (4 + (yield 5) + 6));
334 } 334 }
335 }, 335 },
336 [2, NaN, 5, NaN, NaN], 336 [2, NaN, 5, NaN, NaN],
337 "foo", 337 "foo",
338 [2, "1foo3", 5, "4foo6", "foofoo"]); 338 [2, "1foo3", 5, "4foo6", "foofoo"]);
339 339
340 // Yield with no arguments yields undefined.
341 TestGenerator(
342 function* g26() { return yield yield },
343 [undefined, undefined, undefined],
344 "foo",
345 [undefined, "foo", "foo"]);
346
347 // A newline causes the parser to stop looking for an argument to yield.
348 TestGenerator(
349 function* g27() {
350 yield
351 3
352 return
353 },
354 [undefined, undefined],
355 "foo",
356 [undefined, undefined]);
357
340 // Generator function instances. 358 // Generator function instances.
341 TestGenerator(GeneratorFunction(), 359 TestGenerator(GeneratorFunction(),
342 [undefined], 360 [undefined],
343 "foo", 361 "foo",
344 [undefined]); 362 [undefined]);
345 363
346 TestGenerator(new GeneratorFunction(), 364 TestGenerator(new GeneratorFunction(),
347 [undefined], 365 [undefined],
348 "foo", 366 "foo",
349 [undefined]); 367 [undefined]);
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 function TestThrowRecursion() { 659 function TestThrowRecursion() {
642 function* g() { yield iter.throw(1); } 660 function* g() { yield iter.throw(1); }
643 var iter = g(); 661 var iter = g();
644 return iter.next(); 662 return iter.next();
645 } 663 }
646 assertThrows(TestNextRecursion, Error); 664 assertThrows(TestNextRecursion, Error);
647 assertThrows(TestSendRecursion, Error); 665 assertThrows(TestSendRecursion, Error);
648 assertThrows(TestThrowRecursion, Error); 666 assertThrows(TestThrowRecursion, Error);
649 } 667 }
650 TestRecursion(); 668 TestRecursion();
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/mjsunit/harmony/generators-parsing.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698