tor-browser

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

async-gen-meth-args-trailing-comma-single-args.js (1738B)


      1 // |reftest| async
      2 // This file was procedurally generated from the following sources:
      3 // - src/arguments/args-trailing-comma-single-args.case
      4 // - src/arguments/default/async-gen-meth.template
      5 /*---
      6 description: A trailing comma should not increase the arguments.length, using a single arg (async generator method)
      7 esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
      8 features: [async-iteration]
      9 flags: [generated, async]
     10 info: |
     11    AsyncGeneratorMethod :
     12        async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
     13            { AsyncGeneratorBody }
     14 
     15    1. Let propKey be the result of evaluating PropertyName.
     16    2. ReturnIfAbrupt(propKey).
     17    3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
     18       Otherwise let strict be false.
     19    4. Let scope be the running execution context's LexicalEnvironment.
     20    5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
     21       AsyncGeneratorBody, scope, strict).
     22    [...]
     23 
     24 
     25    Trailing comma in the arguments list
     26 
     27    Left-Hand-Side Expressions
     28 
     29    Arguments :
     30        ( )
     31        ( ArgumentList )
     32        ( ArgumentList , )
     33 
     34    ArgumentList :
     35        AssignmentExpression
     36        ... AssignmentExpression
     37        ArgumentList , AssignmentExpression
     38        ArgumentList , ... AssignmentExpression
     39 ---*/
     40 
     41 var callCount = 0;
     42 var obj = {
     43  async *method() {
     44    assert.sameValue(arguments.length, 1);
     45    assert.sameValue(arguments[0], 42);
     46    callCount = callCount + 1;
     47  }
     48 };
     49 
     50 // Stores a reference `ref` for case evaluation
     51 var ref = obj.method;
     52 
     53 ref(42,).next().then(() => {
     54    assert.sameValue(callCount, 1, 'generator method invoked exactly once');
     55 }).then($DONE, $DONE);