test262/src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-co...

28 lines
916 B
Plaintext

// 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" functions "through" cover grammar
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
{ cover = (function () {}), xCover = (0, function() {}) }
//- vals
{}
//- body
assert.sameValue(cover.name, 'cover');
assert.notSameValue(xCover.name, 'xCover');