Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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: --harmony-sloppy-let --harmony-sloppy | |
| 6 | |
| 7 // Test that hoisting a function out of a lexical scope does not | |
| 8 // lead to a parsing error | |
| 9 | |
| 10 function f(one) { class x { } { class x { } function g() { one; x; } g() } } f() | |
| 11 | |
| 12 function g() { var x = 1; { let x = 2; function g() { x; } g(); } } | |
| 13 assertEquals(undefined, g()); | |
| 14 | |
| 15 function __f_4(one) { | |
| 16 var __v_10 = one + 1; | |
| 17 { | |
| 18 let __v_10 = one + 3; | |
| 19 function __f_6() { | |
| 20 one; | |
| 21 __v_10; | |
| 22 } | |
| 23 __f_6(); | |
| 24 } | |
| 25 } | |
| 26 __f_4(); | |
| 27 | |
| 28 try { | |
|
adamk
2015/08/21 21:39:04
Is this try/catch doing anything?
Dan Ehrenberg
2015/08/21 23:04:31
Yes, it's defining a function __f_14() which refer
| |
| 29 } catch (__v_14) { | |
| 30 function __f_14() { return __v_14; } | |
| 31 } | |
| 32 | |
| 33 assertThrows(() => { | |
| 34 function __f_21() { } | |
|
adamk
2015/08/21 21:39:04
Is this function doing anything?
Dan Ehrenberg
2015/08/21 23:04:31
Not sure, it does something to the scopes but I ac
| |
| 35 try { | |
| 36 throw 2; | |
| 37 } catch(b) { | |
| 38 n = __f_22; | |
| 39 function __f_22() { | |
| 40 return b + c; | |
| 41 } | |
| 42 let c = 3; | |
| 43 } | |
| 44 n(); | |
| 45 }, ReferenceError); | |
|
adamk
2015/08/21 21:39:04
Sorry, I'm missing something; why does this cause
Dan Ehrenberg
2015/08/21 23:04:31
You're right, this doesn't actually make sense. An
| |
| OLD | NEW |