* parse.y (ripper_get_value): escape Qundef.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-04-26 04:11:59 +00:00
parent 3cbb849bbb
commit b0018f6859
3 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,7 @@
Mon Apr 26 13:11:57 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (ripper_get_value): escape Qundef.
Mon Apr 26 12:42:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> Mon Apr 26 12:42:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (warn_balanced): warn according to last state. * parse.y (warn_balanced): warn according to last state.

View File

@ -10351,6 +10351,7 @@ static VALUE
ripper_get_value(VALUE v) ripper_get_value(VALUE v)
{ {
NODE *nd; NODE *nd;
if (v == Qundef) return Qnil;
if (!RB_TYPE_P(v, T_NODE)) return v; if (!RB_TYPE_P(v, T_NODE)) return v;
nd = (NODE *)v; nd = (NODE *)v;
if (nd_type(nd) != NODE_LASGN) return Qnil; if (nd_type(nd) != NODE_LASGN) return Qnil;

View File

@ -463,6 +463,7 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
thru_def = true thru_def = true
} }
assert_equal true, thru_def assert_equal true, thru_def
assert_equal '[def(foo,[],bodystmt([void()]))]', parse('def foo ;end')
end end
def test_defined def test_defined
@ -1102,10 +1103,8 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
end end
def test_unterminated_regexp def test_unterminated_regexp
assert_normal_exit(<<"SRC") compile_error = false
$:.unshift(File.dirname(#{File.expand_path(__FILE__).dump})) parse('/', :compile_error) {|msg| compile_error = msg}
require 'dummyparser' assert_equal("unterminated regexp meets end of file", compile_error)
DummyParser.new('/').parse.to_s
SRC
end end
end if ripper_test end if ripper_test