mirror of https://github.com/tc39/test262.git
Merge pull request #361 from bocoup/function-name
Add tests for function `name` attribute
This commit is contained in:
commit
d2c6a3f142
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: B.3.1
|
||||
description: Function name is not assigned based on the property name
|
||||
info: >
|
||||
[...]
|
||||
6. If propKey is the String value "__proto__" and if
|
||||
IsComputedPropertyKey(propKey) is false, then
|
||||
a. If Type(propValue) is either Object or Null, then
|
||||
i. Return object.[[SetPrototypeOf]](propValue).
|
||||
b. Return NormalCompletion(empty).
|
||||
7. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(propValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(propValue, propKey).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var o;
|
||||
|
||||
o = {
|
||||
__proto__: function() {}
|
||||
};
|
||||
|
||||
assert(o.__proto__.name !== '__proto__');
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 19.2.1.1
|
||||
description: Assignment of function `name` attribute
|
||||
info: >
|
||||
[...]
|
||||
3. Return CreateDynamicFunction(C, NewTarget, "normal", args).
|
||||
|
||||
ES6 19.2.1.1.1
|
||||
RuntimeSemantics: CreateDynamicFunction(constructor, newTarget, kind, args)
|
||||
|
||||
[...]
|
||||
29. Perform SetFunctionName(F, "anonymous").
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Function().name, 'anonymous');
|
||||
verifyNotEnumerable(Function(), 'name');
|
||||
verifyNotWritable(Function(), 'name');
|
||||
verifyConfigurable(Function(), 'name');
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 19.2.3.2
|
||||
description: >
|
||||
Assignment of function `name` attribute (previously-bound function)
|
||||
info: >
|
||||
12. Let targetName be Get(Target, "name").
|
||||
13. ReturnIfAbrupt(targetName).
|
||||
14. If Type(targetName) is not String, let targetName be the empty string.
|
||||
15. Perform SetFunctionName(F, targetName, "bound").
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var target = Object.defineProperty(function() {}, 'name', { value: 'target' });
|
||||
|
||||
assert.sameValue(target.bind().bind().name, 'bound bound target');
|
||||
verifyNotEnumerable(target.bind().bind(), 'name');
|
||||
verifyNotWritable(target.bind().bind(), 'name');
|
||||
verifyConfigurable(target.bind().bind(), 'name');
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 19.2.3.2
|
||||
description: Error thrown when accessing target's `name` property
|
||||
info: >
|
||||
12. Let targetName be Get(Target, "name").
|
||||
13. ReturnIfAbrupt(targetName).
|
||||
---*/
|
||||
|
||||
var target = Object.defineProperty(function() {}, 'name', {
|
||||
get: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
target.bind();
|
||||
});
|
|
@ -0,0 +1,58 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 19.2.3.2
|
||||
description: >
|
||||
Assignment of function `name` attribute (target has non-string name)
|
||||
info: >
|
||||
12. Let targetName be Get(Target, "name").
|
||||
13. ReturnIfAbrupt(targetName).
|
||||
14. If Type(targetName) is not String, let targetName be the empty string.
|
||||
15. Perform SetFunctionName(F, targetName, "bound").
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var target;
|
||||
|
||||
target = Object.defineProperty(function() {}, 'name', { value: undefined });
|
||||
|
||||
assert.sameValue(target.bind().name, 'bound ');
|
||||
verifyNotEnumerable(target.bind(), 'name');
|
||||
verifyNotWritable(target.bind(), 'name');
|
||||
verifyConfigurable(target.bind(), 'name');
|
||||
|
||||
target = Object.defineProperty(function() {}, 'name', { value: null });
|
||||
|
||||
assert.sameValue(target.bind().name, 'bound ');
|
||||
verifyNotEnumerable(target.bind(), 'name');
|
||||
verifyNotWritable(target.bind(), 'name');
|
||||
verifyConfigurable(target.bind(), 'name');
|
||||
|
||||
target = Object.defineProperty(function() {}, 'name', { value: true });
|
||||
|
||||
assert.sameValue(target.bind().name, 'bound ');
|
||||
verifyNotEnumerable(target.bind(), 'name');
|
||||
verifyNotWritable(target.bind(), 'name');
|
||||
verifyConfigurable(target.bind(), 'name');
|
||||
|
||||
target = Object.defineProperty(function() {}, 'name', { value: Symbol('s') });
|
||||
|
||||
assert.sameValue(target.bind().name, 'bound ');
|
||||
verifyNotEnumerable(target.bind(), 'name');
|
||||
verifyNotWritable(target.bind(), 'name');
|
||||
verifyConfigurable(target.bind(), 'name');
|
||||
|
||||
target = Object.defineProperty(function() {}, 'name', { value: 23 });
|
||||
|
||||
assert.sameValue(target.bind().name, 'bound ');
|
||||
verifyNotEnumerable(target.bind(), 'name');
|
||||
verifyNotWritable(target.bind(), 'name');
|
||||
verifyConfigurable(target.bind(), 'name');
|
||||
|
||||
target = Object.defineProperty(function() {}, 'name', { value: {} });
|
||||
|
||||
assert.sameValue(target.bind().name, 'bound ');
|
||||
verifyNotEnumerable(target.bind(), 'name');
|
||||
verifyNotWritable(target.bind(), 'name');
|
||||
verifyConfigurable(target.bind(), 'name');
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 19.2.3.2
|
||||
description: Assignment of function `name` attribute
|
||||
info: >
|
||||
12. Let targetName be Get(Target, "name").
|
||||
13. ReturnIfAbrupt(targetName).
|
||||
14. If Type(targetName) is not String, let targetName be the empty string.
|
||||
15. Perform SetFunctionName(F, targetName, "bound").
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var target = Object.defineProperty(function() {}, 'name', { value: 'target' });
|
||||
|
||||
assert.sameValue(target.bind().name, 'bound target');
|
||||
verifyNotEnumerable(target.bind(), 'name');
|
||||
verifyNotWritable(target.bind(), 'name');
|
||||
verifyConfigurable(target.bind(), 'name');
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 19.2.3
|
||||
description: FunctionPrototype `name` property
|
||||
info: >
|
||||
The value of the name property of the Function prototype object is the
|
||||
empty String.
|
||||
|
||||
ES6 Section 17:
|
||||
|
||||
Unless otherwise specified, the name property of a built-in Function
|
||||
object, if it exists, has the attributes { [[Writable]]: false,
|
||||
[[Enumerable]]: false, [[Configurable]]: true }.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Function.prototype.name, '');
|
||||
verifyNotEnumerable(Function.prototype, 'name');
|
||||
verifyNotWritable(Function.prototype, 'name');
|
||||
verifyConfigurable(Function.prototype, 'name');
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 25.2.1.1
|
||||
description: Assignment of function `name` attribute
|
||||
info: >
|
||||
[...]
|
||||
3. Return CreateDynamicFunction(C, NewTarget, "generator", args).
|
||||
|
||||
ES6 19.2.1.1.1
|
||||
RuntimeSemantics: CreateDynamicFunction(constructor, newTarget, kind, args)
|
||||
|
||||
[...]
|
||||
29. Perform SetFunctionName(F, "anonymous").
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
|
||||
|
||||
assert.sameValue(GeneratorFunction().name, 'anonymous');
|
||||
verifyNotEnumerable(GeneratorFunction(), 'name');
|
||||
verifyNotWritable(GeneratorFunction(), 'name');
|
||||
verifyConfigurable(GeneratorFunction(), 'name');
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (ArrowFunction)
|
||||
es6id: 12.14.5.3
|
||||
info: >
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
|
||||
[...]
|
||||
7. If Initializer is present and value is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var arrow;
|
||||
|
||||
[ arrow = () => {} ] = [];
|
||||
|
||||
assert.sameValue(arrow.name, 'arrow');
|
||||
verifyNotEnumerable(arrow, 'name');
|
||||
verifyNotWritable(arrow, 'name');
|
||||
verifyConfigurable(arrow, 'name');
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (ClassExpression)
|
||||
es6id: 12.14.5.3
|
||||
info: >
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
|
||||
[...]
|
||||
7. If Initializer is present and value is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
features: [class]
|
||||
---*/
|
||||
|
||||
var xCls, cls;
|
||||
|
||||
[ xCls = class x {} ] = [];;
|
||||
[ cls = class {} ] = [];
|
||||
|
||||
assert(xCls.name !== 'xCls');
|
||||
|
||||
assert.sameValue(cls.name, 'cls');
|
||||
verifyNotEnumerable(cls, 'name');
|
||||
verifyNotWritable(cls, 'name');
|
||||
verifyConfigurable(cls, 'name');
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Assignment of function `name` attribute (CoverParenthesizedExpression)
|
||||
es6id: 12.14.5.3
|
||||
info: >
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
|
||||
[...]
|
||||
7. If Initializer is present and value is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var xCover, cover;
|
||||
|
||||
[ xCover = (0, function() {}) ] = [];
|
||||
[ cover = (function() {}) ] = [];
|
||||
|
||||
assert(xCover.name !== 'xCover');
|
||||
|
||||
assert.sameValue(cover.name, 'cover');
|
||||
verifyNotEnumerable(cover, 'name');
|
||||
verifyNotWritable(cover, 'name');
|
||||
verifyConfigurable(cover, 'name');
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (FunctionExpression)
|
||||
es6id: 12.14.5.3
|
||||
info: >
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
|
||||
[...]
|
||||
7. If Initializer is present and value is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
features: [class]
|
||||
---*/
|
||||
|
||||
var xFn, fn;
|
||||
|
||||
[ xFn = function x() {} ] = [];;
|
||||
[ fn = function() {} ] = [];
|
||||
|
||||
assert(xFn.name !== 'xFn');
|
||||
|
||||
assert.sameValue(fn.name, 'fn');
|
||||
verifyNotEnumerable(fn, 'name');
|
||||
verifyNotWritable(fn, 'name');
|
||||
verifyConfigurable(fn, 'name');
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (GeneratorExpression)
|
||||
es6id: 12.14.5.3
|
||||
info: >
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
|
||||
[...]
|
||||
7. If Initializer is present and value is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(v, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(v,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var xGen, gen;
|
||||
|
||||
[ xGen = function* x() {} ] = [];
|
||||
[ gen = function*() {} ] = [];;
|
||||
|
||||
assert(xGen.name !== 'xGen');
|
||||
|
||||
assert.sameValue(gen.name, 'gen');
|
||||
verifyNotEnumerable(gen, 'name');
|
||||
verifyNotWritable(gen, 'name');
|
||||
verifyConfigurable(gen, 'name');
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (ArrowFunction)
|
||||
es6id: 12.14.5.2
|
||||
info: >
|
||||
AssignmentProperty : IdentifierReference Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializeropt 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, P).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var arrow;
|
||||
|
||||
({ arrow = () => {} } = {});
|
||||
|
||||
assert.sameValue(arrow.name, 'arrow');
|
||||
verifyNotEnumerable(arrow, 'name');
|
||||
verifyNotWritable(arrow, 'name');
|
||||
verifyConfigurable(arrow, 'name');
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (ClassExpression)
|
||||
es6id: 12.14.5.2
|
||||
info: >
|
||||
AssignmentProperty : IdentifierReference Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializeropt 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, P).
|
||||
includes: [propertyHelper.js]
|
||||
features: [class]
|
||||
---*/
|
||||
|
||||
var xCls, cls;
|
||||
|
||||
({ xCls = class x {} } = {});
|
||||
({ cls = class {} } = {});
|
||||
|
||||
assert(xCls.name !== 'xCls');
|
||||
|
||||
assert.sameValue(cls.name, 'cls');
|
||||
verifyNotEnumerable(cls, 'name');
|
||||
verifyNotWritable(cls, 'name');
|
||||
verifyConfigurable(cls, 'name');
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Assignment of function `name` attribute (CoverParenthesizedExpression)
|
||||
es6id: 12.14.5.2
|
||||
info: >
|
||||
AssignmentProperty : IdentifierReference Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializeropt 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, P).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var xCover, cover;
|
||||
|
||||
({ xCover = (0, function() {}) } = {});
|
||||
({ cover = (function() {}) } = {});
|
||||
|
||||
assert(xCover.name !== 'xCover');
|
||||
|
||||
assert.sameValue(cover.name, 'cover');
|
||||
verifyNotEnumerable(cover, 'name');
|
||||
verifyNotWritable(cover, 'name');
|
||||
verifyConfigurable(cover, 'name');
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (FunctionExpression)
|
||||
es6id: 12.14.5.2
|
||||
info: >
|
||||
AssignmentProperty : IdentifierReference Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializeropt 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, P).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var xFn, fn;
|
||||
|
||||
({ xFn = function x() {} } = {});
|
||||
({ fn = function() {} } = {});
|
||||
|
||||
assert(xFn.name !== 'xFn');
|
||||
|
||||
assert.sameValue(fn.name, 'fn');
|
||||
verifyNotEnumerable(fn, 'name');
|
||||
verifyNotWritable(fn, 'name');
|
||||
verifyConfigurable(fn, 'name');
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (GeneratorExpression)
|
||||
es6id: 12.14.5.2
|
||||
info: >
|
||||
AssignmentProperty : IdentifierReference Initializeropt
|
||||
|
||||
[...]
|
||||
6. If Initializeropt 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, P).
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var xGen, gen;
|
||||
|
||||
({ xGen = function* x() {} } = {});
|
||||
({ gen = function*() {} } = {});
|
||||
|
||||
assert(xGen.name !== 'xGen');
|
||||
|
||||
assert.sameValue(gen.name, 'gen');
|
||||
verifyNotEnumerable(gen, 'name');
|
||||
verifyNotWritable(gen, 'name');
|
||||
verifyConfigurable(gen, 'name');
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (ArrowFunction)
|
||||
es6id: 12.14.5.4
|
||||
info: >
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
|
||||
[...]
|
||||
7. If Initializer is present and v is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(rhsValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(rhsValue,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var arrow;
|
||||
|
||||
({ x: arrow = () => {} } = {});
|
||||
|
||||
assert.sameValue(arrow.name, 'arrow');
|
||||
verifyNotEnumerable(arrow, 'name');
|
||||
verifyNotWritable(arrow, 'name');
|
||||
verifyConfigurable(arrow, 'name');
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (ClassExpression)
|
||||
es6id: 12.14.5.4
|
||||
info: >
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
|
||||
[...]
|
||||
7. If Initializer is present and v is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(rhsValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(rhsValue,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
features: [class]
|
||||
---*/
|
||||
|
||||
var xCls, cls;
|
||||
|
||||
({ x: xCls = class x {} } = {});
|
||||
({ x: cls = class {} } = {});
|
||||
|
||||
assert(xCls.name !== 'xCls');
|
||||
|
||||
assert.sameValue(cls.name, 'cls');
|
||||
verifyNotEnumerable(cls, 'name');
|
||||
verifyNotWritable(cls, 'name');
|
||||
verifyConfigurable(cls, 'name');
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Assignment of function `name` attribute (CoverParenthesizedExpression)
|
||||
es6id: 12.14.5.4
|
||||
info: >
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
|
||||
[...]
|
||||
7. If Initializer is present and v is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(rhsValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(rhsValue,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var xCover, cover;
|
||||
|
||||
({ x: xCover = (0, function() {}) } = {});
|
||||
({ x: cover = (function() {}) } = {});
|
||||
|
||||
assert(xCover.name !== 'xCover');
|
||||
|
||||
assert.sameValue(cover.name, 'cover');
|
||||
verifyNotEnumerable(cover, 'name');
|
||||
verifyNotWritable(cover, 'name');
|
||||
verifyConfigurable(cover, 'name');
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (FunctionExpression)
|
||||
es6id: 12.14.5.4
|
||||
info: >
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
|
||||
[...]
|
||||
7. If Initializer is present and v is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(rhsValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(rhsValue,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var xFn, fn;
|
||||
|
||||
({ x: xFn = function x() {} } = {});
|
||||
({ x: fn = function() {} } = {});
|
||||
|
||||
assert(xFn.name !== 'xFn');
|
||||
|
||||
assert.sameValue(fn.name, 'fn');
|
||||
verifyNotEnumerable(fn, 'name');
|
||||
verifyNotWritable(fn, 'name');
|
||||
verifyConfigurable(fn, 'name');
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Assignment of function `name` attribute (GeneratorExpression)
|
||||
es6id: 12.14.5.4
|
||||
info: >
|
||||
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
|
||||
|
||||
[...]
|
||||
7. If Initializer is present and v is undefined and
|
||||
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
|
||||
DestructuringAssignmentTarget are both true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(rhsValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(rhsValue,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var xGen, gen;
|
||||
|
||||
({ x: xGen = function* x() {} } = {});
|
||||
({ x: gen = function*() {} } = {});
|
||||
|
||||
assert(xGen.name !== 'xGen');
|
||||
|
||||
assert.sameValue(gen.name, 'gen');
|
||||
verifyNotEnumerable(gen, 'name');
|
||||
verifyNotWritable(gen, 'name');
|
||||
verifyConfigurable(gen, 'name');
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.14.4
|
||||
description: Assignment of function `name` attribute (ArrowFunction)
|
||||
info: >
|
||||
AssignmentExpression[In, Yield] :
|
||||
LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield]
|
||||
|
||||
1. If LeftHandSideExpression is neither an ObjectLiteral nor an
|
||||
ArrayLiteral, then
|
||||
[...]
|
||||
e. If IsAnonymousFunctionDefinition(AssignmentExpression) and
|
||||
IsIdentifierRef of LeftHandSideExpression are both true, then
|
||||
|
||||
i. Let hasNameProperty be HasOwnProperty(rval, "name").
|
||||
ii. ReturnIfAbrupt(hasNameProperty).
|
||||
iii. If hasNameProperty is false, perform SetFunctionName(rval,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var arrow;
|
||||
|
||||
arrow = () => {};
|
||||
|
||||
assert.sameValue(arrow.name, 'arrow');
|
||||
verifyNotEnumerable(arrow, 'name');
|
||||
verifyNotWritable(arrow, 'name');
|
||||
verifyConfigurable(arrow, 'name');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.14.4
|
||||
description: Assignment of function `name` attribute (ClassExpression)
|
||||
info: >
|
||||
AssignmentExpression[In, Yield] :
|
||||
LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield]
|
||||
|
||||
1. If LeftHandSideExpression is neither an ObjectLiteral nor an
|
||||
ArrayLiteral, then
|
||||
[...]
|
||||
e. If IsAnonymousFunctionDefinition(AssignmentExpression) and
|
||||
IsIdentifierRef of LeftHandSideExpression are both true, then
|
||||
|
||||
i. Let hasNameProperty be HasOwnProperty(rval, "name").
|
||||
ii. ReturnIfAbrupt(hasNameProperty).
|
||||
iii. If hasNameProperty is false, perform SetFunctionName(rval,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
features: [class]
|
||||
---*/
|
||||
|
||||
var xCls, cls;
|
||||
|
||||
xCls = class x {};
|
||||
cls = class {};
|
||||
|
||||
assert(xCls.name !== 'xCls');
|
||||
|
||||
assert.sameValue(cls.name, 'cls');
|
||||
verifyNotEnumerable(cls, 'name');
|
||||
verifyNotWritable(cls, 'name');
|
||||
verifyConfigurable(cls, 'name');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.14.4
|
||||
description: >
|
||||
Assignment of function `name` attribute (CoverParenthesizedExpression)
|
||||
info: >
|
||||
AssignmentExpression[In, Yield] :
|
||||
LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield]
|
||||
|
||||
1. If LeftHandSideExpression is neither an ObjectLiteral nor an
|
||||
ArrayLiteral, then
|
||||
[...]
|
||||
e. If IsAnonymousFunctionDefinition(AssignmentExpression) and
|
||||
IsIdentifierRef of LeftHandSideExpression are both true, then
|
||||
|
||||
i. Let hasNameProperty be HasOwnProperty(rval, "name").
|
||||
ii. ReturnIfAbrupt(hasNameProperty).
|
||||
iii. If hasNameProperty is false, perform SetFunctionName(rval,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var xCover, cover;
|
||||
|
||||
xCover = (0, function() {});
|
||||
cover = (function() {});
|
||||
|
||||
assert(xCover.name !== 'xCover');
|
||||
|
||||
assert.sameValue(cover.name, 'cover');
|
||||
verifyNotEnumerable(cover, 'name');
|
||||
verifyNotWritable(cover, 'name');
|
||||
verifyConfigurable(cover, 'name');
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.14.4
|
||||
description: Assignment of function `name` attribute (FunctionExpression)
|
||||
info: >
|
||||
AssignmentExpression[In, Yield] :
|
||||
LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield]
|
||||
|
||||
1. If LeftHandSideExpression is neither an ObjectLiteral nor an
|
||||
ArrayLiteral, then
|
||||
[...]
|
||||
e. If IsAnonymousFunctionDefinition(AssignmentExpression) and
|
||||
IsIdentifierRef of LeftHandSideExpression are both true, then
|
||||
|
||||
i. Let hasNameProperty be HasOwnProperty(rval, "name").
|
||||
ii. ReturnIfAbrupt(hasNameProperty).
|
||||
iii. If hasNameProperty is false, perform SetFunctionName(rval,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var xFn, fn;
|
||||
|
||||
xFn = function x() {};
|
||||
fn = function() {};
|
||||
|
||||
assert(xFn.name !== 'xFn');
|
||||
|
||||
assert.sameValue(fn.name, 'fn');
|
||||
verifyNotEnumerable(fn, 'name');
|
||||
verifyNotWritable(fn, 'name');
|
||||
verifyConfigurable(fn, 'name');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.14.4
|
||||
description: Assignment of function `name` attribute (GeneratorExpression)
|
||||
info: >
|
||||
AssignmentExpression[In, Yield] :
|
||||
LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield]
|
||||
|
||||
1. If LeftHandSideExpression is neither an ObjectLiteral nor an
|
||||
ArrayLiteral, then
|
||||
[...]
|
||||
e. If IsAnonymousFunctionDefinition(AssignmentExpression) and
|
||||
IsIdentifierRef of LeftHandSideExpression are both true, then
|
||||
|
||||
i. Let hasNameProperty be HasOwnProperty(rval, "name").
|
||||
ii. ReturnIfAbrupt(hasNameProperty).
|
||||
iii. If hasNameProperty is false, perform SetFunctionName(rval,
|
||||
GetReferencedName(lref)).
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var xGen, gen;
|
||||
|
||||
xGen = function* x() {};
|
||||
gen = function*() {};
|
||||
|
||||
assert(xGen.name !== 'xGen');
|
||||
|
||||
assert.sameValue(gen.name, 'gen');
|
||||
verifyNotEnumerable(gen, 'name');
|
||||
verifyNotWritable(gen, 'name');
|
||||
verifyConfigurable(gen, 'name');
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.14.4
|
||||
description: Left-hand side as a CoverParenthesizedExpression
|
||||
info: >
|
||||
AssignmentExpression[In, Yield] :
|
||||
LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield]
|
||||
|
||||
1. If LeftHandSideExpression is neither an ObjectLiteral nor an
|
||||
ArrayLiteral, then
|
||||
[...]
|
||||
e. If IsAnonymousFunctionDefinition(AssignmentExpression) and
|
||||
IsIdentifierRef of LeftHandSideExpression are both true, then
|
||||
|
||||
i. Let hasNameProperty be HasOwnProperty(rval, "name").
|
||||
ii. ReturnIfAbrupt(hasNameProperty).
|
||||
iii. If hasNameProperty is false, perform SetFunctionName(rval,
|
||||
GetReferencedName(lref)).
|
||||
---*/
|
||||
|
||||
var fn;
|
||||
|
||||
(fn) = function() {};
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(fn, 'name'), false);
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.14.4
|
||||
description: Left-hand side as a MemberExpression
|
||||
info: >
|
||||
AssignmentExpression[In, Yield] :
|
||||
LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield]
|
||||
|
||||
1. If LeftHandSideExpression is neither an ObjectLiteral nor an
|
||||
ArrayLiteral, then
|
||||
[...]
|
||||
e. If IsAnonymousFunctionDefinition(AssignmentExpression) and
|
||||
IsIdentifierRef of LeftHandSideExpression are both true, then
|
||||
|
||||
i. Let hasNameProperty be HasOwnProperty(rval, "name").
|
||||
ii. ReturnIfAbrupt(hasNameProperty).
|
||||
iii. If hasNameProperty is false, perform SetFunctionName(rval,
|
||||
GetReferencedName(lref)).
|
||||
---*/
|
||||
|
||||
var o = {};
|
||||
|
||||
o.attr = function() {};
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(o.attr, 'name'), false);
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 14.5.16
|
||||
description: Assignment of function `name` attribute
|
||||
info: >
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
5. If className is not undefined, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, then
|
||||
i. Perform SetFunctionName(value, className).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(class {}, 'name'), false);
|
||||
|
||||
assert.sameValue(class cls {}.name, 'cls');
|
||||
verifyNotEnumerable(class cls {}, 'name');
|
||||
verifyNotWritable(class cls {}, 'name');
|
||||
verifyConfigurable(class cls {}, 'name');
|
||||
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(class { constructor() {} }, 'name'), false
|
||||
);
|
||||
|
||||
assert.sameValue(class cls { constructor() {} }.name, 'cls');
|
||||
verifyNotEnumerable(class cls { constructor() {} }, 'name');
|
||||
verifyNotWritable(class cls { constructor() {} }, 'name');
|
||||
verifyConfigurable(class cls { constructor() {} }, 'name');
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 14.1.20
|
||||
description: Assignment of function `name` attribute
|
||||
info: >
|
||||
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||
|
||||
1. If the function code for FunctionExpression is strict mode code, let
|
||||
strict be true. Otherwise let strict be false.
|
||||
2. Let scope be the LexicalEnvironment of the running execution context.
|
||||
3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody,
|
||||
scope, strict).
|
||||
4. Perform MakeConstructor(closure).
|
||||
5. Return closure.
|
||||
|
||||
FunctionExpression :
|
||||
function BindingIdentifier ( FormalParameters ) { FunctionBody }
|
||||
|
||||
[...]
|
||||
5. Let name be StringValue of BindingIdentifier.
|
||||
[...]
|
||||
9. Perform SetFunctionName(closure, name).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(function() {}, 'name'), false);
|
||||
|
||||
assert.sameValue(function func() {}.name, 'func');
|
||||
verifyNotEnumerable(function func() {}, 'name');
|
||||
verifyNotWritable(function func() {}, 'name');
|
||||
verifyConfigurable(function func() {}, 'name');
|
|
@ -1,19 +1,31 @@
|
|||
// Copyright 2015 Cubane Canada, Inc. All rights reserved.
|
||||
// See LICENSE for details.
|
||||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 14.4.1
|
||||
description: Assignment of function `name` attribute
|
||||
info: >
|
||||
Generator can be declared with GeneratorExpression syntax
|
||||
es6id: 14.4
|
||||
author: Sam Mikes
|
||||
description: can create generator function expressions (with name)
|
||||
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||
|
||||
1. If the function code for this GeneratorExpression is strict mode code,
|
||||
let strict be true. Otherwise let strict be false.
|
||||
2. Let scope be the LexicalEnvironment of the running execution context.
|
||||
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters,
|
||||
GeneratorBody, scope, strict).
|
||||
4. Let prototype be ObjectCreate(%GeneratorPrototype%).
|
||||
5. Perform MakeConstructor(closure, true, prototype).
|
||||
6. Return closure.
|
||||
|
||||
GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
|
||||
|
||||
[...]
|
||||
10. Perform SetFunctionName(closure, name).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var f = function *foo(a) { yield a+1; return; };
|
||||
assert.sameValue(Object.hasOwnProperty.call(function*() {}, 'name'), false);
|
||||
|
||||
assert.sameValue(f.name, 'foo');
|
||||
|
||||
var g = f(3);
|
||||
|
||||
assert.sameValue(g.next().value, 4);
|
||||
assert.sameValue(g.next().done, true);
|
||||
assert.sameValue(function* func() {}.name, 'func');
|
||||
verifyNotEnumerable(function* func() {}, 'name');
|
||||
verifyNotWritable(function* func() {}, 'name');
|
||||
verifyConfigurable(function* func() {}, 'name');
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 14.3.9
|
||||
description: Assignment of function `name` attribute ("get" accessor)
|
||||
info: >
|
||||
MethodDefinition : get PropertyName ( ) { FunctionBody }
|
||||
|
||||
[...]
|
||||
8. Perform SetFunctionName(closure, propKey, "get").
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
var o, getter;
|
||||
|
||||
o = {
|
||||
get id() {},
|
||||
get [anonSym]() {},
|
||||
get [namedSym]() {}
|
||||
};
|
||||
|
||||
getter = Object.getOwnPropertyDescriptor(o, 'id').get;
|
||||
assert.sameValue(getter.name, 'get id');
|
||||
verifyNotEnumerable(getter, 'name');
|
||||
verifyNotWritable(getter, 'name');
|
||||
verifyConfigurable(getter, 'name');
|
||||
|
||||
getter = Object.getOwnPropertyDescriptor(o, anonSym).get;
|
||||
assert.sameValue(getter.name, 'get ');
|
||||
verifyNotEnumerable(getter, 'name');
|
||||
verifyNotWritable(getter, 'name');
|
||||
verifyConfigurable(getter, 'name');
|
||||
|
||||
getter = Object.getOwnPropertyDescriptor(o, namedSym).get;
|
||||
assert.sameValue(getter.name, 'get [test262]');
|
||||
verifyNotEnumerable(getter, 'name');
|
||||
verifyNotWritable(getter, 'name');
|
||||
verifyConfigurable(getter, 'name');
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 14.3.9
|
||||
description: Assignment of function `name` attribute ("set" accessor)
|
||||
info: >
|
||||
MethodDefinition :
|
||||
set PropertyName ( PropertySetParameterList ) { FunctionBody }
|
||||
|
||||
[...]
|
||||
7. Perform SetFunctionName(closure, propKey, "set").
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
var o, setter;
|
||||
|
||||
o = {
|
||||
set id(_) {},
|
||||
set [anonSym](_) {},
|
||||
set [namedSym](_) {}
|
||||
};
|
||||
|
||||
setter = Object.getOwnPropertyDescriptor(o, 'id').set;
|
||||
assert.sameValue(setter.name, 'set id');
|
||||
verifyNotEnumerable(setter, 'name');
|
||||
verifyNotWritable(setter, 'name');
|
||||
verifyConfigurable(setter, 'name');
|
||||
|
||||
setter = Object.getOwnPropertyDescriptor(o, anonSym).set;
|
||||
assert.sameValue(setter.name, 'set ');
|
||||
verifyNotEnumerable(setter, 'name');
|
||||
verifyNotWritable(setter, 'name');
|
||||
verifyConfigurable(setter, 'name');
|
||||
|
||||
setter = Object.getOwnPropertyDescriptor(o, namedSym).set;
|
||||
assert.sameValue(setter.name, 'set [test262]');
|
||||
verifyNotEnumerable(setter, 'name');
|
||||
verifyNotWritable(setter, 'name');
|
||||
verifyConfigurable(setter, 'name');
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.2.6.9
|
||||
description: Assignment of function `name` attribute (ArrowFunction)
|
||||
info: >
|
||||
6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(propValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(propValue,
|
||||
propKey).
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
var o;
|
||||
|
||||
o = {
|
||||
id: () => {},
|
||||
[anonSym]: () => {},
|
||||
[namedSym]: () => {}
|
||||
};
|
||||
|
||||
assert.sameValue(o.id.name, 'id', 'via IdentifierName');
|
||||
verifyNotEnumerable(o.id, 'name');
|
||||
verifyNotWritable(o.id, 'name');
|
||||
verifyConfigurable(o.id, 'name');
|
||||
|
||||
assert.sameValue(o[anonSym].name, '', 'via anonymous Symbol');
|
||||
verifyNotEnumerable(o[anonSym], 'name');
|
||||
verifyNotWritable(o[anonSym], 'name');
|
||||
verifyConfigurable(o[anonSym], 'name');
|
||||
|
||||
assert.sameValue(o[namedSym].name, '[test262]', 'via Symbol');
|
||||
verifyNotEnumerable(o[namedSym], 'name');
|
||||
verifyNotWritable(o[namedSym], 'name');
|
||||
verifyConfigurable(o[namedSym], 'name');
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.2.6.9
|
||||
description: Assignment of function `name` attribute (ClassExpression)
|
||||
info: >
|
||||
6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(propValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(propValue,
|
||||
propKey).
|
||||
includes: [propertyHelper.js]
|
||||
features: [class, Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
var o;
|
||||
|
||||
o = {
|
||||
xId: class x {},
|
||||
id: class {},
|
||||
[anonSym]: class {},
|
||||
[namedSym]: class {}
|
||||
};
|
||||
|
||||
assert(o.xId.name !== 'xId');
|
||||
|
||||
assert.sameValue(o.id.name, 'id', 'via IdentifierName');
|
||||
verifyNotEnumerable(o.id, 'name');
|
||||
verifyNotWritable(o.id, 'name');
|
||||
verifyConfigurable(o.id, 'name');
|
||||
|
||||
assert.sameValue(o[anonSym].name, '', 'via anonymous Symbol');
|
||||
verifyNotEnumerable(o[anonSym], 'name');
|
||||
verifyNotWritable(o[anonSym], 'name');
|
||||
verifyConfigurable(o[anonSym], 'name');
|
||||
|
||||
assert.sameValue(o[namedSym].name, '[test262]', 'via Symbol');
|
||||
verifyNotEnumerable(o[namedSym], 'name');
|
||||
verifyNotWritable(o[namedSym], 'name');
|
||||
verifyConfigurable(o[namedSym], 'name');
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.2.6.9
|
||||
description: >
|
||||
Assignment of function `name` attribute (CoverParenthesizedExpression)
|
||||
info: >
|
||||
6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(propValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(propValue,
|
||||
propKey).
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
var o;
|
||||
|
||||
o = {
|
||||
xId: (0, function() {}),
|
||||
id: (function() {}),
|
||||
[anonSym]: (function() {}),
|
||||
[namedSym]: (function() {})
|
||||
};
|
||||
|
||||
assert(o.xId.name !== 'xId');
|
||||
|
||||
assert.sameValue(o.id.name, 'id', 'via IdentifierName');
|
||||
verifyNotEnumerable(o.id, 'name');
|
||||
verifyNotWritable(o.id, 'name');
|
||||
verifyConfigurable(o.id, 'name');
|
||||
|
||||
assert.sameValue(o[anonSym].name, '', 'via anonymous Symbol');
|
||||
verifyNotEnumerable(o[anonSym], 'name');
|
||||
verifyNotWritable(o[anonSym], 'name');
|
||||
verifyConfigurable(o[anonSym], 'name');
|
||||
|
||||
assert.sameValue(o[namedSym].name, '[test262]', 'via Symbol');
|
||||
verifyNotEnumerable(o[namedSym], 'name');
|
||||
verifyNotWritable(o[namedSym], 'name');
|
||||
verifyConfigurable(o[namedSym], 'name');
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.2.6.9
|
||||
description: Assignment of function `name` attribute (FunctionExpression)
|
||||
info: >
|
||||
6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(propValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(propValue,
|
||||
propKey).
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
var o;
|
||||
|
||||
o = {
|
||||
xId: function x() {},
|
||||
id: function() {},
|
||||
[anonSym]: function() {},
|
||||
[namedSym]: function() {}
|
||||
};
|
||||
|
||||
assert(o.xId.name !== 'xId');
|
||||
|
||||
assert.sameValue(o.id.name, 'id', 'via IdentifierName');
|
||||
verifyNotEnumerable(o.id, 'name');
|
||||
verifyNotWritable(o.id, 'name');
|
||||
verifyConfigurable(o.id, 'name');
|
||||
|
||||
assert.sameValue(o[anonSym].name, '', 'via anonymous Symbol');
|
||||
verifyNotEnumerable(o[anonSym], 'name');
|
||||
verifyNotWritable(o[anonSym], 'name');
|
||||
verifyConfigurable(o[anonSym], 'name');
|
||||
|
||||
assert.sameValue(o[namedSym].name, '[test262]', 'via Symbol');
|
||||
verifyNotEnumerable(o[namedSym], 'name');
|
||||
verifyNotWritable(o[namedSym], 'name');
|
||||
verifyConfigurable(o[namedSym], 'name');
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.2.6.9
|
||||
description: >
|
||||
Assignment of function `name` attribute (GeneratorExpression)
|
||||
info: >
|
||||
6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(propValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(propValue,
|
||||
propKey).
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators, Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
var o;
|
||||
|
||||
o = {
|
||||
xId: function* x() {},
|
||||
id: function*() {},
|
||||
[anonSym]: function*() {},
|
||||
[namedSym]: function*() {}
|
||||
};
|
||||
|
||||
assert(o.xId.name !== 'xId');
|
||||
|
||||
assert.sameValue(o.id.name, 'id', 'via IdentifierName');
|
||||
verifyNotEnumerable(o.id, 'name');
|
||||
verifyNotWritable(o.id, 'name');
|
||||
verifyConfigurable(o.id, 'name');
|
||||
|
||||
assert.sameValue(o[anonSym].name, '', 'via anonymous Symbol');
|
||||
verifyNotEnumerable(o[anonSym], 'name');
|
||||
verifyNotWritable(o[anonSym], 'name');
|
||||
verifyConfigurable(o[anonSym], 'name');
|
||||
|
||||
assert.sameValue(o[namedSym].name, '[test262]', 'via Symbol');
|
||||
verifyNotEnumerable(o[namedSym], 'name');
|
||||
verifyNotWritable(o[namedSym], 'name');
|
||||
verifyConfigurable(o[namedSym], 'name');
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.2.6.9
|
||||
description: Assignment of function `name` attribute (MethodDefinition)
|
||||
info: >
|
||||
6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(propValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(propValue,
|
||||
propKey).
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
var o;
|
||||
|
||||
o = {
|
||||
id() {},
|
||||
[anonSym]() {},
|
||||
[namedSym]() {}
|
||||
};
|
||||
|
||||
assert.sameValue(o.id.name, 'id', 'via IdentifierName');
|
||||
verifyNotEnumerable(o.id, 'name');
|
||||
verifyNotWritable(o.id, 'name');
|
||||
verifyConfigurable(o.id, 'name');
|
||||
|
||||
assert.sameValue(o[anonSym].name, '', 'via anonymous Symbol');
|
||||
verifyNotEnumerable(o[anonSym], 'name');
|
||||
verifyNotWritable(o[anonSym], 'name');
|
||||
verifyConfigurable(o[anonSym], 'name');
|
||||
|
||||
assert.sameValue(o[namedSym].name, '[test262]', 'via Symbol');
|
||||
verifyNotEnumerable(o[namedSym], 'name');
|
||||
verifyNotWritable(o[namedSym], 'name');
|
||||
verifyConfigurable(o[namedSym], 'name');
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 14.4.13
|
||||
description: >
|
||||
Assignment of function `name` attribute (GeneratorMethod)
|
||||
info: >
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
[...]
|
||||
9. Perform SetFunctionName(closure, propKey).
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators, Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
var o;
|
||||
|
||||
o = {
|
||||
*id() {},
|
||||
*[anonSym]() {},
|
||||
*[namedSym]() {}
|
||||
};
|
||||
|
||||
assert.sameValue(o.id.name, 'id', 'via IdentifierName');
|
||||
verifyNotEnumerable(o.id, 'name');
|
||||
verifyNotWritable(o.id, 'name');
|
||||
verifyConfigurable(o.id, 'name');
|
||||
|
||||
assert.sameValue(o[anonSym].name, '', 'via anonymous Symbol');
|
||||
verifyNotEnumerable(o[anonSym], 'name');
|
||||
verifyNotWritable(o[anonSym], 'name');
|
||||
verifyConfigurable(o[anonSym], 'name');
|
||||
|
||||
assert.sameValue(o[namedSym].name, '[test262]', 'via Symbol');
|
||||
verifyNotEnumerable(o[namedSym], 'name');
|
||||
verifyNotWritable(o[namedSym], 'name');
|
||||
verifyConfigurable(o[namedSym], 'name');
|
|
@ -0,0 +1,63 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 14.3.9
|
||||
description: Assignment of function `name` attribute ("get" accessor)
|
||||
info: >
|
||||
MethodDefinition : get PropertyName ( ) { FunctionBody }
|
||||
|
||||
[...]
|
||||
8. Perform SetFunctionName(closure, propKey, "get").
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
var getter;
|
||||
|
||||
class A {
|
||||
get id() {}
|
||||
get [anonSym]() {}
|
||||
get [namedSym]() {}
|
||||
static get id() {}
|
||||
static get [anonSym]() {}
|
||||
static get [namedSym]() {}
|
||||
}
|
||||
|
||||
getter = Object.getOwnPropertyDescriptor(A.prototype, 'id').get;
|
||||
assert.sameValue(getter.name, 'get id');
|
||||
verifyNotEnumerable(getter, 'name');
|
||||
verifyNotWritable(getter, 'name');
|
||||
verifyConfigurable(getter, 'name');
|
||||
|
||||
getter = Object.getOwnPropertyDescriptor(A.prototype, anonSym).get;
|
||||
assert.sameValue(getter.name, 'get ');
|
||||
verifyNotEnumerable(getter, 'name');
|
||||
verifyNotWritable(getter, 'name');
|
||||
verifyConfigurable(getter, 'name');
|
||||
|
||||
getter = Object.getOwnPropertyDescriptor(A.prototype, namedSym).get;
|
||||
assert.sameValue(getter.name, 'get [test262]');
|
||||
verifyNotEnumerable(getter, 'name');
|
||||
verifyNotWritable(getter, 'name');
|
||||
verifyConfigurable(getter, 'name');
|
||||
|
||||
getter = Object.getOwnPropertyDescriptor(A, 'id').get;
|
||||
assert.sameValue(getter.name, 'get id');
|
||||
verifyNotEnumerable(getter, 'name');
|
||||
verifyNotWritable(getter, 'name');
|
||||
verifyConfigurable(getter, 'name');
|
||||
|
||||
getter = Object.getOwnPropertyDescriptor(A, anonSym).get;
|
||||
assert.sameValue(getter.name, 'get ');
|
||||
verifyNotEnumerable(getter, 'name');
|
||||
verifyNotWritable(getter, 'name');
|
||||
verifyConfigurable(getter, 'name');
|
||||
|
||||
getter = Object.getOwnPropertyDescriptor(A, namedSym).get;
|
||||
assert.sameValue(getter.name, 'get [test262]');
|
||||
verifyNotEnumerable(getter, 'name');
|
||||
verifyNotWritable(getter, 'name');
|
||||
verifyConfigurable(getter, 'name');
|
|
@ -0,0 +1,64 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 14.3.9
|
||||
description: Assignment of function `name` attribute ("set" accessor)
|
||||
info: >
|
||||
MethodDefinition :
|
||||
set PropertyName ( PropertySetParameterList ) { FunctionBody }
|
||||
|
||||
[...]
|
||||
7. Perform SetFunctionName(closure, propKey, "set").
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
var setter;
|
||||
|
||||
class A {
|
||||
set id(_) {}
|
||||
set [anonSym](_) {}
|
||||
set [namedSym](_) {}
|
||||
static set id(_) {}
|
||||
static set [anonSym](_) {}
|
||||
static set [namedSym](_) {}
|
||||
}
|
||||
|
||||
setter = Object.getOwnPropertyDescriptor(A.prototype, 'id').set;
|
||||
assert.sameValue(setter.name, 'set id');
|
||||
verifyNotEnumerable(setter, 'name');
|
||||
verifyNotWritable(setter, 'name');
|
||||
verifyConfigurable(setter, 'name');
|
||||
|
||||
setter = Object.getOwnPropertyDescriptor(A.prototype, anonSym).set;
|
||||
assert.sameValue(setter.name, 'set ');
|
||||
verifyNotEnumerable(setter, 'name');
|
||||
verifyNotWritable(setter, 'name');
|
||||
verifyConfigurable(setter, 'name');
|
||||
|
||||
setter = Object.getOwnPropertyDescriptor(A.prototype, namedSym).set;
|
||||
assert.sameValue(setter.name, 'set [test262]');
|
||||
verifyNotEnumerable(setter, 'name');
|
||||
verifyNotWritable(setter, 'name');
|
||||
verifyConfigurable(setter, 'name');
|
||||
|
||||
setter = Object.getOwnPropertyDescriptor(A, 'id').set;
|
||||
assert.sameValue(setter.name, 'set id');
|
||||
verifyNotEnumerable(setter, 'name');
|
||||
verifyNotWritable(setter, 'name');
|
||||
verifyConfigurable(setter, 'name');
|
||||
|
||||
setter = Object.getOwnPropertyDescriptor(A, anonSym).set;
|
||||
assert.sameValue(setter.name, 'set ');
|
||||
verifyNotEnumerable(setter, 'name');
|
||||
verifyNotWritable(setter, 'name');
|
||||
verifyConfigurable(setter, 'name');
|
||||
|
||||
setter = Object.getOwnPropertyDescriptor(A, namedSym).set;
|
||||
assert.sameValue(setter.name, 'set [test262]');
|
||||
verifyNotEnumerable(setter, 'name');
|
||||
verifyNotWritable(setter, 'name');
|
||||
verifyConfigurable(setter, 'name');
|
|
@ -0,0 +1,58 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 14.4.13
|
||||
description: >
|
||||
Assignment of function `name` attribute (GeneratorMethod)
|
||||
info: >
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
[...]
|
||||
9. Perform SetFunctionName(closure, propKey).
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators, Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
|
||||
class A {
|
||||
*id() {}
|
||||
*[anonSym]() {}
|
||||
*[namedSym]() {}
|
||||
static *id() {}
|
||||
static *[anonSym]() {}
|
||||
static *[namedSym]() {}
|
||||
}
|
||||
|
||||
assert.sameValue(A.prototype.id.name, 'id', 'via IdentifierName');
|
||||
verifyNotEnumerable(A.prototype.id, 'name');
|
||||
verifyNotWritable(A.prototype.id, 'name');
|
||||
verifyConfigurable(A.prototype.id, 'name');
|
||||
|
||||
assert.sameValue(A.prototype[anonSym].name, '', 'via anonymous Symbol');
|
||||
verifyNotEnumerable(A.prototype[anonSym], 'name');
|
||||
verifyNotWritable(A.prototype[anonSym], 'name');
|
||||
verifyConfigurable(A.prototype[anonSym], 'name');
|
||||
|
||||
assert.sameValue(A.prototype[namedSym].name, '[test262]', 'via Symbol');
|
||||
verifyNotEnumerable(A.prototype[namedSym], 'name');
|
||||
verifyNotWritable(A.prototype[namedSym], 'name');
|
||||
verifyConfigurable(A.prototype[namedSym], 'name');
|
||||
|
||||
assert.sameValue(A.id.name, 'id', 'static via IdentifierName');
|
||||
verifyNotEnumerable(A.id, 'name');
|
||||
verifyNotWritable(A.id, 'name');
|
||||
verifyConfigurable(A.id, 'name');
|
||||
|
||||
assert.sameValue(A[anonSym].name, '', 'static via anonymous Symbol');
|
||||
verifyNotEnumerable(A[anonSym], 'name');
|
||||
verifyNotWritable(A[anonSym], 'name');
|
||||
verifyConfigurable(A[anonSym], 'name');
|
||||
|
||||
assert.sameValue(A[namedSym].name, '[test262]', 'static via Symbol');
|
||||
verifyNotEnumerable(A[namedSym], 'name');
|
||||
verifyNotWritable(A[namedSym], 'name');
|
||||
verifyConfigurable(A[namedSym], 'name');
|
|
@ -0,0 +1,57 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 12.2.6.9
|
||||
description: Assignment of function `name` attribute (MethodDefinition)
|
||||
info: >
|
||||
6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(propValue, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(propValue,
|
||||
propKey).
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var namedSym = Symbol('test262');
|
||||
var anonSym = Symbol();
|
||||
|
||||
class A {
|
||||
id() {}
|
||||
[anonSym]() {}
|
||||
[namedSym]() {}
|
||||
static id() {}
|
||||
static [anonSym]() {}
|
||||
static [namedSym]() {}
|
||||
}
|
||||
|
||||
assert.sameValue(A.prototype.id.name, 'id', 'via IdentifierName');
|
||||
verifyNotEnumerable(A.prototype.id, 'name');
|
||||
verifyNotWritable(A.prototype.id, 'name');
|
||||
verifyConfigurable(A.prototype.id, 'name');
|
||||
|
||||
assert.sameValue(A.prototype[anonSym].name, '', 'via anonymous Symbol');
|
||||
verifyNotEnumerable(A.prototype[anonSym], 'name');
|
||||
verifyNotWritable(A.prototype[anonSym], 'name');
|
||||
verifyConfigurable(A.prototype[anonSym], 'name');
|
||||
|
||||
assert.sameValue(A.prototype[namedSym].name, '[test262]', 'via Symbol');
|
||||
verifyNotEnumerable(A.prototype[namedSym], 'name');
|
||||
verifyNotWritable(A.prototype[namedSym], 'name');
|
||||
verifyConfigurable(A.prototype[namedSym], 'name');
|
||||
|
||||
assert.sameValue(A.id.name, 'id', 'static via IdentifierName');
|
||||
verifyNotEnumerable(A.id, 'name');
|
||||
verifyNotWritable(A.id, 'name');
|
||||
verifyConfigurable(A.id, 'name');
|
||||
|
||||
assert.sameValue(A[anonSym].name, '', 'static via anonymous Symbol');
|
||||
verifyNotEnumerable(A[anonSym], 'name');
|
||||
verifyNotWritable(A[anonSym], 'name');
|
||||
verifyConfigurable(A[anonSym], 'name');
|
||||
|
||||
assert.sameValue(A[namedSym].name, '[test262]', 'static via Symbol');
|
||||
verifyNotEnumerable(A[namedSym], 'name');
|
||||
verifyNotWritable(A[namedSym], 'name');
|
||||
verifyConfigurable(A[namedSym], 'name');
|
|
@ -0,0 +1,63 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 14.5.15
|
||||
description: >
|
||||
Function `name` attribute not inferred in presence of static `name` method
|
||||
info: >
|
||||
ClassDeclaration : class BindingIdentifier ClassTail
|
||||
|
||||
[...]
|
||||
4. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
5. ReturnIfAbrupt(hasNameProperty).
|
||||
6. If hasNameProperty is false, then perform SetFunctionName(value,
|
||||
className).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class A {
|
||||
static name() {
|
||||
$ERROR('Static method should not be executed during definition');
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(typeof A.name, 'function');
|
||||
|
||||
var attr = 'name';
|
||||
class B {
|
||||
static [attr]() {
|
||||
$ERROR(
|
||||
'Static method defined via computed property should not be executed ' +
|
||||
'during definition'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(typeof B.name, 'function');
|
||||
|
||||
class C {
|
||||
static get name() {
|
||||
$ERROR('Static `get` accessor should not be executed during definition');
|
||||
}
|
||||
}
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
C.name;
|
||||
});
|
||||
|
||||
class D {
|
||||
static set name(_) {
|
||||
$ERROR('Static `set` accessor should not be executed during definition');
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(D.name, undefined);
|
||||
|
||||
class E {
|
||||
static *name() {
|
||||
$ERROR('Static GeneratorMethod should not be executed during definition');
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(typeof E.name, 'function');
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 14.5.15
|
||||
description: Assignment of function `name` attribute
|
||||
info: >
|
||||
ClassDeclaration : class BindingIdentifier ClassTail
|
||||
|
||||
[...]
|
||||
6. If hasNameProperty is false, then perform SetFunctionName(value,
|
||||
className).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
class Test262 {}
|
||||
|
||||
assert.sameValue(Test262.name, 'Test262');
|
||||
verifyNotEnumerable(Test262, 'name');
|
||||
verifyNotWritable(Test262, 'name');
|
||||
verifyConfigurable(Test262, 'name');
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.1.4
|
||||
description: Assignment of function `name` attribute (ArrowFunction)
|
||||
info: >
|
||||
LexicalBinding : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
6. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
const arrow = () => {};
|
||||
|
||||
assert.sameValue(arrow.name, 'arrow');
|
||||
verifyNotEnumerable(arrow, 'name');
|
||||
verifyNotWritable(arrow, 'name');
|
||||
verifyConfigurable(arrow, 'name');
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.1.4
|
||||
description: Assignment of function `name` attribute (ClassExpression)
|
||||
info: >
|
||||
LexicalBinding : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
6. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
features: [class]
|
||||
---*/
|
||||
|
||||
const xCls = class x {};
|
||||
const cls = class {};
|
||||
|
||||
assert(xCls.name !== 'xCls');
|
||||
|
||||
assert.sameValue(cls.name, 'cls');
|
||||
verifyNotEnumerable(cls, 'name');
|
||||
verifyNotWritable(cls, 'name');
|
||||
verifyConfigurable(cls, 'name');
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.1.4
|
||||
description: >
|
||||
Assignment of function `name` attribute (CoverParenthesizedExpression)
|
||||
info: >
|
||||
LexicalBinding : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
6. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
const xCover = (0, function() {});
|
||||
const cover = (function() {});
|
||||
|
||||
assert(xCover.name !== 'xCover');
|
||||
|
||||
assert.sameValue(cover.name, 'cover');
|
||||
verifyNotEnumerable(cover, 'name');
|
||||
verifyNotWritable(cover, 'name');
|
||||
verifyConfigurable(cover, 'name');
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.1.4
|
||||
description: Assignment of function `name` attribute (FunctionExpression)
|
||||
info: >
|
||||
LexicalBinding : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
6. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
const xFn = function x() {};
|
||||
const fn = function() {};
|
||||
|
||||
assert(xFn.name !== 'xFn');
|
||||
|
||||
assert.sameValue(fn.name, 'fn');
|
||||
verifyNotEnumerable(fn, 'name');
|
||||
verifyNotWritable(fn, 'name');
|
||||
verifyConfigurable(fn, 'name');
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.1.4
|
||||
description: Assignment of function `name` attribute (GeneratorExpression)
|
||||
info: >
|
||||
LexicalBinding : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
6. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
const xGen = function* x() {};
|
||||
const gen = function*() {};
|
||||
|
||||
assert(xGen.name !== 'xGen');
|
||||
|
||||
assert.sameValue(gen.name, 'gen');
|
||||
verifyNotEnumerable(gen, 'name');
|
||||
verifyNotWritable(gen, 'name');
|
||||
verifyConfigurable(gen, 'name');
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 14.1.19
|
||||
description: Assignment of function `name` attribute
|
||||
info: >
|
||||
FunctionDeclaration :
|
||||
function BindingIdentifier ( FormalParameters ) { FunctionBody }
|
||||
|
||||
1. Let name be StringValue of BindingIdentifier.
|
||||
2. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody, scope, strict).
|
||||
3. Perform MakeConstructor(F).
|
||||
4. Perform SetFunctionName(F, name).
|
||||
5. Return F.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
function func() {}
|
||||
|
||||
assert.sameValue(func.name, 'func');
|
||||
verifyNotEnumerable(func, 'name');
|
||||
verifyNotWritable(func, 'name');
|
||||
verifyConfigurable(func, 'name');
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (C) 2013 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Generator functions should define a `name` property.
|
||||
includes: [propertyHelper.js]
|
||||
es6id: 25.2.4
|
||||
---*/
|
||||
|
||||
function* g() {}
|
||||
|
||||
assert.sameValue(g.name, 'g');
|
||||
verifyNotEnumerable(g, 'name');
|
||||
verifyNotWritable(g, 'name');
|
||||
verifyConfigurable(g, 'name');
|
|
@ -2,13 +2,18 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Generator functions should define a `name` property.
|
||||
description: Assignment of function `name` attribute
|
||||
es6id: 14.4.12
|
||||
info: >
|
||||
GeneratorDeclaration :
|
||||
function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
|
||||
|
||||
[...]
|
||||
6. Perform SetFunctionName(F, name).
|
||||
includes: [propertyHelper.js]
|
||||
es6id: 25.2.4
|
||||
---*/
|
||||
|
||||
var g = function*() {};
|
||||
function* g() {}
|
||||
|
||||
assert.sameValue(g.name, 'g');
|
||||
verifyNotEnumerable(g, 'name');
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.1.4
|
||||
description: Assignment of function `name` attribute (ArrowFunction)
|
||||
info: >
|
||||
LexicalBinding : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
6. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
let arrow = () => {};
|
||||
|
||||
assert.sameValue(arrow.name, 'arrow');
|
||||
verifyNotEnumerable(arrow, 'name');
|
||||
verifyNotWritable(arrow, 'name');
|
||||
verifyConfigurable(arrow, 'name');
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.1.4
|
||||
description: Assignment of function `name` attribute (ClassExpression)
|
||||
info: >
|
||||
LexicalBinding : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
6. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
features: [class]
|
||||
---*/
|
||||
|
||||
let xCls = class x {};
|
||||
let cls = class {};
|
||||
|
||||
assert(xCls.name !== 'xCls');
|
||||
|
||||
assert.sameValue(cls.name, 'cls');
|
||||
verifyNotEnumerable(cls, 'name');
|
||||
verifyNotWritable(cls, 'name');
|
||||
verifyConfigurable(cls, 'name');
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.1.4
|
||||
description: >
|
||||
Assignment of function `name` attribute (CoverParenthesizedExpression)
|
||||
info: >
|
||||
LexicalBinding : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
6. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
let xCover = (0, function() {});
|
||||
let cover = (function() {});
|
||||
|
||||
assert(xCover.name !== 'xCover');
|
||||
|
||||
assert.sameValue(cover.name, 'cover');
|
||||
verifyNotEnumerable(cover, 'name');
|
||||
verifyNotWritable(cover, 'name');
|
||||
verifyConfigurable(cover, 'name');
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.1.4
|
||||
description: Assignment of function `name` attribute (FunctionExpression)
|
||||
info: >
|
||||
LexicalBinding : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
6. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
let xFn = function x() {};
|
||||
let fn = function() {};
|
||||
|
||||
assert(xFn.name !== 'xFn');
|
||||
|
||||
assert.sameValue(fn.name, 'fn');
|
||||
verifyNotEnumerable(fn, 'name');
|
||||
verifyNotWritable(fn, 'name');
|
||||
verifyConfigurable(fn, 'name');
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.1.4
|
||||
description: Assignment of function `name` attribute (GeneratorExpression)
|
||||
info: >
|
||||
LexicalBinding : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
6. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
let xGen = function* x() {};
|
||||
let gen = function*() {};
|
||||
|
||||
assert(xGen.name !== 'xGen');
|
||||
|
||||
assert.sameValue(gen.name, 'gen');
|
||||
verifyNotEnumerable(gen, 'name');
|
||||
verifyNotWritable(gen, 'name');
|
||||
verifyConfigurable(gen, 'name');
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.2.4
|
||||
description: Assignment of function `name` attribute (ArrowFunction)
|
||||
info: >
|
||||
VariableDeclaration : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
7. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var arrow = () => {};
|
||||
|
||||
assert.sameValue(arrow.name, 'arrow');
|
||||
verifyNotEnumerable(arrow, 'name');
|
||||
verifyNotWritable(arrow, 'name');
|
||||
verifyConfigurable(arrow, 'name');
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.2.4
|
||||
description: Assignment of function `name` attribute (ClassExpression)
|
||||
info: >
|
||||
VariableDeclaration : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
7. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
features: [class]
|
||||
---*/
|
||||
|
||||
var xCls = class x {};
|
||||
var cls = class {};
|
||||
|
||||
assert(xCls.name !== 'xCls');
|
||||
|
||||
assert.sameValue(cls.name, 'cls');
|
||||
verifyNotEnumerable(cls, 'name');
|
||||
verifyNotWritable(cls, 'name');
|
||||
verifyConfigurable(cls, 'name');
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.2.4
|
||||
description: >
|
||||
Assignment of function `name` attribute (CoverParenthesizedExpression)
|
||||
info: >
|
||||
VariableDeclaration : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
7. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var xCover = (0, function() {});
|
||||
var cover = (function() {});
|
||||
|
||||
assert(xCover.name !== 'xCover');
|
||||
|
||||
assert.sameValue(cover.name, 'cover');
|
||||
verifyNotEnumerable(cover, 'name');
|
||||
verifyNotWritable(cover, 'name');
|
||||
verifyConfigurable(cover, 'name');
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.2.4
|
||||
description: Assignment of function `name` attribute (FunctionExpression)
|
||||
info: >
|
||||
VariableDeclaration : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
7. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var xFn = function x() {};
|
||||
var fn = function() {};
|
||||
|
||||
assert(xFn.name !== 'xFn');
|
||||
|
||||
assert.sameValue(fn.name, 'fn');
|
||||
verifyNotEnumerable(fn, 'name');
|
||||
verifyNotWritable(fn, 'name');
|
||||
verifyConfigurable(fn, 'name');
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 13.3.2.4
|
||||
description: Assignment of function `name` attribute (GeneratorExpression)
|
||||
info: >
|
||||
VariableDeclaration : BindingIdentifier Initializer
|
||||
|
||||
[...]
|
||||
7. If IsAnonymousFunctionDefinition(Initializer) is true, then
|
||||
a. Let hasNameProperty be HasOwnProperty(value, "name").
|
||||
b. ReturnIfAbrupt(hasNameProperty).
|
||||
c. If hasNameProperty is false, perform SetFunctionName(value,
|
||||
bindingId).
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var xGen = function* x() {};
|
||||
var gen = function*() {};
|
||||
|
||||
assert(xGen.name !== 'xGen');
|
||||
|
||||
assert.sameValue(gen.name, 'gen');
|
||||
verifyNotEnumerable(gen, 'name');
|
||||
verifyNotWritable(gen, 'name');
|
||||
verifyConfigurable(gen, 'name');
|
Loading…
Reference in New Issue