head-using-init.js (870B)
1 // |reftest| shell-option(--enable-explicit-resource-management) skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('explicit-resource-management'))||!xulRuntime.shell) error:SyntaxError -- 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 esid: sec-iteration-statements 6 description: > 7 ForDeclaration containing 'using' does not allow initializer. 8 info: | 9 IterationStatement: 10 for await (ForDeclaration of AssignmentExpression) Statement 11 negative: 12 phase: parse 13 type: SyntaxError 14 features: [async-iteration, explicit-resource-management] 15 ---*/ 16 17 $DONOTEVALUATE(); 18 19 async function fn() { 20 const obj = { [Symbol.dispose]() {} }; 21 for await (using x = obj of []) {} 22 }