await-using-invalid-assignment-next-expression-for.js (947B)
1 // |reftest| shell-option(--enable-explicit-resource-management) skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('explicit-resource-management'))||!xulRuntime.shell) async -- 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-declarative-environment-records-setmutablebinding-n-v-s 7 description: > 8 await using: invalid assignment in next expression. Since an `await using` declaration introduces an immutable 9 binding, any attempt to change it results in a TypeError. 10 flags: [async] 11 includes: [asyncHelpers.js] 12 features: [explicit-resource-management] 13 ---*/ 14 15 asyncTest(async function () { 16 await assert.throwsAsync(TypeError, async function() { 17 for (await using i = null; i === null; i = { [Symbol.dispose]() { } }) {} 18 }); 19 });