mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Incorrectly reporting shadowingOuterLocalVar within macro included
closes #161
This commit is contained in:
parent
7f501a1df5
commit
d650ca5477
4 changed files with 41 additions and 7 deletions
|
@ -114,19 +114,30 @@ module Ameba::AST
|
|||
end
|
||||
end
|
||||
|
||||
describe "#macro?" do
|
||||
describe "#in_macro?" do
|
||||
it "returns true if Crystal::Macro" do
|
||||
nodes = as_nodes %(
|
||||
macro included
|
||||
end
|
||||
)
|
||||
scope = Scope.new nodes.macro_nodes.first
|
||||
scope.macro?.should be_true
|
||||
scope.in_macro?.should be_true
|
||||
end
|
||||
|
||||
it "returns true if node is nested to Crystal::Macro" do
|
||||
nodes = as_nodes %(
|
||||
macro included
|
||||
{{@type.each do |type| a = type end}}
|
||||
end
|
||||
)
|
||||
outer_scope = Scope.new nodes.macro_nodes.first
|
||||
scope = Scope.new nodes.block_nodes.first, outer_scope
|
||||
scope.in_macro?.should be_true
|
||||
end
|
||||
|
||||
it "returns false otherwise" do
|
||||
scope = Scope.new as_node "a = 1"
|
||||
scope.macro?.should be_false
|
||||
scope.in_macro?.should be_false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue