ladybird/Userland/Libraries/LibJS/Tests/modules/top-level-dispose.mjs
davidot 541637e15a LibJS: Add using declaration support, RAII like operation in js
In this patch only top level and not the more complicated for loop using
statements are supported. Also, as noted in the latest meeting of tc39
async parts of the spec are not stage 3 thus not included.
2023-01-23 09:56:50 +00:00

14 lines
284 B
JavaScript

export let passed = false;
let failed = false;
if (passed)
failed = true;
using a = { [Symbol.dispose]() { if (!failed) passed = true; } }
if (passed)
failed = true;
failed = true;
// Should trigger before
using b = { [Symbol.dispose]() { if (!passed) failed = false; } }