Skip to content

Commit

Permalink
Make AST::NodeVisitor::Category a flag enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Sija committed Jun 12, 2023
1 parent 40c1419 commit 204ef65
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ameba/ast/visitors/node_visitor.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Ameba::AST
# visitor = Ameba::AST::NodeVisitor.new(rule, source)
# ```
class NodeVisitor < BaseVisitor
@[Flags]
enum Category
Macro
end
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 204ef65

Please sign in to comment.