Fix bug in AST::Scope#in_macro? not taking account for Crystal::MacroFor

This commit is contained in:
Sijawusz Pur Rahnama 2022-04-04 02:04:04 +02:00
parent 71de3f0012
commit e6ad7c5d24

View file

@ -112,7 +112,8 @@ module Ameba::AST
# Returns `true` if current scope sits inside a macro.
def in_macro?
node.is_a?(Crystal::Macro) || !!outer_scope.try(&.in_macro?)
(node.is_a?(Crystal::Macro) || node.is_a?(Crystal::MacroFor)) ||
!!outer_scope.try(&.in_macro?)
end
# Returns `true` if instance variable is assinged in this scope.