mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
variable.c: a new function mrb_mod_const_at()
And mrb_mod_constants() use the new function now.
This commit is contained in:
@@ -176,11 +176,12 @@ size_t mrb_obj_iv_tbl_memsize(mrb_value);
|
||||
mrb_value mrb_obj_iv_inspect(mrb_state*, struct RObject*);
|
||||
void mrb_obj_iv_set_force(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v);
|
||||
mrb_value mrb_mod_constants(mrb_state *mrb, mrb_value mod);
|
||||
mrb_value mrb_mod_const_at(mrb_state *mrb, struct RClass *c, mrb_value ary);
|
||||
mrb_value mrb_f_global_variables(mrb_state *mrb, mrb_value self);
|
||||
mrb_value mrb_obj_instance_variables(mrb_state*, mrb_value);
|
||||
mrb_value mrb_mod_class_variables(mrb_state*, mrb_value);
|
||||
mrb_value mrb_mod_cv_get(mrb_state *mrb, struct RClass * c, mrb_sym sym);
|
||||
mrb_bool mrb_mod_cv_defined(mrb_state *mrb, struct RClass * c, mrb_sym sym);
|
||||
mrb_value mrb_mod_cv_get(mrb_state *mrb, struct RClass *c, mrb_sym sym);
|
||||
mrb_bool mrb_mod_cv_defined(mrb_state *mrb, struct RClass *c, mrb_sym sym);
|
||||
mrb_bool mrb_ident_p(const char *s, mrb_int len);
|
||||
mrb_value mrb_exc_const_get(mrb_state *mrb, mrb_sym sym);
|
||||
|
||||
|
||||
+8
-1
@@ -924,6 +924,13 @@ const_i(mrb_state *mrb, mrb_sym sym, mrb_value v, void *p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
mrb_value
|
||||
mrb_mod_const_at(mrb_state *mrb, struct RClass *c, mrb_value ary)
|
||||
{
|
||||
iv_foreach(mrb, class_iv_ptr(c), const_i, &ary);
|
||||
return ary;
|
||||
}
|
||||
|
||||
/* 15.2.2.4.24 */
|
||||
/*
|
||||
* call-seq:
|
||||
@@ -941,7 +948,7 @@ mrb_mod_constants(mrb_state *mrb, mrb_value mod)
|
||||
mrb_get_args(mrb, "|b", &inherit);
|
||||
ary = mrb_ary_new(mrb);
|
||||
while (c) {
|
||||
iv_foreach(mrb, class_iv_ptr(c), const_i, &ary);
|
||||
mrb_mod_const_at(mrb, c, ary);
|
||||
if (!inherit) break;
|
||||
c = c->super;
|
||||
if (c == mrb->object_class) break;
|
||||
|
||||
Reference in New Issue
Block a user