summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/iseq.c b/iseq.c
index 1723579864..cdfbae59e6 100644
--- a/iseq.c
+++ b/iseq.c
@@ -520,9 +520,12 @@ rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE rea
const NODE *node = ast ? ast->root : 0;
/* TODO: argument check */
rb_iseq_t *iseq = iseq_alloc();
+ rb_compile_option_t new_opt;
- if (!option) option = &COMPILE_OPTION_DEFAULT;
- prepare_iseq_build(iseq, name, path, realpath, first_lineno, node ? &node->nd_loc : NULL, parent, type, option);
+ new_opt = option ? *option : COMPILE_OPTION_DEFAULT;
+ if (ast && ast->compile_option) rb_iseq_make_compile_option(&new_opt, ast->compile_option);
+
+ prepare_iseq_build(iseq, name, path, realpath, first_lineno, node ? &node->nd_loc : NULL, parent, type, &new_opt);
rb_iseq_compile_node(iseq, node);
finish_iseq_build(iseq);