summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-27 01:16:25 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-27 01:16:25 +0000
commitd090f17f21c1b938e9aa97c14e9e2d7e079b4420 (patch)
tree517d6d448e3a5b50b908e7ca19b822f88cc8d873 /iseq.c
parent197e7b812c8ab14a7b61b7d0425c70768453ac65 (diff)
* iseq.c (rb_iseq_compile_with_option): Instead of testing
respond_to, just check if the argument is actually a file, because by calling user-defined gets something weired can happen. Patch by Glass_saga. [ruby-dev:40202] [Bug #2861] * parse.y (ripper_initialize): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/iseq.c b/iseq.c
index b0cf8014c9..348836b99a 100644
--- a/iseq.c
+++ b/iseq.c
@@ -590,11 +590,16 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE li
if ((state = EXEC_TAG()) == 0) {
int ln = NUM2INT(line);
const char *fn = StringValueCStr(file);
- NODE *node = parse_string(StringValue(src), fn, ln);
+ NODE *node;
rb_compile_option_t option;
make_compile_option(&option, opt);
+ if (RB_TYPE_P((src), T_FILE))
+ node = rb_compile_file(fn, src, ln);
+ else
+ node = parse_string(StringValue(src), fn, ln);
+
if (base_block && base_block->iseq) {
iseqval = rb_iseq_new_with_opt(node, base_block->iseq->location.label,
file, absolute_path, line, base_block->iseq->self,