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

Side by Side Diff: test/mjsunit/harmony/function-sent.js

Issue 1620253003: Implement the function.sent proposal. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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
« src/parsing/parser-base.h ('K') | « src/runtime/runtime-generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --harmony-function-sent
6
rossberg 2016/01/22 14:13:06 Add tests using yield*.
neis 2016/01/27 16:49:40 Done.
7
8 {
9 function* g() { return function.sent }
10 assertEquals({value: 42, done: true}, g().next(42));
11 }
12
13
14 {
15 function* g() {
16 try {
17 yield function.sent;
18 yield function.sent;
19 } finally {
20 return function.sent;
rossberg 2016/01/22 14:13:06 Maybe also have a test that yields in the finally
neis 2016/01/27 16:49:40 Done.
21 }
22 }
23
24
25 {
26 x = g();
27 assertEquals({value: 1, done: false}, x.next(1));
28 assertEquals({value: 2, done: false}, x.next(2));
29 assertEquals({value: 3, done: true}, x.next(3));
30 }
31
32
33 {
34 x = g();
35 assertEquals({value: 1, done: false}, x.next(1));
36 assertEquals({value: 2, done: true}, x.throw(2));
37 }
38 }
39
rossberg 2016/01/22 14:13:06 Once there is 'return', we should probably have mo
40
41 assertThrows("function f() { return function.sent }", SyntaxError);
42 assertThrows("() => { return function.sent }", SyntaxError);
43 assertThrows("() => { function.sent }", SyntaxError);
44 assertThrows("() => function.sent", SyntaxError);
45 assertThrows("({*f() { function.sent }})", SyntaxError);
46 assertDoesNotThrow("({*f() { return function.sent }})");
OLDNEW
« src/parsing/parser-base.h ('K') | « src/runtime/runtime-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698