diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-10 16:22:52 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-10 16:22:52 +0000 |
commit | b40c614b29994fa84d6d1a6bf890a67eec061aae (patch) | |
tree | a889c98c36fe74c6ff2b17cebd85ef31332e1370 | |
parent | 0798cf704290d3060479d531e10ec3beba45e4ab (diff) | |
download | ruby-b40c614b29994fa84d6d1a6bf890a67eec061aae.tar.gz ruby-b40c614b29994fa84d6d1a6bf890a67eec061aae.tar.xz ruby-b40c614b29994fa84d6d1a6bf890a67eec061aae.zip |
* parse.y (shadowing_lvar_gen): no duplicate error for "_".
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | parse.y | 32 | ||||
-rw-r--r-- | version.h | 6 |
3 files changed, 25 insertions, 17 deletions
@@ -1,3 +1,7 @@ +Tue Dec 11 01:21:21 2007 Yukihiro Matsumoto <matz@ruby-lang.org> + + * parse.y (shadowing_lvar_gen): no duplicate error for "_". + Mon Dec 10 22:08:47 2007 Akinori MUSHA <knu@iDaemons.org> * array.c (rb_ary_slice_bang): If an invalid range is given, do @@ -7626,20 +7626,24 @@ assignable_gen(struct parser_params *parser, ID id, NODE *val) static void shadowing_lvar_gen(struct parser_params *parser, ID name) { - if (dyna_in_block()) { - if (dvar_curr(name)) { - yyerror("duplicated argument name"); - } - else if (dvar_defined(name) || local_id(name)) { - rb_warningS("shadowing outer local variable - %s", rb_id2name(name)); - vtable_add(lvtbl->vars, name); - } - } - else { - if (local_id(name)) { - yyerror("duplicated argument name"); - } - } + static ID uscore; + + if (!uscore) uscore = rb_intern("_"); + if (uscore == name) return; + if (dyna_in_block()) { + if (dvar_curr(name)) { + yyerror("duplicated argument name"); + } + else if (dvar_defined(name) || local_id(name)) { + rb_warningS("shadowing outer local variable - %s", rb_id2name(name)); + vtable_add(lvtbl->vars, name); + } + } + else { + if (local_id(name)) { + yyerror("duplicated argument name"); + } + } } static void @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2007-12-10" +#define RUBY_RELEASE_DATE "2007-12-11" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20071210 +#define RUBY_RELEASE_CODE 20071211 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 12 -#define RUBY_RELEASE_DAY 10 +#define RUBY_RELEASE_DAY 11 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; |