[前][次][番号順一覧][スレッド一覧]

ruby-changes:36791

From: nobu <ko1@a...>
Date: Wed, 17 Dec 2014 11:52:24 +0900 (JST)
Subject: [ruby-changes:36791] nobu:r48872 (trunk): iseq.c: absolute_path

nobu	2014-12-17 11:52:19 +0900 (Wed, 17 Dec 2014)

  New Revision: 48872

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48872

  Log:
    iseq.c: absolute_path
    
    * iseq.c (caller_location): separate absolute_path.

  Modified files:
    trunk/iseq.c
Index: iseq.c
===================================================================
--- iseq.c	(revision 48871)
+++ iseq.c	(revision 48872)
@@ -553,17 +553,20 @@ iseq_load(VALUE self, VALUE data, VALUE https://github.com/ruby/ruby/blob/trunk/iseq.c#L553
 }
 
 static VALUE
-caller_location(VALUE *path)
+caller_location(VALUE *path, VALUE *absolute_path)
 {
     rb_thread_t *th = GET_THREAD();
     rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
+
     if (cfp) {
 	int line = rb_vm_get_sourceline(cfp);
 	*path = cfp->iseq->location.path;
+	*absolute_path = cfp->iseq->location.absolute_path;
 	return INT2FIX(line);
     }
     else {
 	*path = rb_str_new2("<compiled>");
+	*absolute_path = *path;
 	return INT2FIX(1);
     }
 }
@@ -573,7 +576,8 @@ rb_method_for_self_aref(VALUE name, VALU https://github.com/ruby/ruby/blob/trunk/iseq.c#L576
 {
     VALUE iseqval = iseq_alloc(rb_cISeq);
     rb_iseq_t *iseq;
-    VALUE path, lineno = caller_location(&path);
+    VALUE path, absolute_path;
+    VALUE lineno = caller_location(&path, &absolute_path);
     VALUE parent = 0;
     VALUE misc, locals, params, exception, body, send_arg;
 
@@ -581,7 +585,8 @@ rb_method_for_self_aref(VALUE name, VALU https://github.com/ruby/ruby/blob/trunk/iseq.c#L585
     iseq->self = iseqval;
     iseq->local_iseq = iseq;
 
-    prepare_iseq_build(iseq, rb_sym2str(name), path, path, lineno, parent,
+    prepare_iseq_build(iseq, rb_sym2str(name), path, absolute_path,
+		       lineno, parent,
 		       ISEQ_TYPE_METHOD, &COMPILE_OPTION_DEFAULT);
 
     misc = params = rb_hash_new(); /* empty */
@@ -619,7 +624,8 @@ rb_method_for_self_aset(VALUE name, VALU https://github.com/ruby/ruby/blob/trunk/iseq.c#L624
 {
     VALUE iseqval = iseq_alloc(rb_cISeq);
     rb_iseq_t *iseq;
-    VALUE path, lineno = caller_location(&path);
+    VALUE path, absolute_path;
+    VALUE lineno = caller_location(&path, &absolute_path);
     VALUE parent = 0;
     VALUE misc, locals, params, exception, body, send_arg;
 
@@ -627,7 +633,8 @@ rb_method_for_self_aset(VALUE name, VALU https://github.com/ruby/ruby/blob/trunk/iseq.c#L633
     iseq->self = iseqval;
     iseq->local_iseq = iseq;
 
-    prepare_iseq_build(iseq, rb_sym2str(name), path, path, lineno, parent,
+    prepare_iseq_build(iseq, rb_sym2str(name), path, absolute_path,
+		       lineno, parent,
 		       ISEQ_TYPE_METHOD, &COMPILE_OPTION_DEFAULT);
 
     /* def name=(val); self[arg] = val; end */

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]