summaryrefslogtreecommitdiff
path: root/parse.y
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 /parse.y
parent711c40ebdcd0974ef3e6ac6870412dc88ae25f3e (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 'parse.y')
-rw-r--r--parse.y12
1 files changed, 6 insertions, 6 deletions
diff --git a/parse.y b/parse.y
index 651e2cea6e..8ff7b8aa29 100644
--- a/parse.y
+++ b/parse.y
@@ -294,7 +294,7 @@ struct parser_params {
NODE *eval_tree;
VALUE error_buffer;
VALUE debug_lines;
- const struct rb_block *base_block;
+ const rb_iseq_t *parent_iseq;
struct {
NODE *outer, *inner, *current;
@@ -329,7 +329,7 @@ static int parser_yyerror(struct parser_params*, const YYLTYPE *yylloc, const ch
#ifdef RIPPER
#define compile_for_eval (0)
#else
-#define compile_for_eval (p->base_block != 0)
+#define compile_for_eval (p->parent_iseq != 0)
#endif
#define token_column ((int)(p->lex.ptok - p->lex.pbeg))
@@ -11777,7 +11777,7 @@ local_id_ref(struct parser_params *p, ID id, ID **vidrefp)
}
if (vars && vars->prev == DVARS_INHERIT) {
- return rb_local_defined(id, p->base_block);
+ return rb_local_defined(id, p->parent_iseq);
}
else if (vtable_included(args, id)) {
return 1;
@@ -11920,7 +11920,7 @@ dvar_defined_ref(struct parser_params *p, ID id, ID **vidrefp)
}
if (vars == DVARS_INHERIT) {
- return rb_dvar_defined(id, p->base_block);
+ return rb_dvar_defined(id, p->parent_iseq);
}
return 0;
@@ -12301,13 +12301,13 @@ rb_parser_new(void)
}
VALUE
-rb_parser_set_context(VALUE vparser, const struct rb_block *base, int main)
+rb_parser_set_context(VALUE vparser, const rb_iseq_t *base, int main)
{
struct parser_params *p;
TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, p);
p->error_buffer = main ? Qfalse : Qnil;
- p->base_block = base;
+ p->parent_iseq = base;
return vparser;
}
#endif