$LOAD_PATH.resolve_feature_path

Moved from RubyVM.  [Feature #15903]
This commit is contained in:
Nobuyoshi Nakada 2019-07-11 14:05:34 +09:00
parent d34303ad10
commit d77b84ca82
No known key found for this signature in database
GPG Key ID: 4BC7D6DF58D8DF60
3 changed files with 4 additions and 7 deletions

1
load.c
View File

@ -1238,6 +1238,7 @@ Init_load(void)
vm->expanded_load_path = rb_ary_tmp_new(0); vm->expanded_load_path = rb_ary_tmp_new(0);
vm->load_path_snapshot = rb_ary_tmp_new(0); vm->load_path_snapshot = rb_ary_tmp_new(0);
vm->load_path_check_cache = 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("$\"", get_loaded_features, 0);
rb_define_virtual_variable("$LOADED_FEATURES", get_loaded_features, 0); rb_define_virtual_variable("$LOADED_FEATURES", get_loaded_features, 0);

View File

@ -898,7 +898,7 @@ class TestRequire < Test::Unit::TestCase
} }
end end
if defined?(RubyVM.resolve_feature_path) if defined?($LOAD_PATH.resolve_feature_path)
def test_resolve_feature_path def test_resolve_feature_path
paths, loaded = $:.dup, $".dup paths, loaded = $:.dup, $".dup
Dir.mktmpdir do |tmp| Dir.mktmpdir do |tmp|
@ -907,9 +907,9 @@ class TestRequire < Test::Unit::TestCase
path = File.realpath(file.path) path = File.realpath(file.path)
dir, base = File.split(path) dir, base = File.split(path)
$:.unshift(dir) $:.unshift(dir)
assert_equal([:rb, path], RubyVM.resolve_feature_path(base)) assert_equal([:rb, path], $LOAD_PATH.resolve_feature_path(base))
$".push(path) $".push(path)
assert_equal([:rb, path], RubyVM.resolve_feature_path(base)) assert_equal([:rb, path], $LOAD_PATH.resolve_feature_path(base))
end end
end end
ensure ensure

4
vm.c
View File

@ -2949,8 +2949,6 @@ static VALUE usage_analysis_register_stop(VALUE self);
* #=> [:rb, "/path/to/set.rb"] * #=> [:rb, "/path/to/set.rb"]
*/ */
VALUE rb_resolve_feature_path(VALUE klass, VALUE fname);
void void
Init_VM(void) Init_VM(void)
{ {
@ -3255,8 +3253,6 @@ Init_VM(void)
/* vm_backtrace.c */ /* vm_backtrace.c */
Init_vm_backtrace(); Init_vm_backtrace();
rb_define_singleton_method(rb_cRubyVM, "resolve_feature_path", rb_resolve_feature_path, 1);
} }
void void