1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

iseq.c (rb_iseq_compile_on_base): Removed

ko1 cannot remember why he introduced the function.  And it is not used.

After it is removed, the argument "base_block" of
rb_iseq_compile_with_option is always zero.
This commit is contained in:
Yusuke Endoh 2019-10-04 21:30:32 +09:00
parent 113bef6976
commit c8a18e25c1
2 changed files with 8 additions and 22 deletions

27
iseq.c
View file

@ -966,12 +966,10 @@ rb_iseq_load(VALUE data, VALUE parent, VALUE opt)
} }
rb_iseq_t * rb_iseq_t *
rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, const struct rb_block *base_block, VALUE opt) rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, VALUE opt)
{ {
rb_iseq_t *iseq = NULL; rb_iseq_t *iseq = NULL;
const rb_iseq_t *const parent = base_block ? vm_block_iseq(base_block) : NULL;
rb_compile_option_t option; rb_compile_option_t option;
const enum iseq_type type = parent ? ISEQ_TYPE_EVAL : ISEQ_TYPE_TOP;
#if !defined(__GNUC__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 8) #if !defined(__GNUC__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 8)
# define INITIALIZED volatile /* suppress warnings by gcc 4.8 */ # define INITIALIZED volatile /* suppress warnings by gcc 4.8 */
#else #else
@ -994,11 +992,8 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, c
} }
{ {
const VALUE parser = rb_parser_new(); const VALUE parser = rb_parser_new();
const rb_iseq_t *outer_scope = parent; VALUE name = rb_fstring_lit("<compiled>");
if (!outer_scope) { const rb_iseq_t *outer_scope = rb_iseq_new(NULL, name, name, Qnil, 0, ISEQ_TYPE_TOP);
VALUE name = rb_fstring_lit("<compiled>");
outer_scope = rb_iseq_new(NULL, name, name, Qnil, 0, ISEQ_TYPE_TOP);
}
VALUE outer_scope_v = (VALUE)outer_scope; VALUE outer_scope_v = (VALUE)outer_scope;
rb_parser_set_context(parser, outer_scope, FALSE); rb_parser_set_context(parser, outer_scope, FALSE);
RB_GC_GUARD(outer_scope_v); RB_GC_GUARD(outer_scope_v);
@ -1010,11 +1005,9 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, c
rb_exc_raise(GET_EC()->errinfo); rb_exc_raise(GET_EC()->errinfo);
} }
else { else {
INITIALIZED VALUE label = parent ? INITIALIZED VALUE label = rb_fstring_lit("<compiled>");
parent->body->location.label :
rb_fstring_lit("<compiled>");
iseq = rb_iseq_new_with_opt(&ast->body, label, file, realpath, line, iseq = rb_iseq_new_with_opt(&ast->body, label, file, realpath, line,
parent, type, &option); 0, ISEQ_TYPE_TOP, &option);
rb_ast_dispose(ast); rb_ast_dispose(ast);
} }
@ -1024,13 +1017,7 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, c
rb_iseq_t * rb_iseq_t *
rb_iseq_compile(VALUE src, VALUE file, VALUE line) rb_iseq_compile(VALUE src, VALUE file, VALUE line)
{ {
return rb_iseq_compile_with_option(src, file, Qnil, line, 0, Qnil); return rb_iseq_compile_with_option(src, file, Qnil, line, Qnil);
}
rb_iseq_t *
rb_iseq_compile_on_base(VALUE src, VALUE file, VALUE line, const struct rb_block *base_block)
{
return rb_iseq_compile_with_option(src, file, Qnil, line, base_block, Qnil);
} }
VALUE VALUE
@ -1214,7 +1201,7 @@ iseqw_s_compile(int argc, VALUE *argv, VALUE self)
Check_Type(path, T_STRING); Check_Type(path, T_STRING);
Check_Type(file, T_STRING); Check_Type(file, T_STRING);
return iseqw_new(rb_iseq_compile_with_option(src, file, path, line, 0, opt)); return iseqw_new(rb_iseq_compile_with_option(src, file, path, line, opt));
} }
/* /*

View file

@ -1021,8 +1021,7 @@ rb_iseq_t *rb_iseq_new_with_callback(const struct rb_iseq_new_with_callback_call
/* src -> iseq */ /* src -> iseq */
rb_iseq_t *rb_iseq_compile(VALUE src, VALUE file, VALUE line); rb_iseq_t *rb_iseq_compile(VALUE src, VALUE file, VALUE line);
rb_iseq_t *rb_iseq_compile_on_base(VALUE src, VALUE file, VALUE line, const struct rb_block *base_block); rb_iseq_t *rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, VALUE opt);
rb_iseq_t *rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, const struct rb_block *base_block, VALUE opt);
VALUE rb_iseq_disasm(const rb_iseq_t *iseq); VALUE rb_iseq_disasm(const rb_iseq_t *iseq);
int rb_iseq_disasm_insn(VALUE str, const VALUE *iseqval, size_t pos, const rb_iseq_t *iseq, VALUE child); int rb_iseq_disasm_insn(VALUE str, const VALUE *iseqval, size_t pos, const rb_iseq_t *iseq, VALUE child);