Skip to content

Commit

Permalink
* include/ruby/ruby.h, eval.c, vm_insnhelper.c: fix typo.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
shugo committed Aug 6, 2012
1 parent d93d45f commit 3dd941b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Mon Aug 6 14:54:38 2012 Shugo Maeda <[email protected]>

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

Mon Aug 6 13:13:58 2012 Nobuyoshi Nakada <[email protected]>

* vm_eval.c (vm_call_super): since cfp->klass is always class or
Expand Down
42 changes: 21 additions & 21 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}

/*
Expand Down Expand Up @@ -1167,26 +1167,26 @@ 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
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);
}
mod = rb_hash_aref(overlayed_modules, klass);
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(overlaid_modules, klass);
if (NIL_P(mod)) {
mod = rb_module_new();
CONST_ID(id_refined_class, "__refined_class__");
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/ruby/ruby.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion vm_insnhelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3dd941b

Please sign in to comment.