diff options
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -519,11 +519,9 @@ rb_iseq_new_with_opt(const NODE *node, VALUE name, VALUE path, VALUE realpath, { /* TODO: argument check */ rb_iseq_t *iseq = iseq_alloc(); - const rb_code_range_t *code_range = NULL; if (!option) option = &COMPILE_OPTION_DEFAULT; - if (node && !imemo_type_p((VALUE)node, imemo_ifunc)) code_range = &node->nd_loc; - prepare_iseq_build(iseq, name, path, realpath, first_lineno, code_range, parent, type, option); + prepare_iseq_build(iseq, name, path, realpath, first_lineno, node ? &node->nd_loc : NULL, parent, type, option); rb_iseq_compile_node(iseq, node); finish_iseq_build(iseq); @@ -531,6 +529,23 @@ rb_iseq_new_with_opt(const NODE *node, VALUE name, VALUE path, VALUE realpath, return iseq_translate(iseq); } +rb_iseq_t * +rb_iseq_new_ifunc(const struct vm_ifunc *ifunc, VALUE name, VALUE path, VALUE realpath, + VALUE first_lineno, const rb_iseq_t *parent, + enum iseq_type type, const rb_compile_option_t *option) +{ + /* TODO: argument check */ + rb_iseq_t *iseq = iseq_alloc(); + + if (!option) option = &COMPILE_OPTION_DEFAULT; + prepare_iseq_build(iseq, name, path, realpath, first_lineno, NULL, parent, type, option); + + rb_iseq_compile_ifunc(iseq, ifunc); + finish_iseq_build(iseq); + + return iseq_translate(iseq); +} + const rb_iseq_t * rb_iseq_load_iseq(VALUE fname) { |