From 8e09f5b907868d3524e3e0557ca7bdf7cd2d73c8 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 9 Apr 2003 15:06:57 +0000 Subject: * 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 --- ChangeLog | 23 +++++++++++++++++++++++ eval.c | 29 +++++++++++++++++------------ parse.y | 4 ++-- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5e4b5c471f..62275a0408 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +Wed Apr 9 23:54:50 2003 Yukihiro Matsumoto + + * 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 + + * eval.c (rb_mod_define_method): Allow UnboundMethod as + parameter. + +Wed Apr 9 18:30:58 2003 Yukihiro Matsumoto + + * 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 * gc.c (rb_gc_mark_children): introduce this function again; this diff --git a/eval.c b/eval.c index c2fdd158dd..d6ddaa3202 100644 --- a/eval.c +++ b/eval.c @@ -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)); } diff --git a/parse.y b/parse.y index b37a749236..ea4112c5b9 100644 --- a/parse.y +++ b/parse.y @@ -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)) { -- cgit v1.2.3