mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
eval.c: hide internal hash
* eval.c (identity_hash_new): hide internal hashes for refinements. * eval.c (rb_mod_refine): no default value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
39ef471e2d
commit
a416367b04
2 changed files with 7 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Tue Oct 2 16:47:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (identity_hash_new): hide internal hashes for refinements.
|
||||||
|
|
||||||
|
* eval.c (rb_mod_refine): no default value.
|
||||||
|
|
||||||
Mon Oct 1 22:54:02 2012 Shugo Maeda <shugo@ruby-lang.org>
|
Mon Oct 1 22:54:02 2012 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (identity_hash_new): new function to create a new identity
|
* eval.c (identity_hash_new): new function to create a new identity
|
||||||
|
|
6
eval.c
6
eval.c
|
@ -1046,11 +1046,7 @@ identity_hash_new()
|
||||||
VALUE hash = rb_hash_new();
|
VALUE hash = rb_hash_new();
|
||||||
|
|
||||||
rb_funcall(hash, rb_intern("compare_by_identity"), 0);
|
rb_funcall(hash, rb_intern("compare_by_identity"), 0);
|
||||||
#if 0
|
|
||||||
/* FIXME: The following code hides hash, but causes "method `default'
|
|
||||||
* called on hidden T_HASH object" error. */
|
|
||||||
RBASIC(hash)->klass = 0;
|
RBASIC(hash)->klass = 0;
|
||||||
#endif
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1214,7 +1210,7 @@ rb_mod_refine(VALUE module, VALUE klass)
|
||||||
overlaid_modules = identity_hash_new();
|
overlaid_modules = identity_hash_new();
|
||||||
rb_ivar_set(module, id_overlaid_modules, overlaid_modules);
|
rb_ivar_set(module, id_overlaid_modules, overlaid_modules);
|
||||||
}
|
}
|
||||||
mod = rb_hash_aref(overlaid_modules, klass);
|
mod = rb_hash_lookup(overlaid_modules, klass);
|
||||||
if (NIL_P(mod)) {
|
if (NIL_P(mod)) {
|
||||||
mod = rb_module_new();
|
mod = rb_module_new();
|
||||||
CONST_ID(id_refined_class, "__refined_class__");
|
CONST_ID(id_refined_class, "__refined_class__");
|
||||||
|
|
Loading…
Reference in a new issue