mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
parent
cd18c6a000
commit
a64f48b543
2 changed files with 20 additions and 0 deletions
|
@ -236,6 +236,21 @@ module Ameba::Rule::Lint
|
|||
)
|
||||
subject.catch(source).should be_valid
|
||||
end
|
||||
|
||||
it "does not report scoped vars to MacroFor" do
|
||||
source = Source.new %(
|
||||
struct Test
|
||||
def test
|
||||
{% for ivar in @type.instance_vars %}
|
||||
{% var_type = ivar %}
|
||||
{% end %}
|
||||
|
||||
{% ["a", "b"].map { |ivar| puts ivar } %}
|
||||
end
|
||||
end
|
||||
)
|
||||
subject.catch(source).should be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -97,6 +97,11 @@ module Ameba::AST
|
|||
on_scope_enter(node)
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
def visit(node : Crystal::MacroFor)
|
||||
on_scope_enter(node)
|
||||
end
|
||||
|
||||
@current_assign : Crystal::ASTNode?
|
||||
|
||||
# :nodoc:
|
||||
|
|
Loading…
Reference in a new issue