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

ruby-changes:33395

From: nagachika <ko1@a...>
Date: Mon, 31 Mar 2014 00:43:59 +0900 (JST)
Subject: [ruby-changes:33395] nagachika:r45474 (ruby_2_0_0): merge revision(s) r45360, r45361: [Backport #9651]

nagachika	2014-03-31 00:43:51 +0900 (Mon, 31 Mar 2014)

  New Revision: 45474

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

  Log:
    merge revision(s) r45360,r45361: [Backport #9651]
    
    * vm_eval.c (eval_string_with_cref): Use file path even if scope is
      given. Related to [ruby-core:56099] [Bug #8662] and r42103.
    
    * vm_eval.c (eval_string_with_cref): Unify to use NIL_P.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/test/ruby/test_method.rb
    branches/ruby_2_0_0/version.h
    branches/ruby_2_0_0/vm_eval.c
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 45473)
+++ ruby_2_0_0/ChangeLog	(revision 45474)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Mon Mar 31 00:15:45 2014  Shota Fukumori  <her@s...>
+
+	* vm_eval.c (eval_string_with_cref): Unify to use NIL_P.
+
+Mon Mar 31 00:15:45 2014  Shota Fukumori  <her@s...>
+
+	* vm_eval.c (eval_string_with_cref): Use file path even if scope is
+	  given. Related to [ruby-core:56099] [Bug #8662] and r42103.
+
 Mon Mar 31 00:02:04 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* parse.y (yycompile): store file name as String to keep the encoding.
Index: ruby_2_0_0/vm_eval.c
===================================================================
--- ruby_2_0_0/vm_eval.c	(revision 45473)
+++ ruby_2_0_0/vm_eval.c	(revision 45474)
@@ -1194,14 +1194,15 @@ eval_string_with_cref(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_eval.c#L1194
 	VALUE absolute_path = Qnil;
 	VALUE fname;
 
+	if (file != Qundef) {
+	    absolute_path = file;
+	}
+
 	if (scope != Qnil) {
 	    if (rb_obj_is_kind_of(scope, rb_cBinding)) {
 		GetBindingPtr(scope, bind);
 		envval = bind->env;
-		if (file != Qundef) {
-		    absolute_path = file;
-		}
-		else if (!NIL_P(bind->path)) {
+		if (NIL_P(absolute_path) && !NIL_P(bind->path)) {
 		    file = bind->path;
 		    line = bind->first_lineno;
 		    absolute_path = rb_current_realfilepath();
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 45473)
+++ ruby_2_0_0/version.h	(revision 45474)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2014-03-31"
-#define RUBY_PATCHLEVEL 464
+#define RUBY_PATCHLEVEL 465
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_0_0/test/ruby/test_method.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_method.rb	(revision 45473)
+++ ruby_2_0_0/test/ruby/test_method.rb	(revision 45474)
@@ -550,6 +550,7 @@ class TestMethod < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_method.rb#L550
     assert_equal(__dir__, eval("__dir__", binding), bug8436)
     bug8662 = '[ruby-core:56099] [Bug #8662]'
     assert_equal("arbitrary", eval("__dir__", binding, "arbitrary/file.rb"), bug8662)
+    assert_equal("arbitrary", Object.new.instance_eval("__dir__", "arbitrary/file.rb"), bug8662)
   end
 
   def test_alias_owner

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r45360-45361


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

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