code


			
class F
  def f
    puts 'f'
  end
end

class G < F
  def f
    super()
  end
end

G.new.f

describe


			
euler:rubinius brian$ bin/rbx describe super.rb  
Sexp:
[:block,
 [:newline,
  1,
  "super.rb",
  [:class,
   [:colon2, :F],
   nil,
   [:scope,
    [:newline,
     2,
     "super.rb",
     [:defn,
      :f,
      [:scope,
       [:block,
        [:args],
        [:newline, 3, "super.rb", [:fcall, :puts, [:array, [:str, "f"]]]]],
       []]]],
    []]]],
 [:newline,
  7,
  "super.rb",
  [:class,
   [:colon2, :G],
   [:const, :F],
   [:scope,
    [:newline,
     8,
     "super.rb",
     [:defn,
      :f,
      [:scope, [:block, [:args], [:newline, 9, "super.rb", [:super]]], []]]],
    []]]],
 [:newline, 13, "super.rb", [:call, [:call, [:const, :G], :new], :f]]]

Bytecode:
0000:  push_nil                   
0001:  open_class                 :F
0003:  dup_top                    
0004:  push_literal               #
0006:  swap_stack                 
0007:  attach_method              :__class_init__
0009:  pop                        
0010:  send_method                #
0012:  push_encloser              
0013:  pop                        
0014:  push_const                 :F
0016:  open_class                 :G
0018:  dup_top                    
0019:  push_literal               #
0021:  swap_stack                 
0022:  attach_method              :__class_init__
0024:  pop                        
0025:  send_method                #
0027:  push_encloser              
0028:  pop                        
0029:  push_const                 :G
0031:  send_method                #
0033:  send_method                #
0035:  pop                        
0036:  push_true                  
0037:  sret                       
= F (0x191) ======================
0000:  push_self                  
0001:  push_cpath_top             
0002:  find_const                 :Module
0004:  push_self                  
0005:  kind_of                    
0006:  goto_if_true               10
0008:  send_method                #
0010:  set_encloser               
0011:  push_literal               #
0013:  push_literal               :f
0015:  push_context               
0016:  send_stack                 #, 2
0019:  sret                       
= G (0x1f1) ======================
0000:  push_self                  
0001:  push_cpath_top             
0002:  find_const                 :Module
0004:  push_self                  
0005:  kind_of                    
0006:  goto_if_true               10
0008:  send_method                #
0010:  set_encloser               
0011:  push_literal               #
0013:  push_literal               :f
0015:  push_context               
0016:  send_stack                 #, 2
0019:  sret                       
= f (0x2d1) ======================
0000:  check_argcount             0, 0
0003:  push_literal               "f"
0005:  string_dup                 
0006:  push_self                  
0007:  set_call_flags             1
0009:  send_stack                 #, 1
0012:  sret                       
= f (0x361) ======================
0000:  check_argcount             0, 0
0003:  push_block                 
0004:  send_super_stack_with_block#, 0
0007:  sret