Bug 162720 - Arrow functions do not infer name from computed property but normal functions do
Summary: Arrow functions do not infer name from computed property but normal functions do
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-29 02:57 PDT by Joseph Pecoraro
Modified: 2016-09-29 13:36 PDT (History)
2 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (3.06 KB, patch)
2016-09-29 11:49 PDT, Joseph Pecoraro
saam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-09-29 02:57:38 PDT
Summary:
Arrow functions do not infer name from computed property but normal functions do

Test:
js> function funcName() { return "funcName" }
...
js> ({"func": function(){}}).func.name
"func"
js> ({["func"]: function(){}}).func.name
"func"
js> ({[funcName()]: function(){}}).func.name
"func"
js> ({func: ()=>{}}).func.name
"func"
js> ({["func"]: ()=>{}}).func.name
""
js> ({[funcName()]: ()=>{}}).func.name
""

Why is this? And is this actually specced anywhere? Maybe this is runtime, since evaluating funcName() must happen at runtime.
Comment 1 Joseph Pecoraro 2016-09-29 11:49:50 PDT
Created attachment 290227 [details]
[PATCH] Proposed Fix

Waiting on the other change to land.
Comment 2 Saam Barati 2016-09-29 11:55:15 PDT
Comment on attachment 290227 [details]
[PATCH] Proposed Fix

r=me
Comment 3 Joseph Pecoraro 2016-09-29 13:36:24 PDT
<https://trac.webkit.org/changeset/206610>