Skip to content

Commit

Permalink
merge revision(s) 38039: [Backport #7408]
Browse files Browse the repository at this point in the history
	* 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
unak committed Dec 19, 2012
1 parent 59995ab commit f19478d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -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]
Expand Down
3 changes: 2 additions & 1 deletion parse.y
Expand Up @@ -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;
}
}
Expand Down
2 changes: 2 additions & 0 deletions test/ruby/test_rubyoptions.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion version.h
@@ -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
Expand Down

0 comments on commit f19478d

Please sign in to comment.