summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-12 13:18:13 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-12 13:18:13 +0000
commit3cbfd63479e0a3f4d49ad60c0b7c7000cd3f3c4f (patch)
tree4d0f9e2bbffcb95f5d3cfbd61739be91a62a179b /vm_eval.c
parent78358a72be1ba095a62f287ac376795f8fec78b2 (diff)
merge revision(s) r45360,r45361: [Backport #9651]
* vm_eval.c (eval_string_with_cref): Use file path even if scope is given. Related to [ruby-core:56099] [Bug #8662] and r42103. * vm_eval.c (eval_string_with_cref): Unify to use NIL_P. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/vm_eval.c b/vm_eval.c
index c7d6f73313..7382b198a7 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1218,14 +1218,15 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *const cref_arg,
VALUE absolute_path = Qnil;
VALUE fname;
+ if (file != Qundef) {
+ absolute_path = file;
+ }
+
if (scope != Qnil) {
bind = Check_TypedStruct(scope, &ruby_binding_data_type);
{
envval = bind->env;
- if (file != Qundef) {
- absolute_path = file;
- }
- else if (!NIL_P(bind->path)) {
+ if (NIL_P(absolute_path) && !NIL_P(bind->path)) {
file = bind->path;
line = bind->first_lineno;
absolute_path = rb_current_realfilepath();