зеркало из https://github.com/github/ruby.git
proc.c: local variable
* proc.c (proc_binding): extract a local variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
ed8da2d12a
Коммит
9bcf16f01a
12
proc.c
12
proc.c
|
@ -2450,10 +2450,12 @@ proc_binding(VALUE self)
|
|||
rb_proc_t *proc;
|
||||
VALUE bindval;
|
||||
rb_binding_t *bind;
|
||||
rb_iseq_t *iseq;
|
||||
|
||||
GetProcPtr(self, proc);
|
||||
if (RB_TYPE_P((VALUE)proc->block.iseq, T_NODE)) {
|
||||
if (!IS_METHOD_PROC_NODE((NODE *)proc->block.iseq)) {
|
||||
iseq = proc->block.iseq;
|
||||
if (RB_TYPE_P((VALUE)iseq, T_NODE)) {
|
||||
if (!IS_METHOD_PROC_NODE((NODE *)iseq)) {
|
||||
rb_raise(rb_eArgError, "Can't create Binding from C level Proc");
|
||||
}
|
||||
}
|
||||
|
@ -2462,9 +2464,9 @@ proc_binding(VALUE self)
|
|||
GetBindingPtr(bindval, bind);
|
||||
bind->env = proc->envval;
|
||||
bind->blockprocval = proc->blockprocval;
|
||||
if (RUBY_VM_NORMAL_ISEQ_P(proc->block.iseq)) {
|
||||
bind->path = proc->block.iseq->location.path;
|
||||
bind->first_lineno = FIX2INT(rb_iseq_first_lineno(proc->block.iseq->self));
|
||||
if (RUBY_VM_NORMAL_ISEQ_P(iseq)) {
|
||||
bind->path = iseq->location.path;
|
||||
bind->first_lineno = FIX2INT(rb_iseq_first_lineno(iseq->self));
|
||||
}
|
||||
else {
|
||||
bind->path = Qnil;
|
||||
|
|
Загрузка…
Ссылка в новой задаче