summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-22 00:48:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-22 00:48:38 +0000
commitc7a56bd6d0b49d6311821991f9cc7d3499e92891 (patch)
treec3aedd182b38d8b5b114aa23e48df461a68e84a0 /vm_eval.c
parent38eb518feb76efd629a5d28899d5d837c5dc9236 (diff)
vm_eval.c: use file argument
* vm_eval.c (eval_string_with_cref): use the given file name unless eval even if scope is given. additional fix for [Bug #8436]. based on the patch by srawlins at [ruby-core:56099] [Bug #8662]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 00d1f26fb8..dfa26186f4 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1205,7 +1205,10 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
if (rb_obj_is_kind_of(scope, rb_cBinding)) {
GetBindingPtr(scope, bind);
envval = bind->env;
- if (strcmp(file, "(eval)") == 0 && bind->path != Qnil) {
+ if (strcmp(file, "(eval)") != 0) {
+ absolute_path = rb_str_new_cstr(file);
+ }
+ else if (bind->path != Qnil) {
file = RSTRING_PTR(bind->path);
line = bind->first_lineno;
absolute_path = rb_current_realfilepath();