[前][次][番号順一覧][スレッド一覧]

ruby-changes:15872

From: yugui <ko1@a...>
Date: Sun, 16 May 2010 12:08:02 +0900 (JST)
Subject: [ruby-changes:15872] Ruby:r27810 (ruby_1_9_2): merges r27716 from trunk into ruby_1_9_2.

yugui	2010-05-16 12:07:45 +0900 (Sun, 16 May 2010)

  New Revision: 27810

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27810

  Log:
    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.

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/bootstraptest/test_eval.rb
    branches/ruby_1_9_2/proc.c
    branches/ruby_1_9_2/vm_core.h
    branches/ruby_1_9_2/vm_eval.c

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 27809)
+++ ruby_1_9_2/ChangeLog	(revision 27810)
@@ -1,3 +1,11 @@
+Mon May 10 03:36:56 2010  Yusuke Endoh  <mame@t...>
+
+	* 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.
+
 Mon May 10 02:29:51 2010  Yusuke Endoh  <mame@t...>
 
 	* cont.c (fiber_switch): raise FiberError when returning to dead
Index: ruby_1_9_2/bootstraptest/test_eval.rb
===================================================================
--- ruby_1_9_2/bootstraptest/test_eval.rb	(revision 27809)
+++ ruby_1_9_2/bootstraptest/test_eval.rb	(revision 27810)
@@ -287,7 +287,7 @@
   eval("", method(:proc).call {}.binding)
 }
 
-assert_equal "(eval):1:in `block in <main>': ", %q{
+assert_equal "", %q{
   b = binding
   10.times{
     eval('', b)
Index: ruby_1_9_2/vm_core.h
===================================================================
--- ruby_1_9_2/vm_core.h	(revision 27809)
+++ ruby_1_9_2/vm_core.h	(revision 27810)
@@ -524,6 +524,8 @@
 
 typedef struct {
     VALUE env;
+    VALUE filename;
+    unsigned short line_no;
 } rb_binding_t;
 
 /* used by compile time and send insn */
Index: ruby_1_9_2/vm_eval.c
===================================================================
--- ruby_1_9_2/vm_eval.c	(revision 27809)
+++ ruby_1_9_2/vm_eval.c	(revision 27810)
@@ -966,6 +966,10 @@
 	    if (rb_obj_is_kind_of(scope, rb_cBinding)) {
 		GetBindingPtr(scope, bind);
 		envval = bind->env;
+		if (strcmp(file, "(eval)") == 0) {
+		    file = RSTRING_PTR(bind->filename);
+		    line = bind->line_no;
+		}
 	    }
 	    else {
 		rb_raise(rb_eTypeError,
Index: ruby_1_9_2/proc.c
===================================================================
--- ruby_1_9_2/proc.c	(revision 27809)
+++ ruby_1_9_2/proc.c	(revision 27810)
@@ -254,6 +254,7 @@
     if (ptr) {
 	bind = ptr;
 	RUBY_MARK_UNLESS_NULL(bind->env);
+	RUBY_MARK_UNLESS_NULL(bind->filename);
     }
     RUBY_MARK_LEAVE("binding");
 }
@@ -289,6 +290,8 @@
     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 @@
 
     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 @@
     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;
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]