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

Implement Prism -> Sorbet translation for anonymous Array and Hash splats #232

Merged
merged 4 commits into from
Sep 13, 2024

Conversation

amomchilov
Copy link

@amomchilov amomchilov commented Sep 3, 2024

Motivation

Builds on top of #42 and #225 to add support for anonymous splats.

Test plan

See included automated tests.

@amomchilov amomchilov changed the base branch from prism to Alex/translate-anonymous-params September 5, 2024 22:01
@amomchilov amomchilov changed the title Alex/translate call kwrest Implement Prism -> Sorbet translation for anonymous Array and Hash splats Sep 5, 2024
@amomchilov amomchilov force-pushed the Alex/translate-anonymous-params branch from bd06e33 to 09e8803 Compare September 6, 2024 17:11
Base automatically changed from Alex/translate-anonymous-params to prism September 7, 2024 15:44
It was still a copy of `def_kw_rest_params`, and were still testing method defs, not calls.
Comment on lines +129 to +130
unreachable("PM_ASSOC_SPLAT_NODE is handled separately in `Translator::translateHash()`, because its "
"translation depends on whether its used in a hash or in a method call");
Copy link
Author

Choose a reason for hiding this comment

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

This prevents us from needing to maintain a parsing context, that remembers whether this recursive call to Translator::translate() originated from a PM_HASH_NODE or a PM_KEYWORD_HASH_NODE.

parser/prism/Translator.cc Show resolved Hide resolved
parser/prism/Translator.cc Outdated Show resolved Hide resolved
@amomchilov amomchilov self-assigned this Sep 12, 2024
@amomchilov amomchilov marked this pull request as ready for review September 12, 2024 21:45
@amomchilov amomchilov requested review from egiurleo, a team and vinistock September 12, 2024 21:46
Copy link

@egiurleo egiurleo left a comment

Choose a reason for hiding this comment

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

Looks great!

parser/prism/Translator.cc Outdated Show resolved Hide resolved
@amomchilov amomchilov merged commit 0afadaa into prism Sep 13, 2024
1 check passed
@amomchilov amomchilov deleted the Alex/translate-call-kwrest branch September 13, 2024 20:32
@amomchilov amomchilov linked an issue Oct 2, 2024 that may be closed by this pull request
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.

Implement translation for PM_ASSOC_SPLAT_NODE
2 participants