зеркало из https://github.com/github/ruby.git
* eval.c (rb_call0): should not report uninitialized warning by
attribute reader method. * variable.c (rb_attr_get): new function to get instance variable without uninitialized warning. * io.c (argf_to_io): should prefetch argv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b4f940b767
Коммит
ddd9d609dc
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Tue Feb 18 21:39:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_call0): should not report uninitialized warning by
|
||||||
|
attribute reader method.
|
||||||
|
|
||||||
|
* variable.c (rb_attr_get): new function to get instance variable
|
||||||
|
without uninitialized warning.
|
||||||
|
|
||||||
|
* io.c (argf_to_io): should prefetch argv.
|
||||||
|
|
||||||
Tue Feb 18 00:13:50 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
Tue Feb 18 00:13:50 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
* misc/ruby-mode.el (ruby-comment-column): customize comment
|
* misc/ruby-mode.el (ruby-comment-column): customize comment
|
||||||
|
|
3
eval.c
3
eval.c
|
@ -4629,6 +4629,9 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
|
||||||
if (argc != 0) {
|
if (argc != 0) {
|
||||||
rb_raise(rb_eArgError, "wrong number of arguments(%d for 0)", argc);
|
rb_raise(rb_eArgError, "wrong number of arguments(%d for 0)", argc);
|
||||||
}
|
}
|
||||||
|
result = rb_attr_get(recv, body->nd_vid);
|
||||||
|
break;
|
||||||
|
|
||||||
case NODE_ATTRSET:
|
case NODE_ATTRSET:
|
||||||
/* for re-scoped/renamed method */
|
/* for re-scoped/renamed method */
|
||||||
case NODE_ZSUPER:
|
case NODE_ZSUPER:
|
||||||
|
|
2
intern.h
2
intern.h
|
@ -119,7 +119,6 @@ void rb_undef _((VALUE, ID));
|
||||||
void rb_define_protected_method _((VALUE, const char*, VALUE (*)(ANYARGS), int));
|
void rb_define_protected_method _((VALUE, const char*, VALUE (*)(ANYARGS), int));
|
||||||
void rb_define_private_method _((VALUE, const char*, VALUE (*)(ANYARGS), int));
|
void rb_define_private_method _((VALUE, const char*, VALUE (*)(ANYARGS), int));
|
||||||
void rb_define_singleton_method _((VALUE, const char*, VALUE(*)(ANYARGS), int));
|
void rb_define_singleton_method _((VALUE, const char*, VALUE(*)(ANYARGS), int));
|
||||||
void rb_define_private_method _((VALUE, const char*, VALUE(*)(ANYARGS), int));
|
|
||||||
VALUE rb_singleton_class _((VALUE));
|
VALUE rb_singleton_class _((VALUE));
|
||||||
/* compar.c */
|
/* compar.c */
|
||||||
int rb_cmpint _((VALUE));
|
int rb_cmpint _((VALUE));
|
||||||
|
@ -437,6 +436,7 @@ VALUE rb_ivar_set _((VALUE, ID, VALUE));
|
||||||
VALUE rb_ivar_defined _((VALUE, ID));
|
VALUE rb_ivar_defined _((VALUE, ID));
|
||||||
VALUE rb_iv_set _((VALUE, const char*, VALUE));
|
VALUE rb_iv_set _((VALUE, const char*, VALUE));
|
||||||
VALUE rb_iv_get _((VALUE, const char*));
|
VALUE rb_iv_get _((VALUE, const char*));
|
||||||
|
VALUE rb_attr_get _((VALUE, ID));
|
||||||
VALUE rb_obj_instance_variables _((VALUE));
|
VALUE rb_obj_instance_variables _((VALUE));
|
||||||
VALUE rb_obj_remove_instance_variable _((VALUE, VALUE));
|
VALUE rb_obj_remove_instance_variable _((VALUE, VALUE));
|
||||||
void *rb_mod_const_at _((VALUE, void*));
|
void *rb_mod_const_at _((VALUE, void*));
|
||||||
|
|
1
io.c
1
io.c
|
@ -3698,6 +3698,7 @@ argf_fileno()
|
||||||
static VALUE
|
static VALUE
|
||||||
argf_to_io()
|
argf_to_io()
|
||||||
{
|
{
|
||||||
|
next_argv();
|
||||||
return current_file;
|
return current_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
25
variable.c
25
variable.c
|
@ -965,10 +965,11 @@ rb_copy_generic_ivar(clone, obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
static VALUE
|
||||||
rb_ivar_get(obj, id)
|
ivar_get(obj, id, warn)
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
ID id;
|
ID id;
|
||||||
|
int warn;
|
||||||
{
|
{
|
||||||
VALUE val;
|
VALUE val;
|
||||||
|
|
||||||
|
@ -984,11 +985,29 @@ rb_ivar_get(obj, id)
|
||||||
return generic_ivar_get(obj, id);
|
return generic_ivar_get(obj, id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rb_warning("instance variable %s not initialized", rb_id2name(id));
|
if (warn && ruby_verbose) {
|
||||||
|
rb_warning("instance variable %s not initialized", rb_id2name(id));
|
||||||
|
}
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_ivar_get(obj, id)
|
||||||
|
VALUE obj;
|
||||||
|
ID id;
|
||||||
|
{
|
||||||
|
return ivar_get(obj, id, Qtrue);
|
||||||
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_attr_get(obj, id)
|
||||||
|
VALUE obj;
|
||||||
|
ID id;
|
||||||
|
{
|
||||||
|
return ivar_get(obj, id, Qfalse);
|
||||||
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_ivar_set(obj, id, val)
|
rb_ivar_set(obj, id, val)
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче