using.js (802B)
1 // |reftest| shell-option(--enable-explicit-resource-management) skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('explicit-resource-management'))||!xulRuntime.shell) module -- explicit-resource-management is not enabled unconditionally, requires shell-options 2 // Copyright (C) 2023 Ron Buckton. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-let-const-using-and-await-using-declarations 7 description: > 8 module and block scope using 9 flags: [module] 10 features: [explicit-resource-management] 11 ---*/ 12 13 using z = null; 14 15 // Block local 16 { 17 using z = undefined; 18 } 19 20 assert.sameValue(z, null); 21 22 if (true) { 23 const obj = { [Symbol.dispose]() { } }; 24 using z = obj; 25 assert.sameValue(z, obj); 26 } 27 28 reportCompare(0, 0);