tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

await-expr-new-expr.js (958B)


      1 // |reftest| module async
      2 // Copyright (C) 2019 Leo Balter. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 description: >
      7  Evaluation of await before a NewExpression
      8 info: |
      9  ModuleItem:
     10    StatementListItem[~Yield, +Await, ~Return]
     11 
     12  ...
     13 
     14  UnaryExpression[Yield, Await]
     15    [+Await]AwaitExpression[?Yield]
     16 
     17  AwaitExpression[Yield]:
     18    await UnaryExpression[?Yield, +Await]
     19 
     20  ...
     21 
     22  LeftHandSideExpression[Yield, Await]:
     23    NewExpression[?Yield, ?Await]
     24    CallExpression[?Yield, ?Await]
     25 
     26  NewExpression[Yield, Await]:
     27    MemberExpression[?Yield, ?Await]
     28    new NewExpression[?Yield, ?Await]
     29 
     30  MemberExpression[Yield, Await]:
     31    ...
     32    new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
     33 esid: prod-AwaitExpression
     34 flags: [module, async]
     35 features: [top-level-await]
     36 ---*/
     37 
     38 var value = await new Promise(function(res, rej) {
     39  res(42);
     40 });
     41 
     42 assert.sameValue(value, 42);
     43 
     44 $DONE();