From a81daa68337f3aab6c616e7a377bf71bcbfb8cc3 Mon Sep 17 00:00:00 2001 From: yugui Date: Sun, 16 May 2010 03:07:45 +0000 Subject: merges r27716 from trunk into ruby_1_9_2. -- * 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/branches/ruby_1_9_2@27810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- proc.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'proc.c') diff --git a/proc.c b/proc.c index 30fc2475a6..313fb34ced 100644 --- a/proc.c +++ b/proc.c @@ -254,6 +254,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"); } @@ -289,6 +290,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; } @@ -315,6 +318,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; } @@ -1893,6 +1898,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; } -- cgit v1.2.3