* eval.c (rb_f_method_name): now __method__ and __callee__ are
aliases. [ruby-core:14244] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7f59e105d1
commit
d65ae590d0
@ -1,3 +1,8 @@
|
|||||||
|
Sat Dec 22 10:19:08 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_f_method_name): now __method__ and __callee__ are
|
||||||
|
aliases. [ruby-core:14244]
|
||||||
|
|
||||||
Sat Dec 22 08:29:56 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sat Dec 22 08:29:56 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (rb_str_buf_append): improvement for non-broken coded
|
* string.c (rb_str_buf_append): improvement for non-broken coded
|
||||||
|
32
eval.c
32
eval.c
@ -2660,12 +2660,10 @@ rb_f_local_variables(void)
|
|||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* __method__ => symbol
|
* __method__ => symbol
|
||||||
|
* __callee__ => symbol
|
||||||
*
|
*
|
||||||
* Returns the name of the current method as a Symbol.
|
* Returns the name of the current method as a Symbol.
|
||||||
* If called from inside of an aliased method it will return the original
|
|
||||||
* nonaliased name.
|
|
||||||
* If called outside of a method, it returns <code>nil</code>.
|
* If called outside of a method, it returns <code>nil</code>.
|
||||||
* See also <code>\_\_callee__</code>.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -2682,32 +2680,6 @@ rb_f_method_name(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* call-seq:
|
|
||||||
* __callee__ => symbol
|
|
||||||
*
|
|
||||||
* Returns the name of the current method as Symbol.
|
|
||||||
* If called from inside of an aliased method it will return the aliased
|
|
||||||
* name.
|
|
||||||
* If called outside of a method, it returns <code>nil</code>.
|
|
||||||
* See also <code>\_\_method__</code>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
static VALUE
|
|
||||||
rb_f_callee_name(void)
|
|
||||||
{
|
|
||||||
/* xxx need to get callee name */
|
|
||||||
ID callee = rb_frame_callee();
|
|
||||||
|
|
||||||
if (callee) {
|
|
||||||
return ID2SYM(callee);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Init_eval(void)
|
Init_eval(void)
|
||||||
{
|
{
|
||||||
@ -2756,7 +2728,7 @@ Init_eval(void)
|
|||||||
rb_define_global_function("local_variables", rb_f_local_variables, 0);
|
rb_define_global_function("local_variables", rb_f_local_variables, 0);
|
||||||
|
|
||||||
rb_define_global_function("__method__", rb_f_method_name, 0);
|
rb_define_global_function("__method__", rb_f_method_name, 0);
|
||||||
rb_define_global_function("__callee__", rb_f_callee_name, 0);
|
rb_define_global_function("__callee__", rb_f_method_name, 0);
|
||||||
|
|
||||||
rb_define_method(rb_cBasicObject, "__send__", rb_f_send, -1);
|
rb_define_method(rb_cBasicObject, "__send__", rb_f_send, -1);
|
||||||
rb_define_method(rb_mKernel, "send", rb_f_send, -1);
|
rb_define_method(rb_mKernel, "send", rb_f_send, -1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user