mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
* AST::Visitor -> AST::NodeVisitor * Scope & ScopeVisitor * Useless assignment rule * Instance vars and useless assignments * Multiple assigns one by one * Support outer scope * Variable used in the useless assignment * Support OpAssign & MultiAssign * Captured by block * Variable, Assignment, Reference & Refactoring * Variable has references, Assignment can be referenced * Branch entity * Handle useless assignments in branches * Handle assignments in a loop * Handle branch equality * Handle special var `$?` assignment * Improve captured by block stuff * Avoid assignments in property definitions (UselessAssign rule reports an warning) * Support MacroIf and MacroFor branches * Handle assignments with shadowed vars in inner scopes * Add method arguments as scope variables * Handle case if branch is blank * Top level scope * Handle case when branch is nop?
11 lines
253 B
Crystal
11 lines
253 B
Crystal
require "../../../spec_helper"
|
|
|
|
module Ameba::AST
|
|
describe Reference do
|
|
it "is derived from a Variable" do
|
|
node = Crystal::Var.new "foo"
|
|
Reference.new(node, Scope.new as_node "foo = 1").is_a?(Variable).should be_true
|
|
end
|
|
end
|
|
end
|