Class: Rubinius::AST::Yield

Inherits:
SendWithArguments show all
Defined in:
lib/compiler/ast/sends.rb

Instance Attribute Summary collapse

Attributes inherited from SendWithArguments

#arguments

Attributes inherited from Send

#block, #check_for_local, #name, #privately, #receiver, #variable

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from SendWithArguments

#arguments_sexp

Methods inherited from Send

#arguments_sexp, #check_local_reference, #receiver_sexp, #sexp_name

Methods inherited from Node

#ascii_graph, #attributes, #children, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, node_name, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #visit, #walk

Constructor Details

#initialize(line, arguments, unwrap) ⇒ Yield

Returns a new instance of Yield.



578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
# File 'lib/compiler/ast/sends.rb', line 578

def initialize(line, arguments, unwrap)
  @line = line

  if arguments.kind_of? ArrayLiteral and not unwrap
    arguments = ArrayLiteral.new line, [arguments]
  end

  @arguments = ActualArguments.new line, arguments
  @argument_count = @arguments.size
  @yield_splat = false

  if @arguments.splat?
    splat = @arguments.splat.value
    if (splat.kind_of? ArrayLiteral or splat.kind_of? EmptyArray) and not unwrap
      @argument_count += 1
    else
      @yield_splat = true
    end
  end
end

Instance Attribute Details

#flagsObject

Returns the value of attribute flags.



576
577
578
# File 'lib/compiler/ast/sends.rb', line 576

def flags
  @flags
end

Instance Method Details

#to_sexpObject



599
600
601
# File 'lib/compiler/ast/sends.rb', line 599

def to_sexp
  arguments_sexp :yield
end