Project

General

Profile

Feature #7730 ยป 0001-parse.y-warn-assigned-but-unused-in-toplevel.patch

nobu (Nobuyoshi Nakada), 01/23/2013 05:34 PM

View differences:

parse.y
9432 9432
    local->prev = lvtbl;
9433 9433
    local->args = vtable_alloc(0);
9434 9434
    local->vars = vtable_alloc(inherit_dvars ? DVARS_INHERIT : DVARS_TOPSCOPE);
9435
    local->used = !inherit_dvars && RTEST(ruby_verbose) ? vtable_alloc(0) : 0;
9435
    local->used = !(inherit_dvars && ifndef_ripper(e_option_supplied(parser))+0) &&
9436
	RTEST(ruby_verbose) ? vtable_alloc(0) : 0;
9436 9437
    lvtbl = local;
9437 9438
}
9438 9439

  
test/ruby/test_rubyoptions.rb
551 551
    assert_in_out_err(["-we", "def foo\n  _a=1\nend"], "", [], [], feature6693)
552 552
    bug7408 = '[ruby-core:49659]'
553 553
    assert_in_out_err(["-we", "def foo\n  a=1\n :a\nend"], "", [], ["-e:2: warning: assigned but unused variable - a"], bug7408)
554
    feature7730 = '[ruby-core:51580]'
555
    assert_in_out_err(["-w", "-"], "a=1", [], ["-:1: warning: assigned but unused variable - a"], feature7730)
554 556
  end
555 557

  
556 558
  def test_shadowing_variable
557
-