head-await-using-init.js (864B)
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 /*--- 6 esid: sec-for-in-and-for-of-statements 7 description: > 8 ForDeclaration containing 'await using' does not support an initializer 9 info: | 10 IterationStatement: 11 for (ForDeclaration of AssignmentExpression) Statement 12 negative: 13 phase: parse 14 type: SyntaxError 15 features: [explicit-resource-management] 16 ---*/ 17 18 $DONOTEVALUATE(); 19 20 const obj = { [Symbol.dispose]() { } }; 21 async function f() { 22 for (await using x = obj of []) {} 23 }