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

ruby-changes:56414

From: Nobuyoshi <ko1@a...>
Date: Thu, 11 Jul 2019 14:12:39 +0900 (JST)
Subject: [ruby-changes:56414] Nobuyoshi Nakada: d77b84ca82 (master): $LOAD_PATH.resolve_feature_path

https://git.ruby-lang.org/ruby.git/commit/?id=d77b84ca82

From d77b84ca82e1cef10ef06776a207151ef864b3ca Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 11 Jul 2019 14:05:34 +0900
Subject: $LOAD_PATH.resolve_feature_path

Moved from RubyVM.  [Feature #15903]

diff --git a/load.c b/load.c
index 7661616..4eb3f7f 100644
--- a/load.c
+++ b/load.c
@@ -1238,6 +1238,7 @@ Init_load(void) https://github.com/ruby/ruby/blob/trunk/load.c#L1238
     vm->expanded_load_path = rb_ary_tmp_new(0);
     vm->load_path_snapshot = rb_ary_tmp_new(0);
     vm->load_path_check_cache = 0;
+    rb_define_singleton_method(vm->load_path, "resolve_feature_path", rb_resolve_feature_path, 1);
 
     rb_define_virtual_variable("$\"", get_loaded_features, 0);
     rb_define_virtual_variable("$LOADED_FEATURES", get_loaded_features, 0);
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb
index afd5d20..56dfd95 100644
--- a/test/ruby/test_require.rb
+++ b/test/ruby/test_require.rb
@@ -898,7 +898,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L898
     }
   end
 
-  if defined?(RubyVM.resolve_feature_path)
+  if defined?($LOAD_PATH.resolve_feature_path)
     def test_resolve_feature_path
       paths, loaded = $:.dup, $".dup
       Dir.mktmpdir do |tmp|
@@ -907,9 +907,9 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L907
           path = File.realpath(file.path)
           dir, base = File.split(path)
           $:.unshift(dir)
-          assert_equal([:rb, path], RubyVM.resolve_feature_path(base))
+          assert_equal([:rb, path], $LOAD_PATH.resolve_feature_path(base))
           $".push(path)
-          assert_equal([:rb, path], RubyVM.resolve_feature_path(base))
+          assert_equal([:rb, path], $LOAD_PATH.resolve_feature_path(base))
         end
       end
     ensure
diff --git a/vm.c b/vm.c
index 7ad6bdd..09e727f 100644
--- a/vm.c
+++ b/vm.c
@@ -2949,8 +2949,6 @@ static VALUE usage_analysis_register_stop(VALUE self); https://github.com/ruby/ruby/blob/trunk/vm.c#L2949
  *      #=> [:rb, "/path/to/set.rb"]
  */
 
-VALUE rb_resolve_feature_path(VALUE klass, VALUE fname);
-
 void
 Init_VM(void)
 {
@@ -3255,8 +3253,6 @@ Init_VM(void) https://github.com/ruby/ruby/blob/trunk/vm.c#L3253
 
     /* vm_backtrace.c */
     Init_vm_backtrace();
-
-    rb_define_singleton_method(rb_cRubyVM, "resolve_feature_path", rb_resolve_feature_path, 1);
 }
 
 void
-- 
cgit v0.10.2


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

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