mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Move NODES
constant into its proper namespace
This commit is contained in:
parent
6e5a9a60b3
commit
85c3db4d74
1 changed files with 28 additions and 28 deletions
|
@ -1,34 +1,6 @@
|
|||
require "./base_visitor"
|
||||
|
||||
module Ameba::AST
|
||||
# List of nodes to be visited by Ameba's rules.
|
||||
NODES = {
|
||||
Alias,
|
||||
IsA,
|
||||
Assign,
|
||||
Call,
|
||||
Block,
|
||||
Case,
|
||||
ClassDef,
|
||||
ClassVar,
|
||||
Def,
|
||||
EnumDef,
|
||||
ExceptionHandler,
|
||||
Expressions,
|
||||
HashLiteral,
|
||||
If,
|
||||
InstanceVar,
|
||||
LibDef,
|
||||
ModuleDef,
|
||||
NilLiteral,
|
||||
StringInterpolation,
|
||||
Unless,
|
||||
Var,
|
||||
When,
|
||||
While,
|
||||
Until,
|
||||
}
|
||||
|
||||
# An AST Visitor that traverses the source and allows all nodes
|
||||
# to be inspected by rules.
|
||||
#
|
||||
|
@ -36,6 +8,34 @@ module Ameba::AST
|
|||
# visitor = Ameba::AST::NodeVisitor.new(rule, source)
|
||||
# ```
|
||||
class NodeVisitor < BaseVisitor
|
||||
# List of nodes to be visited by Ameba's rules.
|
||||
NODES = {
|
||||
Alias,
|
||||
IsA,
|
||||
Assign,
|
||||
Call,
|
||||
Block,
|
||||
Case,
|
||||
ClassDef,
|
||||
ClassVar,
|
||||
Def,
|
||||
EnumDef,
|
||||
ExceptionHandler,
|
||||
Expressions,
|
||||
HashLiteral,
|
||||
If,
|
||||
InstanceVar,
|
||||
LibDef,
|
||||
ModuleDef,
|
||||
NilLiteral,
|
||||
StringInterpolation,
|
||||
Unless,
|
||||
Var,
|
||||
When,
|
||||
While,
|
||||
Until,
|
||||
}
|
||||
|
||||
@skip : Array(Crystal::ASTNode.class)?
|
||||
|
||||
def initialize(@rule, @source, skip = nil)
|
||||
|
|
Loading…
Reference in a new issue