Chromium Code Reviews| Index: test/mjsunit/harmony/block-let-crankshaft.js |
| diff --git a/test/mjsunit/harmony/block-let-crankshaft.js b/test/mjsunit/harmony/block-let-crankshaft.js |
| index 51112082d629c8001f01b722c074e65ef029de45..01d7a5bc1d429e9f933f9508932e1ecf22e94f17 100644 |
| --- a/test/mjsunit/harmony/block-let-crankshaft.js |
| +++ b/test/mjsunit/harmony/block-let-crankshaft.js |
| @@ -95,6 +95,66 @@ function f12() { |
| x = 1; |
| } |
| +function f13(x) { |
|
fschneider
2011/12/08 12:58:54
Where is f13-f23 invoked and optimized? I don't se
Steven
2011/12/08 14:25:41
Done.
|
| + (function() { x; }); |
| +} |
| + |
| +function f14() { |
| + let x; |
| + (function() { x; }); |
| +} |
| + |
| +function f15() { |
| + function x() { |
| + } |
| + (function() { x; }); |
| +} |
| + |
| +function f16() { |
| + let x = 1; |
| + (function() { x; }); |
| +} |
| + |
| +function f17() { |
| + const x = 1; |
| + (function() { x; }); |
| +} |
| + |
| +function f18(x) { |
| + return x; |
| + (function() { x; }); |
| +} |
| + |
| +function f19() { |
| + let x; |
| + return x; |
| + (function() { x; }); |
| +} |
| + |
| +function f20() { |
| + function x() { |
| + } |
| + return x; |
| + (function() { x; }); |
| +} |
| + |
| +function f21(x) { |
| + x = 1; |
| + (function() { x; }); |
| +} |
| + |
| +function f22() { |
| + let x; |
| + x = 1; |
| + (function() { x; }); |
| +} |
| + |
| +function f23() { |
| + function x() { } |
| + x = 1; |
| + (function() { x; }); |
| +} |
| + |
| // Test that temporal dead zone semantics for function and block scoped |
| // let bindings are handled by the optimizing compiler. |
| @@ -121,8 +181,35 @@ function TestFunctionLocal(s) { |
| } |
| } |
| +function TestFunctionContext(s) { |
| + 'use strict'; |
| + var func = eval("(function baz(){ " + s + "; (function() { x; }); })"); |
| + print("Testing:"); |
| + print(func); |
| + for (var i = 0; i < 5; ++i) { |
| + print(i); |
| + try { |
| + func(); |
| + assertUnreachable(); |
| + } catch (e) { |
| + assertInstanceof(e, ReferenceError); |
| + } |
| + } |
| + print("optimize"); |
| + %OptimizeFunctionOnNextCall(func); |
| + try { |
| + print("call"); |
| + func(); |
| + assertUnreachable(); |
| + } catch (e) { |
| + print("catch"); |
| + assertInstanceof(e, ReferenceError); |
| + } |
| +} |
| + |
| function TestAll(s) { |
| TestFunctionLocal(s); |
| + TestFunctionContext(s); |
| } |
| // Use before initialization in declaration statement. |