member-expression-async-this.js 567 B

1234567891011121314151617181920
  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. optional chain on member expression in async context
  7. info: |
  8. Left-Hand-Side Expressions
  9. OptionalExpression:
  10. MemberExpression [PrimaryExpression this] OptionalChain
  11. features: [optional-chaining]
  12. flags: [async]
  13. ---*/
  14. async function thisFn() {
  15. return await this?.a
  16. }
  17. thisFn.call({a: Promise.resolve(33)}).then(function(arg) {
  18. assert.sameValue(33, arg);
  19. }).then($DONE, $DONE);