summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-24 09:33:30 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-24 09:33:30 +0000
commit9ce253a2cfc26cc7a0d2cfeeaf15d6216d522077 (patch)
tree6f6334590a5705de7f7288d3eb8e572bfe75453f /eval.c
parent8581fa1549787fc64e0d8a198838fe47104726c1 (diff)
gtk/nested local variables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/eval.c b/eval.c
index 7c3d8d07d6..2ff7932a60 100644
--- a/eval.c
+++ b/eval.c
@@ -452,19 +452,17 @@ new_dvar(id, value)
{
NEWOBJ(vars, struct RVarmap);
OBJSETUP(vars, 0, T_VARMAP);
- vars->id = id;
vars->val = value;
if (id == 0) {
+ vars->id = (ID)value;
vars->next = the_dyna_vars;
+ the_dyna_vars = vars;
}
else if (the_dyna_vars) {
+ vars->id = id;
vars->next = the_dyna_vars->next;
the_dyna_vars->next = vars;
}
- else { /* complie time dyna_var check */
- vars->next = the_dyna_vars;
- the_dyna_vars = vars;
- }
return vars;
}
@@ -1702,7 +1700,6 @@ rb_eval(self, node)
{
iter_retry:
PUSH_BLOCK(node->nd_var, node->nd_body);
- _block.d_vars = new_dvar(0,0);
PUSH_TAG(PROT_FUNC);
state = EXEC_TAG();
@@ -2804,7 +2801,8 @@ rb_yield_0(val, self)
old_scope = the_scope;
the_scope = block->scope;
the_block = block->prev;
- the_dyna_vars = block->d_vars;
+ the_dyna_vars = new_dvar(0, 0);
+ the_dyna_vars->next = block->d_vars;
the_class = block->klass;
if (!self) self = block->self;
node = block->body;