packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/const-readonly/exec.js
raw symbols SCIP| 1 | function callNow(f) { |
| 2 | f(); |
| 3 | } |
| 4 | |
| 5 | function callLater(f) { |
| 6 | return () => f(); |
| 7 | } |
| 8 | |
| 9 | expect(() => { |
| 10 | const x = 0; |
| 11 | x = 1; |
| 12 | }).toThrow(TypeError); |
| 13 | |
| 14 | expect(() => { |
| 15 | x = 1; |
| 16 | const x = 0; |
| 17 | }).toThrow(ReferenceError); |
| 18 | |
| 19 | expect(() => { |
| 20 | callNow(() => { |
| 21 | x = 1; |
| 22 | }); |
| 23 | const x = 0; |
| 24 | }).toThrow(ReferenceError); |
| 25 | |
| 26 | |
| 27 | expect(() => { |
| 28 | const call = callLater(() => { |
| 29 | x = 1; |
| 30 | }); |
| 31 | const x = 0; |
| 32 | call(); |
| 33 | }).toThrow(TypeError); |