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

ruby-changes:11010

From: knu <ko1@a...>
Date: Wed, 25 Feb 2009 00:03:46 +0900 (JST)
Subject: [ruby-changes:11010] Ruby:r22599 (trunk): * array.c (rb_ary_index, rb_ary_rindex): Emit a warning that a

knu	2009-02-25 00:02:01 +0900 (Wed, 25 Feb 2009)

  New Revision: 22599

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22599

  Log:
    * array.c (rb_ary_index, rb_ary_rindex): Emit a warning that a
      given block is unused when an argument is specified.

  Modified files:
    trunk/ChangeLog
    trunk/array.c

Index: array.c
===================================================================
--- array.c	(revision 22598)
+++ array.c	(revision 22599)
@@ -1128,6 +1128,8 @@
 	return Qnil;
     }
     rb_scan_args(argc, argv, "1", &val);
+    if (rb_block_given_p())
+	rb_warn("given block not used");
     for (i=0; i<RARRAY_LEN(ary); i++) {
 	if (rb_equal(RARRAY_PTR(ary)[i], val))
 	    return LONG2NUM(i);
@@ -1168,6 +1170,8 @@
 	return Qnil;
     }
     rb_scan_args(argc, argv, "1", &val);
+    if (rb_block_given_p())
+	rb_warn("given block not used");
     while (i--) {
 	if (rb_equal(RARRAY_PTR(ary)[i], val))
 	    return LONG2NUM(i);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 22598)
+++ ChangeLog	(revision 22599)
@@ -1,3 +1,8 @@
+Tue Feb 24 23:58:52 2009  Akinori MUSHA  <knu@i...>
+
+	* array.c (rb_ary_index, rb_ary_rindex): Emit a warning that a
+	  given block is unused when an argument is specified.
+
 Tue Feb 24 22:00:37 2009  Tanaka Akira  <akr@f...>
 
 	* ext/socket/socket.c (sockaddr_obj): convert fe80:1::1 to fe80::1%1.

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

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