ruby-changes:14330
From: nobu <ko1@a...>
Date: Wed, 23 Dec 2009 15:34:40 +0900 (JST)
Subject: [ruby-changes:14330] Ruby:r26158 (trunk): * iseq.c (iseq_s_disasm): return nil for native methods.
nobu 2009-12-23 15:22:48 +0900 (Wed, 23 Dec 2009) New Revision: 26158 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26158 Log: * iseq.c (iseq_s_disasm): return nil for native methods. [ruby-core:27226], [Bug#2499] Modified files: trunk/eval_intern.h trunk/include/ruby/intern.h trunk/iseq.c trunk/test/ruby/test_method.rb Index: eval_intern.h =================================================================== --- eval_intern.h (revision 26157) +++ eval_intern.h (revision 26158) @@ -205,7 +205,6 @@ VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val); NODE *rb_vm_cref(void); -VALUE rb_obj_is_proc(VALUE); VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_block_t *blockptr, VALUE filename); void rb_vm_set_progname(VALUE filename); void rb_thread_terminate_all(void); Index: include/ruby/intern.h =================================================================== --- include/ruby/intern.h (revision 26157) +++ include/ruby/intern.h (revision 26158) @@ -303,6 +303,7 @@ VALUE rb_block_proc(void); VALUE rb_f_lambda(void); VALUE rb_proc_new(VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg] */), VALUE); +VALUE rb_obj_is_proc(VALUE); VALUE rb_proc_call(VALUE, VALUE); VALUE rb_proc_call_with_block(VALUE, int argc, VALUE *argv, VALUE); int rb_proc_arity(VALUE); Index: iseq.c =================================================================== --- iseq.c (revision 26157) +++ iseq.c (revision 26158) @@ -1015,7 +1015,7 @@ if ((iseq = rb_method_get_iseq(body)) != 0) { ret = rb_iseq_disasm(iseq->self); } - else { + else if (rb_obj_is_proc(body)) { rb_proc_t *proc; VALUE iseqval; GetProcPtr(body, proc); Index: test/ruby/test_method.rb =================================================================== --- test/ruby/test_method.rb (revision 26157) +++ test/ruby/test_method.rb (revision 26158) @@ -82,6 +82,7 @@ o = Object.new def o.foo; end assert_nothing_raised { RubyVM::InstructionSequence.disasm(o.method(:foo)) } + assert_nothing_raised { RubyVM::InstructionSequence.disasm("x".method(:upcase)) } end def test_new -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/