1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: no assigned but unused warnings in eval

* parse.y (local_push_gen): no assigned but unused variable warnings
  in eval as well as -e.  [Feature #7730] [ruby-core:51580]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-01-31 07:33:30 +00:00
parent b10e6b69a5
commit 20af032e82
3 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Thu Jan 31 16:33:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (local_push_gen): no assigned but unused variable warnings
in eval as well as -e. [Feature #7730] [ruby-core:51580]
Wed Jan 30 12:30:08 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com> Wed Jan 30 12:30:08 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* test/ruby/test_signal.rb (test_trap_puts): Fix typo. "sync" * test/ruby/test_signal.rb (test_trap_puts): Fix typo. "sync"

View file

@ -9432,7 +9432,8 @@ local_push_gen(struct parser_params *parser, int inherit_dvars)
local->prev = lvtbl; local->prev = lvtbl;
local->args = vtable_alloc(0); local->args = vtable_alloc(0);
local->vars = vtable_alloc(inherit_dvars ? DVARS_INHERIT : DVARS_TOPSCOPE); local->vars = vtable_alloc(inherit_dvars ? DVARS_INHERIT : DVARS_TOPSCOPE);
local->used = !(inherit_dvars && ifndef_ripper(e_option_supplied(parser))+0) && local->used = !(inherit_dvars &&
(ifndef_ripper(compile_for_eval || e_option_supplied(parser))+0)) &&
RTEST(ruby_verbose) ? vtable_alloc(0) : 0; RTEST(ruby_verbose) ? vtable_alloc(0) : 0;
lvtbl = local; lvtbl = local;
} }

View file

@ -554,6 +554,7 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err(["-we", "def foo\n a=1\n :a\nend"], "", [], ["-e:2: warning: assigned but unused variable - a"], bug7408) assert_in_out_err(["-we", "def foo\n a=1\n :a\nend"], "", [], ["-e:2: warning: assigned but unused variable - a"], bug7408)
feature7730 = '[ruby-core:51580]' feature7730 = '[ruby-core:51580]'
assert_in_out_err(["-w", "-"], "a=1", [], ["-:1: warning: assigned but unused variable - a"], feature7730) assert_in_out_err(["-w", "-"], "a=1", [], ["-:1: warning: assigned but unused variable - a"], feature7730)
assert_in_out_err(["-w", "-"], "eval('a=1')", [], [], feature7730)
end end
def test_shadowing_variable def test_shadowing_variable