mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Merge pull request #407 from crystal-ameba/crystal-next-compatibility
fix: crystal next compatibility
This commit is contained in:
commit
c9538220c6
3 changed files with 4 additions and 26 deletions
|
@ -85,30 +85,5 @@ module Ameba::AST
|
|||
assignment.branch.should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "#transformed?" do
|
||||
it "returns false if the assignment is not transformed by the compiler" do
|
||||
nodes = as_nodes <<-CRYSTAL
|
||||
def method(a)
|
||||
a = 2
|
||||
end
|
||||
CRYSTAL
|
||||
scope = Scope.new nodes.def_nodes.first
|
||||
variable = Variable.new(nodes.var_nodes.first, scope)
|
||||
assignment = Assignment.new(nodes.assign_nodes.first, variable, scope)
|
||||
assignment.transformed?.should be_false
|
||||
end
|
||||
|
||||
it "returns true if the assignment is transformed by the compiler" do
|
||||
nodes = as_nodes <<-CRYSTAL
|
||||
array.each do |(a, b)|
|
||||
end
|
||||
CRYSTAL
|
||||
scope = Scope.new nodes.block_nodes.first
|
||||
variable = Variable.new(nodes.var_nodes.first, scope)
|
||||
assignment = Assignment.new(nodes.assign_nodes.first, variable, scope)
|
||||
assignment.transformed?.should be_true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -233,7 +233,7 @@ module Ameba::Rule::Lint
|
|||
subject.catch(s).should be_valid
|
||||
end
|
||||
|
||||
context "when transformed" do
|
||||
context "block unpacking" do
|
||||
it "does not report if the first arg is transformed and not used" do
|
||||
s = Source.new %(
|
||||
collection.each do |(a, b)|
|
||||
|
|
|
@ -76,6 +76,9 @@ module Ameba::AST
|
|||
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.
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue