aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-10-04 01:48:31 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-10-04 02:30:36 +0900
commitb43afa0a8f82a5d806adc24afa2eaf41479da1a3 (patch)
treeb62d5698e738b2dcf16ecb7b91d7b7c7b1dae426 /compile.c
parent711c40ebdcd0974ef3e6ac6870412dc88ae25f3e (diff)
downloadruby-b43afa0a8f82a5d806adc24afa2eaf41479da1a3.tar.gz
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.
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c12
1 files changed, 4 insertions, 8 deletions
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;