From d7935475fc46adc50def2f89bfe3a5b99d7707ac Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 28 Mar 2016 21:39:24 +0000 Subject: remove rb_thread_t::parse_in_eval * parse.y (struct parser_params): move parse_in_eval flag from rb_thread_t. * parse.y (rb_parser_set_context): set parsing context, not only mild error flag. * iseq.c (rb_iseq_compile_with_option): the parser now refers no thread local states to be restored. * vm_eval.c (eval_string_with_cref): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index efa35ba833..860de31f9f 100644 --- a/compile.c +++ b/compile.c @@ -6764,12 +6764,11 @@ rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc, VALUE locals, VALUE params, /* for parser */ int -rb_dvar_defined(ID id) +rb_dvar_defined(ID id, const rb_block_t *base_block) { - rb_thread_t *th = GET_THREAD(); const rb_iseq_t *iseq; - if (th->base_block && (iseq = th->base_block->iseq)) { + if (base_block && (iseq = base_block->iseq)) { while (iseq->body->type == ISEQ_TYPE_BLOCK || iseq->body->type == ISEQ_TYPE_RESCUE || iseq->body->type == ISEQ_TYPE_ENSURE || @@ -6790,14 +6789,13 @@ rb_dvar_defined(ID id) } int -rb_local_defined(ID id) +rb_local_defined(ID id, const rb_block_t *base_block) { - rb_thread_t *th = GET_THREAD(); const rb_iseq_t *iseq; - if (th->base_block && th->base_block->iseq) { + if (base_block && base_block->iseq) { unsigned int i; - iseq = th->base_block->iseq->body->local_iseq; + iseq = base_block->iseq->body->local_iseq; for (i=0; ibody->local_table_size; i++) { if (iseq->body->local_table[i] == id) { @@ -6808,18 +6806,6 @@ rb_local_defined(ID id) return 0; } -int -rb_parse_in_eval(void) -{ - return GET_THREAD()->parse_in_eval > 0; -} - -int -rb_parse_in_main(void) -{ - return GET_THREAD()->parse_in_eval < 0; -} - static int caller_location(VALUE *path, VALUE *absolute_path) { -- cgit v1.2.3