mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* class.c (rb_generic_class_instance_methods): merge argument
check (and warning) into one function; following DRY principle. [ruby-core:01193] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9a47a04607
commit
dff438fba3
2 changed files with 24 additions and 38 deletions
|
@ -1,3 +1,9 @@
|
|||
Wed Jun 25 12:52:58 2003 Matthew Dempsky <jivera@flame.org>
|
||||
|
||||
* class.c (rb_generic_class_instance_methods): merge argument
|
||||
check (and warning) into one function; following DRY principle.
|
||||
[ruby-core:01193]
|
||||
|
||||
Wed Jun 25 00:14:30 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* variable.c (autoload_delete): should delete Qundef from iv_tbl.
|
||||
|
|
56
class.c
56
class.c
|
@ -549,23 +549,33 @@ method_list(mod, recur, func)
|
|||
return ary;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_class_instance_methods(argc, argv, mod)
|
||||
static VALUE
|
||||
class_instance_method_list(argc, argv, mod, func)
|
||||
int argc;
|
||||
VALUE *argv;
|
||||
VALUE mod;
|
||||
void (*func)();
|
||||
{
|
||||
VALUE recur;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &recur);
|
||||
if (argc == 0) {
|
||||
#if RUBY_VERSION_CODE < 181
|
||||
rb_warn("instance_methods parameter will default to 'true' after 1.8.1");
|
||||
rb_warn("%s: parameter will default to 'true' as of 1.8.1", rb_id2name(rb_frame_last_func()));
|
||||
#else
|
||||
recur = Qtrue;
|
||||
#endif
|
||||
}
|
||||
return method_list(mod, RTEST(recur), ins_methods_i);
|
||||
return method_list(mod, RTEST(recur), func);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_class_instance_methods(argc, argv, mod)
|
||||
int argc;
|
||||
VALUE *argv;
|
||||
VALUE mod;
|
||||
{
|
||||
return class_instance_method_list(argc, argv, mod, ins_methods_i);
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
@ -574,17 +584,7 @@ rb_class_protected_instance_methods(argc, argv, mod)
|
|||
VALUE *argv;
|
||||
VALUE mod;
|
||||
{
|
||||
VALUE recur;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &recur);
|
||||
if (argc == 0) {
|
||||
#if RUBY_VERSION_CODE < 181
|
||||
rb_warn("protected_instance_methods parameter will default to 'true' after 1.8.1");
|
||||
#else
|
||||
recur = Qtrue;
|
||||
#endif
|
||||
}
|
||||
return method_list(mod, RTEST(recur), ins_methods_prot_i);
|
||||
return class_instance_method_list(argc, argv, mod, ins_methods_prot_i);
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
@ -593,17 +593,7 @@ rb_class_private_instance_methods(argc, argv, mod)
|
|||
VALUE *argv;
|
||||
VALUE mod;
|
||||
{
|
||||
VALUE recur;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &recur);
|
||||
if (argc == 0) {
|
||||
#if RUBY_VERSION_CODE < 181
|
||||
rb_warn("private_instance_methods parameter will default to 'true' after 1.8.1");
|
||||
#else
|
||||
recur = Qtrue;
|
||||
#endif
|
||||
}
|
||||
return method_list(mod, RTEST(recur), ins_methods_priv_i);
|
||||
return class_instance_method_list(argc, argv, mod, ins_methods_priv_i);
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
@ -612,17 +602,7 @@ rb_class_public_instance_methods(argc, argv, mod)
|
|||
VALUE *argv;
|
||||
VALUE mod;
|
||||
{
|
||||
VALUE recur;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &recur);
|
||||
if (argc == 0) {
|
||||
#if RUBY_VERSION_CODE < 181
|
||||
rb_warn("public_instance_methods parameter will default to 'true' after 1.8.1");
|
||||
#else
|
||||
recur = Qtrue;
|
||||
#endif
|
||||
}
|
||||
return method_list(mod, RTEST(recur), ins_methods_pub_i);
|
||||
return class_instance_method_list(argc, argv, mod, ins_methods_pub_i);
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
@ -637,7 +617,7 @@ rb_obj_singleton_methods(argc, argv, obj)
|
|||
rb_scan_args(argc, argv, "01", &recur);
|
||||
if (argc == 0) {
|
||||
#if RUBY_VERSION_CODE < 181
|
||||
rb_warn("singleton_methods parameter will default to 'true' after 1.8.1");
|
||||
rb_warn("singleton_methods: parameter will default to 'true' as of 1.8.1");
|
||||
#else
|
||||
recur = Qtrue;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue