mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
* rename proposal-explicit-resource-management to transform-explicit-resource-management * update library description * bump Babel/core version requirements to ^7.23.9 * add deprecation reminder * remove outdated reminders * update reminder date
26 lines
431 B
JavaScript
26 lines
431 B
JavaScript
return (async function () {
|
|
const log = [];
|
|
|
|
function disposable(name) {
|
|
return {
|
|
async [Symbol.dispose || Symbol.for("Symbol.dispose")]() {
|
|
log.push(name);
|
|
},
|
|
};
|
|
}
|
|
|
|
async function f() {
|
|
using y = disposable("y");
|
|
await using x = undefined;
|
|
log.push("f body");
|
|
}
|
|
|
|
const promise = f();
|
|
|
|
log.push("body");
|
|
|
|
await promise;
|
|
|
|
expect(log).toEqual(["f body", "body", "y"]);
|
|
})();
|