diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-06-19 09:32:13 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-06-19 09:32:13 +0000 |
commit | f9747b7a571556b6b8add7cfd4e324ad316d50b3 (patch) | |
tree | 3971f82312c9b748dcf763fd24e91489657fb36c /eval.c | |
parent | 992923053cfb51dc04c6a7ee07ca6fff1b61d1a5 (diff) |
1.1b9_27
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 71 |
1 files changed, 35 insertions, 36 deletions
@@ -455,24 +455,11 @@ new_dvar(id, value) } static void -push_dvar(id, value) - ID id; - VALUE value; -{ - the_dyna_vars = new_dvar(id, value); -} - -static void mark_dvar(vars) - struct RVarmap* vars; + struct RVarmap *vars; { - if (!vars) { - the_dyna_vars = new_dvar(0, 0); - the_dyna_vars->next = vars; - } - else { - the_dyna_vars = vars; - } + the_dyna_vars = new_dvar(0, 0); + the_dyna_vars->next = vars; } VALUE @@ -503,6 +490,14 @@ dyna_var_ref(id) return Qnil; } +void +dyna_var_push(id, value) + ID id; + VALUE value; +{ + the_dyna_vars = new_dvar(id, value); +} + VALUE dyna_var_asgn(id, value) ID id; @@ -517,10 +512,26 @@ dyna_var_asgn(id, value) } vars = vars->next; } - push_dvar(id, value); + dyna_var_push(id, value); return value; } +static void +dvar_asgn_push(id, value) + ID id; + VALUE value; +{ + if (the_dyna_vars && the_dyna_vars->id == 0) { + struct RVarmap* vars = new_dvar(id, value); + + vars->next = the_dyna_vars->next; + the_dyna_vars->next = vars; + } + else { + dyna_var_push(id, value); + } +} + struct iter { int iter; struct iter *prev; @@ -2081,15 +2092,7 @@ rb_eval(self, node) case NODE_DASGN_PUSH: result = rb_eval(self, node->nd_value); - if (the_dyna_vars && the_dyna_vars->id == 0) { - struct RVarmap* vars = new_dvar(node->nd_vid, result); - - vars->next = the_dyna_vars->next; - the_dyna_vars->next = vars; - } - else { - push_dvar(node->nd_vid, result); - } + dvar_asgn_push(node->nd_vid, result); break; case NODE_GASGN: @@ -2972,13 +2975,17 @@ assign(self, lhs, val) break; case NODE_DASGN_PUSH: - push_dvar(lhs->nd_vid, val); + dvar_asgn_push(lhs->nd_vid, val); break; case NODE_CASGN: rb_const_set(the_class, lhs->nd_vid, val); break; + case NODE_MASGN: + massign(self, lhs, val); + break; + case NODE_CALL: { VALUE recv; @@ -3817,7 +3824,7 @@ eval(self, src, scope, file, line) old_block = the_block; the_block = data->prev; old_d_vars = the_dyna_vars; - mark_dvar(data->d_vars); + the_dyna_vars = data->d_vars; old_vmode = scope_vmode; scope_vmode = data->vmode; @@ -4864,10 +4871,6 @@ f_binding(self) data->prev = 0; } - if (data->d_vars && data->d_vars->id) { - push_dvar(0, 0); - data->d_vars = the_dyna_vars; - } scope_dup(data->scope); POP_BLOCK(); @@ -4922,10 +4925,6 @@ proc_s_new(klass) break; } } - if (data->d_vars && data->d_vars->id) { - push_dvar(0, 0); - data->d_vars = the_dyna_vars; - } obj_call_init(proc); return proc; |