name anonymous functions on property assignments

Allen Wirfs-Brock allen at
Sun Jul 26 20:37:26 UTC 2015

On Jul 26, 2015, at 1:17 PM, Jordan Harband wrote:

> What is the function's name if the computed object literal key is a Symbol? ie, what does the following output:

specified in step 4 of 

> ```js
> const sym = Symbol('something');
> const o = {
>     [sym] () {}
> };
> console.log(o[sym].name);
> ```

should be:  "[something]"
> Currently it appears Babel outputs an empty string for this case.
> If the current spec handles symbols just fine in this way, why would "the possibility that the property key is a symbol" be a reason for an expression form not to set the "name" property?

Yes, the ES2015 spec. does say how to handle Symbols as `name` property values.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list