ruby-changes:25982
From: nobu <ko1@a...>
Date: Fri, 30 Nov 2012 15:24:50 +0900 (JST)
Subject: [ruby-changes:25982] nobu:r38039 (trunk): parse.y: false usage of local variable
nobu 2012-11-30 15:24:40 +0900 (Fri, 30 Nov 2012) New Revision: 38039 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38039 Log: parse.y: false usage of local variable * parse.y (parser_yylex): fix false usage of local variable, it cannot appear in fname state [ruby-core:49659] [Bug #7408] Modified files: trunk/ChangeLog trunk/parse.y trunk/test/ruby/test_rubyoptions.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38038) +++ ChangeLog (revision 38039) @@ -1,3 +1,8 @@ +Fri Nov 30 15:24:37 2012 Nobuyoshi Nakada <nobu@r...> + + * parse.y (parser_yylex): fix false usage of local variable, it cannot + appear in fname state [ruby-core:49659] [Bug #7408] + Fri Nov 30 15:20:12 2012 Eric Hodel <drbrain@s...> * lib/rubygems/package.rb: Load YAML for building gems. Index: parse.y =================================================================== --- parse.y (revision 38038) +++ parse.y (revision 38039) @@ -8019,7 +8019,7 @@ ID ident = TOK_INTERN(!ENC_SINGLE(mb)); set_yylval_name(ident); - if (!IS_lex_state_for(last_state, EXPR_DOT) && + if (!IS_lex_state_for(last_state, EXPR_DOT|EXPR_FNAME) && is_local_id(ident) && lvar_defined(ident)) { lex_state = EXPR_END; } Index: test/ruby/test_rubyoptions.rb =================================================================== --- test/ruby/test_rubyoptions.rb (revision 38038) +++ test/ruby/test_rubyoptions.rb (revision 38039) @@ -533,6 +533,8 @@ assert_in_out_err(["-we", "def foo\n"" 1.times do |a| end\n""end"], "", [], []) feature6693 = '[ruby-core:46160]' assert_in_out_err(["-we", "def foo\n _a=1\nend"], "", [], [], feature6693) + 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/