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)
|
# visitor = Ameba::AST::NodeVisitor.new(rule, source)
|
||||||
# ```
|
# ```
|
||||||
class NodeVisitor < BaseVisitor
|
class NodeVisitor < BaseVisitor
|
||||||
|
@[Flags]
|
||||||
enum Category
|
enum Category
|
||||||
Macro
|
Macro
|
||||||
end
|
end
|
||||||
|
@ -43,14 +44,13 @@ module Ameba::AST
|
||||||
@skip : Array(Crystal::ASTNode.class)?
|
@skip : Array(Crystal::ASTNode.class)?
|
||||||
|
|
||||||
def self.category_to_node_classes(category : Category)
|
def self.category_to_node_classes(category : Category)
|
||||||
case category
|
([] of Crystal::ASTNode.class).tap do |classes|
|
||||||
in .macro?
|
classes.push(
|
||||||
[
|
|
||||||
Crystal::Macro,
|
Crystal::Macro,
|
||||||
Crystal::MacroExpression,
|
Crystal::MacroExpression,
|
||||||
Crystal::MacroIf,
|
Crystal::MacroIf,
|
||||||
Crystal::MacroFor,
|
Crystal::MacroFor,
|
||||||
]
|
) if category.macro?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue