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

Allow symbol keys in getter/setter in object literal syntax #1749

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

andreabergia
Copy link
Contributor

This PR allows syntax such as:

var o = { get [aSymbol]: value }

to work correctly. I've also done a bit of refactoring of the tests in ComputedPropertiesTest to use Utils.runWithAllOptimizationLevels instead of having three functions for each case.

Should fix #1614

@andreabergia andreabergia force-pushed the getter-setter-symbol-key branch 2 times, most recently from 4c7e556 to cc69848 Compare December 9, 2024 09:42
Copy link
Collaborator

@gbrail gbrail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also looks good to me (and is surprisingly simple for a change). Thanks and please rebase when you get a chance...

@andreabergia andreabergia force-pushed the getter-setter-symbol-key branch from cc69848 to 2541f12 Compare December 10, 2024 07:58
@andreabergia
Copy link
Contributor Author

Rebased.
This is likely to conflict with #1747. I am happy to rebase one of the two after the other is merged on master 🙂

@gbrail
Copy link
Collaborator

gbrail commented Dec 11, 2024

Yes, I'm afraid that we need one more rebase of that big old test262.properties file. Thanks!

@andreabergia andreabergia force-pushed the getter-setter-symbol-key branch from 2541f12 to dafd20f Compare December 11, 2024 08:01
@andreabergia
Copy link
Contributor Author

Rebased again. I would suggest not squashing this.

@gbrail
Copy link
Collaborator

gbrail commented Dec 13, 2024

Thanks -- looks good!

@gbrail gbrail merged commit 9f217f1 into mozilla:master Dec 13, 2024
3 checks passed
@andreabergia andreabergia deleted the getter-setter-symbol-key branch December 13, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot use Symbol as key in computed key accessor property: var x = {get [Symbol()](){ /* some code */ }}
2 participants