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
 | 
					    # end
 | 
				
			||||||
    # ```
 | 
					    # ```
 | 
				
			||||||
    def spawn_block?
 | 
					    def spawn_block?
 | 
				
			||||||
      return false unless node.is_a?(Crystal::Block)
 | 
					      node.as?(Crystal::Block).try(&.call).try(&.name) == "spawn"
 | 
				
			||||||
 | 
					 | 
				
			||||||
      call = node.as(Crystal::Block).call
 | 
					 | 
				
			||||||
      call.try(&.name) == "spawn"
 | 
					 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Returns `true` if current scope sits inside a macro.
 | 
					    # 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,
 | 
					    # Returns `true` if current scope (or any of inner scopes) yields,
 | 
				
			||||||
    # `false` otherwise.
 | 
					    # `false` otherwise.
 | 
				
			||||||
    def yields?(check_inner_scopes = true)
 | 
					    def yields?(check_inner_scopes = true)
 | 
				
			||||||
      return true if @yields
 | 
					      @yields || (check_inner_scopes && inner_scopes.any?(&.yields?))
 | 
				
			||||||
      return inner_scopes.any?(&.yields?) if check_inner_scopes
 | 
					 | 
				
			||||||
      false
 | 
					 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Returns visibility of the current scope (could be inherited from the outer scope).
 | 
					    # 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?
 | 
					      @current_assign = node.value unless node.value.nil?
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # :nodoc:
 | 
				
			||||||
    def end_visit(node : Crystal::TypeDeclaration)
 | 
					    def end_visit(node : Crystal::TypeDeclaration)
 | 
				
			||||||
      return unless (var = node.var).is_a?(Crystal::Var)
 | 
					      return unless (var = node.var).is_a?(Crystal::Var)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue