From 93639b65bdea42bf8e7360a81376ce319e7e38b5 Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 21 May 2015 08:45:57 +0000 Subject: * proc.c: fix issues caused by binding created from Method#to_proc. [Bug #11163] * vm.c (vm_cref_new_toplevel): export as rb_vm_cref_new_toplevel(). * test/ruby/test_method.rb: add some assersions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'vm.c') diff --git a/vm.c b/vm.c index 75304c34aa..faac85b2b2 100644 --- a/vm.c +++ b/vm.c @@ -98,6 +98,12 @@ vm_cref_new_toplevel(rb_thread_t *th) return cref; } +rb_cref_t * +rb_vm_cref_new_toplevel(void) +{ + return vm_cref_new_toplevel(GET_THREAD()); +} + static void vm_cref_dump(const char *mesg, const rb_cref_t *cref) { @@ -772,8 +778,14 @@ rb_binding_add_dynavars(rb_binding_t *bind, int dyncount, const ID *dynvars) MEMCPY(dyns + 1, dynvars, ID, dyncount); node = NEW_NODE(NODE_SCOPE, dyns, 0, 0); + if (base_iseq) { iseqval = rb_iseq_new(node, base_iseq->location.label, path, path, base_iseq->self, ISEQ_TYPE_EVAL); + } + else { + VALUE tempstr = rb_str_new2(""); + iseqval = rb_iseq_new_top(node, tempstr, tempstr, tempstr, Qfalse); + } node->u1.tbl = 0; /* reset table */ ALLOCV_END(idtmp); -- cgit v1.2.3