| 1 | const box = new class { |
| 2 | locked = true; |
| 3 | #content = []; |
| 4 | |
| 5 | unlock() { this.locked = false; } |
| 6 | lock() { this.locked = true; } |
| 7 | get content() { |
| 8 | if (this.locked) throw new Error("Locked!"); |
| 9 | return this.#content; |
| 10 | } |
| 11 | }; |
| 12 | |
| 13 | function withBoxUnlocked(body) { |
| 14 | let locked = box.locked; |
nothing calls this directly
no outgoing calls
no test coverage detected