summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-05 02:56:03 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-05 02:56:03 +0000
commitf403624a6fe18cc6c95a19871a2784327cb17a3c (patch)
treeee423e748129a6146db4672dbbad5779f12a5f16 /vm_eval.c
parente5eb9a16dff5ab5efd838726cfd1ca89fbe68b4f (diff)
* vm_eval.c (eval_string_with_cref): A binding should keep
refinements activation information and the refinements should be activated in subsequent eval calls with the binding. [ruby-core:67945] [Bug #10818] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 8dd9653840..6eeee5f02e 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1304,10 +1304,15 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *const cref_arg,
th->parse_in_eval--;
if (!cref && base_block->iseq) {
- orig_cref = rb_vm_get_cref(base_block->iseq, base_block->ep);
- cref = NEW_CREF(Qnil);
- crefval = (VALUE) cref;
- COPY_CREF(cref, orig_cref);
+ if (NIL_P(scope)) {
+ orig_cref = rb_vm_get_cref(base_block->iseq, base_block->ep);
+ cref = NEW_CREF(Qnil);
+ crefval = (VALUE) cref;
+ COPY_CREF(cref, orig_cref);
+ }
+ else {
+ cref = rb_vm_get_cref(base_block->iseq, base_block->ep);
+ }
}
vm_set_eval_stack(th, iseqval, cref, base_block);
th->cfp->klass = CLASS_OF(base_block->self);