Skip to content

Commit a391477

Browse files
committed
Fix comments for methods using desugar_or_write_defined_node
1 parent 4ebd956 commit a391477

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/yarp/desugar_visitor.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def visit_constant_and_write_node(node)
4242
#
4343
# becomes
4444
#
45-
# Foo || Foo = bar
45+
# defined?(Foo) ? Foo : Foo = bar
4646
def visit_constant_or_write_node(node)
4747
desugar_or_write_defined_node(node, ConstantReadNode, ConstantWriteNode)
4848
end
@@ -74,7 +74,7 @@ def visit_constant_path_and_write_node(node)
7474
#
7575
# becomes
7676
#
77-
# Foo::Bar || Foo::Bar = baz
77+
# defined?(Foo::Bar) ? Foo::Bar : Foo::Bar = baz
7878
def visit_constant_path_or_write_node(node)
7979
IfNode.new(
8080
node.operator_loc,
@@ -132,7 +132,7 @@ def visit_global_variable_and_write_node(node)
132132
#
133133
# becomes
134134
#
135-
# $foo || $foo = bar
135+
# defined?($foo) ? $foo : $foo = bar
136136
def visit_global_variable_or_write_node(node)
137137
desugar_or_write_defined_node(node, GlobalVariableReadNode, GlobalVariableWriteNode)
138138
end
@@ -244,7 +244,7 @@ def desugar_or_write_node(node, read_class, write_class, arguments: [])
244244
)
245245
end
246246

247-
# Don't desugar `x ||= y` to `defined?(x) ? x : x = y`
247+
# Desugar `x ||= y` to `defined?(x) ? x : x = y`
248248
def desugar_or_write_defined_node(node, read_class, write_class, arguments: [])
249249
IfNode.new(
250250
node.operator_loc,

0 commit comments

Comments
 (0)