aboutsummaryrefslogtreecommitdiffstats
path: root/iseq.c
diff options
context:
space:
mode:
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,