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

parse.y: freeze filename

* parse.y (ripper_initialize): filename can not be modified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-03-24 13:19:57 +00:00
parent 87108634e1
commit 0331e42be3
3 changed files with 10 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Mon Mar 24 22:19:56 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (ripper_initialize): filename can not be modified.
Mon Mar 24 15:19:47 2014 NARUSE, Yui <naruse@ruby-lang.org>
* addr2line.c (rb_dump_backtrace_with_lines): fetch path of the

View file

@ -11445,9 +11445,11 @@ ripper_initialize(int argc, VALUE *argv, VALUE self)
parser->eofp = Qfalse;
if (NIL_P(fname)) {
fname = STR_NEW2("(ripper)");
OBJ_FREEZE(fname);
}
else {
StringValue(fname);
fname = rb_str_new_frozen(fname);
}
parser_initialize(parser);

View file

@ -26,6 +26,10 @@ class TestRipper::Ripper < Test::Unit::TestCase
def test_filename
assert_equal '(ripper)', @ripper.filename
filename = "ripper"
ripper = Ripper.new("", filename)
filename.clear
assert_equal "ripper", ripper.filename
end
def test_lineno