* eval.c (frame_func_id): return proper method ID.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-08-17 16:12:03 +00:00
parent 2c5463fe99
commit 69dd06ae68
4 changed files with 28 additions and 8 deletions

View File

@ -1,3 +1,7 @@
Sat Aug 18 01:12:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (frame_func_id): return proper method ID.
Fri Aug 17 22:43:11 2007 Koichi Sasada <ko1@atdot.net> Fri Aug 17 22:43:11 2007 Koichi Sasada <ko1@atdot.net>
* compile.c (iseq_compile_each): massign should return rvalue(s). * compile.c (iseq_compile_each): massign should return rvalue(s).

17
eval.c
View File

@ -1612,12 +1612,19 @@ frame_func_id(rb_control_frame_t *cfp)
if (!iseq) { if (!iseq) {
return cfp->method_id; return cfp->method_id;
} }
else if (RUBY_VM_IFUNC_P(iseq)) { while (iseq) {
return rb_intern("<ifunc>"); if (RUBY_VM_IFUNC_P(iseq)) {
} return rb_intern("<ifunc>");
else { }
return rb_intern(RSTRING_PTR(iseq->name)); if (iseq->defined_method_id) {
return iseq->defined_method_id;
}
if (iseq->local_iseq == iseq) {
break;
}
iseq = iseq->parent_iseq;
} }
return 0;
} }
ID ID

View File

@ -43,4 +43,13 @@ class TestMethod < Test::Unit::TestCase
um.bind(Base.new) um.bind(Base.new)
end end
end end
def test_callee
assert_equal(:test_callee, __method__)
assert_equal(:m, Class.new {def m; __method__; end}.new.m)
assert_equal(:m, Class.new {def m; tap{return __method__}; end}.new.m)
assert_equal(:m, Class.new {define_method(:m) {__method__}}.new.m)
assert_equal(:m, Class.new {define_method(:m) {tap{return __method__}}}.new.m)
assert_nil(eval("class TestCallee; __method__; end"))
end
end end

View File

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0" #define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-08-17" #define RUBY_RELEASE_DATE "2007-08-18"
#define RUBY_VERSION_CODE 190 #define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20070817 #define RUBY_RELEASE_CODE 20070818
#define RUBY_PATCHLEVEL 0 #define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0 #define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 8 #define RUBY_RELEASE_MONTH 8
#define RUBY_RELEASE_DAY 17 #define RUBY_RELEASE_DAY 18
#ifdef RUBY_EXTERN #ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[]; RUBY_EXTERN const char ruby_version[];