diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-03 05:10:41 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-03 05:10:41 +0000 |
commit | cd0fec37281a72d402981894b764d27ab7d1fb39 (patch) | |
tree | 7798f0f28cbf31b54fd44887585c878c35277a76 /proc.c | |
parent | 25d1891899be492dc64bb6852741d4f112feba64 (diff) | |
download | ruby-cd0fec37281a72d402981894b764d27ab7d1fb39.tar.gz |
Add TracePoint#parameters
It can be used to get the parameters' information of method and block.
There was no way to get block parameters.
It was possible but ineffective to get method parameters via Method
object: `tp.defined_class.method(tp.method_id).parameters`
TracePoint#parameters allows us to get the information easily.
[Feature #14694]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1148,8 +1148,8 @@ rb_proc_location(VALUE self) return iseq_location(rb_proc_get_iseq(self, 0)); } -static VALUE -unnamed_parameters(int arity) +VALUE +rb_unnamed_parameters(int arity) { VALUE a, param = rb_ary_new2((arity < 0) ? -arity : arity); int n = (arity < 0) ? ~arity : arity; @@ -1183,7 +1183,7 @@ rb_proc_parameters(VALUE self) int is_proc; const rb_iseq_t *iseq = rb_proc_get_iseq(self, &is_proc); if (!iseq) { - return unnamed_parameters(rb_proc_arity(self)); + return rb_unnamed_parameters(rb_proc_arity(self)); } return rb_iseq_parameters(iseq, is_proc); } @@ -2567,7 +2567,7 @@ rb_method_parameters(VALUE method) { const rb_iseq_t *iseq = rb_method_iseq(method); if (!iseq) { - return unnamed_parameters(method_arity(method)); + return rb_unnamed_parameters(method_arity(method)); } return rb_iseq_parameters(iseq, 0); } |