using-invalid-assignment-statement-body-for-of.js (835B)
1 // |reftest| shell-option(--enable-explicit-resource-management) skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('explicit-resource-management'))||!xulRuntime.shell) -- 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 using: invalid assignment in Statement body. Since a `using` declaration introduces an immutable 9 binding, any attempt to change it results in a TypeError. 10 features: [explicit-resource-management] 11 ---*/ 12 13 assert.throws(TypeError, function() { 14 for (using x of [null]) { x = { [Symbol.dispose]() { } }; } 15 }); 16 17 reportCompare(0, 0);