summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-08 19:50:37 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-08 19:50:37 +0000
commitae166317a4cceeaa195760f675f89a4afec0feee (patch)
tree2acb49ed9eb1037637b7e0b0f0ea98991a27a4ad /eval.c
parentb6d5ce7975667cc32d7d86a992d5206627e5ff73 (diff)
* internal.h: define CREF accessor macros.
* CREF_CLASS(cref) * CREF_NEXT(cref) * CREF_VISI(cref) * CREF_VISI_SET(cref, v) * CREF_REFINEMENTS(cref) * CREF_PUSHED_BY_EVAL(cref) * CREF_PUSHED_BY_EVAL_SET(cref) * CREF_OMOD_SHARED(cref) * CREF_OMOD_SHARED_SET(cref) * CREF_OMOD_SHARED_UNSET(cref) This is process to change CREF data type from NODE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/eval.c b/eval.c
index 5b3c093..7efc4c7 100644
--- a/eval.c
+++ b/eval.c
@@ -343,13 +343,13 @@ rb_mod_nesting(void)
VALUE ary = rb_ary_new();
const NODE *cref = rb_vm_cref();
- while (cref && cref->nd_next) {
- VALUE klass = cref->nd_clss;
- if (!(cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL) &&
+ while (cref && CREF_NEXT(cref)) {
+ VALUE klass = CREF_CLASS(cref);
+ if (!CREF_PUSHED_BY_EVAL(cref) &&
!NIL_P(klass)) {
rb_ary_push(ary, klass);
}
- cref = cref->nd_next;
+ cref = CREF_NEXT(cref);
}
return ary;
}
@@ -389,15 +389,15 @@ rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
}
while (cref) {
- klass = cref->nd_clss;
- if (!(cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL) &&
+ klass = CREF_CLASS(cref);
+ if (!CREF_PUSHED_BY_EVAL(cref) &&
!NIL_P(klass)) {
- data = rb_mod_const_at(cref->nd_clss, data);
+ data = rb_mod_const_at(CREF_CLASS(cref), data);
if (!cbase) {
cbase = klass;
}
}
- cref = cref->nd_next;
+ cref = CREF_NEXT(cref);
}
if (cbase) {
@@ -1160,15 +1160,15 @@ rb_using_refinement(NODE *cref, VALUE klass, VALUE module)
Check_Type(klass, T_CLASS);
Check_Type(module, T_MODULE);
- if (NIL_P(cref->nd_refinements)) {
- RB_OBJ_WRITE(cref, &cref->nd_refinements, hidden_identity_hash_new());
+ if (NIL_P(CREF_REFINEMENTS(cref))) {
+ RB_OBJ_WRITE(cref, &CREF_REFINEMENTS(cref), hidden_identity_hash_new());
}
else {
- if (cref->flags & NODE_FL_CREF_OMOD_SHARED) {
- RB_OBJ_WRITE(cref, &cref->nd_refinements, rb_hash_dup(cref->nd_refinements));
- cref->flags &= ~NODE_FL_CREF_OMOD_SHARED;
+ if (CREF_OMOD_SHARED(cref)) {
+ RB_OBJ_WRITE(cref, &CREF_REFINEMENTS(cref), rb_hash_dup(CREF_REFINEMENTS(cref)));
+ CREF_OMOD_SHARED_UNSET(cref);
}
- if (!NIL_P(c = rb_hash_lookup(cref->nd_refinements, klass))) {
+ if (!NIL_P(c = rb_hash_lookup(CREF_REFINEMENTS(cref), klass))) {
superclass = c;
while (c && RB_TYPE_P(c, T_ICLASS)) {
if (RBASIC(c)->klass == module) {
@@ -1193,7 +1193,7 @@ rb_using_refinement(NODE *cref, VALUE klass, VALUE module)
RCLASS_REFINED_CLASS(c) = klass;
module = RCLASS_SUPER(module);
}
- rb_hash_aset(cref->nd_refinements, klass, iclass);
+ rb_hash_aset(CREF_REFINEMENTS(cref), klass, iclass);
}
static int
@@ -1488,7 +1488,7 @@ top_using(VALUE self, VALUE module)
NODE *cref = rb_vm_cref();
rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
- if (cref->nd_next || (prev_cfp && prev_cfp->me)) {
+ if (CREF_NEXT(cref) || (prev_cfp && prev_cfp->me)) {
rb_raise(rb_eRuntimeError,
"main.using is permitted only at toplevel");
}