Chromium Code Reviews| Index: test/mjsunit/es8/syntactic-tail-call.js |
| diff --git a/test/mjsunit/es7/syntactic-tail-call.js b/test/mjsunit/es8/syntactic-tail-call.js |
| similarity index 92% |
| rename from test/mjsunit/es7/syntactic-tail-call.js |
| rename to test/mjsunit/es8/syntactic-tail-call.js |
| index b65fc450590afff8f051e1323dad6a4ec38ceede..4a8b7d163e0a478d41633c626cfd64abe0dcf2f0 100644 |
| --- a/test/mjsunit/es7/syntactic-tail-call.js |
| +++ b/test/mjsunit/es8/syntactic-tail-call.js |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| // Flags: --allow-natives-syntax --harmony-explicit-tailcalls |
| +// Flags: --harmony-do-expressions |
| Error.prepareStackTrace = (error,stack) => { |
| error.strace = stack; |
| @@ -223,15 +224,15 @@ function f_153(expected_call_stack, a) { |
| // Tail calling via various expressions. |
|
rossberg
2016/05/04 10:45:30
Can you add tests where these cases nest? E.g.
a
Igor Sheludko
2016/05/04 11:50:14
Done.
|
| (function() { |
| function g1(a) { |
| - return continue f([f, g1, test], false) || f([f, test], true); |
| + return f([f, g1, test], false) || continue f([f, test], true); |
| } |
| function g2(a) { |
| - return continue f([f, g2, test], true) && f([f, test], true); |
| + return f([f, g2, test], true) && continue f([f, test], true); |
| } |
| function g3(a) { |
| - return continue f([f, g3, test], 13), f([f, test], 153); |
| + return f([f, g3, test], 13), continue f([f, test], 153); |
| } |
| function test() { |
| @@ -404,10 +405,9 @@ function f_153(expected_call_stack, a) { |
| } |
| function g3(a) { |
| - var closure = () => continue f([f, closure, test], true) |
| - ? f_153([f_153, test]) |
| - : f_153([f_153, test]); |
| - |
| + var closure = () => f([f, closure, test], true) |
| + ? continue f_153([f_153, test]) |
| + : continue f_153([f_153, test]); |
| return continue closure(); |
| } |
| @@ -421,3 +421,20 @@ function f_153(expected_call_stack, a) { |
| %OptimizeFunctionOnNextCall(test); |
| test(); |
| })(); |
| + |
| + |
| +// Test tail calls from do expressions. |
| +(function () { |
| + function g1(a) { |
| + var a = do { return continue f_153([f_153, test]); 42; }; |
| + return a; |
| + } |
| + |
| + function test() { |
| + assertEquals(153, g1()); |
| + } |
| + test(); |
| + test(); |
| + %OptimizeFunctionOnNextCall(test); |
| + test(); |
| +})(); |