summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-01 00:58:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-01 00:58:52 +0000
commitb8243bb8f29621612481a6bb3dd5e7abbcb541f5 (patch)
tree99672e4abca3b47c21f7c7a678b1182f5c2b03fa
parentd6347a467d2b2f5628f45da473fa9e159bbc5c13 (diff)
compile.c: fix loading pathobj
* compile.c (ibf_load_iseq_each): location.pathobj may not be a mere string now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--compile.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index e09e828c6f..05dcfa8fec 100644
--- a/compile.c
+++ b/compile.c
@@ -8049,7 +8049,25 @@ ibf_load_iseq_each(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t of
RB_OBJ_WRITE(iseq, &load_body->mark_ary, iseq_mark_ary_create((int)body->mark_ary));
- RB_OBJ_WRITE(iseq, &load_body->location.pathobj, ibf_load_location_str(load, body->location.pathobj));
+ {
+ VALUE realpath = Qnil, path = ibf_load_object(load, body->location.pathobj);
+ if (RB_TYPE_P(path, T_STRING)) {
+ realpath = path = rb_fstring(path);
+ }
+ else if (RB_TYPE_P(path, T_ARRAY)) {
+ VALUE pathobj = path;
+ if (RARRAY_LEN(pathobj) != 2) {
+ rb_raise(rb_eRuntimeError, "path object size mismatch");
+ }
+ path = rb_fstring(RARRAY_AREF(pathobj, 0));
+ realpath = rb_fstring(RARRAY_AREF(pathobj, 1));
+ }
+ else {
+ rb_raise(rb_eRuntimeError, "unexpected path object");
+ }
+ rb_iseq_pathobj_set(iseq, path, realpath);
+ }
+
RB_OBJ_WRITE(iseq, &load_body->location.base_label, ibf_load_location_str(load, body->location.base_label));
RB_OBJ_WRITE(iseq, &load_body->location.label, ibf_load_location_str(load, body->location.label));
load_body->location.first_lineno = body->location.first_lineno;