aboutsummaryrefslogtreecommitdiffstats
path: root/vm_eval.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-20 00:17:25 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-20 00:17:25 +0000
commitc267d24ef0b4955ee5d0538707ed47d1b6278699 (patch)
tree7cc4faa9287f8400cfec82f20e1900def66a705b /vm_eval.c
parent895b44dcf6d94e58f3daaf78d58453e2735ee827 (diff)
downloadruby-c267d24ef0b4955ee5d0538707ed47d1b6278699.tar.gz
* 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
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c5
1 files changed, 2 insertions, 3 deletions
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);