mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Small refactor to DocFinder#visit
This commit is contained in:
parent
d55b93c866
commit
ca2c5a7273
1 changed files with 3 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
|||
require "compiler/crystal/syntax/*"
|
||||
|
||||
private class DocFinder < Crystal::Visitor
|
||||
getter type_name : String?
|
||||
getter type_name : String
|
||||
getter doc : String?
|
||||
|
||||
def initialize(nodes, @type_name)
|
||||
|
@ -11,11 +11,8 @@ private class DocFinder < Crystal::Visitor
|
|||
def visit(node : Crystal::ASTNode)
|
||||
return false if @doc
|
||||
|
||||
if node.responds_to?(:name) &&
|
||||
(name = node.name) &&
|
||||
name.is_a?(Crystal::Path) &&
|
||||
name.names.last? == @type_name
|
||||
@doc = node.doc
|
||||
if node.responds_to?(:name) && (name = node.name).is_a?(Crystal::Path)
|
||||
@doc = node.doc if name.names.last? == @type_name
|
||||
end
|
||||
|
||||
true
|
||||
|
|
Loading…
Reference in a new issue