static-init-await-reference.js (757B)
1 // Copyright (C) 2021 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-class-definitions-static-semantics-early-errors 5 description: The `await` keyword is interpreted as an IdentifierReference within function expressions 6 info: | 7 ClassStaticBlockBody : ClassStaticBlockStatementList 8 9 [...] 10 - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. 11 features: [class-static-block] 12 ---*/ 13 14 var await = 0; 15 var fromParam, fromBody; 16 17 class C { 18 static { 19 (function (x = fromParam = await) { 20 fromBody = await; 21 })(); 22 } 23 } 24 25 assert.sameValue(fromParam, 0, 'from parameter'); 26 assert.sameValue(fromBody, 0, 'from body'); 27 28 reportCompare(0, 0);