summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEarlopain <14981592+Earlopain@users.noreply.github.com>2026-01-20 20:34:49 +0100
committergit <svn-admin@ruby-lang.org>2026-01-20 20:23:18 +0000
commit9ad8dd00b1be782b7a053315bc4c00ff642c5fba (patch)
tree3398d420effbe6f1420aa6d6d50f3b2969d8c99b /lib
parentd225bb8b464e4e03d2eb6c09ef15adf727af9e2b (diff)
[ruby/prism] Fix `on_*` return value of ripper translator
You're supposed to return the first argument. ```rb # Before [[:stmts_new], [:rescue_mod, nil, nil], [:stmts_add, nil, nil], [:program, nil]] # After [[:stmts_new], [:rescue_mod, "1", "2"], [:stmts_add, nil, "1"], [:program, nil]] ``` The correct result would be: `[[:rescue_mod, "1", "2"], [:stmts_new], [:stmts_add, nil, "1"], [:program, nil]]` But the order depends on the prism AST so it seems very difficult to match. https://github.com/ruby/prism/commit/94e0107729
Diffstat (limited to 'lib')
-rw-r--r--lib/prism/translation/ripper.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb
index c8f9fa7731..afe30bb5db 100644
--- a/lib/prism/translation/ripper.rb
+++ b/lib/prism/translation/ripper.rb
@@ -3446,12 +3446,12 @@ module Prism
# :stopdoc:
def _dispatch_0; end
- def _dispatch_1(_); end
- def _dispatch_2(_, _); end
- def _dispatch_3(_, _, _); end
- def _dispatch_4(_, _, _, _); end
- def _dispatch_5(_, _, _, _, _); end
- def _dispatch_7(_, _, _, _, _, _, _); end
+ def _dispatch_1(arg); arg end
+ def _dispatch_2(arg, _); arg end
+ def _dispatch_3(arg, _, _); arg end
+ def _dispatch_4(arg, _, _, _); arg end
+ def _dispatch_5(arg, _, _, _, _); arg end
+ def _dispatch_7(arg, _, _, _, _, _, _); arg end
# :startdoc:
#