mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Several small refactors
This commit is contained in:
parent
4d8346509e
commit
7caa47fb6a
2 changed files with 3 additions and 7 deletions
|
@ -124,10 +124,7 @@ module Ameba::AST
|
|||
# end
|
||||
# ```
|
||||
def spawn_block?
|
||||
return false unless node.is_a?(Crystal::Block)
|
||||
|
||||
call = node.as(Crystal::Block).call
|
||||
call.try(&.name) == "spawn"
|
||||
node.as?(Crystal::Block).try(&.call).try(&.name) == "spawn"
|
||||
end
|
||||
|
||||
# Returns `true` if current scope sits inside a macro.
|
||||
|
@ -170,9 +167,7 @@ module Ameba::AST
|
|||
# Returns `true` if current scope (or any of inner scopes) yields,
|
||||
# `false` otherwise.
|
||||
def yields?(check_inner_scopes = true)
|
||||
return true if @yields
|
||||
return inner_scopes.any?(&.yields?) if check_inner_scopes
|
||||
false
|
||||
@yields || (check_inner_scopes && inner_scopes.any?(&.yields?))
|
||||
end
|
||||
|
||||
# Returns visibility of the current scope (could be inherited from the outer scope).
|
||||
|
|
|
@ -122,6 +122,7 @@ module Ameba::AST
|
|||
@current_assign = node.value unless node.value.nil?
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
def end_visit(node : Crystal::TypeDeclaration)
|
||||
return unless (var = node.var).is_a?(Crystal::Var)
|
||||
|
||||
|
|
Loading…
Reference in a new issue