diff options
author | Kevin Newton <kddnewton@gmail.com> | 2024-05-22 14:31:38 -0400 |
---|---|---|
committer | Kevin Newton <kddnewton@gmail.com> | 2024-05-22 16:34:04 -0400 |
commit | e575954887a8e8ae26a4122c33c66b8cb82dfa36 (patch) | |
tree | f1f9a41a0fcaa57640c914dcc429b8643f675b59 /lib/prism/translation/ripper.rb | |
parent | 5613d6e95bc09c2e8d2794590bb18444e0a4051d (diff) |
[ruby/prism] Fix support for 'it' implicit local variable
https://github.com/ruby/prism/commit/53bbcfe513
Diffstat (limited to 'lib/prism/translation/ripper.rb')
-rw-r--r-- | lib/prism/translation/ripper.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb index 68f658565d..79ba0e7ab3 100644 --- a/lib/prism/translation/ripper.rb +++ b/lib/prism/translation/ripper.rb @@ -2218,6 +2218,13 @@ module Prism end # -> { it } + # ^^ + def visit_it_local_variable_read_node(node) + bounds(node.location) + on_vcall(on_ident(node.slice)) + end + + # -> { it } # ^^^^^^^^^ def visit_it_parameters_node(node) end @@ -2312,12 +2319,7 @@ module Prism # ^^^ def visit_local_variable_read_node(node) bounds(node.location) - - if node.name == :"0it" - on_vcall(on_ident(node.slice)) - else - on_var_ref(on_ident(node.slice)) - end + on_var_ref(on_ident(node.slice)) end # foo = 1 |