From 2c67fe2c3f9d215e0a70c60297c48ffa22e319d8 Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Wed, 23 Nov 2022 03:23:42 +0100 Subject: [PATCH] Use tuple instead of an array --- spec/spec_helper.cr | 4 ++-- src/ameba/ast/visitors/node_visitor.cr | 4 ++-- src/ameba/ast/visitors/scope_visitor.cr | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr index 32855f95..86e992c4 100644 --- a/spec/spec_helper.cr +++ b/spec/spec_helper.cr @@ -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 diff --git a/src/ameba/ast/visitors/node_visitor.cr b/src/ameba/ast/visitors/node_visitor.cr index 4dca9f7f..4e6e3618 100644 --- a/src/ameba/ast/visitors/node_visitor.cr +++ b/src/ameba/ast/visitors/node_visitor.cr @@ -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. diff --git a/src/ameba/ast/visitors/scope_visitor.cr b/src/ameba/ast/visitors/scope_visitor.cr index 5abf4056..be369b2c 100644 --- a/src/ameba/ast/visitors/scope_visitor.cr +++ b/src/ameba/ast/visitors/scope_visitor.cr @@ -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"