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 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 5 | // Test that hoisting a function out of a lexical scope does not |
| 6 | // lead to a parsing error |
| 7 | |
| 8 | // This used to cause a crash in the parser |
| 9 | function f(one) { class x { } { class x { } function g() { one; x; } g() } } f() |
| 10 | |
| 11 | // This used to lead to a ReferenceError |
| 12 | function g() { var x = 1; { let x = 2; function g() { x; } g(); } } |
| 13 | assertEquals(undefined, g()); |
| 14 | |
| 15 | // This used to cause a crash in the parser |
| 16 | function __f_4(one) { |
| 17 | var __v_10 = one + 1; |
| 18 | { |
| 19 | let __v_10 = one + 3; |
| 20 | function __f_6() { |
| 21 | one; |
| 22 | __v_10; |
| 23 | } |
| 24 | __f_6(); |
| 25 | } |
| 26 | } |
| 27 | __f_4(); |