Project

General

Profile

Backport #8662 » cleaner-v2.patch

an even cleaner cleaner.patch - srawlins (Sam Rawlins), 07/22/2013 05:53 AM

View differences:

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;
}
(3-3/3)