Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/synvert/core/node_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,7 @@ def debug_info
#
# @return [String] source code.
def to_source
if self.loc.expression
self.loc.expression.source
end
self.loc.expression&.source
end

# Get the indent of current node.
Expand Down
2 changes: 1 addition & 1 deletion lib/synvert/core/rewriter/condition/if_exist_condition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Rewriter::IfExistCondition < Rewriter::Condition
def match?
match = false
@instance.current_node.recursive_children do |child_node|
match = match || (child_node && child_node.match?(@rules))
match = match || (child_node&.match?(@rules))
end
match
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Rewriter::UnlessExistCondition < Rewriter::Condition
def match?
match = false
@instance.current_node.recursive_children do |child_node|
match = match || (child_node && child_node.match?(@rules))
match = match || (child_node&.match?(@rules))
end
!match
end
Expand Down