Remove deprecated Assignment#transformed? method

This commit is contained in:
Sijawusz Pur Rahnama 2023-11-14 03:32:17 +01:00
parent b3f11913ed
commit 52ccf23ef9
2 changed files with 1 additions and 30 deletions

View file

@ -75,34 +75,5 @@ module Ameba::AST
node
end
end
# TODO: Remove in a next release. BC for crystal <= 1.9.
# refs https://github.com/crystal-ameba/ameba/pull/407
#
# Indicates whether the node is a transformed assignment by the compiler.
# i.e.
#
# ```
# collection.each do |(a, b)|
# puts b
# end
# ```
#
# is transformed to:
#
# ```
# collection.each do |__arg0|
# a = __arg0[0]
# b = __arg0[1]
# puts(b)
# end
# ```
def transformed?
return false unless (assign = node).is_a?(Crystal::Assign)
return false unless (value = assign.value).is_a?(Crystal::Call)
return false unless (obj = value.obj).is_a?(Crystal::Var)
obj.name.starts_with? "__arg"
end
end
end

View file

@ -42,7 +42,7 @@ module Ameba::Rule::Lint
next if scope.assigns_type_dec?(var.name)
var.assignments.each do |assign|
next if assign.referenced? || assign.transformed?
next if assign.referenced?
issue_for assign.target_node, MSG % var.name
end
end