tor-browser

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

destructuring-array-parameters-function-arguments-length.js (1076B)


      1 // Copyright (C) 2020 Rick Waldron. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-destructuring-binding-patterns-static-semantics-hasinitializer
      6 description: >
      7  Function.length when ArrayBindingPattern in FormalParameterList
      8 info: |
      9  #sec-function-definitions-static-semantics-expectedargumentcount
     10 
     11  Static Semantics: ExpectedArgumentCount
     12 
     13    FormalParameterList : FormalParameter
     14 
     15    1. If HasInitializer of FormalParameter is true, return 0.
     16    2. Return 1.
     17 
     18  #sec-destructuring-binding-patterns-static-semantics-hasinitializer
     19 
     20  Static Semantics: HasInitializer
     21 
     22    BindingElement : BindingPattern
     23 
     24    1. Return false.
     25 
     26 features: [destructuring-binding]
     27 ---*/
     28 
     29 assert.sameValue((([a,b]) => {}).length, 1);
     30 assert.sameValue((function([a,b]) {}).length, 1);
     31 assert.sameValue((function * ([a,b]) {}).length, 1);
     32 assert.sameValue((async ([a,b]) => {}).length, 1);
     33 assert.sameValue((async function([a,b]) {}).length, 1);
     34 assert.sameValue((async function * ([a,b]) {}).length, 1);
     35 
     36 
     37 reportCompare(0, 0);