summaryrefslogtreecommitdiff
path: root/src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
blob: 3eb8bcd5d5f6e65defd1a21dbd3486fa46acc0b8 (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
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: SingleNameBinding assigns name to "anonymous" generator functions
template: default
info: |
    13.3.3.7 Runtime Semantics: KeyedBindingInitialization

    SingleNameBinding : BindingIdentifier Initializer_opt

    [...]
    6. If Initializer is present and v is undefined, then
       [...]
       d. If IsAnonymousFunctionDefinition(Initializer) is true, then
          i. Let hasNameProperty be HasOwnProperty(v, "name").
          ii. ReturnIfAbrupt(hasNameProperty).
          iii. If hasNameProperty is false, perform SetFunctionName(v,
               bindingId).
---*/

//- elems
{ gen = function* () {}, xGen = function* x() {} }
//- vals
{}
//- body
assert.sameValue(gen.name, 'gen');
assert.notSameValue(xGen.name, 'xGen');