From b43afa0a8f82a5d806adc24afa2eaf41479da1a3 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Fri, 4 Oct 2019 01:48:31 +0900 Subject: Make parser_params have parent_iseq instead of base_block The parser needs to determine whether a local varaiable is defined or not in outer scope. For the sake, "base_block" field has kept the outer block. However, the whole block was actually unneeded; the parser used only base_block->iseq. So, this change lets parser_params have the iseq directly, instead of the whole block. --- compile.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 78d2fd4dd0..7a88f81daa 100644 --- a/compile.c +++ b/compile.c @@ -9123,11 +9123,9 @@ rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc, VALUE locals, VALUE params, /* for parser */ int -rb_dvar_defined(ID id, const struct rb_block *base_block) +rb_dvar_defined(ID id, const rb_iseq_t *iseq) { - const rb_iseq_t *iseq; - - if (base_block && (iseq = vm_block_iseq(base_block)) != NULL) { + if (iseq) { const struct rb_iseq_constant_body *body = iseq->body; while (body->type == ISEQ_TYPE_BLOCK || body->type == ISEQ_TYPE_RESCUE || @@ -9150,11 +9148,9 @@ rb_dvar_defined(ID id, const struct rb_block *base_block) } int -rb_local_defined(ID id, const struct rb_block *base_block) +rb_local_defined(ID id, const rb_iseq_t *iseq) { - const rb_iseq_t *iseq; - - if (base_block && (iseq = vm_block_iseq(base_block)) != NULL) { + if (iseq) { unsigned int i; const struct rb_iseq_constant_body *const body = iseq->body->local_iseq->body; -- cgit v1.2.3