[前][次][番号順一覧][スレッド一覧]

ruby-changes:2957

From: ko1@a...
Date: 22 Dec 2007 10:21:26 +0900
Subject: [ruby-changes:2957] matz - Ruby:r14448 (trunk): * eval.c (rb_f_method_name): now __method__ and __callee__ are

matz	2007-12-22 10:20:57 +0900 (Sat, 22 Dec 2007)

  New Revision: 14448

  Modified files:
    trunk/ChangeLog
    trunk/eval.c

  Log:
    * eval.c (rb_f_method_name): now __method__ and __callee__ are
      aliases.  [ruby-core:14244]

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14448&r2=14447
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/eval.c?r1=14448&r2=14447

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14447)
+++ ChangeLog	(revision 14448)
@@ -1,3 +1,8 @@
+Sat Dec 22 10:19:08 2007  Yukihiro Matsumoto  <matz@r...>
+
+	* 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@r...>
 
 	* string.c (rb_str_buf_append): improvement for non-broken coded
Index: eval.c
===================================================================
--- eval.c	(revision 14447)
+++ eval.c	(revision 14448)
@@ -2660,12 +2660,10 @@
 /*
  *  call-seq:
  *     __method__         => symbol
+ *     __callee__         => 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>.
- *  See also <code>\_\_callee__</code>.
  *
  */
 
@@ -2682,32 +2680,6 @@
     }
 }
 
-/*
- *  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
 Init_eval(void)
 {
@@ -2756,7 +2728,7 @@
     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("__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_mKernel, "send", rb_f_send, -1);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]