dir_eval.diff

Dawid Janczak, 05/23/2013 02:31 AM

Download (1.39 KB)

View differences:

test/ruby/test_method.rb (working copy)
553 553

  
554 554
  def test___dir__
555 555
    assert_instance_of String, __dir__
556
    assert_equal(File.dirname(__FILE__), __dir__)
556
    assert_equal(File.dirname(File.realpath(__FILE__)), __dir__)
557
    assert_equal(__dir__, eval("__dir__", binding))
557 558
  end
558 559

  
559 560
  def test_alias_owner
vm_eval.c (working copy)
1164 1164
    int state;
1165 1165
    VALUE result = Qundef;
1166 1166
    VALUE envval;
1167
    VALUE absolute_path = Qnil;
1167 1168
    rb_thread_t *th = GET_THREAD();
1168 1169
    rb_env_t *env = NULL;
1169 1170
    rb_block_t block, *base_block;
......
1190 1191
		if (strcmp(file, "(eval)") == 0 && bind->path != Qnil) {
1191 1192
		    file = RSTRING_PTR(bind->path);
1192 1193
		    line = bind->first_lineno;
1194
		    absolute_path = rb_current_realfilepath();
1193 1195
		}
1194 1196
	    }
1195 1197
	    else {
......
1217 1219
	/* make eval iseq */
1218 1220
	th->parse_in_eval++;
1219 1221
	th->mild_compile_error++;
1220
	iseqval = rb_iseq_compile_on_base(src, rb_str_new2(file), INT2FIX(line), base_block);
1222
	iseqval = rb_iseq_compile_with_option(src, rb_str_new2(file), absolute_path, INT2FIX(line), base_block, Qnil);
1221 1223
	th->mild_compile_error--;
1222 1224
	th->parse_in_eval--;
1223 1225