| 1 |
// Copyright (C) 2015 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
es6id: 14.4.1 |
| 6 |
description: Assignment of function `name` attribute |
| 7 |
info: | |
| 8 |
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } |
| 9 |
|
| 10 |
1. If the function code for this GeneratorExpression is strict mode code, |
| 11 |
let strict be true. Otherwise let strict be false. |
| 12 |
2. Let scope be the LexicalEnvironment of the running execution context. |
| 13 |
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, |
| 14 |
GeneratorBody, scope, strict). |
| 15 |
4. Let prototype be ObjectCreate(%GeneratorPrototype%). |
| 16 |
5. Perform MakeConstructor(closure, true, prototype). |
| 17 |
6. Return closure. |
| 18 |
|
| 19 |
GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } |
| 20 |
|
| 21 |
[...] |
| 22 |
10. Perform SetFunctionName(closure, name). |
| 23 |
includes: [propertyHelper.js] |
| 24 |
features: [generators] |
| 25 |
---*/ |
| 26 |
|
| 27 |
assert.sameValue(Object.hasOwnProperty.call(function*() {}, 'name'), false); |
| 28 |
|
| 29 |
assert.sameValue(function* func() {}.name, 'func'); |
| 30 |
verifyNotEnumerable(function* func() {}, 'name'); |
| 31 |
verifyNotWritable(function* func() {}, 'name'); |
| 32 |
verifyConfigurable(function* func() {}, 'name'); |