Class: CodeTools::AST::Super

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

Direct Known Subclasses

ZSuper

Instance Attribute Summary collapse

Attributes inherited from SendWithArguments

#arguments

Attributes inherited from Send

#privately, #receiver, #variable, #vcall_style

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, #value_defined

Methods inherited from Node

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

Constructor Details

#initialize(line, arguments) ⇒ Super

Returns a new instance of Super.



938
939
940
941
942
943
# File 'lib/rubinius/code/ast/sends.rb', line 938

def initialize(line, arguments)
  @line = line
  @block = nil
  @name = nil
  @arguments = Arguments.new line, arguments
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



936
937
938
# File 'lib/rubinius/code/ast/sends.rb', line 936

def block
  @block
end

#nameObject

Returns the value of attribute name.



936
937
938
# File 'lib/rubinius/code/ast/sends.rb', line 936

def name
  @name
end

Instance Method Details

#block_bytecode(g) ⇒ Object



945
946
947
948
949
950
951
# File 'lib/rubinius/code/ast/sends.rb', line 945

def block_bytecode(g)
  if @block
    @block.bytecode(g)
  else
    g.push_block
  end
end

#bytecode(g) ⇒ Object



953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
# File 'lib/rubinius/code/ast/sends.rb', line 953

def bytecode(g)
  pos(g)

  @name = g.state.super.name if g.state.super?

  @arguments.bytecode(g)

  block_bytecode(g)

  if @arguments.splat?
    g.send_super @name, @arguments.size, true
  else
    g.send_super @name, @arguments.size
  end
end

#defined(g) ⇒ Object



969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
# File 'lib/rubinius/code/ast/sends.rb', line 969

def defined(g)
  nope = g.new_label
  done = g.new_label

  g.invoke_primitive :vm_check_super_callable, 0

  g.goto_if_false nope

  g.push_literal "super"
  g.string_dup
  g.goto done

  nope.set!
  g.push_nil

  done.set!
end

#to_sexpObject



987
988
989
# File 'lib/rubinius/code/ast/sends.rb', line 987

def to_sexp
  arguments_sexp :super
end