summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-09-19 02:51:52 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-09-19 02:51:52 +0900
commit95c7f570e10d40deca74e69a197219622e249c01 (patch)
tree15e92a12b65e55c3f6270c094b40d95d8402b290 /src
parent6b34166ba58fa8503a6a7805d39dd29c4b3c8445 (diff)
downloadmruby-95c7f570e10d40deca74e69a197219622e249c01.tar.gz
mruby-95c7f570e10d40deca74e69a197219622e249c01.zip
change class argument of mrb_const_defined_at from `struct RClass*` to `mrb_value` to make it consistent with mrb_const_defined; ref #2593
Diffstat (limited to 'src')
-rw-r--r--src/class.c4
-rw-r--r--src/variable.c11
2 files changed, 8 insertions, 7 deletions
diff --git a/src/class.c b/src/class.c
index c11346223..63b9c3ee0 100644
--- a/src/class.c
+++ b/src/class.c
@@ -137,7 +137,7 @@ define_module(mrb_state *mrb, mrb_sym name, struct RClass *outer)
{
struct RClass *m;
- if (mrb_const_defined_at(mrb, outer, name)) {
+ if (mrb_const_defined_at(mrb, mrb_obj_value(outer), name)) {
return module_from_sym(mrb, outer, name);
}
m = mrb_module_new(mrb);
@@ -179,7 +179,7 @@ define_class(mrb_state *mrb, mrb_sym name, struct RClass *super, struct RClass *
{
struct RClass * c;
- if (mrb_const_defined_at(mrb, outer, name)) {
+ if (mrb_const_defined_at(mrb, mrb_obj_value(outer), name)) {
c = class_from_sym(mrb, outer, name);
if (super && mrb_class_real(c->super) != super) {
mrb_raisef(mrb, E_TYPE_ERROR, "superclass mismatch for Class %S (%S not %S)",
diff --git a/src/variable.c b/src/variable.c
index e9f77b8d9..c4f6fb830 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -1081,9 +1081,10 @@ mrb_f_global_variables(mrb_state *mrb, mrb_value self)
}
static mrb_bool
-mrb_const_defined_0(mrb_state *mrb, struct RClass *klass, mrb_sym id, mrb_bool exclude, mrb_bool recurse)
+mrb_const_defined_0(mrb_state *mrb, mrb_value mod, mrb_sym id, mrb_bool exclude, mrb_bool recurse)
{
- struct RClass * tmp;
+ struct RClass *klass = mrb_class_ptr(mod);
+ struct RClass *tmp;
mrb_bool mod_retry = 0;
tmp = klass;
@@ -1106,13 +1107,13 @@ retry:
MRB_API mrb_bool
mrb_const_defined(mrb_state *mrb, mrb_value mod, mrb_sym id)
{
- return mrb_const_defined_0(mrb, mrb_class_ptr(mod), id, TRUE, TRUE);
+ return mrb_const_defined_0(mrb, mod, id, TRUE, TRUE);
}
MRB_API mrb_bool
-mrb_const_defined_at(mrb_state *mrb, struct RClass *klass, mrb_sym id)
+mrb_const_defined_at(mrb_state *mrb, mrb_value mod, mrb_sym id)
{
- return mrb_const_defined_0(mrb, klass, id, TRUE, FALSE);
+ return mrb_const_defined_0(mrb, mod, id, TRUE, FALSE);
}
MRB_API mrb_value