summaryrefslogtreecommitdiff
path: root/lib/prism/translation/ripper.rb
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-03-06 00:38:02 -0500
committergit <svn-admin@ruby-lang.org>2024-03-06 16:42:58 +0000
commitf96ce41ac88267a6dce2d13f6f0400f2265476a9 (patch)
tree04c32549e8b2e5eacbbbb85110997a6d37fe4c9d /lib/prism/translation/ripper.rb
parent14877e737bcf38477d783a7d5f0dda29becc0a5b (diff)
[ruby/prism] Disallow keywords as method names in ripper translation
https://github.com/ruby/prism/commit/dc74428e2e
Diffstat (limited to 'lib/prism/translation/ripper.rb')
-rw-r--r--lib/prism/translation/ripper.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb
index f9cd6d3ada..be4032de8d 100644
--- a/lib/prism/translation/ripper.rb
+++ b/lib/prism/translation/ripper.rb
@@ -629,7 +629,7 @@ module Prism
on_binary(receiver, node.name, value)
else
bounds(node.message_loc)
- message = visit_token(node.message)
+ message = visit_token(node.message, false)
if node.variable_call?
on_vcall(message)
@@ -666,7 +666,7 @@ module Prism
:call
else
bounds(node.message_loc)
- visit_token(node.message)
+ visit_token(node.message, false)
end
if node.name.end_with?("=") && !node.message.end_with?("=") && !node.arguments.nil? && node.block.nil?
@@ -2761,13 +2761,13 @@ module Prism
# Visit the string content of a particular node. This method is used to
# split into the various token types.
- def visit_token(token)
+ def visit_token(token, allow_keywords = true)
case token
when "."
on_period(token)
when "`"
on_backtick(token)
- when *KEYWORDS
+ when *(allow_keywords ? KEYWORDS : [])
on_kw(token)
when /^_/
on_ident(token)