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

* class.c (singleton_class_of): flonum can't have singleton class.

* vm.c (vm_define_method): flonum can't have singleton method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2012-08-23 11:36:42 +00:00
parent b2ea5504bc
commit 6a80947a4b
3 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,9 @@
Thu Aug 23 20:34:32 2012 NAKAMURA Usaku <usa@ruby-lang.org>
* class.c (singleton_class_of): flonum can't have singleton class.
* vm.c (vm_define_method): flonum can't have singleton method.
Thu Aug 23 19:18:33 2012 NAKAMURA Usaku <usa@ruby-lang.org>
* common.mk (win32/*): macro RUBY_H_INCLUDES is not defined there,

View file

@ -1315,7 +1315,7 @@ singleton_class_of(VALUE obj)
{
VALUE klass;
if (FIXNUM_P(obj) || SYMBOL_P(obj)) {
if (FIXNUM_P(obj) || FLONUM_P(obj) || SYMBOL_P(obj)) {
rb_raise(rb_eTypeError, "can't define singleton");
}
if (SPECIAL_CONST_P(obj)) {

2
vm.c
View file

@ -1857,7 +1857,7 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval,
}
if (is_singleton) {
if (FIXNUM_P(obj) || SYMBOL_P(obj)) {
if (FIXNUM_P(obj) || FLONUM_P(obj) || SYMBOL_P(obj)) {
rb_raise(rb_eTypeError,
"can't define singleton method \"%s\" for %s",
rb_id2name(id), rb_obj_classname(obj));