iseq.c: use caller location
* iseq.c (rb_method_for_self_aref, rb_method_for_self_aset): set same location as the caller. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
20748861d4
commit
a3450f4733
22
iseq.c
22
iseq.c
@ -548,13 +548,28 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
|
|||||||
return iseqval;
|
return iseqval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
caller_location(VALUE *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;
|
||||||
|
return INT2FIX(line);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
*path = rb_str_new2("<compiled>");
|
||||||
|
return INT2FIX(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_method_for_self_aref(VALUE name, VALUE arg)
|
rb_method_for_self_aref(VALUE name, VALUE arg)
|
||||||
{
|
{
|
||||||
VALUE iseqval = iseq_alloc(rb_cISeq);
|
VALUE iseqval = iseq_alloc(rb_cISeq);
|
||||||
rb_iseq_t *iseq;
|
rb_iseq_t *iseq;
|
||||||
VALUE path = rb_str_new2("<compiled>");
|
VALUE path, lineno = caller_location(&path);
|
||||||
VALUE lineno = INT2FIX(1);
|
|
||||||
VALUE parent = 0;
|
VALUE parent = 0;
|
||||||
VALUE misc, locals, params, exception, body, send_arg;
|
VALUE misc, locals, params, exception, body, send_arg;
|
||||||
int flag = VM_CALL_FCALL | VM_CALL_ARGS_SIMPLE;
|
int flag = VM_CALL_FCALL | VM_CALL_ARGS_SIMPLE;
|
||||||
@ -603,8 +618,7 @@ rb_method_for_self_aset(VALUE name, VALUE arg)
|
|||||||
{
|
{
|
||||||
VALUE iseqval = iseq_alloc(rb_cISeq);
|
VALUE iseqval = iseq_alloc(rb_cISeq);
|
||||||
rb_iseq_t *iseq;
|
rb_iseq_t *iseq;
|
||||||
VALUE path = rb_str_new2("<compiled>");
|
VALUE path, lineno = caller_location(&path);
|
||||||
VALUE lineno = INT2FIX(1);
|
|
||||||
VALUE parent = 0;
|
VALUE parent = 0;
|
||||||
VALUE misc, locals, params, exception, body, send_arg;
|
VALUE misc, locals, params, exception, body, send_arg;
|
||||||
int flag = VM_CALL_FCALL | VM_CALL_ARGS_SIMPLE;
|
int flag = VM_CALL_FCALL | VM_CALL_ARGS_SIMPLE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user