blob: 9a1d200307897fd1c99620ca5f353ddf9b8932f5 [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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 Murdoch4a90d5f2016-03-22 12:00:34 +00005// 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
9function f(one) { class x { } { class x { } function g() { one; x; } g() } } f()
10
11// This used to lead to a ReferenceError
12function g() { var x = 1; { let x = 2; function g() { x; } g(); } }
13assertEquals(undefined, g());
14
15// This used to cause a crash in the parser
16function __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();