diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-23 06:22:48 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-23 06:22:48 +0000 |
commit | e6a8408c2cc1639e9ca448d90372d4854947346c (patch) | |
tree | 4383f15d23bc96dc0dd2fd4e5b529db2297617cc | |
parent | d3fc1d3e3a42d3105175eed71861cfa56b163ced (diff) |
* iseq.c (iseq_s_disasm): return nil for native methods.
[ruby-core:27226], [Bug#2499]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | eval_intern.h | 1 | ||||
-rw-r--r-- | include/ruby/intern.h | 1 | ||||
-rw-r--r-- | iseq.c | 2 | ||||
-rw-r--r-- | test/ruby/test_method.rb | 1 |
4 files changed, 3 insertions, 2 deletions
diff --git a/eval_intern.h b/eval_intern.h index b7790828dc..549953acfc 100644 --- a/eval_intern.h +++ b/eval_intern.h @@ -205,7 +205,6 @@ NORETURN(void rb_raise_method_missing(rb_thread_t *th, int argc, VALUE *argv, 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); diff --git a/include/ruby/intern.h b/include/ruby/intern.h index 91551079da..14e23b857d 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -303,6 +303,7 @@ VALUE rb_class_new_instance(int, VALUE*, VALUE); 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); @@ -1015,7 +1015,7 @@ iseq_s_disasm(VALUE klass, VALUE body) 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); diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index c60f7fa8a8..d5d6a0e68d 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -82,6 +82,7 @@ class TestMethod < Test::Unit::TestCase 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 |