static-semantics-simple-assignment.js (523B)
1 // |reftest| error:SyntaxError 2 3 // Copyright 2019 Google, Inc. All rights reserved. 4 // This code is governed by the BSD license found in the LICENSE file. 5 /*--- 6 esid: prod-OptionalExpression 7 description: > 8 an optional expression cannot be target of assignment 9 info: | 10 Static Semantics: IsValidSimpleAssignmentTarget 11 LeftHandSideExpression: 12 OptionalExpression 13 Return false. 14 features: [optional-chaining] 15 negative: 16 phase: parse 17 type: SyntaxError 18 ---*/ 19 20 $DONOTEVALUATE(); 21 22 const obj = {}; 23 24 obj?.a = 33;