diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-22 07:53:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-22 07:53:37 +0000 |
commit | 7dc4929214e608f52774cd026ea8cc173e49e6d1 (patch) | |
tree | fc323ff2449a0139c6f97472dba30e3870cc4503 /test | |
parent | 792c822ec441a9a061a2c74ddd970005fab33ab6 (diff) | |
download | ruby-7dc4929214e608f52774cd026ea8cc173e49e6d1.tar.gz |
compile.c: move logop DCE
* compile.c (iseq_peephole_optimize): remove unreachable code
chunk after jump/leave.
* parse.y: move dead code elimination of logical operation to
compile.c. not to warn logical operation of literal constants.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_syntax.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 985a46b532..e2cd389a07 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -633,6 +633,18 @@ eom assert_valid_syntax("a\n&.foo") end + def test_no_warning_logop_literal + assert_warning("") do + eval("true||raise;nil") + end + assert_warning("") do + eval("false&&raise;nil") + end + assert_warning("") do + eval("''||raise;nil") + end + end + private def not_label(x) @result = x; @not_label ||= nil end |