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

Freeze parsing option #414

Merged
merged 3 commits into from
Dec 4, 2019
Merged

Conversation

casperisfine
Copy link

As discussed here: ruby/ruby#2287 (comment)
Followup: #409

With this option enabled:

  • All the objects returned are frozen.
  • All string instances are deduplicated using String#-@.

Note that I had to first refactor symbolize_names, because it was mutating the data structures at the end of the parsing phase.

Also, we could go a bit further and deduplicate some specific objects such as empty hashes and arrays, but I opted to keep this PR as simple as possible.

@tenderlove @rafaelfranca @Edouard-chin

@tenderlove
Copy link
Member

@casperisfine can you rebase this and I'll merge it?

@casperisfine
Copy link
Author

@tenderlove done!

@tenderlove tenderlove merged commit beb0f7f into ruby:master Dec 4, 2019
@tenderlove
Copy link
Member

@casperisfine thank you!

@casperisfine
Copy link
Author

You're most welcome!

paracycle added a commit to Shopify/sorbet that referenced this pull request Oct 8, 2020
The `freeze` parsing option was added almost a year ago in upstream
PR: ruby/psych#414 This commit reflects those
changes in the RBI file.
paracycle added a commit to Shopify/sorbet that referenced this pull request Oct 8, 2020
The `freeze` parsing option was added almost a year ago in upstream
PR: ruby/psych#414 This commit reflects those
changes in the RBI file.
paracycle added a commit to Shopify/sorbet that referenced this pull request Oct 8, 2020
The `freeze` parsing option was added almost a year ago in upstream
PR: ruby/psych#414 This commit reflects those
changes in the RBI file.
jez pushed a commit to sorbet/sorbet that referenced this pull request Oct 17, 2020
The `freeze` parsing option was added almost a year ago in upstream
PR: ruby/psych#414 This commit reflects those
changes in the RBI file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants