Use tuple instead of an array

This commit is contained in:
Sijawusz Pur Rahnama 2022-11-23 03:23:42 +01:00
parent 8b43a40a65
commit 2c67fe2c3f
3 changed files with 6 additions and 6 deletions

View file

@ -241,7 +241,7 @@ module Ameba
end
class TestNodeVisitor < Crystal::Visitor
NODES = [
NODES = {
Crystal::NilLiteral,
Crystal::Var,
Crystal::Assign,
@ -255,7 +255,7 @@ module Ameba
Crystal::MacroLiteral,
Crystal::Expressions,
Crystal::ControlExpression,
]
}
def initialize(node)
node.accept self

View file

@ -2,7 +2,7 @@ require "./base_visitor"
module Ameba::AST
# List of nodes to be visited by Ameba's rules.
NODES = [
NODES = {
Alias,
IsA,
Assign,
@ -27,7 +27,7 @@ module Ameba::AST
When,
While,
Until,
]
}
# An AST Visitor that traverses the source and allows all nodes
# to be inspected by rules.

View file

@ -4,7 +4,7 @@ module Ameba::AST
# AST Visitor that traverses the source and constructs scopes.
class ScopeVisitor < BaseVisitor
# Non-exhaustive list of nodes to be visited by Ameba's rules.
NODES = [
NODES = {
ClassDef,
ModuleDef,
EnumDef,
@ -17,7 +17,7 @@ module Ameba::AST
Block,
Macro,
MacroFor,
]
}
SUPER_NODE_NAME = "super"
RECORD_NODE_NAME = "record"