зеркало из https://github.com/github/ruby.git
* vm_method.c (rb_remove_method_id): exported.
* numeric.c (num_sadded): fix for non-ascii method name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
a20bd463a8
Коммит
84255e0485
|
@ -1,3 +1,9 @@
|
|||
Thu Aug 27 18:31:07 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_method.c (rb_remove_method_id): exported.
|
||||
|
||||
* numeric.c (num_sadded): fix for non-ascii method name.
|
||||
|
||||
Thu Aug 27 14:32:31 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* re.c (rb_reg_preprocess_dregexp): set encoding as ASCII-8BIT
|
||||
|
|
|
@ -263,6 +263,7 @@ NORETURN(void rb_exc_fatal(VALUE));
|
|||
VALUE rb_f_exit(int,VALUE*);
|
||||
VALUE rb_f_abort(int,VALUE*);
|
||||
void rb_remove_method(VALUE, const char*);
|
||||
void rb_remove_method_id(VALUE, ID);
|
||||
#define rb_disable_super(klass, name) ((void)0)
|
||||
#define rb_enable_super(klass, name) ((void)0)
|
||||
#define HAVE_RB_DEFINE_ALLOC_FUNC 1
|
||||
|
|
|
@ -203,13 +203,13 @@ rb_num_coerce_relop(VALUE x, VALUE y, ID func)
|
|||
static VALUE
|
||||
num_sadded(VALUE x, VALUE name)
|
||||
{
|
||||
const char *nstr = rb_id2name(rb_to_id(name));
|
||||
ID mid = rb_to_id(name);
|
||||
/* ruby_frame = ruby_frame->prev; */ /* pop frame for "singleton_method_added" */
|
||||
/* Numerics should be values; singleton_methods should not be added to them */
|
||||
rb_remove_method(rb_singleton_class(x), nstr);
|
||||
rb_remove_method_id(rb_singleton_class(x), mid);
|
||||
rb_raise(rb_eTypeError,
|
||||
"can't define singleton method \"%s\" for %s",
|
||||
nstr,
|
||||
rb_id2name(mid),
|
||||
rb_obj_classname(x));
|
||||
return Qnil; /* not reached */
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ class TestNumeric < Test::Unit::TestCase
|
|||
def test_numeric
|
||||
a = Numeric.new
|
||||
assert_raise(TypeError) { def a.foo; end }
|
||||
assert_raise(TypeError) { eval("def a.\u3042; end") }
|
||||
assert_raise(TypeError) { a.dup }
|
||||
end
|
||||
|
||||
|
|
12
vm_method.c
12
vm_method.c
|
@ -100,12 +100,14 @@ rb_clear_cache_by_class(VALUE klass)
|
|||
}
|
||||
}
|
||||
|
||||
VALUE rb_f_notimplement(int argc, VALUE *argv, VALUE obj)
|
||||
VALUE
|
||||
rb_f_notimplement(int argc, VALUE *argv, VALUE obj)
|
||||
{
|
||||
rb_notimplement();
|
||||
}
|
||||
|
||||
static void rb_define_notimplement_method_id(VALUE mod, ID id, rb_method_flag_t noex)
|
||||
static void
|
||||
rb_define_notimplement_method_id(VALUE mod, ID id, rb_method_flag_t noex)
|
||||
{
|
||||
rb_add_method(mod, id, VM_METHOD_TYPE_NOTIMPLEMENTED, 0, noex);
|
||||
}
|
||||
|
@ -324,8 +326,8 @@ rb_method_entry(VALUE klass, ID id)
|
|||
return rb_get_method_entry(klass, id);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_method(VALUE klass, ID mid)
|
||||
void
|
||||
rb_remove_method_id(VALUE klass, ID mid)
|
||||
{
|
||||
st_data_t data;
|
||||
rb_method_entry_t *me = 0;
|
||||
|
@ -367,6 +369,8 @@ remove_method(VALUE klass, ID mid)
|
|||
}
|
||||
}
|
||||
|
||||
#define remove_method(klass, mid) rb_remove_method_id(klass, mid)
|
||||
|
||||
void
|
||||
rb_remove_method(VALUE klass, const char *name)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче