diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-12-06 10:53:51 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-12-06 10:53:51 +0000 |
commit | a472da8900a5e763da11a2c010be74756112d69d (patch) | |
tree | 81d114776781ca5cecf9da1cfa20da0d1fde93ab | |
parent | 2aee0d514432f05cf7baa9581d71c4366f188bce (diff) | |
download | ruby-a472da8900a5e763da11a2c010be74756112d69d.tar.gz |
backport from ruby_1_8
* parse.y (dyna_init_gen): dvar initialization only if dvar is
assigned inner block. [ruby-talk:227402]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@11356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 24 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 28 insertions, 3 deletions
@@ -1,3 +1,8 @@ +Mon Dec 4 10:43:46 2006 Yukihiro Matsumoto <matz@ruby-lang.org> + + * parse.y (dyna_init_gen): dvar initialization only if dvar is + assigned inner block. [ruby-talk:227402] + Mon Dec 4 10:22:26 2006 URABE Shyouhei <shyouhei@ice.uec.ac.jp> * stable version 1.8.5-p2 relased. @@ -4866,6 +4866,8 @@ gettable(id) return 0; } +static VALUE dyna_var_lookup _((ID id)); + static NODE* assignable(id, val) ID id; @@ -4894,7 +4896,7 @@ assignable(id, val) if (rb_dvar_curr(id)) { return NEW_DASGN_CURR(id, val); } - else if (rb_dvar_defined(id)) { + else if (dyna_var_lookup(id)) { return NEW_DASGN(id, val); } else if (local_id(id) || !dyna_in_block()) { @@ -5736,6 +5738,22 @@ top_local_setup() local_pop(); } +static VALUE +dyna_var_lookup(id) + ID id; +{ + struct RVarmap *vars = ruby_dyna_vars; + + while (vars) { + if (vars->id == id) { + vars->val = Qtrue; + return Qtrue; + } + vars = vars->next; + } + return Qfalse; +} + static struct RVarmap* dyna_push() { @@ -5770,7 +5788,9 @@ dyna_init(node, pre) if (!node || !post || pre == post) return node; for (var = 0; post != pre && post->id; post = post->next) { - var = NEW_DASGN_CURR(post->id, var); + if (RTEST(post->val)) { + var = NEW_DASGN_CURR(post->id, var); + } } return block_append(var, node); } @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2006-12-06" #define RUBY_VERSION_CODE 185 #define RUBY_RELEASE_CODE 20061206 -#define RUBY_PATCHLEVEL 6 +#define RUBY_PATCHLEVEL 7 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 |