feat: support the it block parameter - #2238
Conversation
|
|
||
| def self.new_parser | ||
| Prism::Translation::Parser33.new(Builder.new).tap do |parser| | ||
| Prism::Translation::Parser34.new(Builder.new).tap do |parser| |
There was a problem hiding this comment.
Discussion: I bumped the Prism parser from Parser33 to Parser34 to support the it parameter.
But this introduces incompatible behavior.
def it
1
end
[1, 2, 3].map { it }With Parser33, the it inside the block is recognized as a method call to #it. With Parser34, the same it is recognized as the block's implicit parameter.
I'm afraid that this brings a breaking change. Would it be better to add a configuration for the Ruby syntax version?
There was a problem hiding this comment.
I don't think it's a problem.
Ruby 3.3 was released 2023. Two years old. And it's already in security maintenance stage. We may want to use even newer version --Parser40.
b172612 to
db29dfe
Compare
Recognize Ruby 3.4's `it` (e.g. `[1].map { it + 1 }`) by handling
the new :itblock node alongside :numblock across type checking,
source mapping, diagnostics, hover, and signature help.
This requires bumping Prism::Translation::Parser33 to Parser34.
Closes soutaro#1450
db29dfe to
3e1cf45
Compare
|
@soutaro Is there any chance to merge this? This is a blocker to migrating my code to the new syntax. |
|
Thanks! I can't wait for the next release :-) |
Recognize Ruby 3.4's
it(e.g.[1].map { it + 1 }) by handling the new :itblock node alongside :numblock across type checking, source mapping, diagnostics, hover, and signature help.This requires bumping Prism::Translation::Parser33 to Parser34.
Closes #1450