Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 1 | // Copyright 2015 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: --min-preparse-length=0 |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 6 | |
| 7 | let xxx = 1; |
| 8 | let f = undefined; |
| 9 | { |
| 10 | let inner_x = xxx; |
| 11 | f = function() { return inner_x; }; |
| 12 | } |
| 13 | |
| 14 | assertSame(1, f()); |
| 15 | |
| 16 | xxx = 42; |
| 17 | { |
| 18 | f = function() { return inner_x1; }; |
| 19 | let inner_x1 = xxx; |
| 20 | } |
| 21 | |
| 22 | assertSame(42, f()); |
| 23 | |
| 24 | xxx = 31; |
| 25 | { |
| 26 | let inner_x1 = xxx; |
| 27 | try { |
| 28 | throw new Error(); |
| 29 | } catch (e) { |
| 30 | f = function() { return inner_x1; }; |
| 31 | } |
| 32 | } |
| 33 | assertSame(31, f()); |