OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 // MODULE |
| 6 |
| 7 export { myvar, mylet, myconst }; |
| 8 |
| 9 var myvar = "var"; |
| 10 assertEquals("var", myvar); |
| 11 let mylet = "let"; |
| 12 assertEquals("let", mylet); |
| 13 const myconst = "const"; |
| 14 assertEquals("const", myconst); |
| 15 |
| 16 function* gaga() { yield 1 } |
| 17 assertEquals(1, gaga().next().value); |
| 18 export {gaga}; |
| 19 export default gaga; |
| 20 export {gaga as shiiit}; |
| 21 assertEquals(1, gaga().next().value); |
| 22 |
| 23 |
| 24 export let gugu = 42; |
| 25 |
| 26 { |
| 27 assertEquals(42, gugu); |
| 28 } |
| 29 |
| 30 try { |
| 31 assertEquals(42, gugu); |
| 32 } catch(_) { |
| 33 assertUnreachable(); |
| 34 } |
| 35 |
| 36 try { |
| 37 throw {}; |
| 38 } catch(_) { |
| 39 assertEquals(42, gugu); |
| 40 } |
| 41 |
| 42 try { |
| 43 throw {}; |
| 44 } catch({x=gugu}) { |
| 45 assertEquals(42, x); |
| 46 } |
| 47 |
| 48 assertEquals(5, eval("var x = 5; x")); |
OLD | NEW |