Permalink
Browse files

merge revision(s) 38039: [Backport #7408]

	* parse.y (parser_yylex): fix false usage of local variable, it cannot
	  appear in fname state [ruby-core:49659] [Bug #7408]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 59995ab commit f19478d5e39e9512bdbc73cd6510bd341d058128 @unak unak committed Dec 19, 2012
Showing with 10 additions and 2 deletions.
  1. +5 −0 ChangeLog
  2. +2 −1 parse.y
  3. +2 −0 test/ruby/test_rubyoptions.rb
  4. +1 −1 version.h
View
@@ -1,3 +1,8 @@
+Wed Dec 19 21:15:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_yylex): fix false usage of local variable, it cannot
+ appear in fname state [ruby-core:49659] [Bug #7408]
+
Wed Dec 19 21:14:28 2012 Narihiro Nakamura <authornari@gmail.com>
* gc.c: return true or false. Patch by Dirkjan Bussink. [Bug #6821]
View
@@ -7923,7 +7923,8 @@ parser_yylex(struct parser_params *parser)
ID ident = TOK_INTERN(!ENC_SINGLE(mb));
set_yylval_name(ident);
- if (last_state != EXPR_DOT && is_local_id(ident) && lvar_defined(ident)) {
+ if (last_state != EXPR_DOT && last_state != EXPR_FNAME &&
+ is_local_id(ident) && lvar_defined(ident)) {
lex_state = EXPR_END;
}
}
@@ -489,6 +489,8 @@ def test_unused_variable
assert_in_out_err(["-we", "1.times do\n a=1\nend"], "", [], [], feature3446)
assert_in_out_err(["-we", "def foo\n 1.times do\n a=1\n end\nend"], "", [], ["-e:3: warning: assigned but unused variable - a"], feature3446)
assert_in_out_err(["-we", "def foo\n"" 1.times do |a| end\n""end"], "", [], [])
+ bug7408 = '[ruby-core:49659]'
+ assert_in_out_err(["-we", "def foo\n a=1\n :a\nend"], "", [], ["-e:2: warning: assigned but unused variable - a"], bug7408)
end
def test_shadowing_variable
View
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 343
+#define RUBY_PATCHLEVEL 344
#define RUBY_RELEASE_DATE "2012-12-19"
#define RUBY_RELEASE_YEAR 2012

0 comments on commit f19478d

Please sign in to comment.