From 7fb56df726d4e661fdec10266a54cf27e52d9892 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Wed, 30 Aug 2023 21:29:11 +0200 Subject: [ruby/yarp] Fix comments for methods using desugar_or_write_defined_node https://github.com/ruby/yarp/commit/a39147736e --- lib/yarp/desugar_visitor.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') 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, -- cgit v1.2.3