summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-09 18:41:51 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-09 18:41:51 +0000
commitb8571b4285fc222f51d2edaaa6dedde8654e0faf (patch)
tree8fa053f13f37eb57fe0227355538b0fc2c5135fc /proc.c
parentd49052b5970147a90b653f76ba18bd9af7a971ed (diff)
* vm_eval.c (eval_string_with_cref): propagative filename and line_no
of binding. [ruby-dev:38767] [ruby-core:28307] * vm_core.h (rb_binding_t), proc.c: add filename and line_no fields to preserve them. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/proc.c b/proc.c
index 7f7c2e8cd0..fc05a8eae0 100644
--- a/proc.c
+++ b/proc.c
@@ -255,6 +255,7 @@ binding_mark(void *ptr)
if (ptr) {
bind = ptr;
RUBY_MARK_UNLESS_NULL(bind->env);
+ RUBY_MARK_UNLESS_NULL(bind->filename);
}
RUBY_MARK_LEAVE("binding");
}
@@ -290,6 +291,8 @@ binding_dup(VALUE self)
GetBindingPtr(self, src);
GetBindingPtr(bindval, dst);
dst->env = src->env;
+ dst->filename = src->filename;
+ dst->line_no = src->line_no;
return bindval;
}
@@ -316,6 +319,8 @@ rb_binding_new(void)
GetBindingPtr(bindval, bind);
bind->env = rb_vm_make_env_object(th, cfp);
+ bind->filename = cfp->iseq->filename;
+ bind->line_no = rb_vm_get_sourceline(cfp);
return bindval;
}
@@ -1892,6 +1897,8 @@ proc_binding(VALUE self)
bindval = binding_alloc(rb_cBinding);
GetBindingPtr(bindval, bind);
bind->env = proc->envval;
+ bind->filename = proc->block.iseq->filename;
+ bind->line_no = rb_iseq_first_lineno(proc->block.iseq);
return bindval;
}