| 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: 12.2.6.9 |
| 6 |
description: Assignment of function `name` attribute (MethodDefinition) |
| 7 |
info: | |
| 8 |
6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then |
| 9 |
a. Let hasNameProperty be HasOwnProperty(propValue, "name"). |
| 10 |
b. ReturnIfAbrupt(hasNameProperty). |
| 11 |
c. If hasNameProperty is false, perform SetFunctionName(propValue, |
| 12 |
propKey). |
| 13 |
includes: [propertyHelper.js] |
| 14 |
features: [Symbol] |
| 15 |
---*/ |
| 16 |
|
| 17 |
var namedSym = Symbol('test262'); |
| 18 |
var anonSym = Symbol(); |
| 19 |
|
| 20 |
class A { |
| 21 |
id() {} |
| 22 |
[anonSym]() {} |
| 23 |
[namedSym]() {} |
| 24 |
static id() {} |
| 25 |
static [anonSym]() {} |
| 26 |
static [namedSym]() {} |
| 27 |
} |
| 28 |
|
| 29 |
verifyProperty(A.prototype.id, 'name', { |
| 30 |
value: 'id', |
| 31 |
writable: false, |
| 32 |
enumerable: false, |
| 33 |
configurable: true, |
| 34 |
}); |
| 35 |
|
| 36 |
verifyProperty(A.prototype[anonSym], 'name', { |
| 37 |
value: '', |
| 38 |
writable: false, |
| 39 |
enumerable: false, |
| 40 |
configurable: true, |
| 41 |
}); |
| 42 |
|
| 43 |
verifyProperty(A.prototype[namedSym], 'name', { |
| 44 |
value: '[test262]', |
| 45 |
writable: false, |
| 46 |
enumerable: false, |
| 47 |
configurable: true, |
| 48 |
}); |
| 49 |
|
| 50 |
verifyProperty(A.id, 'name', { |
| 51 |
value: 'id', |
| 52 |
writable: false, |
| 53 |
enumerable: false, |
| 54 |
configurable: true, |
| 55 |
}); |
| 56 |
|
| 57 |
verifyProperty(A[anonSym], 'name', { |
| 58 |
value: '', |
| 59 |
writable: false, |
| 60 |
enumerable: false, |
| 61 |
configurable: true, |
| 62 |
}); |
| 63 |
|
| 64 |
verifyProperty(A[namedSym], 'name', { |
| 65 |
value: '[test262]', |
| 66 |
writable: false, |
| 67 |
enumerable: false, |
| 68 |
configurable: true, |
| 69 |
}); |
| 70 |
|
| 71 |
reportCompare(0, 0); |