Address PR comments
This commit is contained in:
parent
1701b79b54
commit
10c5063704
@ -968,10 +968,10 @@ rb_iseq_compile_node(rb_iseq_t *iseq, const NODE *node)
|
|||||||
return iseq_setup(iseq, ret);
|
return iseq_setup(iseq, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE rb_translate_prism(rb_iseq_t *iseq, const pm_scope_node_t node, LINK_ANCHOR *const ret);
|
static VALUE rb_translate_prism(rb_iseq_t *iseq, const pm_scope_node_t *scope_node, LINK_ANCHOR *const ret);
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_iseq_compile_prism_node(rb_iseq_t * iseq, pm_scope_node_t scope_node, pm_parser_t *parser)
|
rb_iseq_compile_prism_node(rb_iseq_t * iseq, pm_scope_node_t *scope_node, pm_parser_t *parser)
|
||||||
{
|
{
|
||||||
DECL_ANCHOR(ret);
|
DECL_ANCHOR(ret);
|
||||||
INIT_ANCHOR(ret);
|
INIT_ANCHOR(ret);
|
||||||
@ -984,7 +984,7 @@ rb_iseq_compile_prism_node(rb_iseq_t * iseq, pm_scope_node_t scope_node, pm_pars
|
|||||||
constants[index] = rb_intern3((const char *) constant->start, constant->length, encoding);
|
constants[index] = rb_intern3((const char *) constant->start, constant->length, encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
scope_node.constants = (void *)constants;
|
scope_node->constants = (void *)constants;
|
||||||
|
|
||||||
CHECK(rb_translate_prism(iseq, scope_node, ret));
|
CHECK(rb_translate_prism(iseq, scope_node, ret));
|
||||||
free(constants);
|
free(constants);
|
||||||
|
10
iseq.c
10
iseq.c
@ -941,10 +941,10 @@ rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE rea
|
|||||||
return iseq_translate(iseq);
|
return iseq_translate(iseq);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE rb_iseq_compile_prism_node(rb_iseq_t * iseq, pm_scope_node_t scope_node, pm_parser_t *parser);
|
VALUE rb_iseq_compile_prism_node(rb_iseq_t * iseq, pm_scope_node_t *scope_node, pm_parser_t *parser);
|
||||||
|
|
||||||
rb_iseq_t *
|
rb_iseq_t *
|
||||||
pm_iseq_new_with_opt(pm_scope_node_t scope_node, pm_parser_t *parser, VALUE name, VALUE path, VALUE realpath,
|
pm_iseq_new_with_opt(pm_scope_node_t *scope_node, pm_parser_t *parser, VALUE name, VALUE path, VALUE realpath,
|
||||||
int first_lineno, const rb_iseq_t *parent, int isolated_depth,
|
int first_lineno, const rb_iseq_t *parent, int isolated_depth,
|
||||||
enum rb_iseq_type type, const rb_compile_option_t *option)
|
enum rb_iseq_type type, const rb_compile_option_t *option)
|
||||||
{
|
{
|
||||||
@ -954,8 +954,8 @@ pm_iseq_new_with_opt(pm_scope_node_t scope_node, pm_parser_t *parser, VALUE name
|
|||||||
|
|
||||||
if (!option) option = &COMPILE_OPTION_DEFAULT;
|
if (!option) option = &COMPILE_OPTION_DEFAULT;
|
||||||
|
|
||||||
pm_line_column_t start_line_col = pm_newline_list_line_column(&parser->newline_list, scope_node.base.location.start);
|
pm_line_column_t start_line_col = pm_newline_list_line_column(&parser->newline_list, scope_node->base.location.start);
|
||||||
pm_line_column_t end_line_col = pm_newline_list_line_column(&parser->newline_list, scope_node.base.location.end);
|
pm_line_column_t end_line_col = pm_newline_list_line_column(&parser->newline_list, scope_node->base.location.end);
|
||||||
|
|
||||||
code_loc = (rb_code_location_t) {
|
code_loc = (rb_code_location_t) {
|
||||||
.beg_pos = {
|
.beg_pos = {
|
||||||
@ -1446,7 +1446,7 @@ iseqw_s_compile_prism(int argc, VALUE *argv, VALUE self)
|
|||||||
|
|
||||||
pm_scope_node_t scope_node;
|
pm_scope_node_t scope_node;
|
||||||
pm_scope_node_init(node, &scope_node, NULL, &parser);
|
pm_scope_node_init(node, &scope_node, NULL, &parser);
|
||||||
rb_iseq_compile_prism_node(iseq, scope_node, &parser);
|
rb_iseq_compile_prism_node(iseq, &scope_node, &parser);
|
||||||
|
|
||||||
finish_iseq_build(iseq);
|
finish_iseq_build(iseq);
|
||||||
pm_node_destroy(&parser, node);
|
pm_node_destroy(&parser, node);
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
if (!popped) ADD_INSN(ret, &dummy_line_node, putnil);
|
if (!popped) ADD_INSN(ret, &dummy_line_node, putnil);
|
||||||
|
|
||||||
rb_iseq_t *
|
rb_iseq_t *
|
||||||
pm_iseq_new_with_opt(pm_scope_node_t node, pm_parser_t *parser, VALUE name, VALUE path, VALUE realpath,
|
pm_iseq_new_with_opt(pm_scope_node_t *scope_node, pm_parser_t *parser, VALUE name, VALUE path, VALUE realpath,
|
||||||
int first_lineno, const rb_iseq_t *parent, int isolated_depth,
|
int first_lineno, const rb_iseq_t *parent, int isolated_depth,
|
||||||
enum rb_iseq_type type, const rb_compile_option_t *option);
|
enum rb_iseq_type type, const rb_compile_option_t *option);
|
||||||
|
|
||||||
@ -579,7 +579,7 @@ pm_new_child_iseq(rb_iseq_t *iseq, pm_scope_node_t node, pm_parser_t *parser,
|
|||||||
{
|
{
|
||||||
debugs("[new_child_iseq]> ---------------------------------------\n");
|
debugs("[new_child_iseq]> ---------------------------------------\n");
|
||||||
int isolated_depth = ISEQ_COMPILE_DATA(iseq)->isolated_depth;
|
int isolated_depth = ISEQ_COMPILE_DATA(iseq)->isolated_depth;
|
||||||
rb_iseq_t * ret_iseq = pm_iseq_new_with_opt(node, parser, name,
|
rb_iseq_t * ret_iseq = pm_iseq_new_with_opt(&node, parser, name,
|
||||||
rb_iseq_path(iseq), rb_iseq_realpath(iseq),
|
rb_iseq_path(iseq), rb_iseq_realpath(iseq),
|
||||||
line_no, parent,
|
line_no, parent,
|
||||||
isolated_depth ? isolated_depth + 1 : 0,
|
isolated_depth ? isolated_depth + 1 : 0,
|
||||||
@ -2530,11 +2530,11 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_translate_prism(rb_iseq_t *iseq, const pm_scope_node_t scope_node, LINK_ANCHOR *const ret)
|
rb_translate_prism(rb_iseq_t *iseq, const pm_scope_node_t *scope_node, LINK_ANCHOR *const ret)
|
||||||
{
|
{
|
||||||
RUBY_ASSERT(ISEQ_COMPILE_DATA(iseq));
|
RUBY_ASSERT(ISEQ_COMPILE_DATA(iseq));
|
||||||
|
|
||||||
pm_compile_node(iseq, (pm_node_t *)&scope_node, ret, scope_node.base.location.start, false, (pm_scope_node_t *)&scope_node);
|
pm_compile_node(iseq, (pm_node_t *)scope_node, ret, scope_node->base.location.start, false, (pm_scope_node_t *)scope_node);
|
||||||
iseq_set_sequence(iseq, ret);
|
iseq_set_sequence(iseq, ret);
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user