Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable ES6 function name inference #3407

Closed
bterlson opened this issue Jul 20, 2017 · 6 comments
Closed

Enable ES6 function name inference #3407

bterlson opened this issue Jul 20, 2017 · 6 comments

Comments

@bterlson
Copy link
Contributor

There are a number of cases that are currently not working properly, for example:

function foo(a = function () { }) { return a; }
print(foo().name);

Expected: 'a'
Actual: ''

This appears to be fixed with the ES6FunctionName flag - we should consider enabling this. Anyone know why this isn't yet enabled?

@dilijev
Copy link
Contributor

dilijev commented Jul 20, 2017

FWIW I'm not seeing that the -ES6FunctionName is not fixing this issue, but that node-ch does the right thing.

es -its -h ch-1.6.*,d8,sm,node*,jsc fnameinf.js
## Source
function foo(a = function () { }) { return a; }; print(foo().name); print('end')


┌───────────────┬─────┐
│ ch-1.6.0-args │ end │
│ ch-1.6.0      │     │
├───────────────┼─────┤
│ d8            │ a   │
│ jsc           │ end │
│ sm            │     │
│ node-ch       │     │
│ node          │     │
└───────────────┴─────┘

@dilijev dilijev added this to the vNext milestone Jul 20, 2017
@dilijev dilijev removed this from the vNext milestone Jul 20, 2017
@bterlson
Copy link
Contributor Author

bterlson commented Jul 20, 2017

@dilijev perhaps you are right, I noted that -es6experimental fixed it and figured it was because -es6experimental threw ES6FunctionName (which was disabled by default). Maybe my assumption was wrong :)

@curtisman curtisman added this to the vNext milestone Jul 20, 2017
@curtisman curtisman assigned atulkatti and unassigned curtisman Jul 20, 2017
@dilijev
Copy link
Contributor

dilijev commented Jul 21, 2017

Hmm, doesn't work for me with -es6experimental either. Which version of ChakraCore are you using?

@dilijev
Copy link
Contributor

dilijev commented Jul 28, 2017

Correcting my earlier assertion that it didn't work: I was using a Release build to test. It works with Debug/Test builds with -es6experimental

@bterlson
Copy link
Contributor Author

Another case not enabled in stable is the simple var x = function () { }; x.name pattern.

@rhuanjl
Copy link
Collaborator

rhuanjl commented Mar 25, 2020

This was fixed in master by #6287

@rhuanjl rhuanjl closed this as completed Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants