Bug #1676
closedonly last "return" is traced by set_trace_func
Description
=begin
複数ある return のうち最後ではないものでメソッドの処理が終わったとき
set_trace_func の "return" イベントが起こりません。
$ ruby -ve '
set_trace_func(proc{|*a|p a if a[0] == "call" || a[0] == "return"})
iseq = RubyVM::InstructionSequence.compile(<<EOS)
def foo(a)
return if a
return
end
foo(false)
foo(true)
EOS
iseq.eval
puts iseq.disasm
'
ruby 1.9.2dev (2009-06-21 trunk 23809) [i386-mingw32]
["call", "", 1, :foo, #Binding:0xb94d80, Object]
["return", "", 1, :foo, #Binding:0xb94a40, Object]
["call", "", 1, :foo, #Binding:0xb947a0, Object]
== disasm: <RubyVM::InstructionSequence:@>==========
0000 trace 1 ( 1)
0002 putspecialobject 1
0004 putspecialobject 2
0006 putobject :foo
0008 putiseq foo
0010 send :"core#define_method", 3, nil, 0,
0016 pop
0017 trace 1 ( 5)
0019 putnil
0020 putobject false
0022 send :foo, 1, nil, 8,
0028 pop
0029 trace 1 ( 6)
0031 putnil
0032 putobject true
0034 send :foo, 1, nil, 8,
0040 leave
== disasm: <RubyVM::InstructionSequence:foo@>=================
local table (size: 2, argc: 1 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] a
0000 trace 8 ( 1)
0002 trace 1 ( 2)
0004 getlocal a
0006 branchunless 12
0008 jump 10
0010 putnil
0011 leave
0012 putnil
0013 trace 16 ( 1)
0015 leave ( 2)
=end