packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/function-call-maybe/exec.js
raw symbols SCIP| 1 | // "random" :) |
| 2 | let random = (i => { |
| 3 | const vals = [0, 0, 1, 1]; |
| 4 | return () => vals[i++]; |
| 5 | })(0); |
| 6 | |
| 7 | expect(() => { |
| 8 | function f() { x } |
| 9 | random() && f(); |
| 10 | let x; |
| 11 | }).not.toThrow(); |
| 12 | |
| 13 | expect(() => { |
| 14 | function f() { x } |
| 15 | random() || f(); |
| 16 | let x; |
| 17 | }).toThrow(ReferenceError); |
| 18 | |
| 19 | expect(() => { |
| 20 | function f() { x } |
| 21 | random() && f(); |
| 22 | let x; |
| 23 | }).toThrow(ReferenceError); |
| 24 | |
| 25 | expect(() => { |
| 26 | function f() { x } |
| 27 | random() || f(); |
| 28 | let x; |
| 29 | }).not.toThrow(); |