зеркало из https://github.com/github/ruby.git
* class.c (rb_class_has_methods): added to reduce depenedency
to internal class data structure. * internal.h: ditto. * hash.c (has_extra_methods): use added function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
3d410dde5c
Коммит
258131446c
|
@ -1,3 +1,12 @@
|
|||
Mon Jun 1 04:15:42 2015 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* class.c (rb_class_has_methods): added to reduce depenedency
|
||||
to internal class data structure.
|
||||
|
||||
* internal.h: ditto.
|
||||
|
||||
* hash.c (has_extra_methods): use added function.
|
||||
|
||||
Mon Jun 1 04:11:48 2015 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* gc.c , gc.h (rb_obj_info): export obj_info(VALUE) for debugging.
|
||||
|
|
7
class.c
7
class.c
|
@ -1985,6 +1985,13 @@ rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, V
|
|||
#undef extract_kwarg
|
||||
}
|
||||
|
||||
int
|
||||
rb_class_has_methods(VALUE c)
|
||||
{
|
||||
st_table *mtbl = RCLASS_M_TBL(c);
|
||||
return mtbl && mtbl->num_entries ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \}
|
||||
*/
|
||||
|
|
3
hash.c
3
hash.c
|
@ -37,8 +37,7 @@ has_extra_methods(VALUE klass)
|
|||
const VALUE base = rb_cHash;
|
||||
VALUE c = klass;
|
||||
while (c != base) {
|
||||
st_table *mtbl = RCLASS_M_TBL(c);
|
||||
if (mtbl && mtbl->num_entries) return klass;
|
||||
if (rb_class_has_methods(c)) return klass;
|
||||
c = RCLASS_SUPER(c);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -667,6 +667,8 @@ VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
|
|||
VALUE rb_singleton_class_get(VALUE obj);
|
||||
void Init_class_hierarchy(void);
|
||||
|
||||
int rb_class_has_methods(VALUE c);
|
||||
|
||||
/* compar.c */
|
||||
VALUE rb_invcmp(VALUE, VALUE);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче