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

* include/ruby/ruby.h, eval.c, vm_insnhelper.c: fix typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2012-08-06 05:55:19 +00:00
parent d93d45fea7
commit 3dd941b234
4 changed files with 26 additions and 22 deletions

View file

@ -1,3 +1,7 @@
Mon Aug 6 14:54:38 2012 Shugo Maeda <shugo@ruby-lang.org>
* include/ruby/ruby.h, eval.c, vm_insnhelper.c: fix typo.
Mon Aug 6 13:13:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_eval.c (vm_call_super): since cfp->klass is always class or

40
eval.c
View file

@ -1046,18 +1046,18 @@ rb_overlay_module(NODE *cref, VALUE klass, VALUE module)
superclass = c;
while (c && TYPE(c) == T_ICLASS) {
if (RBASIC(c)->klass == module) {
/* already overlayed module */
/* already overlaid module */
return;
}
c = RCLASS_SUPER(c);
}
}
}
FL_SET(module, RMODULE_IS_OVERLAYED);
FL_SET(module, RMODULE_IS_OVERLAID);
c = iclass = rb_include_class_new(module, superclass);
module = RCLASS_SUPER(module);
while (module) {
FL_SET(module, RMODULE_IS_OVERLAYED);
FL_SET(module, RMODULE_IS_OVERLAID);
c = RCLASS_SUPER(c) = rb_include_class_new(module, RCLASS_SUPER(c));
module = RCLASS_SUPER(module);
}
@ -1077,14 +1077,14 @@ using_module_i(VALUE klass, VALUE module, VALUE arg)
void
rb_using_module(NODE *cref, VALUE module)
{
ID id_overlayed_modules;
VALUE overlayed_modules;
ID id_overlaid_modules;
VALUE overlaid_modules;
Check_Type(module, T_MODULE);
CONST_ID(id_overlayed_modules, "__overlayed_modules__");
overlayed_modules = rb_attr_get(module, id_overlayed_modules);
if (NIL_P(overlayed_modules)) return;
rb_hash_foreach(overlayed_modules, using_module_i, (VALUE) cref);
CONST_ID(id_overlaid_modules, "__overlaid_modules__");
overlaid_modules = rb_attr_get(module, id_overlaid_modules);
if (NIL_P(overlaid_modules)) return;
rb_hash_foreach(overlaid_modules, using_module_i, (VALUE) cref);
}
/*
@ -1167,7 +1167,7 @@ refinement_module_include(int argc, VALUE *argv, VALUE module)
*
* Refine <i>klass</i> in the receiver.
*
* Returns an overlayed module.
* Returns an overlaid module.
*/
static VALUE
@ -1175,18 +1175,18 @@ rb_mod_refine(VALUE module, VALUE klass)
{
NODE *cref = rb_vm_cref();
VALUE mod;
ID id_overlayed_modules, id_refined_class;
VALUE overlayed_modules;
ID id_overlaid_modules, id_refined_class;
VALUE overlaid_modules;
Check_Type(klass, T_CLASS);
CONST_ID(id_overlayed_modules, "__overlayed_modules__");
overlayed_modules = rb_attr_get(module, id_overlayed_modules);
if (NIL_P(overlayed_modules)) {
overlayed_modules = rb_hash_new();
rb_funcall(overlayed_modules, rb_intern("compare_by_identity"), 0);
rb_ivar_set(module, id_overlayed_modules, overlayed_modules);
CONST_ID(id_overlaid_modules, "__overlaid_modules__");
overlaid_modules = rb_attr_get(module, id_overlaid_modules);
if (NIL_P(overlaid_modules)) {
overlaid_modules = rb_hash_new();
rb_funcall(overlaid_modules, rb_intern("compare_by_identity"), 0);
rb_ivar_set(module, id_overlaid_modules, overlaid_modules);
}
mod = rb_hash_aref(overlayed_modules, klass);
mod = rb_hash_aref(overlaid_modules, klass);
if (NIL_P(mod)) {
mod = rb_module_new();
CONST_ID(id_refined_class, "__refined_class__");
@ -1196,7 +1196,7 @@ rb_mod_refine(VALUE module, VALUE klass)
rb_define_singleton_method(mod, "include",
refinement_module_include, -1);
rb_overlay_module(cref, klass, mod);
rb_hash_aset(overlayed_modules, klass, mod);
rb_hash_aset(overlaid_modules, klass, mod);
}
rb_mod_module_eval(0, NULL, mod);
return mod;

View file

@ -663,7 +663,7 @@ struct RClass {
#define RMODULE_CONST_TBL(m) RCLASS_CONST_TBL(m)
#define RMODULE_M_TBL(m) RCLASS_M_TBL(m)
#define RMODULE_SUPER(m) RCLASS_SUPER(m)
#define RMODULE_IS_OVERLAYED FL_USER2
#define RMODULE_IS_OVERLAID FL_USER2
struct RFloat {
struct RBasic basic;

View file

@ -1210,7 +1210,7 @@ static inline VALUE
vm_get_iclass(rb_control_frame_t *cfp, VALUE klass)
{
if (TYPE(klass) == T_MODULE &&
FL_TEST(klass, RMODULE_IS_OVERLAYED) &&
FL_TEST(klass, RMODULE_IS_OVERLAID) &&
TYPE(cfp->klass) == T_ICLASS &&
RBASIC(cfp->klass)->klass == klass) {
return cfp->klass;