From e6ad7c5d2465593d8fcfcaf2b6dea1981372d552 Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Mon, 4 Apr 2022 02:04:04 +0200 Subject: [PATCH] Fix bug in `AST::Scope#in_macro?` not taking account for `Crystal::MacroFor` --- src/ameba/ast/scope.cr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ameba/ast/scope.cr b/src/ameba/ast/scope.cr index 87815687..bcae082c 100644 --- a/src/ameba/ast/scope.cr +++ b/src/ameba/ast/scope.cr @@ -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.