static-semantics-simple-assignment.js 492 B

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