A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://ruby-syntax-tree.github.io/syntax_tree/SyntaxTree/LambdaVar.html below:

class SyntaxTree::LambdaVar - RDoc Documentation

  1. SyntaxTree::
  2. LambdaVar
class SyntaxTree::LambdaVar

LambdaVar represents the parameters being declared for a lambda. Effectively this node is everything contained within the parentheses. This includes all of the various parameter types, as well as block-local variable declarations.

-> (positional, optional = value, keyword:, █ local) do
end
Attributes
Array[ Ident ]

the list of block-local variable declarations

Params

the parameters being declared with the block

Public Class Methods

Source

def initialize(params:, locals:, location:)
  @params = params
  @locals = locals
  @location = location
  @comments = []
end
Public Instance Methods

Source

def ===(other)
  other.is_a?(LambdaVar) && params === other.params &&
    ArrayMatch.call(locals, other.locals)
end

Source

def accept(visitor)
  visitor.visit_lambda_var(self)
end

Source

def child_nodes
  [params, *locals]
end

Source

def copy(params: nil, locals: nil, location: nil)
  node =
    LambdaVar.new(
      params: params || self.params,
      locals: locals || self.locals,
      location: location || self.location
    )

  node.comments.concat(comments.map(&:copy))
  node
end

Source

def deconstruct_keys(_keys)
  { params: params, locals: locals, location: location, comments: comments }
end

Source

def empty?
  params.empty? && locals.empty?
end

Source

def format(q)
  q.format(params)

  if locals.any?
    q.text("; ")
    q.seplist(locals, BlockVar::SEPARATOR) { |local| q.format(local) }
  end
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4