Backport #8662 » cleaner-v2.patch
test/ruby/test_method.rb | ||
---|---|---|
assert_equal(File.dirname(File.realpath(__FILE__)), __dir__)
|
||
bug8436 = '[ruby-core:55123] [Bug #8436]'
|
||
assert_equal(__dir__, eval("__dir__", binding), bug8436)
|
||
assert_equal("arbitrary",
|
||
eval("__dir__", binding, File.join("arbitrary", "file.rb")),
|
||
bug8436)
|
||
end
|
||
def test_alias_owner
|
vm_eval.c | ||
---|---|---|
VALUE absolute_path = Qnil;
|
||
if (scope != Qnil) {
|
||
if (rb_obj_is_kind_of(scope, rb_cBinding)) {
|
||
GetBindingPtr(scope, bind);
|
||
envval = bind->env;
|
||
if (strcmp(file, "(eval)") == 0 && bind->path != Qnil) {
|
||
file = RSTRING_PTR(bind->path);
|
||
line = bind->first_lineno;
|
||
absolute_path = rb_current_realfilepath();
|
||
}
|
||
}
|
||
else {
|
||
if (!rb_obj_is_kind_of(scope, rb_cBinding)) {
|
||
rb_raise(rb_eTypeError,
|
||
"wrong argument type %s (expected Binding)",
|
||
rb_obj_classname(scope));
|
||
}
|
||
GetBindingPtr(scope, bind);
|
||
envval = bind->env;
|
||
if (strcmp(file, "(eval)") != 0) {
|
||
absolute_path = rb_str_new2(file);
|
||
}
|
||
else if (bind->path != Qnil) {
|
||
file = RSTRING_PTR(bind->path);
|
||
line = bind->first_lineno;
|
||
absolute_path = rb_current_realfilepath();
|
||
}
|
||
GetEnvPtr(envval, env);
|
||
base_block = &env->block;
|
||
}
|
- « Previous
- 1
- 2
- 3
- Next »