diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-27 08:11:36 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-27 08:11:36 +0000 |
commit | 50496df640aa74acbd1e6940b6276801a04c3c2a (patch) | |
tree | 5df87b8cd9c5b850170548bd1d0c52803c5cbbee /eval.c | |
parent | 3bc544045b37a71e58261143b8caed23df3f1327 (diff) | |
download | ruby-50496df640aa74acbd1e6940b6276801a04c3c2a.tar.gz ruby-50496df640aa74acbd1e6940b6276801a04c3c2a.tar.xz ruby-50496df640aa74acbd1e6940b6276801a04c3c2a.zip |
* eval.c (rb_eval): copy on write for argument local variable
assignment.
* eval.c (assign): ditto.
* eval.c (rb_call0): update ruby_frame->argv with the default
value used for the optional arguments.
* object.c (Init_Object): "===" calls rb_obj_equal() directly.
[ruby-list:39937]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1246,8 +1246,6 @@ ruby_init() Init_stack((void*)&state); Init_heap(); PUSH_SCOPE(); - ruby_scope->local_vars = 0; - ruby_scope->local_tbl = 0; top_scope = ruby_scope; /* default visibility is private at toplevel */ SCOPE_SET(SCOPE_PRIVATE); @@ -3392,6 +3390,7 @@ rb_eval(self, n) if (ruby_scope->local_vars == 0) rb_bug("unexpected local variable assignment"); result = rb_eval(self, node->nd_value); + if (node->nd_cnt < ruby_frame->argc + 2) scope_dup(ruby_scope); ruby_scope->local_vars[node->nd_cnt] = result; break; @@ -4954,6 +4953,7 @@ assign(self, lhs, val, pcall) case NODE_LASGN: if (ruby_scope->local_vars == 0) rb_bug("unexpected local variable assignment"); + if (lhs->nd_cnt < ruby_frame->argc + 2) scope_dup(ruby_scope); ruby_scope->local_vars[lhs->nd_cnt] = val; break; @@ -5617,7 +5617,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper) if (local_vars) { if (i > 0) { /* +2 for $_ and $~ */ - MEMCPY(local_vars+2, argv, VALUE, i); + MEMCPY(local_vars+2, argv, VALUE, ruby_frame->argc); } argv += i; argc -= i; if (node->nd_opt) { |