Open
Conversation
Morriar
reviewed
Jan 19, 2026
| call_node.arguments().and_then(|args| args.arguments().iter().next()), | ||
| Nesting::Owner, | ||
| |indexer, definition_id| { | ||
| indexer.nesting_stack.push(Nesting::Owner(definition_id)); |
Contributor
There was a problem hiding this comment.
Can't we leave this in handle_class_definition since it's the same in both cases?
Member
Author
There was a problem hiding this comment.
It's not always the same. In visit_class_node, this pushes a Nesting::LexicalScope.
| } | ||
|
|
||
| /// Handles the arguments to `Struct.new` and creates the appropriate definitions | ||
| fn handle_struct_fields(&mut self, call_node: &ruby_prism::CallNode) { |
Contributor
There was a problem hiding this comment.
It looks like we're again trying to do some desugaring/rewriting by introducing a synthetic constant alias. Shouldn't we create a Struct definition instead and create the proper declaration in the resolver?
I think it's another symptom of #471 (review) we're trying to work around.
Member
Author
There was a problem hiding this comment.
I put a topic for us to discuss in our next meeting.
fc5531b to
7a56214
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Another step for #392
This PR starts handling
Struct.new, creating all definitions related to it. There are a few things regarding behaviour that's interesting:Structnamespaceinitializemethod is always created (even if there are no fields)keyword_initparameter changes the signature ofinitializeto use keyword optional arguments instead of positional optional argumentsStructNote: there might be overlap with the handling for
Data.define, but I didn't want to make this PR too large. I'll refactor if there's an opportunity for it