summaryrefslogtreecommitdiff
path: root/lib/prism/desugar_compiler.rb
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-04-11 14:37:11 -0400
committergit <svn-admin@ruby-lang.org>2024-04-11 18:53:30 +0000
commitcd516ebd20a8d2c7b0f912e4d5750f84616463a5 (patch)
treeed677fdbc2de6d64f847ef9768b9281d1cb97cba /lib/prism/desugar_compiler.rb
parent58f93eec188df0a77b61b4781a7baf7b2c608097 (diff)
[ruby/prism] Add Location#chop
https://github.com/ruby/prism/commit/5dd57f4b84
Diffstat (limited to 'lib/prism/desugar_compiler.rb')
-rw-r--r--lib/prism/desugar_compiler.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/prism/desugar_compiler.rb b/lib/prism/desugar_compiler.rb
index 8d059b0c98..9b62c00df3 100644
--- a/lib/prism/desugar_compiler.rb
+++ b/lib/prism/desugar_compiler.rb
@@ -73,6 +73,8 @@ module Prism
# Desugar `x += y` to `x = x + y`
def compile
+ operator_loc = node.operator_loc.chop
+
write_class.new(
source,
*arguments,
@@ -82,8 +84,8 @@ module Prism
0,
read_class.new(source, *arguments, node.name_loc),
nil,
- node.operator_loc.slice.chomp("=").to_sym,
- node.operator_loc.copy(length: node.operator_loc.length - 1),
+ operator_loc.slice.to_sym,
+ operator_loc,
nil,
ArgumentsNode.new(source, 0, [node.value], node.value.location),
nil,