summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/destructuring/binding/syntax/destructuring-array-parameters-function-arguments-length.js
blob: 3ea3b59a0099ee7de0435f1efb37d54abb0e3b64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-destructuring-binding-patterns-static-semantics-hasinitializer
description: >
  Function.length when ArrayBindingPattern in FormalParameterList
info: |
  #sec-function-definitions-static-semantics-expectedargumentcount

  Static Semantics: ExpectedArgumentCount

    FormalParameterList : FormalParameter

    1. If HasInitializer of FormalParameter is true, return 0.
    2. Return 1.

  #sec-destructuring-binding-patterns-static-semantics-hasinitializer

  Static Semantics: HasInitializer

    BindingElement : BindingPattern

    1. Return false.

features: [destructuring-binding]
---*/

assert.sameValue((([a,b]) => {}).length, 1);
assert.sameValue((function([a,b]) {}).length, 1);
assert.sameValue((function * ([a,b]) {}).length, 1);
assert.sameValue((async ([a,b]) => {}).length, 1);
assert.sameValue((async function([a,b]) {}).length, 1);
assert.sameValue((async function * ([a,b]) {}).length, 1);


reportCompare(0, 0);