* variable.c (set_const_visibility): print a warning when no argument

is passwd to Module#private_constant.  [ruby-list:48558]

* vm_method.c (set_method_visibility): ditto for
  Module#private_class_method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2011-12-03 11:52:14 +00:00
Родитель d267b2e347
Коммит 4a1cfe70dc
3 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Sat Dec 3 20:49:16 2011 Yusuke Endoh <mame@tsg.ne.jp>
* variable.c (set_const_visibility): print a warning when no argument
is passwd to Module#private_constant. [ruby-list:48558]
* vm_method.c (set_method_visibility): ditto for
Module#private_class_method.
Sat Dec 3 20:43:14 2011 Yusuke Endoh <mame@tsg.ne.jp>
* variable.c (set_const_visibility): Module#private_constant has

Просмотреть файл

@ -2111,6 +2111,10 @@ set_const_visibility(VALUE mod, int argc, VALUE *argv, rb_const_flag_t flag)
"Insecure: can't change constant visibility");
}
if (argc == 0) {
rb_warning("%s with no argument is just ignored", rb_id2name(rb_frame_callee()));
}
for (i = 0; i < argc; i++) {
VALUE val = argv[i];
id = rb_check_id(&val);

Просмотреть файл

@ -985,6 +985,11 @@ set_method_visibility(VALUE self, int argc, VALUE *argv, rb_method_flag_t ex)
{
int i;
secure_visibility(self);
if (argc == 0) {
rb_warning("%s with no argument is just ignored", rb_id2name(rb_frame_callee()));
}
for (i = 0; i < argc; i++) {
VALUE v = argv[i];
ID id = rb_check_id(&v);