mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Make AST::NodeVisitor::Category
a flag enum
This commit is contained in:
parent
38b6751bc0
commit
c09b36799a
1 changed files with 4 additions and 4 deletions
|
@ -8,6 +8,7 @@ module Ameba::AST
|
|||
# visitor = Ameba::AST::NodeVisitor.new(rule, source)
|
||||
# ```
|
||||
class NodeVisitor < BaseVisitor
|
||||
@[Flags]
|
||||
enum Category
|
||||
Macro
|
||||
end
|
||||
|
@ -43,14 +44,13 @@ module Ameba::AST
|
|||
@skip : Array(Crystal::ASTNode.class)?
|
||||
|
||||
def self.category_to_node_classes(category : Category)
|
||||
case category
|
||||
in .macro?
|
||||
[
|
||||
([] of Crystal::ASTNode.class).tap do |classes|
|
||||
classes.push(
|
||||
Crystal::Macro,
|
||||
Crystal::MacroExpression,
|
||||
Crystal::MacroIf,
|
||||
Crystal::MacroFor,
|
||||
]
|
||||
) if category.macro?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue