diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-21 08:45:57 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-21 08:45:57 +0000 |
commit | 928d89c77b81b7ef560c0f40b0119dfcd31f3605 (patch) | |
tree | 53fac06efc9b08a19a446fddc9f77b394dde17ce /vm.c | |
parent | e398e64ad73fbdb3d7fc75b5f88a9b9e50f47b52 (diff) | |
download | ruby-928d89c77b81b7ef560c0f40b0119dfcd31f3605.tar.gz |
* 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
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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("<temp>"); + iseqval = rb_iseq_new_top(node, tempstr, tempstr, tempstr, Qfalse); + } node->u1.tbl = 0; /* reset table */ ALLOCV_END(idtmp); |