ruby-changes:47593
From: nobu <ko1@a...>
Date: Fri, 1 Sep 2017 09:59:01 +0900 (JST)
Subject: [ruby-changes:47593] nobu:r59709 (trunk): compile.c: fix loading pathobj
nobu 2017-09-01 09:58:52 +0900 (Fri, 01 Sep 2017) New Revision: 59709 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59709 Log: compile.c: fix loading pathobj * compile.c (ibf_load_iseq_each): location.pathobj may not be a mere string now. Modified files: trunk/compile.c Index: compile.c =================================================================== --- compile.c (revision 59708) +++ compile.c (revision 59709) @@ -8049,7 +8049,25 @@ ibf_load_iseq_each(const struct ibf_load https://github.com/ruby/ruby/blob/trunk/compile.c#L8049 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/