summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-14 23:37:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-14 23:37:35 +0000
commitf3b537c5248e77d55ade4f86719e6dbf3310bcbb (patch)
tree02d7bcec92b506efc52955953f077fcfd4fa48ab /vm_eval.c
parentb135b8d084063598f8603b675a933d13f9874624 (diff)
vm_eval.c: __dir__ in eval
* vm_eval.c (eval_string_with_cref): propagate absolute path from the binding if it is given explicitly. patch by Gat (Dawid Janczak) at [ruby-core:55123]. [Bug #8436] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 8311544139..3895e5628c 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1164,6 +1164,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
int state;
VALUE result = Qundef;
VALUE envval;
+ VALUE absolute_path = Qnil;
rb_thread_t *th = GET_THREAD();
rb_env_t *env = NULL;
rb_block_t block, *base_block;
@@ -1190,6 +1191,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
if (strcmp(file, "(eval)") == 0 && bind->path != Qnil) {
file = RSTRING_PTR(bind->path);
line = bind->first_lineno;
+ absolute_path = rb_current_realfilepath();
}
}
else {
@@ -1217,7 +1219,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
/* make eval iseq */
th->parse_in_eval++;
th->mild_compile_error++;
- iseqval = rb_iseq_compile_on_base(src, rb_str_new2(file), INT2FIX(line), base_block);
+ iseqval = rb_iseq_compile_with_option(src, rb_str_new2(file), absolute_path, INT2FIX(line), base_block, Qnil);
th->mild_compile_error--;
th->parse_in_eval--;