summaryrefslogtreecommitdiff
path: root/lib/yarp
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2023-08-30 21:29:11 +0200
committergit <svn-admin@ruby-lang.org>2023-09-01 13:18:29 +0000
commit7fb56df726d4e661fdec10266a54cf27e52d9892 (patch)
treea73bfd316546c9ab68bfd6f005f11e19112431e6 /lib/yarp
parent2efd59e2eb4ebf68f85ab6f07b1a4aea0584248a (diff)
[ruby/yarp] Fix comments for methods using desugar_or_write_defined_node
https://github.com/ruby/yarp/commit/a39147736e
Diffstat (limited to 'lib/yarp')
-rw-r--r--lib/yarp/desugar_visitor.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/yarp/desugar_visitor.rb b/lib/yarp/desugar_visitor.rb
index d0c0494e0c..426ecf541f 100644
--- a/lib/yarp/desugar_visitor.rb
+++ b/lib/yarp/desugar_visitor.rb
@@ -42,7 +42,7 @@ module YARP
#
# becomes
#
- # Foo || Foo = bar
+ # defined?(Foo) ? Foo : Foo = bar
def visit_constant_or_write_node(node)
desugar_or_write_defined_node(node, ConstantReadNode, ConstantWriteNode)
end
@@ -74,7 +74,7 @@ module YARP
#
# becomes
#
- # Foo::Bar || Foo::Bar = baz
+ # defined?(Foo::Bar) ? Foo::Bar : Foo::Bar = baz
def visit_constant_path_or_write_node(node)
IfNode.new(
node.operator_loc,
@@ -132,7 +132,7 @@ module YARP
#
# becomes
#
- # $foo || $foo = bar
+ # defined?($foo) ? $foo : $foo = bar
def visit_global_variable_or_write_node(node)
desugar_or_write_defined_node(node, GlobalVariableReadNode, GlobalVariableWriteNode)
end
@@ -244,7 +244,7 @@ module YARP
)
end
- # Don't desugar `x ||= y` to `defined?(x) ? x : x = y`
+ # Desugar `x ||= y` to `defined?(x) ? x : x = y`
def desugar_or_write_defined_node(node, read_class, write_class, arguments: [])
IfNode.new(
node.operator_loc,