From c267d24ef0b4955ee5d0538707ed47d1b6278699 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 20 Nov 2015 00:17:25 +0000 Subject: * vm.c (rb_vm_cref_replace_with_duplicated_cref): added. CREFs should not be shared by methods between `using'. [Bug #11247] * vm_insnhelper.c (vm_cref_replace_with_duplicated_cref): ditto. * vm.c (vm_cref_dup): should copy refinements correctly. * eval.c: use rb_vm_cref_replace_with_duplicated_cref(). * eval_intern.h: add a decl. of rb_vm_cref_replace_with_duplicated_cref(). * vm_eval.c (eval_string_with_cref): do not need to pass scope's CREF because VM can find out CREF from stack frames. * test/ruby/test_refinement.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_eval.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'vm_eval.c') diff --git a/vm_eval.c b/vm_eval.c index 1bc91f518f..d32cf1ba55 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -1271,7 +1271,6 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, rb_cref_t *const cref_ rb_block_t block, *base_block; volatile int parse_in_eval; volatile int mild_compile_error; - rb_cref_t *orig_cref; volatile VALUE file; volatile int line; @@ -1337,11 +1336,11 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, rb_cref_t *const cref_ if (!cref && base_block->iseq) { if (NIL_P(scope)) { - orig_cref = rb_vm_get_cref(base_block->ep); + rb_cref_t *orig_cref = rb_vm_get_cref(base_block->ep); cref = vm_cref_dup(orig_cref); } else { - cref = rb_vm_get_cref(base_block->ep); + cref = NULL; /* use stacked CREF */ } } vm_set_eval_stack(th, iseq, cref, base_block); -- cgit v1.2.3