tor-browser

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

async-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js (2315B)


      1 // |reftest| error:SyntaxError
      2 // This file was procedurally generated from the following sources:
      3 // - src/dstr-binding/ary-ptrn-rest-not-final-id.case
      4 // - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template
      5 /*---
      6 description: Rest element (identifier) may not be followed by any element (static class expression async generator method (default parameter))
      7 esid: sec-class-definitions-runtime-semantics-evaluation
      8 features: [async-iteration]
      9 flags: [generated]
     10 negative:
     11  phase: parse
     12  type: SyntaxError
     13 info: |
     14    ClassExpression : class BindingIdentifieropt ClassTail
     15 
     16    1. If BindingIdentifieropt is not present, let className be undefined.
     17    2. Else, let className be StringValue of BindingIdentifier.
     18    3. Let value be the result of ClassDefinitionEvaluation of ClassTail
     19       with argument className.
     20    [...]
     21 
     22    14.5.14 Runtime Semantics: ClassDefinitionEvaluation
     23 
     24    21. For each ClassElement m in order from methods
     25        a. If IsStatic of m is false, then
     26        b. Else,
     27           Let status be the result of performing PropertyDefinitionEvaluation
     28           for m with arguments F and false.
     29    [...]
     30 
     31    Runtime Semantics: PropertyDefinitionEvaluation
     32 
     33    AsyncGeneratorMethod :
     34        async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
     35            { AsyncGeneratorBody }
     36 
     37    1. Let propKey be the result of evaluating PropertyName.
     38    2. ReturnIfAbrupt(propKey).
     39    3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
     40       Otherwise let strict be false.
     41    4. Let scope be the running execution context's LexicalEnvironment.
     42    5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
     43       AsyncGeneratorBody, scope, strict).
     44    [...]
     45 
     46 
     47    13.3.3 Destructuring Binding Patterns
     48    ArrayBindingPattern[Yield] :
     49        [ Elisionopt BindingRestElement[?Yield]opt ]
     50        [ BindingElementList[?Yield] ]
     51        [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
     52 ---*/
     53 $DONOTEVALUATE();
     54 
     55 
     56 var callCount = 0;
     57 var C = class {
     58  static async *method([...x, y] = [1, 2, 3]) {
     59    
     60    callCount = callCount + 1;
     61  }
     62 };
     63 
     64 C.method().next().then(() => {
     65    assert.sameValue(callCount, 1, 'invoked exactly once');    
     66 }).then($DONE, $DONE);