name anonymous functions on property assignments

Alexander Jones alex at weej.com
Sat Jan 28 13:29:36 UTC 2017


Just for a bit of context, can you elaborate on how this broke your code?
Thanks

On 27 January 2017 at 16:56, Jordan Harband <ljharb at gmail.com> wrote:

> I'd have an objection. Function name inference has already broken my code
> - luckily only tests so far, that i know of - and doing it more often would
> break more of it.
>
> On Fri, Jan 27, 2017 at 7:26 AM, T.J. Crowder <
> tj.crowder at farsightsoftware.com> wrote:
>
>> Two questions on the minor issue of the following not assigning a name
>> to the function:
>>
>> ```js
>> obj.foo = function() { };
>> ```
>>
>> 1) Am I correct that the only reason it doesn't (in spec terms) is
>> that Step 1.e. of [Runtime Semantics:
>> Evaluation](https://tc39.github.io/ecma262/#sec-assignment-
>> operators-runtime-semantics-evaluation)
>> reads
>>
>> > If IsAnonymousFunctionDefinition(AssignmentExpression) and
>> IsIdentifierRef of LeftHandSideExpression are both true, then
>>
>> and that changing that to
>>
>> > If IsAnonymousFunctionDefinition(AssignmentExpression) is true and
>> either IsIdentifierRef of LeftHandSideExpression is true or
>> IsPropertyReference of LeftHandSideExpression is true, then
>>
>> would mean it would assign the name `foo`? (The subsequent step
>> getting the name to use already uses GetReferencedName, which works
>> for property references as well as identifier references.)
>>
>> 2) Are there any objections to closing this gap in how function names
>> are assigned?
>>
>> -- T.J.
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170128/710c5d9f/attachment.html>


More information about the es-discuss mailing list