This commit is contained in:
Jemma Issroff 2023-10-18 15:18:37 -03:00 коммит произвёл Aaron Patterson
Родитель 252b0fc715
Коммит 5408ce8c17
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -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 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);
@ -574,7 +574,7 @@ pm_constant_id_lookup(pm_scope_node_t *scope_node, pm_constant_id_t constant_id)
} }
static rb_iseq_t * static rb_iseq_t *
pm_new_child_iseq(rb_iseq_t *iseq, pm_scope_node_t * node, pm_parser_t *parser, pm_new_child_iseq(rb_iseq_t *iseq, pm_scope_node_t node, pm_parser_t *parser,
VALUE name, const rb_iseq_t *parent, enum rb_iseq_type type, int line_no) VALUE name, const rb_iseq_t *parent, enum rb_iseq_type type, int line_no)
{ {
debugs("[new_child_iseq]> ---------------------------------------\n"); debugs("[new_child_iseq]> ---------------------------------------\n");
@ -1029,7 +1029,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
pm_scope_node_t next_scope_node; pm_scope_node_t next_scope_node;
pm_scope_node_init(call_node->block, &next_scope_node, scope_node, parser); pm_scope_node_init(call_node->block, &next_scope_node, scope_node, parser);
const rb_iseq_t *block_iseq = NEW_CHILD_ISEQ(&next_scope_node, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, lineno); const rb_iseq_t *block_iseq = NEW_CHILD_ISEQ(next_scope_node, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, lineno);
ISEQ_COMPILE_DATA(iseq)->current_block = block_iseq; ISEQ_COMPILE_DATA(iseq)->current_block = block_iseq;
ADD_SEND_WITH_BLOCK(ret, &dummy_line_node, method_id, INT2FIX(orig_argc), block_iseq); ADD_SEND_WITH_BLOCK(ret, &dummy_line_node, method_id, INT2FIX(orig_argc), block_iseq);
} }
@ -1065,7 +1065,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
VALUE class_name = rb_str_freeze(rb_sprintf("<class:%"PRIsVALUE">", rb_id2str(class_id))); VALUE class_name = rb_str_freeze(rb_sprintf("<class:%"PRIsVALUE">", rb_id2str(class_id)));
const rb_iseq_t *class_iseq = NEW_CHILD_ISEQ(&next_scope_node, class_name, ISEQ_TYPE_CLASS, lineno); const rb_iseq_t *class_iseq = NEW_CHILD_ISEQ(next_scope_node, class_name, ISEQ_TYPE_CLASS, lineno);
// TODO: Once we merge constant path nodes correctly, fix this flag // TODO: Once we merge constant path nodes correctly, fix this flag
const int flags = VM_DEFINECLASS_TYPE_CLASS | const int flags = VM_DEFINECLASS_TYPE_CLASS |
@ -1344,7 +1344,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
ID method_name = pm_constant_id_lookup(scope_node, def_node->name); ID method_name = pm_constant_id_lookup(scope_node, def_node->name);
pm_scope_node_t next_scope_node; pm_scope_node_t next_scope_node;
pm_scope_node_init((pm_node_t *)def_node, &next_scope_node, scope_node, parser); pm_scope_node_init((pm_node_t *)def_node, &next_scope_node, scope_node, parser);
rb_iseq_t *method_iseq = NEW_ISEQ(&next_scope_node, rb_id2str(method_name), ISEQ_TYPE_METHOD, lineno); rb_iseq_t *method_iseq = NEW_ISEQ(next_scope_node, rb_id2str(method_name), ISEQ_TYPE_METHOD, lineno);
ADD_INSN2(ret, &dummy_line_node, definemethod, ID2SYM(method_name), method_iseq); ADD_INSN2(ret, &dummy_line_node, definemethod, ID2SYM(method_name), method_iseq);
RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)method_iseq); RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)method_iseq);
@ -1787,7 +1787,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
pm_scope_node_t next_scope_node; pm_scope_node_t next_scope_node;
pm_scope_node_init(node, &next_scope_node, scope_node, parser); pm_scope_node_init(node, &next_scope_node, scope_node, parser);
const rb_iseq_t *block = NEW_CHILD_ISEQ(&next_scope_node, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, lineno); const rb_iseq_t *block = NEW_CHILD_ISEQ(next_scope_node, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, lineno);
VALUE argc = INT2FIX(0); VALUE argc = INT2FIX(0);
ADD_INSN1(ret, &dummy_line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); ADD_INSN1(ret, &dummy_line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
@ -2029,7 +2029,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
ID module_id = pm_constant_id_lookup(scope_node, module_node->name); ID module_id = pm_constant_id_lookup(scope_node, module_node->name);
VALUE module_name = rb_str_freeze(rb_sprintf("<module:%"PRIsVALUE">", rb_id2str(module_id))); VALUE module_name = rb_str_freeze(rb_sprintf("<module:%"PRIsVALUE">", rb_id2str(module_id)));
const rb_iseq_t *module_iseq = NEW_CHILD_ISEQ(&next_scope_node, module_name, ISEQ_TYPE_CLASS, lineno); const rb_iseq_t *module_iseq = NEW_CHILD_ISEQ(next_scope_node, module_name, ISEQ_TYPE_CLASS, lineno);
const int flags = VM_DEFINECLASS_TYPE_MODULE | const int flags = VM_DEFINECLASS_TYPE_MODULE |
pm_compile_class_path(ret, iseq, module_node->constant_path, &dummy_line_node, src, false, scope_node); pm_compile_class_path(ret, iseq, module_node->constant_path, &dummy_line_node, src, false, scope_node);
@ -2349,7 +2349,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
pm_scope_node_t next_scope_node; pm_scope_node_t next_scope_node;
pm_scope_node_init((pm_node_t *)singleton_class_node, &next_scope_node, scope_node, parser); pm_scope_node_init((pm_node_t *)singleton_class_node, &next_scope_node, scope_node, parser);
const rb_iseq_t *singleton_class = NEW_ISEQ(&next_scope_node, rb_fstring_lit("singleton class"), ISEQ_TYPE_CLASS, lineno); const rb_iseq_t *singleton_class = NEW_ISEQ(next_scope_node, rb_fstring_lit("singleton class"), ISEQ_TYPE_CLASS, lineno);
PM_COMPILE(singleton_class_node->expression); PM_COMPILE(singleton_class_node->expression);
ADD_INSN(ret, &dummy_line_node, putnil); ADD_INSN(ret, &dummy_line_node, putnil);