private-field-rhs-await-absent.js (972B)
1 // Copyright 2021 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: Parsing observes the `Await` production parameter when absent 6 info: | 7 Syntax 8 RelationalExpression[In, Yield, Await]: 9 [...] 10 [+In]PrivateIdentifier in ShiftExpression[?Yield, ?Await] 11 12 [...] 13 14 1. Let privateIdentifier be the StringValue of PrivateIdentifier. 15 2. Let rref be the result of evaluating ShiftExpression. 16 3. Let rval be ? GetValue(rref). 17 4. If Type(rval) is not Object, throw a TypeError exception. 18 esid: sec-relational-operators-runtime-semantics-evaluation 19 features: [class-fields-private, class-fields-private-in] 20 ---*/ 21 22 let value; 23 function await() { 24 return value; 25 } 26 27 class C { 28 #field; 29 30 static isNameIn() { 31 return #field in await(null); 32 } 33 } 34 35 value = new C(); 36 assert.sameValue(C.isNameIn(), true); 37 38 value = {}; 39 assert.sameValue(C.isNameIn(), false); 40 41 reportCompare(0, 0);