1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* variable.c (rb_obj_remove_instance_variable): better message.

[ruby-talk:68987]

* variable.c (rb_mod_remove_const): ditto.

* object.c (rb_obj_ivar_get): ditto.

* object.c (rb_obj_ivar_set): ditto.

* parse.y (yylex): ditto.

* eval.c (rb_mod_define_method): Allow UnboundMethod as
  parameter.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-04-09 15:06:57 +00:00
parent e5877f1c96
commit 8e09f5b907
3 changed files with 42 additions and 14 deletions

View file

@ -1,3 +1,26 @@
Wed Apr 9 23:54:50 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* variable.c (rb_obj_remove_instance_variable): better message.
[ruby-talk:68987]
* variable.c (rb_mod_remove_const): ditto.
* object.c (rb_obj_ivar_get): ditto.
* object.c (rb_obj_ivar_set): ditto.
* parse.y (yylex): ditto.
Wed Apr 9 21:51:20 2003 Dave Thomas <Dave@Thomases.com>
* eval.c (rb_mod_define_method): Allow UnboundMethod as
parameter.
Wed Apr 9 18:30:58 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (top_include): include module to wrapper module if
wrapper is present. experimental. [ruby-list:37539]
Wed Apr 9 17:24:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (rb_gc_mark_children): introduce this function again; this

29
eval.c
View file

@ -5083,7 +5083,7 @@ backtrace(lev)
{
struct FRAME *frame = ruby_frame;
char buf[BUFSIZ];
volatile VALUE ary;
VALUE ary;
NODE *n;
ary = rb_ary_new();
@ -6086,7 +6086,12 @@ top_include(argc, argv)
VALUE *argv;
{
rb_secure(4);
return rb_mod_include(argc, argv, rb_cObject);
if (ruby_wrapper) {
return rb_mod_include(argc, argv, ruby_wrapper);
}
else {
return rb_mod_include(argc, argv, rb_cObject);
}
}
void
@ -7180,19 +7185,10 @@ umethod_bind(method, recv)
st_lookup(RCLASS(CLASS_OF(recv))->m_tbl, data->oid, 0)) {
rb_raise(rb_eTypeError, "method `%s' overridden", rb_id2name(data->oid));
}
#if 0
if (!((TYPE(data->rklass) == T_MODULE) ?
rb_obj_is_kind_of(recv, data->rklass) :
rb_obj_is_instance_of(recv, data->rklass))) {
rb_raise(rb_eTypeError, "bind argument must be an instance of %s",
rb_class2name(data->rklass));
}
#else
if(!rb_obj_is_kind_of(recv, data->rklass)) {
rb_raise(rb_eTypeError, "bind argument must be an instance of %s",
rb_class2name(data->rklass));
}
#endif
}
method = Data_Make_Struct(rb_cMethod,struct METHOD,bm_mark,free,bound);
@ -7343,6 +7339,15 @@ umethod_proc(method)
return Qnil; /* not reached */
}
static VALUE
rb_obj_is_method(m)
VALUE m;
{
if (TYPE(m) == T_DATA && RDATA(m)->dmark == (RUBY_DATA_FUNC)bm_mark) {
return Qtrue;
}
}
static VALUE
rb_mod_define_method(argc, argv, mod)
int argc;
@ -7361,7 +7366,7 @@ rb_mod_define_method(argc, argv, mod)
else if (argc == 2) {
id = rb_to_id(argv[0]);
body = argv[1];
if (!rb_obj_is_kind_of(body, rb_cMethod) && !rb_obj_is_proc(body)) {
if (!rb_obj_is_method(body) && !rb_obj_is_proc(body)) {
rb_raise(rb_eTypeError, "wrong argument type %s (expected Proc/Method)",
rb_obj_classname(body));
}

View file

@ -4271,10 +4271,10 @@ yylex()
}
if (ISDIGIT(c)) {
if (tokidx == 1) {
rb_compile_error("`@%c' is not a valid instance variable name", c);
rb_compile_error("`@%c' is not allowable as an instance variable name", c);
}
else {
rb_compile_error("`@@%c' is not a valid class variable name", c);
rb_compile_error("`@@%c' is not allowable as a class variable name", c);
}
}
if (!is_identchar(c)) {