mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Fix newly found issue
This commit is contained in:
parent
1524aad299
commit
f45d6a2ef0
1 changed files with 4 additions and 5 deletions
|
@ -122,11 +122,10 @@ module Ameba::AST
|
||||||
# `false` if not.
|
# `false` if not.
|
||||||
def used_in_macro?(scope = @scope)
|
def used_in_macro?(scope = @scope)
|
||||||
scope.inner_scopes.each do |inner_scope|
|
scope.inner_scopes.each do |inner_scope|
|
||||||
return true if MacroReferenceFinder.new(inner_scope.node, node.name).references
|
return true if MacroReferenceFinder.new(inner_scope.node, node.name).references?
|
||||||
end
|
end
|
||||||
return true if MacroReferenceFinder.new(scope.node, node.name).references
|
return true if MacroReferenceFinder.new(scope.node, node.name).references?
|
||||||
return true if (outer_scope = scope.outer_scope) &&
|
return true if (outer_scope = scope.outer_scope) && used_in_macro?(outer_scope)
|
||||||
used_in_macro?(outer_scope)
|
|
||||||
|
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
@ -169,7 +168,7 @@ module Ameba::AST
|
||||||
end
|
end
|
||||||
|
|
||||||
private class MacroReferenceFinder < Crystal::Visitor
|
private class MacroReferenceFinder < Crystal::Visitor
|
||||||
property references = false
|
property? references = false
|
||||||
|
|
||||||
def initialize(node, @reference : String = reference)
|
def initialize(node, @reference : String = reference)
|
||||||
node.accept self
|
node.accept self
|
||||||
|
|
Loading…
Reference in a new issue