diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-10-04 01:48:31 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-10-04 02:30:36 +0900 |
commit | b43afa0a8f82a5d806adc24afa2eaf41479da1a3 (patch) | |
tree | b62d5698e738b2dcf16ecb7b91d7b7c7b1dae426 /compile.c | |
parent | 711c40ebdcd0974ef3e6ac6870412dc88ae25f3e (diff) |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2519
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -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; |