cleaner-v2.patch

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

Download (1.63 KB)

View differences:

test/ruby/test_method.rb
508 508
    assert_equal(File.dirname(File.realpath(__FILE__)), __dir__)
509 509
    bug8436 = '[ruby-core:55123] [Bug #8436]'
510 510
    assert_equal(__dir__, eval("__dir__", binding), bug8436)
511
    assert_equal("arbitrary",
512
                 eval("__dir__", binding, File.join("arbitrary", "file.rb")),
513
                 bug8436)
511 514
  end
512 515

  
513 516
  def test_alias_owner
vm_eval.c
1195 1195
	VALUE absolute_path = Qnil;
1196 1196

  
1197 1197
	if (scope != Qnil) {
1198
	    if (rb_obj_is_kind_of(scope, rb_cBinding)) {
1199
		GetBindingPtr(scope, bind);
1200
		envval = bind->env;
1201
		if (strcmp(file, "(eval)") == 0 && bind->path != Qnil) {
1202
		    file = RSTRING_PTR(bind->path);
1203
		    line = bind->first_lineno;
1204
		    absolute_path = rb_current_realfilepath();
1205
		}
1206
	    }
1207
	    else {
1198
	    if (!rb_obj_is_kind_of(scope, rb_cBinding)) {
1208 1199
		rb_raise(rb_eTypeError,
1209 1200
			 "wrong argument type %s (expected Binding)",
1210 1201
			 rb_obj_classname(scope));
1211 1202
	    }
1203

  
1204
	    GetBindingPtr(scope, bind);
1205
	    envval = bind->env;
1206
	    if (strcmp(file, "(eval)") != 0) {
1207
		absolute_path = rb_str_new2(file);
1208
	    }
1209
	    else if (bind->path != Qnil) {
1210
		file = RSTRING_PTR(bind->path);
1211
		line = bind->first_lineno;
1212
		absolute_path = rb_current_realfilepath();
1213
	    }
1212 1214
	    GetEnvPtr(envval, env);
1213 1215
	    base_block = &env->block;
1214 1216
	}